]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/mac/tkn154/CsmaP.nc
- moved promiscuous mode into separate component
[tinyos-2.x.git] / tos / lib / mac / tkn154 / CsmaP.nc
index b32714cb28c79799477c5eec7e37cd855fc52c05..18354816aa39060dbac0fd508b389d932bd16198 100644 (file)
@@ -173,7 +173,7 @@ implementation
     return SUCCESS;
   }
 
-  event void TokenTransferred.transferred()
+  async event void TokenTransferred.transferred()
   {
     // we got the token, i.e. CAP has just started    
     uint32_t actualCapLen = call CapLen.getNow();
@@ -182,10 +182,7 @@ implementation
       // and didn't find a beacon for aBaseSuperframeDuration*(2n+1) symbols
       // -> transmit current frame using unslotted CSMA-CA
       m_numCCA = 1;
-      signal Token.granted();
-      return;
-    }
-    else if (actualCapLen < IEEE154_RADIO_GUARD_TIME){
+    } else if (actualCapLen < IEEE154_RADIO_GUARD_TIME){
       call Debug.log(LEVEL_IMPORTANT, CapP_TOO_SHORT, superframeDirection, actualCapLen, IEEE154_RADIO_GUARD_TIME);
       call TokenToCfp.transfer();
       return;
@@ -211,7 +208,6 @@ implementation
           actualCapLen, call CapStart.getNow()+ actualCapLen);
     }
     updateState();
-    call Debug.flush();
   }
 
   command ieee154_status_t FrameTx.transmit(ieee154_txframe_t *frame)
@@ -707,8 +703,7 @@ implementation
 
   event void Token.granted()
   {
-    // the current frame should be transmitted using unslotted CSMA-CA
-    updateState();
+    // will not happen
   }
 
   task void tokenRequestedTask()
@@ -718,6 +713,9 @@ implementation
 
   async event void TokenRequested.requested() 
   {
+    // TODO: this event can be generated by the BeaconTransmitP or
+    // BeaconSynchronizeP component - in this case the Token should
+    // probably not be released!
     atomic {
       if (call Token.isOwner()){
         if (!m_lock && !(DEVICE_ROLE && m_indirectTxPending) && !(COORD_ROLE && m_bcastFrame))