[diablu commit] r309 - in trunk/SMS2OSC: . build build/classes build/classes/pt build/classes/pt/citar build/clas...

1 view
Skip to first unread message

codesite...@google.com

unread,
Nov 3, 2008, 12:15:03 PM11/3/08
to diablu...@googlegroups.com
Author: pedro.r.santos
Date: Mon Nov 3 09:14:29 2008
New Revision: 309

Added:
trunk/SMS2OSC/build/
trunk/SMS2OSC/build.xml
trunk/SMS2OSC/build/classes/
trunk/SMS2OSC/build/classes/pt/
trunk/SMS2OSC/build/classes/pt/citar/
trunk/SMS2OSC/build/classes/pt/citar/diablu/
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/S2O.class
(contents, props changed)
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/bluetooth/

trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection$InboundNotification.class
(contents, props changed)

trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection$OutboundNotification.class
(contents, props changed)

trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection.class
(contents, props changed)

trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnectionTimeout.class
(contents, props changed)
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/gui/
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/gui/S2OGUI$1.class
(contents, props changed)
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/gui/S2OGUI$2.class
(contents, props changed)
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/gui/S2OGUI.class
(contents, props changed)
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/osc/

trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/osc/S2OOscClient.class
(contents, props changed)

trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/osc/S2OOscListener.class
(contents, props changed)

trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/osc/S2OOscServer.class
(contents, props changed)
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/util/

trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/util/S2OCommPortList.class
(contents, props changed)

trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/util/S2OProperties.class
(contents, props changed)
trunk/SMS2OSC/lib/
trunk/SMS2OSC/lib/NetUtil.jar (contents, props changed)
trunk/SMS2OSC/lib/SmsLib.jar (contents, props changed)
trunk/SMS2OSC/lib/log4j-1.2.15.jar (contents, props changed)
trunk/SMS2OSC/src/
trunk/SMS2OSC/src/pt/
trunk/SMS2OSC/src/pt/citar/
trunk/SMS2OSC/src/pt/citar/diablu/
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/S2O.java
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection.java

trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnectionTimeout.java
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.form
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.java
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscClient.java
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscListener.java
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscServer.java
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OCommPortList.java
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OProperties.java

Log:


Added: trunk/SMS2OSC/build.xml
==============================================================================
--- (empty file)
+++ trunk/SMS2OSC/build.xml Mon Nov 3 09:14:29 2008
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- You may freely edit this file. See commented blocks below for -->
+<!-- some examples of how to customize the build. -->
+<!-- (If you delete it and reopen the project it will be recreated.) -->
+<project name="SMS2OSC" default="default" basedir=".">
+ <description>Builds, tests, and runs the project SMS2OSC.</description>
+ <import file="nbproject/build-impl.xml"/>
+ <!--
+
+ There exist several targets which are by default empty and which can be
+ used for execution of your tasks. These targets are usually executed
+ before and after some main targets. They are:
+
+ -pre-init: called before initialization of project
properties
+ -post-init: called after initialization of project
properties
+ -pre-compile: called before javac compilation
+ -post-compile: called after javac compilation
+ -pre-compile-single: called before javac compilation of single
file
+ -post-compile-single: called after javac compilation of single
file
+ -pre-compile-test: called before javac compilation of JUnit
tests
+ -post-compile-test: called after javac compilation of JUnit
tests
+ -pre-compile-test-single: called before javac compilation of single
JUnit test
+ -post-compile-test-single: called after javac compilation of single
JUunit test
+ -pre-jar: called before JAR building
+ -post-jar: called after JAR building
+ -post-clean: called after cleaning build products
+
+ (Targets beginning with '-' are not intended to be called on their
own.)
+
+ Example of inserting an obfuscator after compilation could look like
this:
+
+ <target name="-post-compile">
+ <obfuscate>
+ <fileset dir="${build.classes.dir}"/>
+ </obfuscate>
+ </target>
+
+ For list of available properties check the imported
+ nbproject/build-impl.xml file.
+
+
+ Another way to customize the build is by overriding existing main
targets.
+ The targets of interest are:
+
+ -init-macrodef-javac: defines macro for javac compilation
+ -init-macrodef-junit: defines macro for junit execution
+ -init-macrodef-debug: defines macro for class debugging
+ -init-macrodef-java: defines macro for class execution
+ -do-jar-with-manifest: JAR building (if you are using a manifest)
+ -do-jar-without-manifest: JAR building (if you are not using a
manifest)
+ run: execution of project
+ -javadoc-build: Javadoc generation
+ test-report: JUnit report generation
+
+ An example of overriding the target for project execution could look
like this:
+
+ <target name="run" depends="SMS2OSC-impl.jar">
+ <exec dir="bin" executable="launcher.exe">
+ <arg file="${dist.jar}"/>
+ </exec>
+ </target>
+
+ Notice that the overridden target depends on the jar target and not
only on
+ the compile target as the regular run target does. Again, for a list
of available
+ properties which you can use, check the target you are overriding in
the
+ nbproject/build-impl.xml file.
+
+ -->
+</project>

Added: trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/S2O.class
==============================================================================
Binary file. No diff available.

Added:
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection$InboundNotification.class
==============================================================================
Binary file. No diff available.

Added:
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection$OutboundNotification.class
==============================================================================
Binary file. No diff available.

