2.4.1 WPAN_MLME_ScanReq Function
C
bool WPAN_MLME_ScanReq(uint8_t ScanType, uint32_t ScanChannels, uint8_t ScanDuration, uint8_t ChannelPage)
Summary
It initiates MLME-SCAN.request service and have it placed in the MLME-SAP queue.
Description
This function is used to initiate a channel scan over a given list of channels. A device can use a channel scan to measure the energy on the channel, search for the coordinator with which it associated, or search for all coordinators transmitting beacon frames within the POS of the scanning device. It initiates MLME-SCAN.request service and have it placed in the MLME-SAP queue. The MLME-SCAN.request primitive is used to initiate a channel scan over a given list of channels. A device can use a channel scan to measure the energy on the channel, search for the coordinator with which it associated, or search for all coordinators transmitting beacon frames within the POS of the scanning device.
Precondition
WPAN_Init() should have been called before calling this function.
Parameters
Param | Description |
---|---|
ScanType | Type of scan to perform. Valid values:- @ref MLME_SCAN_TYPE_ED, @ref MLME_SCAN_TYPE_ACTIVE, @ref MLME_SCAN_TYPE_PASSIVE, @ref MLME_SCAN_TYPE_ORPHAN |
ScanChannels | Channels to be scanned |
ScanDuration | Duration of each scan |
ChannelPage | The channel page on which to perform the scan |
Returns
true - success; false - buffer not available or queue full.
Example
bool retVal = false; uint8_t current_channel = 13; uint8_t current_channel_page = 0; uint8_t scan_duration = 5; retVal = WPAN_MLME_ScanReq(MLME_SCAN_TYPE_ACTIVE, SCAN_CHANNEL(current_channel), scan_duration, current_channel_page); if (true != retVal) { printf("buffer not available or queue full"); }
Remarks
On the receipt of WPAN_MLME_ScanReq, MAC layer will perform respective operation and asynchronously invokes USR_MLME_ScanConf with proper status.