When using SDK 2.6.x, I didn't know about Wi-Fi Credentials, so I connected to Wi-Fi as follows:
(Partially omitted)
struct net_if *iface; static struct wifi_connect_req_params cnx_params; // Parameter(s) iface = net_if_get_default(); cnx_params.timeout = 30; cnx_params.band = WIFI_FREQ_BAND_UNKNOWN; cnx_params.channel = WIFI_CHANNEL_ANY; cnx_params.security = m_system.security; cnx_params.mfp = WIFI_MFP_OPTIONAL; cnx_params.ssid = m_system.ssid; cnx_params.ssid_length = strlen(cnx_params.ssid); cnx_params.psk = m_system.password; cnx_params.psk_length = strlen(cnx_params.psk); // Connect err = net_mgmt(NET_REQUEST_WIFI_CONNECT, iface, &cnx_params, sizeof(struct wifi_connect_req_params));
With the release of SDK 3.1.1, I learned about Wi-Fi Credentials, so this time I'm connecting using Wi-Fi Credentials.
The code is very simple.
(I think this is the biggest reason to use Wi-Fi Credential)
// Connect
if (net_mgmt(NET_REQUEST_WIFI_CONNECT_STORED, iface, NULL, 0) == 0) {
LOG_INF("Connecting to Wi-Fi using stored credentials");
} else {
LOG_ERR("Connection request failed");
}
However, I feel like I can't set the timeout or the bandwidth to use like before.
How do I set them up?