Hi,

getPayload() will return (void *), which means that it will point to array of 
memories. 
By casting it into structure pointer, it'll be easier to access the field 
inside the structure.

Here's a little illustration :
(void *) AMSend.getPayload(&pkt) = 0x00 0x01 0x00 0x05
(BlinkToRadioMsg*) AMSend.getPayload(&pkt) = 0x0001 | 0x0005
(BlinkToRadioMsg*) AMSend.getPayload(&pkt) = nodeid | counter

It's the concept of how C arranging the structures into plain array of memories 
(thus it's the basic of how to structure the plain array of memories into 
fields).

I think K&R have explained it.

Regards,

-daniel

-------- Original Message --------
> From: John Griessen <[EMAIL PROTECTED]>
> What is the meaning of
> (BlinkToRadioMsg*)  (call AMSend.getPayload(&pkt));
>  in the top line?  Is this the syntax for coercing to type BlinkToRadioMsg*?
> Where in the docs is this syntax defined? 
> 
> It's not like K&R C...where
> you would declare *btrpkt to get a pointer you could use as btrpkt->nodeid
> 
> 
> John Griessen
> 
> Ecosensory




_______________________________________________
Tinyos-help mailing list
Tinyos-help@Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to