[diablu commit] r321 - in trunk/SMS2OSC: . lib nbproject nbproject/private src/pt/citar/diablu/sms2osc src/pt/cit...

2 views
Skip to first unread message

codesite...@google.com

unread,
Dec 11, 2008, 9:36:15 AM12/11/08
to diablu...@googlegroups.com
Author: pedro.r.santos
Date: Thu Dec 11 05:58:52 2008
New Revision: 321

Added:
trunk/SMS2OSC/lib/smslib-3.3.2.jar (contents, props changed)
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OConnectingPopUp.form
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OConnectingPopUp.java
Modified:
trunk/SMS2OSC/build.xml
trunk/SMS2OSC/nbproject/build-impl.xml
trunk/SMS2OSC/nbproject/genfiles.properties
trunk/SMS2OSC/nbproject/private/private.properties
trunk/SMS2OSC/nbproject/project.properties
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/S2O.java
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/S2OGUI.form
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.java
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscServer.java
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OProperties.java
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OTextAreaHandler.java

Log:


Modified: trunk/SMS2OSC/build.xml
==============================================================================
--- trunk/SMS2OSC/build.xml (original)
+++ trunk/SMS2OSC/build.xml Thu Dec 11 05:58:52 2008
@@ -2,6 +2,11 @@
<!-- 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.) -->
+<!-- By default, only the Clean and Build commands use this build script.
-->
+<!-- Commands such as Run, Debug, and Test only use this build script if
-->
+<!-- the Compile on Save feature is turned off for the project. -->
+<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
+<!-- in the project's Project Properties dialog box.-->
<project name="SMS2OSC" default="default" basedir=".">
<description>Builds, tests, and runs the project SMS2OSC.</description>
<import file="nbproject/build-impl.xml"/>

Added: trunk/SMS2OSC/lib/smslib-3.3.2.jar
==============================================================================
Binary file. No diff available.

Modified: trunk/SMS2OSC/nbproject/build-impl.xml
==============================================================================
--- trunk/SMS2OSC/nbproject/build-impl.xml (original)
+++ trunk/SMS2OSC/nbproject/build-impl.xml Thu Dec 11 05:58:52 2008
@@ -218,13 +218,13 @@
</sequential>
</macrodef>
</target>
- <target name="-init-macrodef-nbjpda">
+ <target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart"
uri="http://www.netbeans.org/ns/j2se-project/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}" name="classpath"/>
<attribute default="" name="stopclassname"/>
<sequential>
- <nbjpdastart addressproperty="jpda.address" name="@{name}"
stopclassname="@{stopclassname}" transport="dt_socket">
+ <nbjpdastart addressproperty="jpda.address" name="@{name}"
stopclassname="@{stopclassname}" transport="${debug-transport}">
<classpath>
<path path="@{classpath}"/>
</classpath>
@@ -255,6 +255,12 @@
<condition else="-Xdebug" property="debug-args-line"
value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
+ <condition else="dt_socket" property="debug-transport-by-os"
value="dt_shmem">
+ <os family="windows"/>
+ </condition>
+ <condition else="${debug-transport-by-os}"
property="debug-transport" value="${debug.transport}">
+ <isset property="debug.transport"/>
+ </condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug"
uri="http://www.netbeans.org/ns/j2se-project/3">
@@ -264,7 +270,7 @@
<sequential>
<java classname="@{classname}" dir="${work.dir}"
fork="true">
<jvmarg line="${debug-args-line}"/>
- <jvmarg
value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
+ <jvmarg
value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<jvmarg line="${run.jvmargs}"/>
<classpath>
<path path="@{classpath}"/>
@@ -311,6 +317,13 @@
===================
-->
<target depends="init" name="deps-jar" unless="no.deps"/>
+ <target
depends="init,-check-automatic-build,-clean-after-automatic-build"
name="-verify-automatic-build"/>
+ <target depends="init" name="-check-automatic-build">
+ <available file="${build.classes.dir}/.netbeans_automatic_build"
property="netbeans.automatic.build"/>
+ </target>
+ <target depends="init" if="netbeans.automatic.build"
name="-clean-after-automatic-build">
+ <antcall target="clean"/>
+ </target>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
</target>
@@ -331,7 +344,7 @@
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
- <target
depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile"
description="Compile project." name="compile"/>
+ <target
depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile"
description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
@@ -345,7 +358,7 @@
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
- <target
depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"
name="compile-single"/>
+ <target
depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single"
name="compile-single"/>
<!--
====================
JAR BUILDING SECTION

