Asynchronous API Invocation#
WiSeConnectâ„¢ SDK v3.x has common API functions for both synchronous and asynchronous processing, while v2.x has different functions for synchronous and asynchronous processing.
As an example, the difference between access point connection APIs is illustrated below:
In v2.x, the
rsi_wlan_connect_async()
function is invoked to connect to a Wi-Fi AP asynchronously, andrsi_wlan_connect()
to connect synchronously.status = rsi_wlan_connect_async(ssid, sec_type, secret_key, callback_ptr); // Connect asynchronously status = rsi_wlan_connect((int8_t *)SSID, SECURITY_TYPE, PSK); // Connect synchronously
In v3.x, the sl_wifi_connect() function is invoked with a
timeout_ms
parameter value of 0 to connect to a Wi-Fi access point (AP) asynchronously, and a value other than 0 to connect synchronously.status = sl_wifi_connect(SL_WIFI_CLIENT_INTERFACE, &profile.config, 0); // Connect asynchronously status = sl_wifi_connect(SL_WIFI_CLIENT_INTERFACE, &profile.config, 15000); // Connect synchronously