SWRU455M February 2017 – October 2020 CC3120 , CC3120MOD , CC3130 , CC3135 , CC3135MOD , CC3220MOD , CC3220MODA , CC3220R , CC3220S , CC3220SF , CC3230S , CC3230SF , CC3235MODAS , CC3235MODASF , CC3235MODS , CC3235MODSF , CC3235S , CC3235SF
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 */
}
The SimpleLink device lets users set the scan parameters. Two parameters must be configured before activating the scan policy:
An example of setting the minimum RSSI to –70 dBm and scan channels 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 */
}
Scan results can be retrieved after setting the scan policy. Each scan cycle updates the results (added, updated, or removed in case of aging). Scan results can include up to 30 entries. Each entry includes the following parameters:
sl_WlanGetNetworkList triggers a one-shot scan if there are no scan results in the system, or if the scan results which exist are old (aging is defined as 20 seconds if the scan policy is disabled, or twice the scan interval if the policy is enabled).
An example of getting scan results from index 0 to 29:
SlWlanNetworkEntry_t netEntries[30];
_i16 resultsCount = sl_WlanGetNetworkList(0,30,&netEntries[0]);
In CC313x/CC323x, there is support also to get extended scan results: sl_WlanGetExtNetworkList. This command is similar to the legacy command (sl_WlanGetNetworkList) but the result includes more information if published by the AP. This information includes the country code of the AP and the supported channels of the AP (For both 2.4 GHz and 5 GHz).
Example of getting extended scan results from index 0 to 30:
SlWlanExtNetworkEntry_t netExtEntries[30];
_i16 resultsCount = sl_WlanGetExtNetworkList(0,30,&netExtEntries[0]);