Modified: trunk/SMS2OSC/nbproject/genfiles.properties
==============================================================================
--- trunk/SMS2OSC/nbproject/genfiles.properties (original)
+++ trunk/SMS2OSC/nbproject/genfiles.properties Thu Dec 11 05:58:52 2008
@@ -1,8 +1,8 @@
build.xml.data.CRC32=88503688
-build.xml.script.CRC32=0ee78cb6
-build.xml.stylesheet.CRC32=be360661
+build.xml.script.CRC32=fd5d8bf8
+build.xml.stylesheet.CRC32=958a1d3e
# This file is used by a NetBeans-based IDE to track changes in generated
files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never
regenerate such files for you.
nbproject/build-impl.xml.data.CRC32=88503688
-nbproject/build-impl.xml.script.CRC32=6d8c1125
-nbproject/build-impl.xml.stylesheet.CRC32=487672f9
+nbproject/build-impl.xml.script.CRC32=333c1b30
+nbproject/build-impl.xml.stylesheet.CRC32=e55b27f5

Modified: trunk/SMS2OSC/nbproject/private/private.properties
==============================================================================
--- trunk/SMS2OSC/nbproject/private/private.properties (original)
+++ trunk/SMS2OSC/nbproject/private/private.properties Thu Dec 11 05:58:52
2008
@@ -1,4 +1,7 @@
-file.reference.log4j-1.2.15.jar=D:\\psantos\\SMS2OSC\\lib\\log4j-1.2.15.jar
-file.reference.SmsLib.jar=D:\\psantos\\SMS2OSC\\lib\\SmsLib.jar
-jaxws.endorsed.dir=C:\\Program Files\\NetBeans
6.1\\java2\\modules\\ext\\jaxws21\\api
-user.properties.file=C:\\Documents and
Settings\\psantos\\.netbeans\\6.1\\build.properties
+compile.on.save=false
+do.depend=false
+do.jar=true
+javac.debug=true
+javadoc.preview=true
+jaxws.endorsed.dir=C:\\Program Files\\NetBeans
6.5\\java2\\modules\\ext\\jaxws21\\api:C:\\Program Files\\NetBeans
6.5\\ide10\\modules\\ext\\jaxb\\api
+user.properties.file=C:\\Documents and
Settings\\Raspa\\.netbeans\\6.5\\build.properties

Modified: trunk/SMS2OSC/nbproject/project.properties
==============================================================================
--- trunk/SMS2OSC/nbproject/project.properties (original)
+++ trunk/SMS2OSC/nbproject/project.properties Thu Dec 11 05:58:52 2008
@@ -1,3 +1,5 @@
+application.title=SMS2OSC
+application.vendor=Raspa
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
@@ -16,15 +18,13 @@
dist.jar=${dist.dir}/SMS2OSC.jar
dist.javadoc.dir=${dist.dir}/javadoc
excludes=
-file.reference.log4j-1.2.15.jar=E:\\SMS2OSC\\SMS2OSC\\lib\\log4j-1.2.15.jar
file.reference.NetUtil.jar=lib\\NetUtil.jar
-file.reference.SmsLib.jar=E:\\SMS2OSC\\SMS2OSC\\lib\\SmsLib.jar
+file.reference.smslib-3.3.2.jar=lib\\smslib-3.3.2.jar
includes=**
jar.compress=false
javac.classpath=\
- ${file.reference.SmsLib.jar}:\
- ${file.reference.log4j-1.2.15.jar}:\
- ${file.reference.NetUtil.jar}
+ ${file.reference.NetUtil.jar}:\
+ ${file.reference.smslib-3.3.2.jar}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false

Modified: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/S2O.java
==============================================================================
--- trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/S2O.java (original)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/S2O.java Thu Dec 11 05:58:52
2008
@@ -1,12 +1,12 @@
package pt.citar.diablu.sms2osc;

import java.io.IOException;
-import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
import pt.citar.diablu.sms2osc.bluetooth.S2OBTConnection;
+import pt.citar.diablu.sms2osc.gui.S2OConnectingPopUp;
import pt.citar.diablu.sms2osc.gui.S2OGUI;
import pt.citar.diablu.sms2osc.osc.S2OOscClient;
import pt.citar.diablu.sms2osc.osc.S2OOscServer;
@@ -25,10 +25,13 @@


private S2OGUI gui;
+ private S2OConnectingPopUp connectionPopUpGui;
private S2OTextAreaHandler textAreaHandler;
private FileHandler fileHandler;
private S2OOscServer oscServer;
private S2OOscClient oscClient;
+
+


private S2OSMSParser smsParser;
@@ -51,10 +54,9 @@
smsParser = new S2OSMSParser(this, properties.useParser());
if(smsParser.isActive())
{
- System.out.println("lalala");
smsParser.getCommands(properties.getCommands());
}
- btConnection = new S2OBTConnection(this,
properties.getGateway(), "COM6", 57600, "Siemens", "S65");
+ btConnection = new S2OBTConnection(this, properties.getGateway(),
this.getGui().getCommPort(), 57600, "", "");

@@ -66,15 +68,6 @@

S2O s2o = new S2O();
s2o.gui.setVisible(true);
-
- s2o.logger.log(Level.SEVERE, "SEVERE");
- s2o.logger.log(Level.WARNING, "WARNING");
- s2o.logger.log(Level.INFO, "INFO");
- s2o.logger.log(Level.CONFIG, "CONFIG");
- s2o.logger.log(Level.FINE, "FINE");
- s2o.logger.log(Level.FINER, "FINER");
- s2o.logger.log(Level.FINEST, "FINEST");
-
}

