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: <tinyos-help@Millennium.Berkeley.EDU>
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: <tinyos-help@Millennium.Berkeley.EDU>
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
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help





_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to