Mike,
   
    I was thinking of a different approach. In the OscopeMsg structure, I put 
some extra fields for the TOS_Msg header fields. On the mote running TOSBase, I 
copied the TOS_Msg header fields to these Java-based structures. That should 
work.
   
    The downside of this approach is there are soem unnecessary fields in the 
original OscopeMsg structure. Besides, the TOSBase code is not "transparent" 
anymore.
   
    I have a question: since TOS_DATA_LENGTH is a constant which defines the 
size of the payload of the TOS message. Does it mean that the size of the 
packet transmitted over the air is always fixed (i.e. equal TOS_DATA_LENGTH + 
size of some header fields), regardless of how little the real payload is.
   
    Thanks a lot
    Heo


Michael Schippling <[EMAIL PROTECTED]> wrote:  Warning: answer only relevant to 
TOS1.x...

I was going to say just look at the Message classes:
net/tinyos/message/Message.java
net/tinyos/oscope/OscopeMsg.java
and the doc for MIG (which generates OscopeMsg.java).

But when I did (because I just refused to use them from
the outset so I never did before) I found that there are
no builtin accessors for the message header. And what's
more the way to get to arbitrary fields is:

protected long getUIntElement(int offset, int length)

So you can't use it from outside OscopeMsg. Somehow I have
come to expect this sort of thing but it still annoys me...


So your two options are A) extend OscopeMsg and add accessors
that call getUIntElement() using your own special knowledge of
the header structure gleaned from tos/types/AM.h; or, B) write
the whole thing yourself (assuming you are not just modifying
the oscope app...). For an example of the DIY option see my code:
http://www.etantdonnes.com/Motes/robocode.tar.gz

MS

Heo Heo wrote:
> I was wondering if there is a way to access the TOS_Msg fields (like 
> addr, type, group, strength, etc.) from Java.
> 
> The context is that there is a mote running OscilloscopeRF. This mote 
> sends messages (class OscopeMsg) to the base station (connected to PC 
> with Serial forwarder). For each message received at the PC, our Java 
> program (running on the PC) needs to access some fields of the TOS_Msg 
> header.
> 
> Thanks a lot for any help.
> 
> 
> 
> 
> Everyone is raving about the all-new Yahoo! Mail beta. 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help


 
---------------------------------
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives. Check it out.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to