Wi-Fi Scan and Connect API Reference#

This section provides an overview of the main APIs used for Wi-Fi scanning and connection. For full function signatures and parameters, see the WiSeConnect API reference documentation.

For detailed information on how scan and connection parameters impact Wi-Fi connection behavior and performance, see Scan and Connect Parameter Tuning.

For detailed API documentation, see the WiSeConnect API Reference – Wi-Fi.

Initialization APIs#

API

Description

sl_wifi_init

Initialize Wi-Fi subsystem.

sl_net_init

Initialize SiWx91x subsystem

Scan APIs#

API

Description

sl_wifi_start_scan

Start a scan. Parameters: interface, optional SSID, scan configuration. Returns SL_STATUS_IN_PROGRESS when scan started. Supports Active, Passive, Extended, and Advanced scan types.

sl_wifi_set_scan_callback_v2

Register callback for scan results and completion. Recommended; use instead of deprecated sl_wifi_set_scan_callback.

sl_wifi_get_stored_scan_results

Retrieve stored results after an Extended scan. Pass structure with array and optional filters.

sl_wifi_stop_scan

Stop an Advanced scan. Not applicable to Active, Passive, or Extended scans (they run to completion).

sl_wifi_set_advanced_scan_configuration

Set advanced scan configuration (channel times, trigger levels, enable_instant_scan, etc.).

sl_wifi_get_advanced_scan_configuration

Get current advanced scan configuration.

sl_si91x_set_timeout

Set global timeouts (including scan channel times). Must be called before sl_wifi_init.

sl_wifi_configure_timeout

Configure individual timeout (e.g., active/passive scan channel time). Can be called after init.

sl_wifi_get_timeout

Get the current value of a configured timeout.

sl_wifi_set_max_tx_power

Set scan and join transmit power (1–31 dBm).

Channel Bitmap#

  • 2.4 GHz: channel_bitmap_2g4 – bits 0–13 represent channels 1–14. Channel N = (1 << (N-1)).

  • All channels: Set channel_bitmap_2g4 = 0.

  • Example – channels 1, 6, 11: (1 << 0) | (1 << 5) | (1 << 10).

Connect APIs#

API

Description

sl_wifi_connect

Connect to an AP. Performs internal scan then join. Parameters: interface, client configuration, timeout_ms. Synchronous; returns when connection attempt completes or times out.

sl_wifi_set_join_callback_v2

Register callback for connection events (success, failure, disconnect). Required for asynchronous connect; recommended for synchronous.

sl_wifi_set_join_configuration

Set join feature bitmap (BSSID-based, quick join, listen interval, MFP, etc.).

sl_wifi_set_listen_interval_v2

Set listen interval when join feature bitmap has LISTEN_INTERVAL_VALID.

sl_wifi_set_advanced_client_configuration

Set retry, rejoin, and rejoin scan interval (max_retry_attempts, beacon_missed_count, scan_interval, first_time_retry_enable).

sl_net_set_credential

Set PSK credential (recommended for WPA/WPA2/WPA3).

sl_wifi_set_credential

Set EAP, PMK, WEP, or PSK credentials.

sl_wifi_set_interface_up

Bring interface up.

sl_wifi_is_interface_up

Check if interface is up.

sl_net_up / sl_net_up_async

Network-level connect using profile; internally use connection logic and internal scan.

Callback APIs#

API

Description

sl_wifi_set_scan_callback_v2

Invoked with scan results (up to 11 for non-Extended) and/or completion status. For Extended scan, use callback to know when scan is done, then call sl_wifi_get_stored_scan_results.

sl_wifi_set_join_callback_v2

Register callback for connection events (success, failure, disconnect). Required for asynchronous connect; recommended for synchronous. Use SL_WIFI_CHECK_IF_EVENT_FAILED(event) to detect failure. Check status_code and optional data for details.