Added:
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection.class
==============================================================================
Binary file. No diff available.

Added:
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnectionTimeout.class
==============================================================================
Binary file. No diff available.

Added:
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/gui/S2OGUI$1.class
==============================================================================
Binary file. No diff available.

Added:
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/gui/S2OGUI$2.class
==============================================================================
Binary file. No diff available.

Added: trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/gui/S2OGUI.class
==============================================================================
Binary file. No diff available.

Added:
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/osc/S2OOscClient.class
==============================================================================
Binary file. No diff available.

Added:
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/osc/S2OOscListener.class
==============================================================================
Binary file. No diff available.

Added:
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/osc/S2OOscServer.class
==============================================================================
Binary file. No diff available.

Added:
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/util/S2OCommPortList.class
==============================================================================
Binary file. No diff available.

Added:
trunk/SMS2OSC/build/classes/pt/citar/diablu/sms2osc/util/S2OProperties.class
==============================================================================
Binary file. No diff available.

Added: trunk/SMS2OSC/lib/NetUtil.jar
==============================================================================
Binary file. No diff available.

Added: trunk/SMS2OSC/lib/SmsLib.jar
==============================================================================
Binary file. No diff available.

Added: trunk/SMS2OSC/lib/log4j-1.2.15.jar
==============================================================================
Binary file. No diff available.

Added: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/S2O.java
==============================================================================
--- (empty file)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/S2O.java Mon Nov 3 09:14:29
2008
@@ -0,0 +1,75 @@
+package pt.citar.diablu.sms2osc;
+
+import pt.citar.diablu.sms2osc.bluetooth.S2OBTConnection;
+import pt.citar.diablu.sms2osc.gui.S2OGUI;
+import pt.citar.diablu.sms2osc.osc.S2OOscServer;
+import pt.citar.diablu.sms2osc.util.S2OCommPortList;
+import pt.citar.diablu.sms2osc.util.S2OProperties;
+
+
+public class S2O {
+
+ private S2OCommPortList commPortList;
+ private S2OProperties properties;
+
+ private S2OGUI gui;
+ private S2OOscServer oscServer;
+
+
+ private S2OBTConnection btConnection;
+ public Thread btConnectionThread;
+
+ public S2O()
+ {
+ commPortList = new S2OCommPortList();
+ properties = new S2OProperties(this);
+ properties.loadProperties();
+ oscServer = new S2OOscServer(this);
+ gui = new S2OGUI(this);
+ btConnection = new S2OBTConnection(this,
properties.getGateway(), "COM6", 57600, "Siemens", "S65");
+
+
+ }
+
+ public static void main(String[] args) {
+
+ S2O s2o = new S2O();
+ s2o.gui.setVisible(true);
+
+ }
+
+ public S2OGUI getGui() {
+ return gui;
+ }
+
+ public S2OBTConnection getBtConnection() {
+ return btConnection;
+ }
+
+ public Thread getBtConnectionThread() {
+ return btConnectionThread;
+ }
+
+
+ public S2OProperties getProperties() {
+ return properties;
+ }
+
+ public S2OCommPortList getCommPortList() {
+ return commPortList;
+ }
+
+ public S2OOscServer getOscServer() {
+ return oscServer;
+ }
+
+
+
+
+
+
+
+
+
+
+}