private void setupLogger()
@@ -136,6 +129,24 @@
public S2OSMSParser getSmsParser() {
return smsParser;
}
+
+ public void setBtConnectionThread(Thread btConnectionThread) {
+ this.btConnectionThread = btConnectionThread;
+ }
+
+ public S2OConnectingPopUp getConnectionPopUpGui() {
+ return connectionPopUpGui;
+ }
+
+ public void setConnectionPopUpGui(S2OConnectingPopUp
connectionPopUpGui) {
+ this.connectionPopUpGui = connectionPopUpGui;
+ }
+
+ public void setBtConnection(S2OBTConnection btConnection) {
+ this.btConnection = btConnection;
+ }
+
+


Modified:
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection.java
==============================================================================
---
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection.java
(original)
+++
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnection.java
Thu Dec 11 05:58:52 2008
@@ -32,6 +32,7 @@
S2O s2o;
boolean connected;
boolean connecting;
+ SerialModemGateway gateway;

public S2OBTConnection(S2O s2o, String id, String port, int baud,
String manufacturer, String model) {
this.s2o = s2o;
@@ -55,14 +56,14 @@


srv = new Service();
- SerialModemGateway gateway = new SerialModemGateway(id, port,
baud, manufacturer, model);
+ gateway = new SerialModemGateway(id, port, baud, manufacturer,
model);
gateway.setInbound(true);
gateway.setOutbound(true);
- gateway.setOutboundNotification(outboundNotification);
- gateway.setInboundNotification(inboundNotification);
+ srv.setOutboundNotification(outboundNotification);
+ srv.setInboundNotification(inboundNotification);
srv.addGateway(gateway);
srv.startService();
- System.out.println("Modem Information: build2");
+ 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());
@@ -114,7 +115,9 @@

public void stopConnection() {
try {
+
srv.stopService();
+ gateway.stopGateway();
} catch (TimeoutException ex) {

Logger.getLogger(S2OBTConnection.class.getName()).log(Level.SEVERE, null,
ex);
} catch (GatewayException ex) {
@@ -166,9 +169,11 @@

public void connect()
{
- Thread to = new Thread(new S2OBTConnectionTimeout(s2o,
Thread.currentThread(), 15));
+ S2OBTConnectionTimeout timeout = new S2OBTConnectionTimeout(s2o,
15);
+ Thread to = new Thread(timeout);
to.start();
this.startConnection();
+ timeout.setConnected(true);
to.interrupt();
}

@@ -182,6 +187,10 @@

public boolean isConnected() {
return connected;
+ }
+
+ public String getPort() {
+ return port;
}

Modified:
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnectionTimeout.java
==============================================================================
---
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnectionTimeout.java
(original)
+++
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/bluetooth/S2OBTConnectionTimeout.java
Thu Dec 11 05:58:52 2008
@@ -7,33 +7,46 @@

int timeout;
boolean interrupted;
+ boolean connected;
Thread btConnect;
S2O s2o;

- public S2OBTConnectionTimeout(S2O s2o, Thread btConnect, int timeout)
+ public S2OBTConnectionTimeout(S2O s2o, int timeout)
{
this.timeout = timeout;
- this.btConnect = btConnect;
this.s2o = s2o;
+ this.connected = false;
}

public void run() {
-
+ this.connected = false;
System.out.println("timeout");
try {
Thread.sleep(timeout * 1000);
if(!interrupted)
{
- btConnect.interrupt();
-
-
-
- }
+ s2o.getBtConnectionThread().interrupt();
+ }
+ s2o.getConnectionPopUpGui().connectionFailed();
} catch (InterruptedException ex) {

//Logger.getLogger(S2OBTConnectionTimeout.class.getName()).log(Level.SEVERE,
null, ex);
System.out.println("timeout stopped");
+ if(connected)
+ s2o.getConnectionPopUpGui().connected();
+ else
+ s2o.getConnectionPopUpGui().connectionFailed();
+
+
+
}
+
+ }
+
+ public void setConnected(boolean connected) {
+ this.connected = connected;
}
+
+


