]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/chips/cc2420/lpl/DefaultLplP.nc
The big interface switchover for Packet, Send, Receive, and AMSend.
[tinyos-2.x.git] / tos / chips / cc2420 / lpl / DefaultLplP.nc
index 689199528c025dde61f3c0e69a52519c0e943980..1a68ec15c03a5699739e79a64f2dbeb843622caf 100644 (file)
@@ -83,11 +83,13 @@ implementation {
   bool dutyCycling;
 
   /**
-   * Radio State
+   * Radio Power State
    */
   enum {
-    S_OFF,
+    S_OFF, // off by default
+    S_TURNING_ON,
     S_ON,
+    S_TURNING_OFF,
   };
   
   /**
@@ -300,8 +302,8 @@ implementation {
     return call SubSend.maxPayloadLength();
   }
 
-  command void *Send.getPayload(message_t* msg) {
-    return call SubSend.getPayload(msg);
+  command void *Send.getPayload(message_t* msg, uint8_t len) {
+    return call SubSend.getPayload(msg, len);
   }
   
   
@@ -325,15 +327,6 @@ implementation {
   async event void RadioBackoff.requestCca[am_id_t amId](message_t *msg) {
   }
   
-  /***************** Receive Commands ***************/
-  command void *Receive.getPayload(message_t* msg, uint8_t* len) {
-    return call SubReceive.getPayload(msg, len);
-  }
-
-  command uint8_t Receive.payloadLength(message_t* msg) {
-    return call SubReceive.payloadLength(msg);
-  }
-
 
   /***************** DutyCycle Events ***************/
   /**
@@ -347,9 +340,7 @@ implementation {
     // just a little longer in case there is more than one lpl transmitter on
     // the channel.
     
-    if(call SendState.isIdle()) {
-      startOffTimer();
-    }
+    startOffTimer();
   }
   
   
@@ -425,14 +416,14 @@ implementation {
   }
   
   /***************** Timer Events ****************/
-  event void OffTimer.fired() {
+  event void OffTimer.fired() {    
     /*
      * Only stop the radio if the radio is supposed to be off permanently
      * or if the duty cycle is on and our sleep interval is not 0
      */
     if(call SplitControlState.getState() == S_OFF
         || (call PowerCycle.getSleepInterval() > 0
-            && call SplitControlState.getState() == S_ON
+            && call SplitControlState.getState() != S_OFF
                 && call SendState.getState() == S_LPL_NOT_SENDING)) { 
       post stopRadio();
     }