I haven't use the interface in question, but it looks as if the
message routing (via handlerID) is left as an exercise for the
reader. I imagine that you need to build a messageListener factory
someplace that instantiates the right class for each reception.
There are some comments in MoteIF about using this i/f, and there
may be more examples if you search the tools/java tree.

hope someone else knows more than me...
MS

Jose L. Ponce wrote:
Hi all,


Once again, I have a quick question regarding Java and message
management.

When classes which require receiving messages from the motes are
programmed, usually all those classes are based on MessageListener. In
this way, we have the following method when we receive a message:

synchronized public void messageReceived( int to, Message m )

The problem comes when I have two classes, and each receives different
types of messages: both classes have a messageReceived method, but it
fires when a message is received, indepently from the message type, so
it could happen that one class gets the message which was sent for the
other class, and thus when I want to extract information from the
message it doesn't work... In the mote side this doesn't happen because
when send and receive are wired they are told which message type they
should expect...

How can I solve this problem on the Java side?

Thank you all,

- Jose.




_______________________________________________
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

Reply via email to