X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Flib%2Fmac%2Ftkn154%2FScanP.nc;h=37ac03b661bfd485c25c48ee5c125a90b3960de4;hb=35905c1cd223f9fbef7f5435b518dc34acfd3bef;hp=a92fc5ac9e42b99d9143b1bcfdbd84f939608508;hpb=079699a3ec5419479cc3bad49814ca06da91d196;p=tinyos-2.x.git diff --git a/tos/lib/mac/tkn154/ScanP.nc b/tos/lib/mac/tkn154/ScanP.nc index a92fc5ac..37ac03b6 100644 --- a/tos/lib/mac/tkn154/ScanP.nc +++ b/tos/lib/mac/tkn154/ScanP.nc @@ -272,21 +272,23 @@ implementation uint32_t unscannedChannels = 0; if (m_terminateScan){ - // scan operation terminated prematurely because the max. - // number of PAN descriptors/ED samples was reached - result = IEEE154_LIMIT_REACHED; - - // mark the channel on which we received the last beacon - // as unscanned, because it was not completely scanned + // Scan operation terminated because the max. + // number of PAN descriptors/ED samples was reached. + // Check if there are channels that were unscanned. + // In active/passive scan we consider a channel + // unscanned if it was not completely scanned. if (m_scanType == PASSIVE_SCAN || m_scanType == ACTIVE_SCAN) - currentChannelBit >>= 1; + currentChannelBit >>= 1; // last (partially) scanned channel while (!(currentChannelBit & INVALID_CHANNEL_BITMASK) && (m_scanChannels & currentChannelBit)){ unscannedChannels |= currentChannelBit; currentChannelBit <<= 1; } + if (unscannedChannels) // some channels were not (completely) scanned + result = IEEE154_LIMIT_REACHED; } else if (m_scanType != ENERGY_DETECTION_SCAN && !m_resultIndex) result = IEEE154_NO_BEACON; + if (m_scanType == PASSIVE_SCAN || m_scanType == ACTIVE_SCAN) call MLME_SET.macPANId(m_PANID); if (m_txFrame != NULL) {