Added: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OConnectingPopUp.form
==============================================================================
--- (empty file)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OConnectingPopUp.form
Thu Dec 11 05:58:52 2008
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<Form version="1.3" maxVersion="1.7"
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_generateFQN" type="java.lang.Boolean"
value="true"/>
+ <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">
+ <Group type="102" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="1" attributes="0">
+ <Component id="cancelButton" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="okButton" min="-2" max="-2"
attributes="0"/>
+ </Group>
+ <Component id="messageLabel" alignment="0" pref="297"
max="32767" 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="1" attributes="0">
+ <EmptySpace max="-2" attributes="0"/>
+ <Component id="messageLabel" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace pref="15" max="32767" attributes="0"/>
+ <Group type="103" groupAlignment="3" attributes="0">
+ <Component id="cancelButton" alignment="3" min="-2"
max="-2" attributes="0"/>
+ <Component id="okButton" alignment="3" min="-2" max="-2"
attributes="0"/>
+ </Group>
+ <EmptySpace max="-2" attributes="0"/>
+ </Group>
+ </Group>
+ </DimensionLayout>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JButton" name="cancelButton">
+ <Properties>
+ <Property name="label" type="java.lang.String" value="Cancel"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed"
listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent"
handler="cancelButtonActionPerformed"/>
+ </Events>
+ </Component>
+ <Component class="javax.swing.JLabel" name="messageLabel">
+ <Properties>
+ <Property name="horizontalAlignment" type="int" value="0"/>
+ <Property name="text" type="java.lang.String" value="jLabel1"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JButton" name="okButton">
+ <Properties>
+ <Property name="text" type="java.lang.String" value="OK"/>
+ </Properties>
+ <Events>
+ <EventHandler event="actionPerformed"
listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/>
+ </Events>
+ </Component>
+ </SubComponents>
+</Form>

Added: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OConnectingPopUp.java
==============================================================================
--- (empty file)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OConnectingPopUp.java
Thu Dec 11 05:58:52 2008
@@ -0,0 +1,143 @@
+/*
+ *
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/*
+ * S2OConnectingPopUp.java
+ *
+ * Created on 9/Dez/2008, 11:08:11
+ */
+
+package pt.citar.diablu.sms2osc.gui;
+
+//import javax.swing.JFrame;
+import pt.citar.diablu.sms2osc.S2O;
+
+/**
+ *
+ * @author Raspa
+ */
+public class S2OConnectingPopUp extends javax.swing.JFrame {
+
+ S2O s2o;
+ String commPort;
+
+ /** Creates new form S2OConnectingPopUp */
+ public S2OConnectingPopUp(S2O s2o, String commPort) {
+ this.s2o = s2o;
+ this.commPort = commPort;
+ initComponents();
+ //this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
+ messageLabel.setText("Establishing Connection on port " +
commPort);
+ okButton.setVisible(false);
+ }
+
+
+ @SuppressWarnings("unchecked")
+ // <editor-fold defaultstate="collapsed" desc="Generated
Code">//GEN-BEGIN:initComponents
+ private void initComponents() {
+
+ cancelButton = new javax.swing.JButton();
+ messageLabel = new javax.swing.JLabel();
+ okButton = new javax.swing.JButton();
+
+
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
+
+ cancelButton.setLabel("Cancel");
+ cancelButton.addActionListener(new java.awt.event.ActionListener()
{
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ cancelButtonActionPerformed(evt);
+ }
+ });
+
+
messageLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
+ messageLabel.setText("jLabel1");
+
+ okButton.setText("OK");
+ okButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ okButtonActionPerformed(evt);
+ }
+ });
+
+ javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
+ getContentPane().setLayout(layout);
+ layout.setHorizontalGroup(
+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
+ .addComponent(cancelButton)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(okButton))
+ .addComponent(messageLabel,
javax.swing.GroupLayout.DEFAULT_SIZE, 297, Short.MAX_VALUE))
+ .addContainerGap())
+ );
+ layout.setVerticalGroup(
+
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
layout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(messageLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
15,
Short.MAX_VALUE)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(cancelButton)
+ .addComponent(okButton))
+ .addContainerGap())
+ );
+
+ pack();
+ }// </editor-fold>//GEN-END:initComponents
+
+ private void cancelButtonActionPerformed(java.awt.event.ActionEvent
evt) {//GEN-FIRST:event_cancelButtonActionPerformed
+ s2o.getBtConnectionThread().interrupt();
+ s2o.getBtConnection().stopConnection();
+ s2o.getGui().setVisible(true);
+ this.setVisible(false);
+ s2o.getGui().setGatewayConnectionState(false);
+
+ }//GEN-LAST:event_cancelButtonActionPerformed
+
+ private void okButtonActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_okButtonActionPerformed
+ s2o.getGui().setVisible(true);
+ this.setVisible(false);
+ }//GEN-LAST:event_okButtonActionPerformed
+
+ public void connected()
+ {
+ cancelButton.setVisible(false);
+ okButton.setVisible(true);
+ messageLabel.setText("Connection established on port " + commPort);
+ s2o.getGui().setGatewayConnectionState(true);
+
+ }
+
+ public void connectionFailed()
+ {
+ cancelButton.setVisible(false);
+ okButton.setVisible(true);
+ messageLabel.setText("Connection failed on port " + commPort);
+ s2o.getGui().setGatewayConnectionState(false);
+
+ }
+
+ public void connectionStopped()
+ {
+ this.setVisible(true);
+ cancelButton.setVisible(false);
+ okButton.setVisible(true);
+ messageLabel.setText("Connection stopped port " +
s2o.getBtConnection().getPort());
+ s2o.getGui().setGatewayConnectionState(false);
+
+ }
+
+
+ // Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton cancelButton;
+ private javax.swing.JLabel messageLabel;
+ private javax.swing.JButton okButton;
+ // End of variables declaration//GEN-END:variables
+
+}

