]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/mac/tkn154/BeaconTransmitP.nc
- fixed an issue with the beacon sequence number being set incorrectly
[tinyos-2.x.git] / tos / lib / mac / tkn154 / BeaconTransmitP.nc
index 64611920237df53da51b1ac726489924ddbc7677..7ddc5a284746da7e24372e5a2d1378fa4d4e43f4 100644 (file)
@@ -347,7 +347,7 @@ implementation
     isShortAddr = (shortAddress != 0xFFFE);
     m_beaconFrame.header->mhr[MHR_INDEX_FC1] = FC1_FRAMETYPE_BEACON;
     m_beaconFrame.header->mhr[MHR_INDEX_FC2] = isShortAddr ? FC2_SRC_MODE_SHORT : FC2_SRC_MODE_EXTENDED;
-    m_beaconFrame.header->mhr[MHR_INDEX_SEQNO] = call MLME_GET.macBSN();
+    m_beaconFrame.header->mhr[MHR_INDEX_SEQNO] = call MLME_GET.macBSN() + 1;
     offset = MHR_INDEX_ADDRESS;
     *((nxle_uint16_t*) &m_beaconFrame.header->mhr[offset]) = m_updatePANId;
     offset += sizeof(ieee154_macPANId_t);
@@ -562,7 +562,7 @@ implementation
 
   task void txDoneTask()
   {
-    call MLME_SET.macBSN(m_beaconFrame.header->mhr[MHR_INDEX_SEQNO]+1);
+    call MLME_SET.macBSN(m_beaconFrame.header->mhr[MHR_INDEX_SEQNO]);
     m_beaconFrame.header->mhr[MHR_INDEX_SEQNO] += 1; // may be overwritten by the next higher layer
     call SetMacBeaconTxTime.set(m_lastBeaconTxTime); // start of slot0, ie. first preamble byte of beacon
     call BeaconPayloadUpdateTimer.startOneShotAt(m_lastBeaconTxTime, 
@@ -721,7 +721,7 @@ implementation
     } // end atomic (give BeaconSendAlarm.fired() the chance to execute)
 
     signal IEEE154TxBeaconPayload.aboutToTransmit();
-    m_beaconFrame.header->mhr[MHR_INDEX_SEQNO] = call MLME_GET.macBSN();
+    m_beaconFrame.header->mhr[MHR_INDEX_SEQNO] = call MLME_GET.macBSN() + 1;
 
     atomic {
       // (4) try to update beacon payload