Wi-Fi management extension
The Wi-Fi management extension library adds an automatic connection feature to the Wi-Fi® stack.
Overview
The automatic connection feature is implemented by adding a NET_REQUEST_WIFI_CONNECT_STORED command to Zephyr’s Wi-Fi L2 Layer.
Credentials are pulled from the Wi-Fi credentials library.
Configuration
For development purposes, you can set static Wi-Fi credentials configuration using the following Kconfig options:
CONFIG_WIFI_CREDENTIALS_STATIC- This option enables static Wi-Fi configuration.CONFIG_WIFI_CREDENTIALS_STATIC_SSID- Wi-Fi SSID.CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD- Wi-Fi password.CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_OPEN- Wi-Fi network uses no password.CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_PSK- Wi-Fi network uses a password and WPA2-PSK security (default).CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_PSK_SHA256- Wi-Fi network uses a password and PSK-256 security.CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_SAE- Wi-Fi network uses a password and SAE security.CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_WPA_PSK- Wi-Fi network uses a password and WPA-PSK security.
Usage
The following code snippet shows how to use the Network Management command:
int ret;
struct net_if *iface = net_if_get_default();
int rc = net_mgmt(NET_REQUEST_WIFI_CONNECT_STORED, iface, NULL, 0);
if (rc) {
printk("an error occurred when trying to auto-connect to a network. err: %d", rc);
}
Limitations
The library has the following limitations:
The commands
NET_REQUEST_WIFI_CONNECTandNET_REQUEST_WIFI_CONNECT_STOREDclear the list of configured Wi-Fi networks in RAM. Automatic connection has to be requested again after directly requesting connection to a specific network.