Added:
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection.java
==============================================================================
--- (empty file)
+++
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection.java
Mon Nov 3 09:14:29 2008
@@ -0,0 +1,188 @@
+
+package pt.citar.diablu.sms2osc.bluetooth;
+
+import pt.citar.diablu.sms2osc.*;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.smslib.GatewayException;
+import org.smslib.IInboundMessageNotification;
+import org.smslib.IOutboundMessageNotification;
+import org.smslib.InboundMessage;
+import org.smslib.InboundMessage.MessageClasses;
+import org.smslib.Library;
+import org.smslib.Message.MessageTypes;
+import org.smslib.OutboundMessage;
+import org.smslib.SMSLibException;
+import org.smslib.Service;
+import org.smslib.TimeoutException;
+import org.smslib.modem.SerialModemGateway;
+
+/**
+ *
+ * @author Raspa
+ */
+public class S2OBTConnection implements Runnable {
+
+ String id;
+ String port;
+ int baud;
+ String manufacturer;
+ String model;
+ Service srv;
+ S2O s2o;
+ boolean connected;
+ boolean connecting;
+
+ public S2OBTConnection(S2O s2o, String id, String port, int baud,
String manufacturer, String model) {
+ this.s2o = s2o;
+ this.id = id;
+ this.port = port;
+ this.baud = baud;
+ this.manufacturer = manufacturer;
+ this.model = model;
+ this.connected = false;
+ this.connecting = false;
+ }
+
+ public void startConnection() {
+ try {
+
+ this.connecting = true;
+ List<InboundMessage> msgList;
+
+ InboundNotification inboundNotification = new
InboundNotification();
+ OutboundNotification outboundNotification = new
OutboundNotification();
+
+
+ System.out.println("Version: " + Library.getLibraryVersion());
+ srv = new Service();
+ SerialModemGateway gateway = new SerialModemGateway(id, port,
baud, manufacturer, model);
+ gateway.setInbound(true);
+ gateway.setOutbound(true);
+ gateway.setOutboundNotification(outboundNotification);
+ gateway.setInboundNotification(inboundNotification);
+ srv.addGateway(gateway);
+ srv.startService();
+ System.out.println("Modem Information: build2");
+ System.out.println(" Manufacturer: " +
gateway.getManufacturer());
+ System.out.println(" Model: " + gateway.getModel());
+ System.out.println(" Serial No: " + gateway.getSerialNo());
+ System.out.println(" SIM IMSI: " + gateway.getImsi());
+ System.out.println(" Signal Level: " +
gateway.getSignalLevel() + "%");
+ System.out.println(" Battery Level: " +
gateway.getBatteryLevel() + "%");
+
+ msgList = new ArrayList<InboundMessage>();
+ srv.readMessages(msgList, MessageClasses.ALL);
+ for (InboundMessage msg : msgList) {
+ System.out.println(msg);
+ }
+ this.connected = true;
+ this.connecting = false;
+
+ } catch (TimeoutException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ this.connecting = false;
+ } catch (GatewayException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ this.connecting = false;
+ } catch (SMSLibException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ this.connecting = false;
+ } catch (IOException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ this.connecting = false;
+ } catch (InterruptedException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ this.connecting = false;
+ }
+ }
+
+ public void sendMessage(String smsRecipient, String smsBody) {
+ try {
+ OutboundMessage msg;
+ msg = new OutboundMessage(smsRecipient, smsBody);
+ srv.sendMessage(msg);
+
+ } catch (TimeoutException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ } catch (GatewayException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ } catch (IOException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ } catch (InterruptedException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ }
+ }
+
+ public void stopConnection() {
+ try {
+ srv.stopService();
+ } catch (TimeoutException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ } catch (GatewayException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ } catch (IOException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ } catch (InterruptedException ex) {
+
Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
+ }
+ }
+
+ public class OutboundNotification implements
IOutboundMessageNotification {
+
+ public void process(String gatewayId, OutboundMessage msg) {
+ System.out.println("Sending message through: " + gatewayId);
+ System.out.println("To: " + msg.getRecipient());
+ System.out.println("Body:\n" + msg);
+
+ }
+ }
+
+ public class InboundNotification implements
IInboundMessageNotification {
+
+ public void process(String gatewayId, MessageTypes msgType,
InboundMessage msg) {
+
+ if (msgType == MessageTypes.INBOUND) {
+ System.out.println(">>> New Inbound message detected from
Gateway: " + gatewayId);
+ //s2o.getMessages().addMessage(msg.getOriginator(),
msg.getText());
+ System.out.println("Message: " + msg.getText());
+
+ } else if (msgType == MessageTypes.STATUSREPORT) {
+ System.out.println(">>> New Inbound Status Report message
detected from Gateway: " + gatewayId);
+ }
+ try {
+
+ srv.deleteMessage(msg);
+ } catch (Exception e) {
+ System.out.println("Oops!!! Something gone bad...");
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void connect()
+ {
+ Thread to = new Thread(new S2OBTConnectionTimeout(s2o,
Thread.currentThread(), 15));
+ to.start();
+ this.startConnection();
+ to.interrupt();
+ }
+
+ public void run() {
+ connect();
+ }
+
+ public void setPort(String port) {
+ this.port = port;
+ }
+
+ public boolean isConnected() {
+ return connected;
+ }
+
+
+
+}

Added:
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnectionTimeout.java
==============================================================================
--- (empty file)
+++
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnectionTimeout.java
Mon Nov 3 09:14:29 2008
@@ -0,0 +1,41 @@
+
+package pt.citar.diablu.sms2osc.bluetooth;
+
+import pt.citar.diablu.sms2osc.S2O;
+
+public class S2OBTConnectionTimeout implements Runnable{
+
+ int timeout;
+ boolean interrupted;
+ Thread btConnect;
+ S2O s2o;
+
+ public S2OBTConnectionTimeout(S2O s2o, Thread btConnect, int timeout)
+ {
+ this.timeout = timeout;
+ this.btConnect = btConnect;
+ this.s2o = s2o;
+ }
+
+ public void run() {
+
+ System.out.println("timeout");
+ try {
+ Thread.sleep(timeout * 1000);
+ if(!interrupted)
+ {
+ btConnect.interrupt();
+
+
+
+ }
+ } catch (InterruptedException ex) {
+
//Logger.getLogger(S2OBTConnectionTimeout.class.getName()).log(Level.SEVERE,
null, ex);
+ System.out.println("timeout stopped");
+ }
+ }
+
+
+
+
+}

Added: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.form
==============================================================================
--- (empty file)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.form Mon Nov 3
09:14:29 2008
@@ -0,0 +1,387 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.6"
type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
+ <Properties>
+ <Property name="defaultCloseOperation" type="int" value="3"/>
+ </Properties>
+ <SyntheticProperties>
+ <SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ </SyntheticProperties>
+ <AuxValues>
+ <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer"
value="0"/>
+ <AuxValue name="FormSettings_autoSetComponentName"
type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateMnemonicsCode"
type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean"
value="false"/>
+ <AuxValue name="FormSettings_layoutCodeTarget"
type="java.lang.Integer" value="1"/>
+ <AuxValue name="FormSettings_listenerGenerationStyle"
type="java.lang.Integer" value="0"/>
+ <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean"
value="false"/>
+ <AuxValue name="FormSettings_variablesModifier"
type="java.lang.Integer" value="2"/>
+ </AuxValues>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="S2OTabbedPane" alignment="0" pref="659"
max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="S2OTabbedPane" alignment="0" pref="240"
max="32767" attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JTabbedPane" name="S2OTabbedPane">
+
+ <Layout
class="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"/>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="ConnectionPanel">
+ <Constraints>
+ <Constraint
layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"
value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
+ <JTabbedPaneConstraints tabName="Connection">
+ <Property name="tabTitle" type="java.lang.String"
value="Connection"/>
+ </JTabbedPaneConstraints>
+ </Constraint>
+ </Constraints>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="OSCPanel" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace type="unrelated" max="-2"
attributes="0"/>
+ <Component id="GatewayPanel" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="1" attributes="0">
+ <Component id="OSCPanel" alignment="0"
max="32767" attributes="1"/>
+ <Component id="GatewayPanel" alignment="0"
max="32767" attributes="1"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="OSCPanel">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border"
editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border
info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
+ <TitledBorder title="OSC"/>
+ </Border>
+ </Property>
+ </Properties>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="YourAppPane" linkSize="8"
min="-2" max="-2" attributes="0"/>
+ <EmptySpace type="unrelated" max="-2"
attributes="0"/>
+ <Component id="SMS2OSCPanel" linkSize="8"
min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace pref="327" max="32767"
attributes="0"/>
+ <Component id="OSCConnectButton" min="-2"
max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Group type="103" groupAlignment="1" max="-2"
attributes="0">
+ <Component id="YourAppPane" alignment="0"
max="32767" attributes="1"/>
+ <Component id="SMS2OSCPanel" alignment="0"
max="32767" attributes="1"/>
+ </Group>
+ <EmptySpace min="-2" pref="24" max="-2"
attributes="0"/>
+ <Component id="OSCConnectButton" min="-2"
max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JPanel" name="YourAppPane">
+ <Properties>
+ <Property name="border"
type="javax.swing.border.Border"
editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border
info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
+ <TitledBorder title="Your Application"/>
+ </Border>
+ </Property>
+ </Properties>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" max="-2" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0"
attributes="0">
+ <Group type="102" alignment="0"
attributes="0">
+ <Component id="YAHostnameLabel"
linkSize="5" min="-2" pref="70" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="YAHostnameTextField"
linkSize="7" pref="89" max="32767" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="0"
attributes="0">
+ <Component id="YAPortjLabel"
linkSize="5" min="-2" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="YAPortTextField"
linkSize="7" min="-2" max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3"
attributes="0">
+ <Component id="YAHostnameLabel"
alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="YAHostnameTextField"
alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3"
attributes="0">
+ <Component id="YAPortjLabel"
alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="YAPortTextField"
alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="17" max="32767"
attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JTextField"
name="YAHostnameTextField">
+ <Properties>
+ <Property name="horizontalAlignment" type="int"
value="4"/>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection
code="s2o.getProperties().getRemoteIP() " type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel"
name="YAHostnameLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String"
value="Hostname:"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JLabel"
name="YAPortjLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String"
value="Port:"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField"
name="YAPortTextField">
+ <Properties>
+ <Property name="horizontalAlignment" type="int"
value="4"/>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection
code="s2o.getProperties().getIncomingPort() " type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JButton"
name="OSCConnectButton">
+ <Properties>
+ <Property name="text" type="java.lang.String"
value="Start Server"/>
+ </Properties>
+ <AccessibilityProperties>
+ <Property name="AccessibleContext.accessibleName"
type="java.lang.String" value=""/>
+ </AccessibilityProperties>
+ <Events>
+ <EventHandler event="actionPerformed"
listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent"
handler="OSCConnectButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Container class="javax.swing.JPanel" name="SMS2OSCPanel">
+ <Properties>
+ <Property name="border"
type="javax.swing.border.Border"
editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border
info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
+ <TitledBorder title="SMS2OSC"/>
+ </Border>
+ </Property>
+ </Properties>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="S2OPortLabel" min="-2"
pref="70" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="S2OPortTextField" pref="89"
max="32767" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3"
attributes="0">
+ <Component id="S2OPortLabel"
alignment="3" min="-2" max="-2" attributes="0"/>
+ <Component id="S2OPortTextField"
alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="43" max="32767"
attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel"
name="S2OPortLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String"
value="Port:"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JTextField"
name="S2OPortTextField">
+ <Properties>
+ <Property name="horizontalAlignment" type="int"
value="4"/>
+ <Property name="text" type="java.lang.String"
editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
+ <Connection
code="s2o.getProperties().getOutgoingPort() " type="code"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="GatewayPanel">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border"
editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border
info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
+ <TitledBorder title="Gateway"/>
+ </Border>
+ </Property>
+ </Properties>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="CommPortLabel" min="-2" pref="70"
max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="CommPorts" min="-2" pref="70"
max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
+ </Group>
+ <Group type="102" alignment="1" attributes="0">
+ <EmptySpace pref="81" max="32767"
attributes="0"/>
+ <Component id="Connect" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3"
attributes="0">
+ <Component id="CommPortLabel" alignment="3"
min="-2" max="-2" attributes="0"/>
+ <Component id="CommPorts" alignment="3"
min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="97" max="32767"
attributes="0"/>
+ <Component id="Connect" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JComboBox" name="CommPorts">
+ <Properties>
+ <Property name="model"
type="javax.swing.ComboBoxModel"
editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
+ <StringArray count="0"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JButton" name="Connect">
+ <Properties>
+ <Property name="text" type="java.lang.String"
value="Connect"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed"
listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent" handler="ConnectActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JLabel" name="CommPortLabel">
+ <Properties>
+ <Property name="text" type="java.lang.String"
value="Port:"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="jPanel1">
+ <Constraints>
+ <Constraint
layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"
value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
+ <JTabbedPaneConstraints tabName="Log">
+ <Property name="tabTitle" type="java.lang.String"
value="Log"/>
+ </JTabbedPaneConstraints>
+ </Constraint>
+ </Constraints>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Component id="jScrollPane1" alignment="0"
pref="634" max="32767" attributes="0"/>
+ <Component id="jComboBox1" alignment="1"
min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="jScrollPane1" min="-2" pref="161"
max="-2" attributes="0"/>
+ <EmptySpace pref="9" max="32767" attributes="0"/>
+ <Component id="jComboBox1" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Container class="javax.swing.JScrollPane" name="jScrollPane1">
+ <AuxValues>
+ <AuxValue name="autoScrollPane" type="java.lang.Boolean"
value="true"/>
+ </AuxValues>
+
+ <Layout
class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
+ <SubComponents>
+ <Component class="javax.swing.JTextArea" name="jTextArea1">
+ <Properties>
+ <Property name="columns" type="int" value="20"/>
+ <Property name="rows" type="int" value="5"/>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ <Component class="javax.swing.JComboBox" name="jComboBox1">
+ <Properties>
+ <Property name="model" type="javax.swing.ComboBoxModel"
editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
+ <StringArray count="4">
+ <StringItem index="0" value="Item 1"/>
+ <StringItem index="1" value="Item 2"/>
+ <StringItem index="2" value="Item 3"/>
+ <StringItem index="3" value="Item 4"/>
+ </StringArray>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+ </Container>
+ </SubComponents>
+</Form>

Added: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.java
==============================================================================
--- (empty file)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.java Mon Nov 3
09:14:29 2008
@@ -0,0 +1,338 @@
+
+package pt.citar.diablu.sms2osc.gui;
+
+import pt.citar.diablu.sms2osc.*;
+
+
+public class S2OGUI extends javax.swing.JFrame {
+
+ S2O s2o;
+
+ public S2OGUI(S2O s2o) {
+ this.s2o = s2o;
+ initComponents();
+ setCommPorts();
+ }
+
+ private void setCommPorts()
+ {
+ for(String port: s2o.getCommPortList().getCommPorts())
+ CommPorts.addItem(port);
+ CommPorts.setSelectedItem(s2o.getProperties().getComPort());
+
+
+ }
+
+
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated
Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ S2OTabbedPane = new javax.swing.JTabbedPane();
+ ConnectionPanel = new javax.swing.JPanel();
+ OSCPanel = new javax.swing.JPanel();
+ YourAppPane = new javax.swing.JPanel();
+ YAHostnameTextField = new javax.swing.JTextField();
+ YAHostnameLabel = new javax.swing.JLabel();
+ YAPortjLabel = new javax.swing.JLabel();
+ YAPortTextField = new javax.swing.JTextField();
+ OSCConnectButton = new javax.swing.JButton();
+ SMS2OSCPanel = new javax.swing.JPanel();
+ S2OPortLabel = new javax.swing.JLabel();
+ S2OPortTextField = new javax.swing.JTextField();
+ GatewayPanel = new javax.swing.JPanel();
+ CommPorts = new javax.swing.JComboBox();
+ Connect = new javax.swing.JButton();
+ CommPortLabel = new javax.swing.JLabel();
+ jPanel1 = new javax.swing.JPanel();
+ jScrollPane1 = new javax.swing.JScrollPane();
+ jTextArea1 = new javax.swing.JTextArea();
+ jComboBox1 = new javax.swing.JComboBox();
+
+
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+
+
OSCPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("OSC"));
+
+
YourAppPane.setBorder(javax.swing.BorderFactory.createTitledBorder("Your
Application"));
+
+
YAHostnameTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
+ YAHostnameTextField.setText(s2o.getProperties().getRemoteIP() );
+
+ YAHostnameLabel.setText("Hostname:");
+
+ YAPortjLabel.setText("Port:");
+
+
YAPortTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
+ YAPortTextField.setText(s2o.getProperties().getIncomingPort() );
+
+ javax.swing.GroupLayout YourAppPaneLayout = new
javax.swing.GroupLayout(YourAppPane);
+ YourAppPane.setLayout(YourAppPaneLayout);
+ YourAppPaneLayout.setHorizontalGroup(
+
YourAppPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(YourAppPaneLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(YourAppPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(YourAppPaneLayout.createSequentialGroup()
+ .addComponent(YAHostnameLabel,
javax.swing.GroupLayout.PREFERRED_SIZE, 70,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(YAHostnameTextField,
javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE))
+ .addGroup(YourAppPaneLayout.createSequentialGroup()
+ .addComponent(YAPortjLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(YAPortTextField,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
+ );
+
+ YourAppPaneLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {YAHostnameLabel, YAPortjLabel});
+
+ YourAppPaneLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {YAHostnameTextField, YAPortTextField});
+
+ YourAppPaneLayout.setVerticalGroup(
+
YourAppPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(YourAppPaneLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(YourAppPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(YAHostnameLabel)
+ .addComponent(YAHostnameTextField,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(YourAppPaneLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(YAPortjLabel)
+ .addComponent(YAPortTextField,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(17, Short.MAX_VALUE))
+ );
+
+ OSCConnectButton.setText("Start Server");
+ OSCConnectButton.addActionListener(new
java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ OSCConnectButtonActionPerformed(evt);
+ }
+ });
+
+
SMS2OSCPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("SMS2OSC"));
+
+ S2OPortLabel.setText("Port:");
+
+
S2OPortTextField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
+ S2OPortTextField.setText(s2o.getProperties().getOutgoingPort() );
+
+ javax.swing.GroupLayout SMS2OSCPanelLayout = new
javax.swing.GroupLayout(SMS2OSCPanel);
+ SMS2OSCPanel.setLayout(SMS2OSCPanelLayout);
+ SMS2OSCPanelLayout.setHorizontalGroup(
+
SMS2OSCPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(SMS2OSCPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(S2OPortLabel,
javax.swing.GroupLayout.PREFERRED_SIZE, 70,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(S2OPortTextField,
javax.swing.GroupLayout.DEFAULT_SIZE, 89, Short.MAX_VALUE)
+ .addContainerGap())
+ );
+ SMS2OSCPanelLayout.setVerticalGroup(
+
SMS2OSCPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(SMS2OSCPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(SMS2OSCPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(S2OPortLabel)
+ .addComponent(S2OPortTextField,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap(43, Short.MAX_VALUE))
+ );
+
+ javax.swing.GroupLayout OSCPanelLayout = new
javax.swing.GroupLayout(OSCPanel);
+ OSCPanel.setLayout(OSCPanelLayout);
+ OSCPanelLayout.setHorizontalGroup(
+
OSCPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(OSCPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(YourAppPane,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(SMS2OSCPanel,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
OSCPanelLayout.createSequentialGroup()
+ .addContainerGap(327, Short.MAX_VALUE)
+ .addComponent(OSCConnectButton)
+ .addContainerGap())
+ );
+
+ OSCPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new
java.awt.Component[] {SMS2OSCPanel, YourAppPane});
+
+ OSCPanelLayout.setVerticalGroup(
+
OSCPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(OSCPanelLayout.createSequentialGroup()
+ .addGroup(OSCPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
+ .addComponent(YourAppPane,
javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
+ .addComponent(SMS2OSCPanel,
javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
+ .addGap(24, 24, 24)
+ .addComponent(OSCConnectButton)
+ .addContainerGap())
+ );
+
+ OSCConnectButton.getAccessibleContext().setAccessibleName("");
+
+
GatewayPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Gateway"));
+
+ Connect.setText("Connect");
+ Connect.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ ConnectActionPerformed(evt);
+ }
+ });
+
+ CommPortLabel.setText("Port:");
+
+ javax.swing.GroupLayout GatewayPanelLayout = new
javax.swing.GroupLayout(GatewayPanel);
+ GatewayPanel.setLayout(GatewayPanelLayout);
+ GatewayPanelLayout.setHorizontalGroup(
+
GatewayPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(GatewayPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(CommPortLabel,
javax.swing.GroupLayout.PREFERRED_SIZE, 70,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(CommPorts,
javax.swing.GroupLayout.PREFERRED_SIZE, 70,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
GatewayPanelLayout.createSequentialGroup()
+ .addContainerGap(81, Short.MAX_VALUE)
+ .addComponent(Connect)
+ .addContainerGap())
+ );
+ GatewayPanelLayout.setVerticalGroup(
+
GatewayPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(GatewayPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(GatewayPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(CommPortLabel)
+ .addComponent(CommPorts,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
97,
Short.MAX_VALUE)
+ .addComponent(Connect)
+ .addContainerGap())
+ );
+
+ javax.swing.GroupLayout ConnectionPanelLayout = new
javax.swing.GroupLayout(ConnectionPanel);
+ ConnectionPanel.setLayout(ConnectionPanelLayout);
+ ConnectionPanelLayout.setHorizontalGroup(
+
ConnectionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(ConnectionPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(OSCPanel,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(GatewayPanel,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
+ );
+ ConnectionPanelLayout.setVerticalGroup(
+
ConnectionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
ConnectionPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(ConnectionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
+ .addComponent(OSCPanel,
javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
+ .addComponent(GatewayPanel,
javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
+ .addContainerGap())
+ );
+
+ S2OTabbedPane.addTab("Connection", ConnectionPanel);
+
+ jTextArea1.setColumns(20);
+ jTextArea1.setRows(5);
+ jScrollPane1.setViewportView(jTextArea1);
+
+ jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new
String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
+
+ javax.swing.GroupLayout jPanel1Layout = new
javax.swing.GroupLayout(jPanel1);
+ jPanel1.setLayout(jPanel1Layout);
+ jPanel1Layout.setHorizontalGroup(
+
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jScrollPane1,
javax.swing.GroupLayout.DEFAULT_SIZE, 634, Short.MAX_VALUE)
+ .addComponent(jComboBox1,
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap())
+ );
+ jPanel1Layout.setVerticalGroup(
+
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(jPanel1Layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 161,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
9,
Short.MAX_VALUE)
+ .addComponent(jComboBox1,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap())
+ );
+
+ S2OTabbedPane.addTab("Log", jPanel1);
+
+ javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(S2OTabbedPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 659, Short.MAX_VALUE)
+ );
+ layout.setVerticalGroup(
+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(S2OTabbedPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
+ );
+
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+private void ConnectActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_ConnectActionPerformed
+if(s2o.getBtConnection().isConnected())
+ {
+ s2o.getBtConnection().stopConnection();
+ }
+ s2o.getBtConnection().setPort(CommPorts.getSelectedItem().toString());
+
+ Thread btT = new Thread(s2o.getBtConnection());
+ btT.start();
+}//GEN-LAST:event_ConnectActionPerformed
+
+private void OSCConnectButtonActionPerformed(java.awt.event.ActionEvent
evt) {//GEN-FIRST:event_OSCConnectButtonActionPerformed
+if(!s2o.getOscServer().isConnected())
+ s2o.getOscServer().start();
+ else
+ s2o.getOscServer().stop();
+}//GEN-LAST:event_OSCConnectButtonActionPerformed
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JLabel CommPortLabel;
+ private javax.swing.JComboBox CommPorts;
+ private javax.swing.JButton Connect;
+ private javax.swing.JPanel ConnectionPanel;
+ private javax.swing.JPanel GatewayPanel;
+ private javax.swing.JButton OSCConnectButton;
+ private javax.swing.JPanel OSCPanel;
+ private javax.swing.JLabel S2OPortLabel;
+ private javax.swing.JTextField S2OPortTextField;
+ private javax.swing.JTabbedPane S2OTabbedPane;
+ private javax.swing.JPanel SMS2OSCPanel;
+ private javax.swing.JLabel YAHostnameLabel;
+ private javax.swing.JTextField YAHostnameTextField;
+ private javax.swing.JTextField YAPortTextField;
+ private javax.swing.JLabel YAPortjLabel;
+ private javax.swing.JPanel YourAppPane;
+ private javax.swing.JComboBox jComboBox1;
+ private javax.swing.JPanel jPanel1;
+ private javax.swing.JScrollPane jScrollPane1;
+ private javax.swing.JTextArea jTextArea1;
+ // End of variables declaration//GEN-END:variables
+
+ public String getHostname() {
+ return YAHostnameTextField.getText();
+ }
+
+ public String getClientPort() {
+ return YAPortTextField.getText();
+ }
+
+ public String getServerPort() {
+ return S2OPortTextField.getText();
+ }
+
+ public void serverButtonStop(boolean b) {
+ if(b)
+ OSCConnectButton.setText("Stop Server");
+ else
+ OSCConnectButton.setText("Start Server");
+ }
+
+
+
+
+}

Added: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscClient.java
==============================================================================
--- (empty file)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscClient.java Mon
Nov 3 09:14:29 2008
@@ -0,0 +1,76 @@
+/*
+ * DiABlu Mailman
+ * Copyright (C) 2008-2009, CITAR (Research Centre for Science and
Technology in Art)
+ *
+ * This is part of the DiABlu Project, created by Jorge Cardoso -
http://diablu.jorgecardoso.eu
+ *
+ *
+ * Contributors:
+ * - Pedro Santos <psa...@porto.ucp.pt>
+ * - Jorge Cardoso <jcca...@porto.ucp.pt>
+ *
+ * This program is free software; you can redistribute it and/or modify it
under the terms of the
+ * GNU General Public License as published by the Free Software
Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
with this program;
+ * if not, write to the Free Software Foundation, Inc., 59 Temple Place,
Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+package pt.citar.diablu.sms2osc.osc;
+
+
+import de.sciss.net.OSCClient;
+import de.sciss.net.OSCMessage;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import pt.citar.diablu.sms2osc.S2O;
+
+
+public class S2OOscClient{
+
+ private OSCClient oscClient;
+ private S2O s2o;
+
+
+ public S2OOscClient(S2O s2o)
+ {
+ try {
+ this.s2o = s2o;
+ if
(this.s2o.getProperties().getUseLoopback().equalsIgnoreCase("true") ) {
+ oscClient = OSCClient.newUsing(OSCClient.UDP, 12345, true);
+ } else {
+ oscClient = OSCClient.newUsing(OSCClient.UDP);
+ }
+
+ } catch (IOException ex) {
+ }
+ }
+
+ public void send(OSCMessage oscMessage)
+ {
+ String message = oscMessage.getName();
+ for (int i = 0; i < oscMessage.getArgCount(); i++) {
+ message += " " + oscMessage.getArg(i);
+ }
+
+ try {
+ InetSocketAddress isa = new
InetSocketAddress(s2o.getGui().getHostname(),
Integer.parseInt(s2o.getGui().getClientPort()));
+ oscClient.setTarget(isa);
+ oscClient.start();
+ oscClient.send(oscMessage);
+ oscClient.stop();
+
+ } catch (IOException ex) {
+ ex.printStackTrace();
+
+ }
+ }
+
+
+}

Added: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscListener.java
==============================================================================
--- (empty file)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscListener.java Mon
Nov 3 09:14:29 2008
@@ -0,0 +1,38 @@
+package pt.citar.diablu.sms2osc.osc;
+
+
+import de.sciss.net.OSCListener;
+import de.sciss.net.OSCMessage;
+import java.net.SocketAddress;
+import pt.citar.diablu.sms2osc.S2O;
+
+/**
+ *
+ * @author Raspa
+ */
+public class S2OOscListener implements OSCListener {
+
+ S2O s2o;
+
+ public S2OOscListener(S2O s2o) {
+ this.s2o = s2o;
+ }
+
+ public void messageReceived(OSCMessage msg, SocketAddress sender, long
time) {
+
+ String msgReceived = msg.getName();
+
+ for(int i = 0; i <msg.getArgCount(); i++)
+ {
+ msgReceived += " " + msg.getArg(i);
+ }
+ System.out.println(msgReceived);
+
+ }
+
+
+}
+
+
+
+

Added: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscServer.java
==============================================================================
--- (empty file)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscServer.java Mon
Nov 3 09:14:29 2008
@@ -0,0 +1,58 @@
+
+
+package pt.citar.diablu.sms2osc.osc;
+
+
+import de.sciss.net.OSCServer;
+import java.io.IOException;
+import pt.citar.diablu.sms2osc.S2O;
+
+
+public class S2OOscServer {
+
+ private S2O s2o;
+ private S2OOscListener oscListener;
+ private OSCServer oscServer;
+ private boolean connected;
+
+ public S2OOscServer(S2O s2o) {
+ this.s2o = s2o;
+ connected = false;
+ this.oscListener = new S2OOscListener(s2o);
+
+ }
+
+ public void start() {
+
+ try {
+ oscServer = OSCServer.newUsing(OSCServer.UDP,
Integer.parseInt(s2o.getGui().getServerPort()), true);
+ oscServer.addOSCListener(oscListener);
+ oscServer.start();
+ connected = true;
+ s2o.getGui().serverButtonStop(connected);
+
+ } catch (IOException ex) {
+
+ oscServer.dispose();
+ connected = false;
+ s2o.getGui().serverButtonStop(connected);
+ }
+ }
+
+ public void stop() {
+
+ oscServer.dispose();
+ while (!oscServer.isActive())
+ {
+ connected = false;
+ s2o.getGui().serverButtonStop(connected);
+ break;
+ }
+ }
+
+ public boolean isConnected() {
+ return connected;
+ }
+
+
+}

Added: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OCommPortList.java
==============================================================================
--- (empty file)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OCommPortList.java Mon
Nov 3 09:14:29 2008
@@ -0,0 +1,31 @@
+package pt.citar.diablu.sms2osc.util;
+
+import java.util.Enumeration;
+import java.util.Vector;
+import org.smslib.helper.CommPortIdentifier;
+
+public class S2OCommPortList {
+
+ Vector<String> portList;
+
+ public S2OCommPortList()
+ {
+ portList = new Vector<String>();
+ Enumeration pList = CommPortIdentifier.getPortIdentifiers();
+ while(pList.hasMoreElements())
+
portList.add(((CommPortIdentifier)pList.nextElement()).getName());
+ }
+
+ public Vector<String> getCommPorts()
+ {
+ return portList;
+ }
+
+ public String getFirst()
+ {
+ if(portList.size() > 0)
+ return portList.elementAt(0);
+ return "";
+ }
+
+}

Added: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OProperties.java
==============================================================================
--- (empty file)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OProperties.java Mon
Nov 3 09:14:29 2008
@@ -0,0 +1,91 @@
+package pt.citar.diablu.sms2osc.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+import pt.citar.diablu.sms2osc.S2O;
+
+public class S2OProperties {
+
+ S2O s2o;
+ Properties properties;
+
+ public S2OProperties(S2O s2o) {
+ this.s2o = s2o;
+ this.properties = new Properties();
+ }
+
+ public void loadProperties() {
+ File file = new File("config.ini");
+ FileInputStream fis = null;
+ if (!file.exists()) {
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(file);
+ properties.setProperty("RemoteIP", "127.0.0.1");
+ properties.setProperty("IncomingPort", "12000");
+ properties.setProperty("OutgoingPort", "12001");
+ properties.setProperty("Gateway", "sms2osc");
+ properties.setProperty("ComPort",
s2o.getCommPortList().getFirst());
+ properties.setProperty("UseLoopback", "true");
+ properties.store(fos, "SMS2OSC Configuration");
+
+ } catch (IOException ex) {
+ } finally {
+ try {
+ fos.close();
+ } catch (IOException ex) {
+ }
+ }
+ } else {
+ try {
+ fis = new FileInputStream(file);
+ properties.load(fis);
+ } catch (FileNotFoundException ex) {
+ } catch (IOException ex) {
+ } finally {
+ try {
+ fis.close();
+ } catch (IOException ex) {
+ }
+ }
+ }
+
+ }
+
+ public String getRemoteIP()
+ {
+ return properties.getProperty("RemoteIP", "127.0.0.1");
+ }
+
+ public String getIncomingPort()
+ {
+ return properties.getProperty("IncomingPort", "12000");
+ }
+
+ public String getOutgoingPort()
+ {
+ return properties.getProperty("OutgoingPort", "12001");
+ }
+
+ public String getGateway()
+ {
+ return properties.getProperty("Gateway", "sms2osc");
+ }
+
+ public String getComPort()
+ {
+ return properties.getProperty("ComPort",
s2o.getCommPortList().getFirst());
+ }
+
+ public String getUseLoopback()
+ {
+ return properties.getProperty("UseLoopback", "true");
+ }
+
+}
+
+

Reply all
Reply to author
Forward
0 new messages