[Tinyos-help] C mig generated files
David Gay
dgay42 at gmail.com
Fri Dec 1 13:33:01 PST 2006
On 12/1/06, Michael Schippling <schip at santafe.edu> wrote:
> From the description it sounds like your ReportMsg_field_get() function
> is expecting to get a pointer to the payload, not the full message.
>
> Unless things are very different in T2, the message payload should
> be at a fixed offset from the beginning of the packet and shouldn't
> vary with payload type (although the actual length might vary). The
> old standby technique is something like:
>
> TOS_Msg *msg = (TOS_Msg*) (packet + 1); // assume +1 skips sync byte?
> tmsg_t *tmsg = (tmsg_t *) msg->data;
>
> Which seems to be what the prettylisten.c example is doing.
Yes, this is correct. The +1 is to skip the first byte of serial
packets which indicates packet kind (0 for active-message packets).
David Gay
More information about the Tinyos-help
mailing list