[Tinyos-help] SerialForwarder invisible to the user.
Javier .
javierpo at hotmail.com
Tue Jun 20 10:36:36 PDT 2006
Hi, I'm trying to use SerialForwarder in my aplication, but Iwant to do it
invisible to the user.
Is not dificult to start listening to the serial port with the "-no-gui"
option. The problem begins when I stop SerialForwarder listening to the
port. If I try to start listening again, this advise apears:
serial at COM3:57600 died - restarting (java.io.IOException: Port COM3 busy)
SF enabled, 1 client, 0 packets read, 0 packets written SF enabled, 1
client, 0 packets read, 0 packets written SF enabled, 1 client, 0 packets
read, 0 packets written
SF disabled, 1 client, 0 packets read, 0 packets written
Followed by this error message:
java.io.IOException: Port COM3 busy
at net.tinyos.packet.SerialByteSource.openStreams(SerialByteSource.java:69)
at net.tinyos.packet.StreamByteSource.open(StreamByteSource.java:51)
at net.tinyos.packet.Packetizer.openSource(Packetizer.java:119).........
This is my code:
public synchronized void startDetecting(){
if (sf==null){
try {
sf = new SerialForwarder(new String[]
{"-quiet","-no-gui","-comm","serial at COM"+serialPort+":mica2","-port","9001"});
} catch (IOException e) {
e.printStackTrace();
}
}
else{
sf.startListenServer();
}
waitingForConnection = new Vector(0);
moteif = new MoteIF(PrintStreamMessenger.err);
moteif.registerListener(new ConnectionMsg(),this);
detecting=true;
}
public synchronized void stopDetecting(){
moteif.deregisterListener(new ConnectionMsg(),this);
sf.listenServerStopped
sf.stopListenServer();
detecting=false;
}
I'm using the 1.1.15 CVS version.
The only thing I want is to have a variable called sf of the type
SerialForwarder in order to start and stop listening when the user wants but
without the SerialForwarder gui.
Thanks in advance.
More information about the Tinyos-help
mailing list