Wi-Fi Scanning AT Commands#

Commands#

wifi-scan-advconf#

Configures advanced scan parameters that are used when the scan type is set to advanced in the wifi-start-scan command.

Command Format#

at+wifi-scan-advconf=<trigger-rssi-level>,<trigger-rssi-change>,<active-channel-time>,<passive-channel-time>,<enable-instant-scan>,<enable-multi-probe>

Related SDK API#

sl_wifi_set_advanced_scan_configuration

Pre-conditions#

Parameters#

trigger-rssi-level#

The RSSI level that causes an advanced scan to be triggered.

trigger-rssi-change#

The change in RSSI level that causes an advanced scan to be triggered.

active-channel-time#

Time spent on each channel in milliseconds during an active scan.

passive-channel-time#

Time spent on each channel in milliseconds during a passive scan.

enable-instant-scan#

Set to 0 or 1 to indicate whether the advanced scan is started immediately.

enable-multi-probe#

Set to 0 or 1 to indicate whether a probe request is sent to all Access Points in addition to the connected SSID.

Response#

Examples#

at+wifi-scan-advconf=15,5,200,100,0,0

wifi-start-scan#

Begin a Wi-Fi scan.

Command Format#

at+wifi-start-scan=<interface>,<filter-ssid>,<scan-type>,<scan-flags>,<periodic-scan-interval>,<channel-bitmap-2g4>,<channel-bitmap-5g>,<enable-lp-mode>

Related SDK API#

sl_wifi_start_scan

Pre-conditions#

Parameters#

interface#

The type of Wi-Fi network interface over which Wi-Fi scanning is to be started. Contains a numeric value that corresponds to one of the values of the enum sl_wifi_interface_t. Note some values are not currently supported, as indicated in the linked documentation.

Note: The enum values of sl_net_interface_t are not in the default numerical order of an enum. See sl_net_constants.h for the actual numeric values in this enum.

filter-ssid#

