Now that I'm looking at the code in v1.1.7, I don't see the
constructor that takes (IPaddr, port, groupID). Which I believe
is the one that you say does NOT work. In any case the other
constructor should use your MOTECOM env var to figure out
how to contact SerialForwarder, at least if the comments
at the top of MoteIF.java are still relevant.
Also it looks like the groupID argument is the one that is
deprecated, so it might work if you use ANY_GROUP_ID = -1...
Assuming that SF is running on the localhost which is indeed
registered at 127.0.0.1 (try "ping localhost" just to see),
and that you are supplying the correct port number for the SF,
then the first constructor should work OK.
Of course I haven't actually _done_ any of this so I could be
leading you down a twisty garden path.
MS
C. Javier Barbarán Sánchez wrote:
Yes, I know that, and you look down in this message my question was
about it, I was wondering whether I could use it or not. And Michael
Schippling, kindly, answered me that the constructor is deprecated
doesn't mean it can't be used.
I don't know, anyway, if it cannot be used, could you tell me another
way to connect to SerialForwarder over Internet?? It seems that
BuildPacketSource is a little bit complicated.
Thanks!!
Javier.
----- Original Message ----- From: "Andrea Pacini" <[EMAIL PROTECTED]>
To: ""C. Javier Barbarán Sánchez"" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; <[email protected]>
Sent: Thursday, February 09, 2006 6:45 PM
Subject: Re: [Tinyos-help] Connect a Java application to SerialForwarder
It seems to me that that use of MOteIF constructor is DEPRECATED.
C. Javier Barbarán Sánchez wrote:
Hi,
Sorry, I have been occupied in other issues.
Well, I'm using MoteIF constructor with IP address, port number and
gid number, and it connects to SerialForwarder fine, after that I
register the listener with the appropiate message and object, so far
so good... after doing this, it is supposed that my application would
receive messages from motes, but it doesn't happen :(
I changed the constructor
mote = new
MoteIF("127.0.0.1",configConn.getPuerto(),configConn.getGrupo());
for the following:
mote = new MoteIF(PrintStreamMessenger.err);
and the result was that my application received packets from motes.
But I don´t know why this is happening, so, I hope Michael o somebody
else could help me.
Thanks in advance.
* this is the code:
//Se le debe pasar el objeto que contiene la configuración del
usuario
public int Conectar(MmotesConfigConn configConn) {
if (mote != null) {
System.out.println("Registrando objeto para la recepcion
de mensajes...");
//Pasarle la referencia del objeto que se encargará de
procesar el mensaje
mote.registerListener(new SurgeMsg(), factoriaPaq);
return 0;
}
try {
System.out.println("Inicializando escucha de mensajes de
motas...");
try {
if (configConn.getEsLocal()) {
System.out.println("Conectando a localhost,
puerto: "+configConn.getPuerto()
+" Grupo:
"+configConn.getGrupo());
mote = new
MoteIF("127.0.0.1",configConn.getPuerto(),configConn.getGrupo());
//mote = new MoteIF(PrintStreamMessenger.err);
}
else {
System.out.println("Conectando a
"+configConn.getDirIP()+", puerto: "+
configConn.getPuerto()+"
Grupo: "+configConn.getGrupo());
mote = new
MoteIF(configConn.getDirIP(),configConn.getPuerto(),configConn.getGrupo());
}
}
catch (Exception e) {
//Lanzamos mensaje en pantalla avisando del error
JOptionPane.showMessageDialog(cliente,
"No se puede conectar con el servidor.\n"+e.toString(),
"Conexion con servidor",
JOptionPane.ERROR_MESSAGE);
}
System.out.println("Registrando objeto para la recepcion
de mensajes...");
//Pasarle la referencia del objeto que se encargará de
procesar el mensaje
mote.registerListener(new SurgeMsg(), factoriaPaq);
}
catch (SecurityException e) {
System.err.println("Error al crear la hebra de escucha de
mensajes");
return 1;
}
return 0;
}
----- Original Message ----- From: "Michael Schippling"
<[EMAIL PROTECTED]>
To: ""C. Javier Barbarán Sánchez"" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Monday, January 30, 2006 2:05 PM
Subject: Re: [Tinyos-help] Connect a Java application to
SerialForwarder overInternet
See, all you have to do is worry about it for a few days...
Do you remember what 'wasn't working'? The acutal exception?
Mayve you recycled SerialForwarder and it didn't have time
to close and reopen the port? Anyway, you should be able to
use netstat to see if the port is really open if it happens again.
Yeah deprecated means you shouldn't use it because some future
version of something might not support it, but I've never seen
anything just disappear. Too many things need to be backward
compatible...
glad it works
MS
C. Javier Barbarán Sánchez wrote:
Fist of all, thanks for your help Michael,
Yes, I know that I can use it but I thought that it could cause
future errors.
I have tried the following code:
try {
mote = new MoteIF("150.***.***.**",9001,125);
}
catch (Exception e) { e.printStackTrace(); }
System.out.println("Registrando objeto para la recepcion de
mensajes...");
mote.registerListener(new SurgeMsg(), this);
Last week I tried it, but I always found an exception telling me
that the SerialForwarder wasn't working at the port I had indicated
(9001), and I'm sure that SerialForwarder was running correctly,
but, anyway, today woks fine... ^_^
It seems to work properly, so probably I have done something wrong
last week.
Again, Thanks a lot.
Javier
----- Original Message ----- From: "Michael Schippling"
<[EMAIL PROTECTED]>
To: ""C. Javier Barbarán Sánchez"" <[EMAIL PROTECTED]>
Cc: <[email protected]>
Sent: Friday, January 27, 2006 2:32 AM
Subject: Re: [Tinyos-help] Connect a Java application to
SerialForwarder overInternet
Just because it's deprecated doesn't mean you can't use it,
it's just discouraged because someone thought they came up
with a better incompatible design...
What's your code and the error message when you run?
MS
C. Javier Barbarán Sánchez wrote:
Hi everybody!!
I'm developing a remote Java application, this application will
monitor the readings that are coming from network sensor over the
Internet. But I have tried to connect my application to
SerialForwarder using MoteIF and it is not possible because the
method that makes is deprecated, instead, it is suggested to use
BuildPacket.makeSF but I don´t understand completely, so, could
anybody suggest me any idea about this matter? I would appreciate
it much.
Thanks in advance!
Javier.
------------------------------------------------------------------------
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help