Client#
Functions#
Connect to the given Wi-Fi AP.
Disconnect the Wi-Fi client interface.
Retrieve the RSSI value of the Access Point to which the Wi-Fi client is connected.
Get the station Timing Synchronization Function (TSF) time which is synchronised with connected AP beacon TSF.
Set the Wi-Fi roaming configuration.
Get the Wi-Fi roaming configuration.
Verify the Wi-Fi client configuration is valid and available.
Load the certificate into the device.
Load the certificate into the device.
Set the advanced configuration options of a client interface.
Send raw data frame.
Configure TWT parameters.
Configure TWT parameters.
Calculates and configures TWT parameters based on the given inputs.
Suspends the TWT agreement corresponding to given flow id and resumes it when suspend duration expires.
Send Filter Broadcast Request frame.
Generate PMK if PSK and SSID are provided.
Configure multicast filter parameters.
Function Documentation#
sl_wifi_connect#
sl_status_t sl_wifi_connect (sl_wifi_interface_t interface, const sl_wifi_client_configuration_t * access_point, uint32_t timeout_ms)
Connect to the given Wi-Fi AP.
[in] | interface | Wi-Fi client interface as identified by sl_wifi_interface_t |
[in] | access_point | sl_wifi_client_configuration_t object that contains the Access Point details. |
[in] | timeout_ms | Timeout value in milliseconds. The function will abort and return when the timeout timer expires. A value of 0 indicates an asynchronous action. TBD: asynchronous action page. |
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
If channel, band, and BSSID are provided, this API will attempt to connect without scanning. If security_type is SL_WIFI_WPA3 then SL_SI91X_JOIN_FEAT_MFP_CAPABLE_REQUIRED join feature is enabled internally by SDK. If security_type is SL_WIFI_WPA3_TRANSITION then SL_SI91X_JOIN_FEAT_MFP_CAPABLE_REQUIRED join feature is disabled and SL_SI91X_JOIN_FEAT_MFP_CAPABLE_ONLY join feature is enabled internally by SDK. Default Active Channel time is 100 milliseconds. If the user needs to modify the time, sl_wifi_set_advanced_scan_configuration can be called. Default Authentication timeout and Association timeout is 300 milliseconds. If the user needs to modify the time, sl_wifi_set_advanced_client_configuration can be called. Default Keep Alive timeout is 30 milliseconds. If the user needs to modify the time, sl_wifi_set_advanced_client_configuration can be called.
544
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_disconnect#
sl_status_t sl_wifi_disconnect (sl_wifi_interface_t interface)
Disconnect the Wi-Fi client interface.
[in] | interface | Wi-Fi client interface as identified by sl_wifi_interface_t |
Pre-conditions:
sl_wifi_connect should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
559
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_get_signal_strength#
sl_status_t sl_wifi_get_signal_strength (sl_wifi_interface_t interface, int32_t * rssi)
Retrieve the RSSI value of the Access Point to which the Wi-Fi client is connected.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[in] | rssi | signal strength (RSSI) in dBm. |
Pre-conditions:
sl_wifi_connect should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
574
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_get_sta_tsf#
sl_status_t sl_wifi_get_sta_tsf (sl_wifi_interface_t interface, sl_wifi_tsf64_t * tsf)
Get the station Timing Synchronization Function (TSF) time which is synchronised with connected AP beacon TSF.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[out] | tsf | 64-bit TSF time in microseconds stored in sl_wifi_tsf64_t structure. |
Pre-condition: sl_wifi_connect should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
This API returns an error if the station is not connected to an Access Point or at least one beacon is not received.
590
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_set_roam_configuration#
sl_status_t sl_wifi_set_roam_configuration (sl_wifi_interface_t interface, sl_wifi_roam_configuration_t * roam_configuration)
Set the Wi-Fi roaming configuration.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[in] | roam_configuration | sl_wifi_roam_configuration_t object to store Wi-Fi roaming configuration. |
Pre-conditions:
sl_wifi_set_advanced_scan_configuration should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
For si91x chips, following ranges are valid: trigger_level: [-10, -100] , trigger_level_change: [0, 90]
609
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_get_roam_configuration#
sl_status_t sl_wifi_get_roam_configuration (sl_wifi_interface_t interface, sl_wifi_roam_configuration_t * roam_configuration)
Get the Wi-Fi roaming configuration.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[out] | roam_configuration | sl_wifi_roam_configuration_t object that will contain the current roam configuration. |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
Note
This API is not yet implemented.
624
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_test_client_configuration#
sl_status_t sl_wifi_test_client_configuration (sl_wifi_interface_t interface, const sl_wifi_client_configuration_t * ap, uint32_t timeout_ms)
Verify the Wi-Fi client configuration is valid and available.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[in] | ap | sl_wifi_client_configuration_t object that contains the details of Access Point. |
[in] | timeout_ms | Timeout value in milliseconds. The function will abort and return when the timeout timer expires. A timeout value of 0 means the function will initiate the verification process and return immediately, without waiting for the process to complete. This indicates that the action will be handled asynchronously. |
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
643
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_set_certificate#
sl_status_t sl_wifi_set_certificate (uint8_t certificate_type, const uint8_t * buffer, uint32_t certificate_length)
Load the certificate into the device.
[in] | certificate_type | Certificate type being set |
[in] | buffer | Pointer to buffer containing the certificate. |
[in] | certificate_length | Length of certificate buffer data. |
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
662
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_set_certificate_with_index#
sl_status_t sl_wifi_set_certificate_with_index (uint8_t certificate_type, uint8_t certificate_index, uint8_t * buffer, uint32_t certificate_length)
Load the certificate into the device.
[in] | certificate_type | Certificate type being set. |
[in] | certificate_index | Certificate to be loaded in specified index. |
[in] | buffer | Pointer to buffer containing the certificate. |
[in] | certificate_length | Length of certificate buffer data. |
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
681
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_set_advanced_client_configuration#
sl_status_t sl_wifi_set_advanced_client_configuration (sl_wifi_interface_t interface, const sl_wifi_advanced_client_configuration_t * configuration)
Set the advanced configuration options of a client interface.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[in] | configuration | Wi-Fi client advanced configuration. See sl_wifi_advanced_client_configuration_t |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
695
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_send_raw_data_frame#
sl_status_t sl_wifi_send_raw_data_frame (sl_wifi_interface_t interface, const void * data, uint16_t data_length)
Send raw data frame.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[in] | data | Data buffer. |
[in] | data_length | length of the data. |
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
713
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_enable_target_wake_time#
sl_status_t sl_wifi_enable_target_wake_time (sl_wifi_twt_request_t * twt_req)
Configure TWT parameters.
[in] | twt_req | Configurable TWT parameters specified in sl_wifi_twt_request_t. |
Enables a TWT session. This is blocking API.
Pre-conditions:
sl_wifi_connect should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
726
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_disable_target_wake_time#
sl_status_t sl_wifi_disable_target_wake_time (sl_wifi_twt_request_t * twt_req)
Configure TWT parameters.
[in] | twt_req | Configurable TWT parameters specified in sl_wifi_twt_request_t. |
Disables a TWT session. This is blocking API.
Pre-conditions:
sl_wifi_enable_target_wake_time should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
739
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_target_wake_time_auto_selection#
sl_status_t sl_wifi_target_wake_time_auto_selection (sl_wifi_twt_selection_t * twt_selection_req)
Calculates and configures TWT parameters based on the given inputs.
[in] | twt_selection_req | sl_wifi_twt_selection_t object containing configurable TWT selection parameters. |
Enables or disables a TWT session. This is blocking API.
Pre-conditions:
sl_wifi_connect should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
752
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_reschedule_twt#
sl_status_t sl_wifi_reschedule_twt (uint8_t flow_id, sl_wifi_reschedule_twt_action_t twt_action, uint64_t suspend_duration)
Suspends the TWT agreement corresponding to given flow id and resumes it when suspend duration expires.
[in] | flow_id | Flow id of the twt agreement. |
[in] | twt_action | sl_wifi_reschedule_twt_action_t specifying different actions that can be taken in relation to rescheduling TWT. |
[in] | suspend_duration | Time interval until which twt agreement is suspended, value taken in milliseconds. |
This API performs the following actions on TWT agreement: SL_WIFI_SUSPEND_INDEFINITELY, SL_WIFI_RESUME_IMMEDIATELY, SL_WIFI_SUSPEND_FOR_DURATION. Note
The reschedule TWT actions are valid till the end of current TWT agreement. If the TWT agreement is terminated (TWT tear down or WLAN disconnection), these actions are not retained. To reapply these actions upon new TWT agreement, the user must re-issue the command.
Pre-conditions:
sl_wifi_connect should be called before this API.
The table below outlines the valid values for TWT actions and their corresponding suspend durations:#
twt_action | Valid values for suspend duration |
---|---|
SL_WIFI_SUSPEND_INDEFINITELY | 0 |
SL_WIFI_RESUME_IMMEDIATELY | 0 |
SL_WIFI_SUSPEND_FOR_DURATION | 1 to 86400000 |
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
780
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_filter_broadcast#
sl_status_t sl_wifi_filter_broadcast (uint16_t beacon_drop_threshold, uint8_t filter_bcast_in_tim, uint8_t filter_bcast_tim_till_next_cmd)
Send Filter Broadcast Request frame.
[in] | beacon_drop_threshold | The amount of time that FW waits to receive full beacon. Default value is 5000 ms. |
[in] | filter_bcast_in_tim | If this bit is set, then from the next dtim any broadcast data pending bit in TIM indicated will be ignored valid values: 0 - 1. |
[in] | filter_bcast_tim_till_next_cmd | 0 - filter_bcast_in_tim is valid till disconnect of the STA. 1 - filter_bcast_in_tim is valid till next update by giving the same command. |
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
800
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_get_pairwise_master_key#
sl_status_t sl_wifi_get_pairwise_master_key (sl_wifi_interface_t interface, const uint8_t type, const sl_wifi_ssid_t * ssid, const char * pre_shared_key, uint8_t * pairwise_master_key)
Generate PMK if PSK and SSID are provided.
[in] | interface | Wi-Fi interface as identified by sl_wifi_interface_t |
[in] | type | Possible values of this field are 1, 2, and 3, but we only pass 3 for generation of PMK. |
[in] | ssid | SSID of type sl_wifi_ssid_t has the SSID of the access point |
[in] | pre_shared_key | Expected parameters are pre-shared key(PSK) of the access point |
[in] | pairwise_master_key | PMK array |
This is a blocking API.
Pre-conditions:
This API should be called after sl_wifi_init and called before sl_wifi_connect.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
823
of file components/protocol/wifi/inc/sl_wifi.h
sl_wifi_configure_multicast_filter#
sl_status_t sl_wifi_configure_multicast_filter (sl_wifi_multicast_filter_info_t * multicast_filter_info)
Configure multicast filter parameters.
[in] | multicast_filter_info | Configurable multicast filter parameters specified in sl_wifi_multicast_filter_info_t. |
This is a blocking API.
Pre-conditions:
sl_wifi_init should be called before this API.
Returns
sl_status_t. See https://docs.silabs.com/gecko-platform/4.1/common/api/group-status for details.
840
of file components/protocol/wifi/inc/sl_wifi.h