]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/rf2xx/layers/LowPowerListeningLayerP.nc
automatically request acks for non-broadcast messages in LPL mode
[tinyos-2.x.git] / tos / chips / rf2xx / layers / LowPowerListeningLayerP.nc
index 12fd1cfea7716554e63c109faa47f37c05ab7a90..7efab6dc21311283ac63822f1cb1949b6f7cec5c 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <RadioAssert.h>
 #include <LowPowerListeningLayer.h>
+#include <Lpl.h>
 
 module LowPowerListeningLayerP
 {
@@ -58,8 +59,6 @@ implementation
                LISTEN_WAKEUP = 6U,     // use xxxL if LISTEN_WAKEUP * 10000 > 65535
 
                MIN_SLEEP = 2,          // the minimum sleep interval in milliseconds
-               MAX_SLEEP = 30000,      // the maximum sleep interval in milliseconds
-               MIN_DUTY = 2,           // the minimum duty cycle
        };
 
        uint16_t sleepInterval = LPL_DEF_LOCAL_WAKEUP;
@@ -291,6 +290,9 @@ implementation
                else
                        return EBUSY;
 
+               if( call Config.needsAutoAckRequest(msg) )
+                       call PacketAcknowledgements.requestAck(msg);
+
                txMsg = msg;
                txError = FAIL;
 
@@ -330,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;
@@ -352,8 +354,6 @@ implementation
        {
                if( interval < MIN_SLEEP )
                        interval = 0;
-               else if( interval > MAX_SLEEP )
-                       interval = MAX_SLEEP;
 
                sleepInterval = interval;
 
@@ -374,8 +374,6 @@ implementation
        {
                if( interval < MIN_SLEEP )
                        interval = 0;
-               else if( interval > MAX_SLEEP )
-                       interval = MAX_SLEEP;
 
                getMeta(msg)->sleepint = interval;
        }