Modified: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.form
==============================================================================
--- trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.form (original)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.form Thu Dec 11
05:58:52 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" ?>

-<Form version="1.3" maxVersion="1.6"
type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
+<Form version="1.5" maxVersion="1.6"
type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
<Property name="defaultCloseOperation" type="int" value="3"/>
</Properties>
@@ -10,6 +10,7 @@
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer"
value="0"/>
<AuxValue name="FormSettings_autoSetComponentName"
type="java.lang.Boolean" value="false"/>
+ <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean"
value="true"/>
<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"/>
@@ -26,7 +27,7 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
- <Component id="S2OTabbedPane" alignment="0" pref="240"
max="32767" attributes="0"/>
+ <Component id="S2OTabbedPane" min="-2" max="-2" attributes="0"/>
</Group>
</DimensionLayout>
</Layout>
@@ -50,7 +51,7 @@
<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"/>
+ <EmptySpace min="-2" pref="10" max="-2"
attributes="0"/>
<Component id="GatewayPanel" min="-2" max="-2"
attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
@@ -58,13 +59,13 @@
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" alignment="1" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
- <Group type="103" groupAlignment="1" attributes="0">
- <Component id="OSCPanel" alignment="0"
max="32767" attributes="1"/>
+ <Group type="103" groupAlignment="1" max="-2"
attributes="0">
<Component id="GatewayPanel" alignment="0"
max="32767" attributes="1"/>
+ <Component id="OSCPanel" alignment="0"
max="32767" attributes="1"/>
</Group>
- <EmptySpace max="-2" attributes="0"/>
+ <EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -98,12 +99,12 @@
</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 type="102" attributes="0">
+ <Group type="103" groupAlignment="0" max="-2"
attributes="0">
+ <Component id="YourAppPane" alignment="1"
max="32767" attributes="1"/>
+ <Component id="SMS2OSCPanel" alignment="1"
max="32767" attributes="1"/>
</Group>
- <EmptySpace min="-2" pref="24" max="-2"
attributes="0"/>
+ <EmptySpace pref="32" max="32767"
attributes="0"/>
<Component id="OSCConnectButton" min="-2"
max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -154,7 +155,7 @@
<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"/>
+ <EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -191,6 +192,8 @@
<Component class="javax.swing.JButton"
name="OSCConnectButton">
<Properties>
<Property name="text" type="java.lang.String"
value="Start Server"/>
+ <Property name="horizontalTextPosition" type="int"
value="4"/>
+ <Property name="verticalTextPosition" type="int"
value="3"/>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleName"
type="java.lang.String" value=""/>
@@ -228,7 +231,7 @@
<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"/>
+ <EmptySpace pref="37" max="32767"
attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -263,16 +266,25 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
- <Group type="102" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
- <Component id="CommPortLabel" min="-2" pref="70"
max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="0"
attributes="0">
+ <Group type="102" 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"/>
+ </Group>
+ <Group type="102" alignment="1"
attributes="0">
+ <Component id="CommPortLabel1" min="-2"
pref="70" max="-2" attributes="0"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Component
id="BaudRateFormatedTextField" min="-2" pref="70" max="-2" attributes="0"/>
+ </Group>
+ </Group>
<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 pref="73" max="32767"
attributes="0"/>
+ <Component id="Connect" min="-2" pref="81"
max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -285,7 +297,12 @@
<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"/>
+ <EmptySpace max="-2" attributes="0"/>
+ <Group type="103" groupAlignment="3"
attributes="0">
+ <Component id="CommPortLabel1" alignment="3"
min="-2" max="-2" attributes="0"/>
+ <Component id="BaudRateFormatedTextField"
alignment="3" min="-2" max="-2" attributes="0"/>
+ </Group>
+ <EmptySpace pref="73" max="32767"
attributes="0"/>
<Component id="Connect" min="-2" max="-2"
attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -303,6 +320,7 @@
<Component class="javax.swing.JButton" name="Connect">
<Properties>
<Property name="text" type="java.lang.String"
value="Connect"/>
+ <Property name="verticalTextPosition" type="int"
value="3"/>
</Properties>
<Events>
<EventHandler event="actionPerformed"
listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent" handler="ConnectActionPerformed"/>
@@ -313,6 +331,21 @@
<Property name="text" type="java.lang.String"
value="Port:"/>
</Properties>
</Component>
+ <Component class="javax.swing.JLabel"
name="CommPortLabel1">
+ <Properties>
+ <Property name="text" type="java.lang.String"
value="Baud Rate:"/>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JFormattedTextField"
name="BaudRateFormatedTextField">
+ <Properties>
+ <Property name="formatterFactory"
type="javax.swing.JFormattedTextField$AbstractFormatterFactory"
editor="org.netbeans.modules.form.editors.AbstractFormatterFactoryEditor">
+ <Format format="#0" subtype="-1" type="0"/>
+ </Property>
+ </Properties>
+ <AuxValues>
+ <AuxValue name="JavaCodeGenerator_AddingCodePost"
type="java.lang.String"
value="BaudRateFormatedTextField.setText(s2o.getProperties().getBaudRate());"/>
+ </AuxValues>
+ </Component>
</SubComponents>
</Container>
</SubComponents>
@@ -320,8 +353,8 @@
<Container class="javax.swing.JPanel" name="jPanel2">
<Constraints>
<Constraint
layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"
value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
- <JTabbedPaneConstraints tabName="tab3">
- <Property name="tabTitle" type="java.lang.String"
value="tab3"/>
+ <JTabbedPaneConstraints tabName="SMSs">
+ <Property name="tabTitle" type="java.lang.String"
value="SMSs"/>
</JTabbedPaneConstraints>
</Constraint>
</Constraints>
@@ -340,7 +373,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace max="-2" attributes="0"/>
- <Component id="jScrollPane2" pref="190" max="32767"
attributes="0"/>
+ <Component id="jScrollPane2" pref="194" max="32767"
attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
@@ -360,7 +393,7 @@
<Table columnCount="3" rowCount="20">
<Column editable="false" title="Number"
type="java.lang.String"/>
<Column editable="false" title="Direction"
type="java.lang.String"/>
- <Column editable="false" title="Title 3"
type="java.lang.String"/>
+ <Column editable="false" title="Message"
type="java.lang.String"/>
</Table>
</Property>
<Property name="autoResizeMode" type="int" value="0"/>
@@ -419,7 +452,7 @@
<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"/>
+ <EmptySpace pref="13" max="32767" attributes="0"/>
<Component id="jComboBox1" min="-2" max="-2"
attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
@@ -453,6 +486,28 @@
</Events>
</Component>
</SubComponents>
+ </Container>
+ <Container class="javax.swing.JPanel" name="jPanel3">
+ <Constraints>
+ <Constraint
layoutClass="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout"
value="org.netbeans.modules.form.compat2.layouts.support.JTabbedPaneSupportLayout$JTabbedPaneConstraintsDescription">
+ <JTabbedPaneConstraints tabName="Test">
+ <Property name="tabTitle" type="java.lang.String"
value="Test"/>
+ </JTabbedPaneConstraints>
+ </Constraint>
+ </Constraints>
+
+ <Layout>
+ <DimensionLayout dim="0">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="654" max="32767"
attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ <DimensionLayout dim="1">
+ <Group type="103" groupAlignment="0" attributes="0">
+ <EmptySpace min="0" pref="216" max="32767"
attributes="0"/>
+ </Group>
+ </DimensionLayout>
+ </Layout>
</Container>
</SubComponents>
</Container>

