[Tinyos-help] Accessing TOS_Msg fields from Java
Michael Schippling
schip at santafe.edu
Sun Jan 14 13:14:20 PST 2007
I just looked at the mica2 code and I think was wrong:
Only TOS_Msg.length bytes of payload are transmitted.
There's a bunch of swapping around of lengths but it looks
like the Msg.length is used to xmit only that number of bytes.
So, even if you have a large TOSH_DATA_LENGTH you don't
loose bandwidth when sending small payloads.
meaculpa...
MS
Heo Heo wrote:
> Mike,
>
> I followed your advice and run ListenRaw. With different payload
> sizes, the packet sizes in ListenRaw are also different. So, I guess
> TinyOS only transmit the actual payload, not the paddings.
>
> Thanks for your advice.
> Heo
>
>
> */Michael Schippling <schip at santafe.edu>/* wrote:
>
> I'd have to go read the radio code again because I wasn't looking
> for this when I did...but I think the transmitter tags the crc onto
> the end of the full packet. The length field would then just tell
> you how many bytes are significant.
>
> If you have a setup with a short message you can use ListenRaw to
> see what is actually coming over the serial. Whether that's the same
> as the radio is a code-review issue...
>
> MS
>
> Heo Heo wrote:
> > Mike,
> >
> > I think we may be wrong on this. There is a field named "length" in
> > the TOSMsg structure. This field indicates the actual length of the
> > payload. So I guess the radio layer only transmits the actual
> bytes used.
> >
> > This thought also came from the fact that when I run "listen" on the
> > PC side, it only shows the actual bytes used, not the paddings.
> >
> > Since I am a newbie, I may be wrong again.
> >
> > Best,
> > Heo
> >
> >
> >
> > */Michael Schippling /* wrote:
> >
> > I believe that is correct. The payload size is always
> TOS_DATA_LENGTH,
> > no matter how many bytes are actually used...
> > MS
> >
> >
> > Heo Heo wrote:
> > > 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 /* 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
> > > > Tinyos-help at Millennium.Berkeley.EDU
> > > >
> > >
> >
> 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. <
> > >
> >
> http://us.rd.yahoo.com/evt=49937/*http://tools.search.yahoo.com/toolbar/features/mail/>
> >
> > >
> >
> >
> >
> ------------------------------------------------------------------------
> > Don't get soaked. Take a quick peak at the forecast <
> > http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news>
> > with theYahoo! Search weather shortcut. <
> > http://tools.search.yahoo.com/shortcuts/?fr=oni_on_mail&#news>
>
>
> ------------------------------------------------------------------------
> Finding fabulous fares is fun.
> Let Yahoo! FareChase search your favorite travel sites
> <http://farechase.yahoo.com/promo-generic-14795097;_ylc=X3oDMTFtNW45amVpBF9TAzk3NDA3NTg5BF9zAzI3MTk0ODEEcG9zAzEEc2VjA21haWx0YWdsaW5lBHNsawNxMS0wNw--
> > to find flight and hotel bargains.
More information about the Tinyos-help
mailing list