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) {