Hi all,
I have 2 questions, would be nice if you can help me figure them out:
Following the tutorials, the 'receive' event of 'Receive' interface has 3 
arguments, and the last one is 'uint8_t len'. so the tutorials says to check if 
a packet is the packet we are interested in, we have to compare this 'len' 
argument with the 'sizeof' the packet we are interested in.
Ok now if I define 2 packets with same length, what will be the situation. For 
example the to packets:
//First Packet
typedef nx_struct LocalNodeMsg
{
 nx_uint16_t NodeId; // 2 bytes
 nx_uint8_t TimerValue; // 2 bytes

} LocalNodeMsg_t;
//Second Packet
typedef nx_struct RemoteNodeMsg
{
 nx_uint16_t NodeId; // 2 bytes
 nx_uint8_t RssiValue; // 2 bytes

} RemoteNodeMsg_t;
Now in the 'receive' event, how can I distinguish between these 2 packets?
I mean, does the 'sizeof()' function returns the same value for both of these 
packets?
 event message_t * RadioReceive.receive(message_t *msg, void *payload, uint8_t 
len)
 { 
 if(len == sizeof(LocalNodeMsg_t))
 {
 // handle the LocalNodeMsg_t packet
 return msg;
 }
 if(len == sizeof(RemoteNodeMSg_t))
 {
 // handle the RemoteNodeMSg_t packet
 return msg;
 }
return msg;
}
If I have like many packets that have same length, what is the correct way to 
filter them in the receive event?
Regards,
Sean.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to