Modified: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.java
==============================================================================
--- trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.java (original)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/gui/S2OGUI.java Thu Dec 11
05:58:52 2008
@@ -1,20 +1,37 @@

package pt.citar.diablu.sms2osc.gui;

+import java.awt.Point;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
import java.util.logging.Level;
import javax.swing.JTextArea;
import pt.citar.diablu.sms2osc.*;
-
+import pt.citar.diablu.sms2osc.bluetooth.S2OBTConnection;

public class S2OGUI extends javax.swing.JFrame {

S2O s2o;
int rowNumber = 0;
+ boolean isGatewayConnected = false;

public S2OGUI(S2O s2o) {
this.s2o = s2o;
initComponents();
setCommPorts();
+
+ jTable1.addMouseListener(new MouseAdapter(){
+ @Override
+ public void mouseClicked(MouseEvent e){
+ if (e.getClickCount() == 2){
+ Point p = e.getPoint();
+ int row = jTable1.rowAtPoint(p);
+ System.out.println((String)jTable1.getValueAt(row,0));
+ System.out.println((String)jTable1.getValueAt(row,1));
+ System.out.println((String)jTable1.getValueAt(row,2));
+ }
+ }
+ } );
}

private void setCommPorts()
@@ -47,6 +64,8 @@
CommPorts = new javax.swing.JComboBox();
Connect = new javax.swing.JButton();
CommPortLabel = new javax.swing.JLabel();
+ CommPortLabel1 = new javax.swing.JLabel();
+ BaudRateFormatedTextField = new javax.swing.JFormattedTextField();
jPanel2 = new javax.swing.JPanel();
jScrollPane2 = new javax.swing.JScrollPane();
jTable1 = new javax.swing.JTable();
@@ -54,6 +73,7 @@
jScrollPane1 = new javax.swing.JScrollPane();
logTextArea = new javax.swing.JTextArea();
jComboBox1 = new javax.swing.JComboBox();
+ jPanel3 = new javax.swing.JPanel();


setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

@@ -104,10 +124,12 @@
.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))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);

