From a8214d93267fc47a4edb5417f91f152bc505ea67 Mon Sep 17 00:00:00 2001 From: mmaroti Date: Wed, 7 Oct 2009 01:51:58 +0000 Subject: [PATCH] automatically request acks for non-broadcast messages in LPL mode --- tos/chips/rf2xx/layers/LowPowerListeningConfig.nc | 12 ++++++++++-- tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc | 5 ++++- tos/chips/rf2xx/rf212/RF212RadioP.nc | 7 ++++++- tos/chips/rf2xx/rf230/RF230RadioP.nc | 7 ++++++- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/tos/chips/rf2xx/layers/LowPowerListeningConfig.nc b/tos/chips/rf2xx/layers/LowPowerListeningConfig.nc index e8bf31f7..57c99d82 100644 --- a/tos/chips/rf2xx/layers/LowPowerListeningConfig.nc +++ b/tos/chips/rf2xx/layers/LowPowerListeningConfig.nc @@ -24,7 +24,15 @@ interface LowPowerListeningConfig { /** - * Returns TRUE if an acknowledgement is requested for this message. + * Returns TRUE if an acknowledgement should be requested + * for the message automatically by the LPL code (this should + * normally happen for all non-broadcast messages). */ - async command bool getAckRequired(message_t* msg); + command bool needsAutoAckRequest(message_t* msg); + + /** + * Returns TRUE if an acknowledgement has been requested for + * this message via the PacketAcknowledgements interface. + */ + command bool ackRequested(message_t* msg); } diff --git a/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc b/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc index 5266c356..7efab6dc 100644 --- a/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc +++ b/tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc @@ -290,6 +290,9 @@ implementation else return EBUSY; + if( call Config.needsAutoAckRequest(msg) ) + call PacketAcknowledgements.requestAck(msg); + txMsg = msg; txError = FAIL; @@ -329,7 +332,7 @@ implementation if( error != SUCCESS || call LowPowerListening.getRemoteWakeupInterval(msg) == 0 || state == SEND_SUBSEND_DONE_LAST - || (call Config.getAckRequired(msg) && call PacketAcknowledgements.wasAcked(msg)) ) + || (call Config.ackRequested(msg) && call PacketAcknowledgements.wasAcked(msg)) ) { call Timer.stop(); state = SEND_DONE; diff --git a/tos/chips/rf2xx/rf212/RF212RadioP.nc b/tos/chips/rf2xx/rf212/RF212RadioP.nc index 14f32949..57823fe3 100644 --- a/tos/chips/rf2xx/rf212/RF212RadioP.nc +++ b/tos/chips/rf2xx/rf212/RF212RadioP.nc @@ -320,7 +320,12 @@ implementation #ifdef LOW_POWER_LISTENING - async command bool LowPowerListeningConfig.getAckRequired(message_t* msg) + command bool LowPowerListeningConfig.needsAutoAckRequest(message_t* msg) + { + return call Ieee154PacketLayer.getDestAddr(msg) != TOS_BCAST_ADDR; + } + + command bool LowPowerListeningConfig.ackRequested(message_t* msg) { return call Ieee154PacketLayer.getAckRequired(msg); } diff --git a/tos/chips/rf2xx/rf230/RF230RadioP.nc b/tos/chips/rf2xx/rf230/RF230RadioP.nc index db37bee3..f4b0eab7 100644 --- a/tos/chips/rf2xx/rf230/RF230RadioP.nc +++ b/tos/chips/rf2xx/rf230/RF230RadioP.nc @@ -320,7 +320,12 @@ implementation #ifdef LOW_POWER_LISTENING - async command bool LowPowerListeningConfig.getAckRequired(message_t* msg) + command bool LowPowerListeningConfig.needsAutoAckRequest(message_t* msg) + { + return call Ieee154PacketLayer.getDestAddr(msg) != TOS_BCAST_ADDR; + } + + command bool LowPowerListeningConfig.ackRequested(message_t* msg) { return call Ieee154PacketLayer.getAckRequired(msg); } -- 2.39.2