I think the more important issue is how the union type works. A union
packs all its elements into one memory address. Writing to a union
will modify all of the elements because they are all pointing to the
same location. Reading from a union will change the meaning of the
bits for that memory address depending on which element you are trying
to read.

On 6/14/06, Michael Schippling <[EMAIL PROTECTED]> wrote:
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
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help



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

Reply via email to