Scan
66
SWRU455A – February 2017 – Revised March 2017
Copyright © 2017, Texas Instruments Incorporated
WLAN
4.7
Scan
4.7.1 General Description
The SimpleLink device can be enabled to perform scans and discover remote devices. The device returns
up to 30 scan results. The device performs three types of scan:
•
Connection scan – This scan is performed when the device tries to connect to an AP by issuing a
manual connection command, or using stored profiles with the Auto connection policy enabled. The
scan is an active scan (sends broadcast probe requests).
•
Scan policy – Setting the scan policy triggers an immediate active scan (with no connection purpose),
and the scan is performed on the enabled channels with a desired interval between scan cycles.
•
One-shot scan – This single scan is performed on the enabled channels.
All of the previously mentioned scan types update the scan result and are supported in STA, AP, and P2P
modes. This section describes the scan policy and one-shot scan. The connection scan is not a user task,
it is activated internally when the connection attempt is performed.
4.7.2 Configuration (AP/STA)
•
Start Scan Policy
To enable or disable the scan policy, sl_WlanPolicySet should be called with enable or disable
parameter and a desired scan interval. The interval value is in seconds.
An example of setting a scan policy with a hidden SSID scan and an interval of 20 seconds:
_u32 intervalInSeconds = 20;
_i16 Status;
Status
= sl_WlanPolicySet(SL_WLAN_POLICY_SCAN, SL_WLAN_SCAN_POLICY(1,1),
(_u8*)&intervalInSeconds,
sizeof
(intervalInSeconds));
if
( Status )
{
/* error */
}
•
Setting Scan Parameters
The SimpleLink device lets users set the scan parameters. Two parameters must be configured before
activating the scan policy:
–
RSSI threshold – Set the minimum RSSI threshold. Results with RSSI below this value are not
presented. The default value is –95 dBm
–
Channel mask – Scan specific channels. Scans performed only on the desired channels and
networks that operate on this specific channel are presented. The default value is 0x1FFF (channel
1 to 13)
An example of setting the minimum RSSI to –70 dBm and scan channels to 1, 6, and 11:
_i16 Status;
SlWlanScanParamCommand_t ScanParamConfig;
ScanParamConfig.RssiThershold = -70;
ScanParamConfig.ChannelsMask = 0x421;
/* channels 1,6,11 */
Status
= sl_WlanSet(SL_WLAN_CFG_GENERAL_PARAM_ID, SL_WLAN_GENERAL_PARAM_OPT_SCAN_PARAMS,
sizeof
(ScanParamConfig), (_u8* )& ScanParamConfig);
if
( Status )
{
/* error */
}
•
Getting Scan Results
Scan results can be retrieved after setting the scan policy. Each scan cycle updates the results (added,