On Mon, Aug 6, 2012 at 5:50 AM, Felipe Cruz Martínez <
[email protected]> wrote:
> Hi,
>
> i have defined a structure with some fields as follows:
>
> *typedef struct message {*
> * uint8_t type;*
> * uint8_t length;
> addr_t destination;*
> * addr_t source;*
> *} msg_t;*
>
> If i want send that ‘message’ struct to other node, (i must get the
> PacketPayload of the MAC frame and fill it with the data), should i define
> the structure as:
>
> *typedef nx_struct message {*
> * nx_uint8_t type;*
> * nx_uint8_t length;
> nx_addr_t destination;*
> * nx_addr_t source;*
> *} msg_t;*
>
I would call this msg_nt (for network type).
You've got the gist of it.
>
> I don’t know when use nx_ types nor if i have to use nx_ (big endian) or
> nx_le (little endian). I’m very confused.
>
Just use the big endian form. (nx_). The reason is simply because that
is the byte order the internet uses and it keeps things simple.
As long as you use the same types on both sides of the connection it will
work fine.
hopefully that helps.
eric
> Thanks very much,
> Felipe.
>
>
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
--
Eric B. Decker
Senior (over 50 :-) Researcher
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help