]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
automatically request acks for non-broadcast messages in LPL mode
authormmaroti <mmaroti>
Wed, 7 Oct 2009 01:51:58 +0000 (01:51 +0000)
committermmaroti <mmaroti>
Wed, 7 Oct 2009 01:51:58 +0000 (01:51 +0000)
tos/chips/rf2xx/layers/LowPowerListeningConfig.nc
tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc
tos/chips/rf2xx/rf212/RF212RadioP.nc
tos/chips/rf2xx/rf230/RF230RadioP.nc

index e8bf31f785526b0558d89738bd94f825257d3fc3..57c99d8202d9de6713ef12779c9eba1983da7bde 100644 (file)
 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);
 }
index 5266c356d16d672baf7d781b7a7b0b69c1fa8427..7efab6dc21311283ac63822f1cb1949b6f7cec5c 100644 (file)
@@ -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;
index 14f32949e41972f09e09a622f2ee093b2958412e..57823fe33fbae5ce939cd4eb0584426095b27dab 100644 (file)
@@ -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);
        }
index db37bee3d07df52a59684eeb5a7137bbe345b16b..f4b0eab716172d4bfd62c7768d5bf90b3eaec53d 100644 (file)
@@ -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);
        }