Optional. An SSID string representing the specific SSID for which Wi-Fi scan results are to be returned. Enclose the string in double quotes (") to include restricted characters such as commas, spaces, or special symbols. This parameter is left empty in order to scan all networks. Must be passed as an empty value if the parameters after this are passed.

scan-type#

Optional. The type of Wi-Fi scan to be performed. Contains a numeric value that corresponds to one of the values of the enum sl_wifi_scan_type_t. Set to 0 (Active scan) if not passed. Must be passed as an empty value if the parameters after this are passed.

Note: The enum values of sl_wifi_scan_type_t are not in the default numerical order of an enum. See sl_wifi_constants.h for the actual numeric values in this enum.

scan-flags#

Optional, reserved parameter. Not currently used. Must be passed as an empty value if the parameters after this are passed.

periodic-scan-interval#

Optional. The interval in milliseconds between periodic scans. Must be passed as an empty value if the parameters after this are passed.

channel-bitmap-2g4#

Optional. A bitmap of the 2.4GHz channels to be scanned. Each channel number is selected by setting the (n - 1)th bit in the bitmap to 1 (channel 1 is selected by setting bit 0, 2 by setting 1, and so on). If this is left empty or passed as 0, all channels are scanned. Must be passed as an empty value if the parameters after this are passed.

channel_bitmap_5g#

Optional, reserved parameter. Not currently used (5GHz band not currently supported). Must be passed as an empty value if the parameters after this are passed.

enable-lp-mode#

Optional. Set to 1 or 0 to enable or disable low-power mode respectively. Low-power mode is disabled if this is not passed.

Response#

  • OK on success

  • ERROR <Error Code> in case of failure. Possible error codes are the same as those returned by sl_wifi_start_scan API.

Notes#

  • If the scan-type is SL_WIFI_SCAN_TYPE_ADV_SCAN (Advanced):

    • The wifi-stop-scan command must be issued after this command.

    • The SiWx91x device must be connected to an Access Point before issuing this command.

  • scan_type SL_WIFI_SCAN_TYPE_PROHIBITED_CHANNELS (Prohibited) is not supported. See the sl_wifi_scan_type_t documentation for information about these types.

Examples#

// Scan over the client interface with default configuration
at+wifi-start-scan=5
OK

// Scan over the client interface for the 'Silabs_SQA_Lab' network with a periodic scan interval of 200ms, and scan for channels 1 and 4 (bitmap set to 9 or binary 1001)
at+wifi-start-scan=5,Silabs_SQA_Lab,,,200,9
OK

wifi-stop-scan#

Stop an ongoing Wi-Fi scan.

Command Format#

at+wifi-stop-scan=<interface>

Related SDK API#

sl_wifi_stop_scan

Pre-conditions#

Parameters#

interface#

The type of Wi-Fi network interface for which the ongoing scan is to be stopped. Contains a numeric value that corresponds to one of the values of the enum sl_wifi_interface_t. Note some values are not currently supported, as indicated in the linked documentation.

Note: The enum values of sl_net_interface_t are not in the default numerical order of an enum. See sl_net_constants.h for the actual numeric values in this enum.

Response#

  • OK on success

  • ERROR <Error Code> in case of failure. Possible error codes are the same as those returned by sl_wifi_stop_scan API.

Examples#

// Stop the ongoing scan over the client interface
at+wifi-stop-scan=0 

wifi-scan-rslts#

Query the complete scan results of an extended scan, beyond the maximum results that are normally returned on scan completion.

Command Format#

at+wifi-scan-rslts=<max-results>,<channel-filter>,<security-mode-filter>,<rssi-filter>,<network-type-filter>

Related SDK API#

sl_wifi_get_stored_scan_results

Pre-conditions#

Parameters#

max-results#

The maximum number of results to be returned. The command will return only up to the number of results specified by this parameter, even if the total scan results exceed this parameter. This corresponds to the array_length member of the sl_wifi_extended_scan_result_parameters_t structure.

channel-filter#

Optional. Only returns scan results that match the channel number specified. Pass an empty value for this parameter to return APs across all channels.

security-mode-filter#

Optional. Only returns scan results that match the security mode specified here, sl_wifi_security_t. Pass an empty value for this parameter to return APs across all security modes.

rssi-filter#

Optional. Only returns scan results that exceed the RSSI value specified. Pass an empty value for this parameter to return APs across all RSSIs.

network-type-filter#

Optional. Only returns scan results that match the network type specified. Pass an empty value for this parameter to return APs across all network types.

Response#

  • In case of success - OK <result-count> <rf-channel> <security-mode> <rssi> <network-type> <ssid> <bssid> ...

    • where result-count is the number of scan results returned. The remaining output values below are repeated as many times as the value of this parameter.

    • rf-channel is the channel number of the Access Point returned in the scan result.

    • security-mode is the security mode of the AP.

    • rssi is the RSSI of the AP.

    • network-type is the network type of the AP.

    • ssid is the SSID string of the AP enclosed in double quotes.

    • bssid is the Basic Service Set Identifier (BSSID) of the AP.

  • ERROR <error code> in case of failure. The error codes returned are the same as those returned by the sl_wifi_get_stored_scan_results API.

Notes#

  • The command is only supported for extended scan types.

Examples#

// Return additional scan results for APs in channel 1 up to a maximum of 20 results
at+wifi-scan-rslts=20,1 
OK 2 1 0 14 1 "Silabs_AP_1" 00:23:A7:1F:15:11 1 1 15 1 "Silabs_AP_2_Test" 00:23:A7:1F:15:11

Events#

WIFI_SCAN_RESULTS#

Event message sent by the SiWx91x device with the results of a Wi-Fi scan after the scan is completed.

Event Message Format#

at+WIFI_SCAN_RESULTS=<scan-count>,<reserved-1>,<rf-channel>,<security-mode>,<rssi-val>,<network-type>,<ssid>,<bssid>,<reserved-2>,...

Related SDK API#

sl_wifi_scan_callback_t

Parameters#

scan-count#

The number of scan results returned. The results starting from the second parameter onwards are repeated for each scan result returned.

reserved-1#

Reserved parameter. Sent as an empty value.

rf-channel#

The channel number of the AP in the scan result.

security-mode#

The security mode of the AP in the scan result as specified here sl_wifi_security_t.

rssi-val#

The RSSI of the AP in the scan result.

network_type#

The type of network of the AP. Indicates whether the Access Point is operating as an infrastructure network, an ad-hoc (IBSS) network, or another type as specified.

ssid#

The SSID of the AP in the scan result, returned as a string enclosed in double quotes.

bssid#

The BSSID of the AP in the scan result, displayed as a 6-byte MAC address with a colon (:) separating every byte (see example below).

reserved-2#

Reserved parameter. Sent as an empty value.

Examples#

at+WIFI_SCAN_RESULTS=2,,10,0,14,1,"Silabs_AP_1",00:23:A7:1F:15:01,,,11,1,15,1,"Silabs_AP_2_Test",00:23:A7:1F:15:01