Updated: October 28, 2024 |
Create a Wi-Fi network (Saved Network) profile
#include <qwf/qwf_wifi.h>
qwf_wifi_Results_e qwf_wifi_CreateSavedNetwork(qwf_Context_t *pCtx, const qwf_wifi_Ssid_t *const pSsid, qwf_wifi_SecurityProtocol_e protocol, qwf_wifi_FrequencyBand_e band, uint16_t priority, const char *const pBssid, uint16_t *const pCreatedNetworkId)
This function creates a Wi-Fi network profile. This Saved Network profile is used to store required authentication settings. The profile is persisted over power cycles.
If the client wants to use the optional background scanning feature when the profile is connected to an access point, they must also call qwf_wifi_SetBgScanMode() to set the background scan parameters before creating the profile.
The network ID provided by qwf_wifi_CreateSavedNetwork() must be used with the other functions that manage network profiles. The ID remains valid regardless of other profiles being added or deleted. However, after the device's power is cycled, the data for all profiles should be retrieved again (using qwf_wifi_GetSavedNetworks()) because the profile IDs will have changed based on these additions and deletions.
The new Saved Network is not enabled by default, so the Wi-Fi Manager service won't automatically connect to the access point when it's available. The auto-connect can be enabled using qwf_wifi_EnableSavedNetwork() with the value returned in pCreatedNetworkId.
WIFI_OK Successful result
WIFI_ERR_INACTIVE The QWF Wi-Fi Manager service is inactive or not ready
WIFI_ERR_INT The QWF Wi-Fi Manager service couldn't issue the request or read the response
WIFI_ERR_PARAM A pointer argument is NULL, or the QWF Wi-Fi Manager context can't be retrieved