[Tinyos Core WG] Serial source address in Java

David Moss dmm at rincon.com
Tue Feb 13 12:57:59 PST 2007


Hi David,

We need a way for Java to set the source address of a 
packet before it is transmitted to the serial port, and a 
way of accessing the source address from the message 
header when a message is received in Java.  Right now, the 
source address of serial packets received on the mote is 
left undefined.  Setting it on the way out in Java will 
prevent any serial stack from having to do it manually on 
the embedded end.  There should probably be some kind of 
address that represents the serial port, like 0xFFFE 
(didn't 1.x do this?).  This would allow application logic 
to evaluate that source address of any inbound packet and 
know whether it needs to reply to the serial or the radio.

We should also update the messageReceived(..) interface to 
allow the user in Java to access any field in the message 
header they need, instead of only the destination address. 
 To do this, we would need to give the user access to both 
the SerialPacket and the Message:

public interface MessageListener {
   public void messageReceived(SerialPacket 
originalPacket, Message m);
}

Then in the user's software it's still possible to access 
that destination address along with all the other header 
information available:
originalPacket.get_header_dest()
originalPacket.get_header_src()
originalPacket.get_header_group()
...

I think these changes are pretty minimal.  Users who 
already have applications that implement 
messageReceived(int to, Message m) will need to update 
their interface, but I was able to do that to my slew of 
Java applications in no time.

Thoughts?
-David Moss




More information about the Tinyos-2.0wg mailing list