OSCConnectButton.setText("Start Server");
+
OSCConnectButton.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
+
OSCConnectButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
OSCConnectButton.addActionListener(new
java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
OSCConnectButtonActionPerformed(evt);
@@ -139,7 +161,7 @@
.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))
+ .addContainerGap(37, Short.MAX_VALUE))
);

javax.swing.GroupLayout OSCPanelLayout = new
javax.swing.GroupLayout(OSCPanel);
@@ -163,10 +185,10 @@
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)
+ .addGroup(OSCPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
+ .addComponent(YourAppPane,
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
+ .addComponent(SMS2OSCPanel,
javax.swing.GroupLayout.Alignment.TRAILING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
32,
Short.MAX_VALUE)
.addComponent(OSCConnectButton)
.addContainerGap())
);
@@ -176,6 +198,7 @@

GatewayPanel.setBorder(javax.swing.BorderFactory.createTitledBorder("Gateway"));

Connect.setText("Connect");
+ Connect.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
Connect.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ConnectActionPerformed(evt);
@@ -184,19 +207,29 @@

CommPortLabel.setText("Port:");

+ CommPortLabel1.setText("Baud Rate:");
+
+ BaudRateFormatedTextField.setFormatterFactory(new
javax.swing.text.DefaultFormatterFactory(new
javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#0"))));
+
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(GatewayPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(GatewayPanelLayout.createSequentialGroup()
+ .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))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
GatewayPanelLayout.createSequentialGroup()
+ .addComponent(CommPortLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE, 70,
javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(BaudRateFormatedTextField,
javax.swing.GroupLayout.PREFERRED_SIZE, 70,
javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
GatewayPanelLayout.createSequentialGroup()
- .addContainerGap(81, Short.MAX_VALUE)
- .addComponent(Connect)
+ .addContainerGap(73, Short.MAX_VALUE)
+ .addComponent(Connect,
javax.swing.GroupLayout.PREFERRED_SIZE, 81,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
GatewayPanelLayout.setVerticalGroup(
@@ -206,11 +239,17 @@
.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)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(GatewayPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(CommPortLabel1)
+ .addComponent(BaudRateFormatedTextField,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
73,
Short.MAX_VALUE)
.addComponent(Connect)
.addContainerGap())
);

+
BaudRateFormatedTextField.setText(s2o.getProperties().getBaudRate());
+
javax.swing.GroupLayout ConnectionPanelLayout = new
javax.swing.GroupLayout(ConnectionPanel);
ConnectionPanel.setLayout(ConnectionPanelLayout);
ConnectionPanelLayout.setHorizontalGroup(
@@ -218,18 +257,18 @@
.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)
+ .addGap(10, 10, 10)
.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()
+ .addGroup(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())
+ .addGroup(ConnectionPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
+ .addComponent(GatewayPanel,
javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
+ .addComponent(OSCPanel,
javax.swing.GroupLayout.Alignment.LEADING,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE))
);

S2OTabbedPane.addTab("Connection", ConnectionPanel);
@@ -258,7 +297,7 @@
{null, null, null}
},
new String [] {
- "Number", "Direction", "Title 3"
+ "Number", "Direction", "Message"
}
) {
Class[] types = new Class [] {
@@ -299,11 +338,11 @@

jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel2Layout.createSequentialGroup()
.addContainerGap()
- .addComponent(jScrollPane2,
javax.swing.GroupLayout.DEFAULT_SIZE, 190, Short.MAX_VALUE)
+ .addComponent(jScrollPane2,
javax.swing.GroupLayout.DEFAULT_SIZE, 194, Short.MAX_VALUE)
.addContainerGap())
);

- S2OTabbedPane.addTab("tab3", jPanel2);
+ S2OTabbedPane.addTab("SMSs", jPanel2);

logTextArea.setColumns(20);
logTextArea.setRows(5);
@@ -332,13 +371,26 @@
.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)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
13,
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 jPanel3Layout = new
javax.swing.GroupLayout(jPanel3);
+ jPanel3.setLayout(jPanel3Layout);
+ jPanel3Layout.setHorizontalGroup(
+
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 654, Short.MAX_VALUE)
+ );
+ jPanel3Layout.setVerticalGroup(
+
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGap(0, 216, Short.MAX_VALUE)
+ );
+
+ S2OTabbedPane.addTab("Test", jPanel3);
+
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
@@ -347,21 +399,32 @@
);
layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(S2OTabbedPane,
javax.swing.GroupLayout.DEFAULT_SIZE, 240, Short.MAX_VALUE)
+ .addComponent(S2OTabbedPane,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)
);

pack();
}// </editor-fold>//GEN-END:initComponents

