我想写一个mote-mote无线电通信程序,并希望接收方向发送方确认。我知道PacketAcknowledgements
是推荐的,但有一些问题我不确定这个界面。
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
答案 0 :(得分:1)
requestAck
或send
拨打AMSend
之前,您需要在即将发送的数据包上致电Send
。请务必检查requestAck
返回的错误代码,因为FAIL
表示通信层不支持同步确认(这取决于您使用的无线芯片和驱动程序)。一旦发送了数据包,即在事件sendDone
(或更高版本)内,请调用wasAcked
,如果接收方确认该数据包,则返回true。更多信息: https://github.com/tinyos/tinyos-main/blob/master/tos/interfaces/PacketAcknowledgements.nc