[Tinyos-devel] Fwd: [Tinyos-help] About java toolchain for T2 andmessage source

David Moss dmm at rincon.com
Sun Apr 6 18:12:40 PDT 2008


This isn't the first time we have discussed this issue.  Although I think
the interface is not ideal as it exists right now, a patch has already been
implemented that allows a developer to access the source address without the
need to change the interface and break existing code.  

All packet information, including everything in the packet's header, is
available in the SerialPacket that the Message was created from.  The fix
that was implemented months ago allows you to access the original
SerialPacket from the Message you received. From the SerialPacket, you can
access that source address and any other header information you want. i.e...

public void messageReceived(int to, Message message) {
  int source = message.getSerialPacket().get_header_src();
  //...
}

If an interface change is in store, maybe the solution is to provide a
Message and its original SerialPacket so you can access whatever you want,
and not limit things to just the source or destination address.  A
completely and painful redesign might allow all the information to be
accessed directly through the Message.

public void messageReceived(Message message, SerialPacket packet) {
  int source = packet.get_header_src();
}

You can get at anything you want to as the code exists now, and that is
probably be a better solution than changing the interface and causing code
management problems throughout the community.  A new major revision of
TinyOS will be able to get away with safely fixing that interface, if
there's consensus to do so.

-moss




-----Original Message-----
From: tinyos-devel-bounces at millennium.berkeley.edu
[mailto:tinyos-devel-bounces at millennium.berkeley.edu] On Behalf Of Philip
Levis
Sent: Saturday, April 05, 2008 11:01 AM
To: Kevin Klues
Cc: TinyOS Development
Subject: Re: [Tinyos-devel] Fwd: [Tinyos-help] About java toolchain for T2
andmessage source

On Apr 5, 2008, at 10:41 AM, Kevin Klues wrote:
> I agree.  Does anyone want to make the cahnge?
>
> Kevin

Let's check it by David Gay, since he designed the original interface.  
I doubt he will have an objection, but let's make sure we're not  
missing some weird usage edge case which might make this problematic.

Phil
_______________________________________________
Tinyos-devel mailing list
Tinyos-devel at millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-devel




More information about the Tinyos-devel mailing list