Hi Eric,

first of all, thanks for your helpful. 

I have just read in the 
http://csl.stanford.edu/~pal/pubs/tinyos-programming-1-0.pdf  document the 
following:

“... the CC2420 expects all of these fields to be little endian.” (Page 138)

For me it is much easier to use the big endian form. I will try to send that 
struct with the nx_ form (big endian).

Thanks very much,
Felipe.

From: Eric Decker 
Sent: Monday, August 06, 2012 6:10 PM
To: Felipe Cruz Martínez 
Cc: TinyOS HELP 
Subject: Re: [Tinyos-help] Information about nx_ types




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

Reply via email to