Chapter 2. API Reference
}
case
case
default:
}
}
}
The manager can be de-initialized at any moment by making a call to wifi_prov_mgr_deinit().
Check Provisioning State
wifi_prov_mgr_is_provisioned(). This internally checks if the Wi-Fi credentials are stored in NVS.
Note that presently manager does not have its own NVS namespace for storage of Wi-Fi credentials, instead it relies
on the esp_wifi_ APIs to set and get the credentials stored in NVS from the default location.
If provisioning state needs to be reset, any of the following approaches may be taken :
• the associated part of NVS partition has to be erased manually
• main application must implement some logic to call esp_wifi_ APIs for erasing the credentials
at runtime
• main application must implement some logic to force start the provisioning irrespective of the
provisioning state
bool
provisioned
ESP_ERROR_CHECK( wifi_prov_mgr_is_provisioned(&provisioned) );
Start Provisioning Service
sponding key. These translate to :
• Wi-Fi SoftAP SSID and passphrase, respectively, when scheme is wifi_prov_scheme_softap
• BLE Device name (service key is ignored) when scheme is wifi_prov_scheme_ble
Also, since internally the manager uses protocomm, we have the option of choosing one of the security features
provided by it :
• Security 1 is secure communication which consists of a prior handshake involving X25519 key exchange along
with authentication using a proof of possession (pop), followed by AES-CTR for encryption/decryption of
subsequent messages
• Security 0 is simply plain text communication. In this case the pop is simply ignored
See
Provisioning
for details about the security features.
const
char
*service_name
const
char
*service_key
wifi_prov_security_t security
const
char
*pop
ESP_ERROR_CHECK( wifi_prov_mgr_start_provisioning(security, pop, service_
name, service_key) );
→
Espressif Systems
break;
WIFI_PROV_CRED_SUCCESS:
ESP_LOGI(TAG,
"Provisioning
break;
WIFI_PROV_END:
/* De-initialize manager once provisioning is finished */
wifi_prov_mgr_deinit();
break;
break;
Whether device is provisioned or not can be checked at runtime by calling
=
false;
At the time of starting provisioning we need to specify a service name and the corre-
=
"my_device";
=
"password";
=
WIFI_PROV_SECURITY_1;
=
"abcd1234";
Submit Document Feedback
successful");
681
(continued from previous page)
Release v4.4
Need help?
Do you have a question about the ESP32-S2 and is the answer not in the manual?