0

I want to write a mote-mote radio communication program, and want the receiver acknowledges back to the sender. I know the PacketAcknowledgements is recommended, but there are some questions I'm not sure about this interface.

1. If I use it in the sender mote,should i also uses interface Receive in the module of the sender mote
2. Should I write extra code in the receiver mote? Should I use interface PacketAcknowledgements too?
3. command error_t requestAck(message_t *msg) and command bool wasAcked(message_t *msg) should be used when and where
Fan
  • 189
  • 1
  • 3
  • 11

1 Answers1

1
  1. No.
  2. No.
  3. You need to call requestAck on a packet you're about to send just before calling send from interface AMSend or Send. Be sure to check an error code returned by requestAck, because FAIL indicates that the communication layer doesn't support synchronous acknowledgements (it depends on the radio chip and driver you use). Once the packet is sent, i.e., inside event sendDone (or later), call wasAcked, which returns true if the packet was acknowledged by the receiver.

More info in: https://github.com/tinyos/tinyos-main/blob/master/tos/interfaces/PacketAcknowledgements.nc

maral
  • 1,431
  • 1
  • 10
  • 15
  • How long will the packet be considered timed out? If the packet is timed out, can I use the PacketLink interface to retry or just call AMSend again in AMSend.sendDone? – Fan Sep 06 '16 at 02:16
  • Well, `PacketLink` is an interface. The question _can I use interface A to do B?_ doesn't really make sense. Show me a particular implementation of this interface for your radio chip (if any) and I'll be able to tell you if it's suitable. – maral Sep 25 '16 at 18:07