You should define:
 
1) a pointer to info struct (struct info * mymessage;)
2) a TOSMsg variable (TOS_Msg tosmessage;)
 
and you should init (for example in StdControl.init() ) like:
 
mymessage = (info *) tosmessage.data;
 
then when you access you message field you can do like
 
mymessage->name
 
bests
andrea
----- Original Message -----
Sent: Friday, January 06, 2006 4:47 PM
Subject: [Tinyos-help] How to define a struct using the payload of the TOSMsg

Hi,
A TOSMsg has 29 bytes of payload...For some convenience, I want to convert these 29 in to a "struct", for examples
struct info {
char name[10];
uint8_t age ;
...
}
How do I go abt doing this so that in my program, I can just use things like  "John.name" or "John.age" (where "John" is variable of the type "info")
instead of using "msg.data[0]" or "msg.data[11]"....
 
Thanks for helping...


_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



----
Email.it, the professional e-mail, gratis per te:clicca qui

Sponsor:
Jamba: Personalizza il tuo cellulare con la Rana Pazza!
La prima suoneria è GRATIS! Scaricala ORA!
Clicca qui


_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to