Hi Imran,
What you could do is create a 16-bit variable that is used as a packet
counter and include that as part of the structure of the data. In other
words, in your header file, packet_counter would be a field of the struct.
On the transmitter side, you would initialize the variable in Boot.booted to
0. In Receive.receive, you could have the following (in pseudocode):
if (received_packet_counter == Current local counter)
if (current local counter == 2^16-1) % Just in case
{ Current local counter = 0; }
if (current local counter != 2^16-1)
{ Current local counter ++; }
AMSend.send (next packet)
end
On the receive side, you could send acknowledgments by updating the
packet_counter field of the struct based on the data received. So, in the
receivers Receive.receive, you could have:
Current local counter = Received packet counter;
AMSend.Send acknowldgement with packet counter = Current local counter
You could differentiate between transmissions and acknowledgements by having
another field in the structure called "packet_type" and set it to 1 if it's
a transmission or set it to 0 if an acknowledgment, and have appropriate if
statements in the Receive.receive of transmitter and receiver.
Hope that helps, feel free to contact me if you need any more help.
Cheers,
--
Mohammed Billoo
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help