private void ConnectActionPerformed(java.awt.event.ActionEvent evt)
{//GEN-FIRST:event_ConnectActionPerformed
-if(s2o.getBtConnection().isConnected())
- {
+ if (isGatewayConnected) {
+ this.setVisible(false);
s2o.getBtConnection().stopConnection();
+ s2o.getConnectionPopUpGui().connectionStopped();
+ } else {
+
+ s2o.setBtConnection(new S2OBTConnection(s2o, "lala",
CommPorts.getSelectedItem().toString(), 57600, "", ""));
+ s2o.setBtConnectionThread(new Thread(s2o.getBtConnection()));
+
s2o.getBtConnection().setPort(CommPorts.getSelectedItem().toString());
+ s2o.getProperties().setProperty("ComPort",
CommPorts.getSelectedItem().toString());
+ s2o.getProperties().setProperty("BaudRate",
BaudRateFormatedTextField.getText());
+
+ s2o.setConnectionPopUpGui(new S2OConnectingPopUp(s2o,
CommPorts.getSelectedItem().toString()));
+ s2o.getConnectionPopUpGui().setVisible(true);
+
+ s2o.setBtConnectionThread(new Thread(s2o.getBtConnection()));
+ s2o.getBtConnectionThread().start();
+ this.setVisible(false);
}
- 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
@@ -377,7 +440,9 @@


// Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JFormattedTextField BaudRateFormatedTextField;
private javax.swing.JLabel CommPortLabel;
+ private javax.swing.JLabel CommPortLabel1;
private javax.swing.JComboBox CommPorts;
private javax.swing.JButton Connect;
private javax.swing.JPanel ConnectionPanel;
@@ -396,12 +461,14 @@
private javax.swing.JComboBox jComboBox1;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
+ private javax.swing.JPanel jPanel3;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JTable jTable1;
private javax.swing.JTextArea logTextArea;
// End of variables declaration//GEN-END:variables

+
public String getHostname() {
return YAHostnameTextField.getText();
}
@@ -450,6 +517,29 @@
rowNumber++;
}
}
+
+ public String getCommPort()
+ {
+ return CommPorts.getSelectedItem().toString();
+ }
+
+ public void setGatewayConnectionState(boolean state)
+ {
+ this.isGatewayConnected = state;
+ if(state)
+ {
+ this.Connect.setText("Stop Connection");
+ System.out.println("true");
+ }
+ else
+ {
+ this.Connect.setText("Connect");
+ System.out.println("false");
+ }
+ }
+
+
+


}

Modified: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscServer.java
==============================================================================
--- trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscServer.java
(original)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/osc/S2OOscServer.java Thu Dec
11 05:58:52 2008
@@ -30,12 +30,13 @@
oscServer.start();
connected = true;
s2o.getGui().serverButtonStop(connected);
-
+ s2o.getProperties().setProperty("RemoteIP",
s2o.getGui().getHostname());
+ s2o.getProperties().setProperty("IncomingPort",
s2o.getGui().getClientPort());
+ s2o.getProperties().setProperty("OutgoingPort",
s2o.getGui().getServerPort());
} catch (IOException ex) {
-
oscServer.dispose();
connected = false;
- s2o.getGui().serverButtonStop(connected);
+ s2o.getGui().serverButtonStop(!connected);
}
}


Modified: trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OProperties.java
==============================================================================
--- trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OProperties.java
(original)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OProperties.java Thu
Dec 11 05:58:52 2008
@@ -16,6 +16,7 @@
public S2OProperties(S2O s2o) {
this.s2o = s2o;
this.properties = new Properties();
+ this.loadProperties();
}

public void loadProperties() {
@@ -31,6 +32,7 @@
properties.setProperty("Gateway", "sms2osc");
properties.setProperty("ComPort",
s2o.getCommPortList().getFirst());
properties.setProperty("UseLoopback", "true");
+ properties.setProperty("BaudRate", "57600");
properties.store(fos, "SMS2OSC Configuration");

} catch (IOException ex) {
@@ -104,9 +106,31 @@
{
return properties.getProperty(command, "");
}
-
-
-
+
+ public void setProperty(String key, String value)
+ {
+
+ File file = new File("config.ini");
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(file);
+ properties.setProperty(key, value);
+ properties.store(fos, "SMS2OSC Configuration");
+
+ } catch (IOException ex) {
+ } finally {
+ try {
+ fos.close();
+ } catch (IOException ex) {
+ }
+ }
+
+ }
+
+ public String getBaudRate()
+ {
+ return properties.getProperty("BaudRate", "57600");
+ }


}

Modified:
trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OTextAreaHandler.java
==============================================================================
--- trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OTextAreaHandler.java
(original)
+++ trunk/SMS2OSC/src/pt/citar/diablu/sms2osc/util/S2OTextAreaHandler.java
Thu Dec 11 05:58:52 2008
@@ -34,7 +34,7 @@
{ if(i != 0)
textArea.append("\n");
textArea.append(logs.elementAt(i).getMessage());
- textArea.setCaretPosition(textArea.getText().length() - 1);
+ textArea.setCaretPosition(textArea.getText().length());
}
}
}

Reply all
Reply to author
Forward
0 new messages