Hello Julia,
Your output should be laid out as:
// SimpleCmd message structure
typedef struct SimpleCmdMsg {
int8_t seqno;.....0 (int8_t=1byte)
int8_t action;....1 (int8_t=1byte)
uint16_t source;...00 (uint16_t=2bytes)
uint8_t hop_count;...0 (int8_t=1byte)
union {
start_sense_args ss_args;...00 0000 (int=2bytes, uint32_t=4bytes)
OR
read_log_args rl_args;...00 (uint16_t=2bytes)
OR
uint8_t untyped_args[0];..0 (int8_t=1byte)
} args;
} SimpleCmdMsg;"
Notice that there is a union in the structure. What that means is that you
want to interpret the same portion of memory in different ways. So,
start_sense_args ss_args;
read_log_args rl_args;
uint8_t untyped_args[0];
refer to the same memory space that is accessible as either ss_args,
rl_args or untyped_args[0]. The size of the common memory space is the
size of the largest element of the union, which in this case, is ss_args
with 6 bytes. If you use rl_args or untyped_args[0], the rest of the
memory space beyond that defined by their size will be filled with 0s for
a total of 6 bytes.
In your example of LED_ON, the output should be:
0 1 0 0 0 0 0 0 0 0 0
with 9 zeros after the 1.
Adesola
----------------------------------------------------------------------
Message: 1
Date: Wed, 14 Jun 2006 23:07:14 -0600
From: Michael Schippling <[EMAIL PROTECTED]>
Subject: Re: [Tinyos-help] SimpleCmdMsg format
To: [EMAIL PROTECTED]
Cc: [email protected]
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
I'm not sure that I'm even capable of following your zero counting logic,
but it may be that what is being printed in your "It just shows:" line has
a single zero for each element, regardless of byte,int,long size, whereas
it seems that you are counting each byte in your structure analysis...
MS
[EMAIL PROTECTED] wrote:
> Hi,
>
> I have a question concerning the format of the SimpleCmdMsg found in
> C:\tinyos\cygwin\opt\tinyos-1.x\apps\simpleCmd...In SimpleCmdMsg.h,
> "typedef struct {
> int nsamples;
> uint32_t interval;
> } start_sense_args;
>
> typedef struct {
> uint16_t destaddr;
> } read_log_args;
>
> // SimpleCmd message structure
> typedef struct SimpleCmdMsg {
> int8_t seqno;.....0
> int8_t action;....1
> uint16_t source;...00
> uint8_t hop_count;...0
> union {
> start_sense_args ss_args;...0 0000
> read_log_args rl_args;...00
> uint8_t untyped_args[0];..0
> } args;
> } SimpleCmdMsg;"
>
> So if the command is LED_ON, We should have: 0 1 00 0 0 0000 00 0 but
> after running the BcastInject code found in
> tinyos\cygwin\opt\tinyos-1.x\tools\java\net\tinyos\tools...It just shows:
> sending payload: 0 1 0 0 0 0 0 0 0 0 0 (9 zeros after the one...and it
> should be 11 zeros)..
>
> Am I right in analyzing the payload for the LED_ON commad????
>
> Thanks in advance,
>
> Julia.
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help