Hi again,

This is actually standard C. TOS_Msg is probably a data structure that
defines data
packets sent over the radio links (look for .h files that define it).
The data field in it
is probably defined as uint8_t array, so in effect points to the first
element in the array.
If you want to send/receive data, it is much easier for you to do this
with your own
data structure, hence the IntMsg. You just say that you have a pointer
to your data
structure and that it should point to the memory of the data portion of
the radio message.

Cheers,
Urs


Renee Azhen wrote:
> dear all:
>   In many examples exist this code:
>   IntMsg *message = (IntMsg *)data.data;
>    
>   I am so puzzled here: 
>   here is the definition of data and IntMsg:
>    TOS_Msg data;
>   typedef struct IntMsg {
>   uint16_t val;
>   uint16_t src;
> } IntMsg;
>    
>   It is so differnet from C code.
>   They are different kink data struct, how to convert a TOS_Msg to an IntMsg??
>   Could you help me to make it clear?
>   thanks and Best regards
>   Sam
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to