qwf_wifi_CreateSavedNetwork()

Create a Wi-Fi network (Saved Network) profile

Synopsis:

#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);

Arguments:

pCtx
A pointer to the QWF service context created by qwf_Init()
pSsid
A pointer to an immutable qwf_wifi_Ssid_t structure for storing the SSID
protocol
A qwf_wifi_SecurityProtocol_e constant specifying the authentication protocol
band
A qwf_wifi_FrequencyBand_e constant specifying the frequency band used by the access point
priority
The network selection priority for the profile within an ESS with the same SSID. A lower value means a higher priority, with 1 being the highest. 0 means the network selection will be based only on the strongest signal of the available access points and not the priority.
pBssid
An immutable string containing the BSSID (MAC address) to connect to when an access point has multiple hardware addresses within an ESS with the same SSID. A NULL value means that the profile will connect to the access point that has the strongest signal.
pCreatedNetworkId
A pointer to memory for storing the ID for the new Wi-Fi network profile, as an unsigned 16-bit integer

Library:

qwf_interface

Description:

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.

Before calling this function, the client application must set all parameters needed for authentication, by calling the following functions as needed:

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 profile 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 created 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.

Returns:

WIFI_OK Successful result

WIFI_ERR_PARAM A pointer argument is NULL, an invalid frequency band is given, or the QWF Wi-Fi Manager context can't be retrieved

WIFI_ERR_INT The QWF Wi-Fi Manager service couldn't issue the request or read the response