Chapter 2. API Reference
• ESP_OK : Successfully retrieved Wi-Fi disconnect reason
• ESP_FAIL : Provisioning app not running
Parameters
• [out] reason: Pointer to wifi_prov_sta_fail_reason_t variable to be filled
esp_err_t wifi_prov_mgr_configure_sta(wifi_config_t *wifi_cfg)
Runs Wi-Fi as Station with the supplied configuration.
Configures the Wi-Fi station mode to connect to the AP with SSID and password specified in config structure
and sets Wi-Fi to run as station.
This is automatically called by provisioning service upon receiving new credentials.
If credentials are to be supplied to the manager via a different mode other than through protocomm, then this
API needs to be called.
Event WIFI_PROV_CRED_RECV is emitted after credentials have been applied and Wi-Fi station started
Return
• ESP_OK : Wi-Fi configured and started successfully
• ESP_FAIL : Failed to set configuration
Parameters
• [in] wifi_cfg: Pointer to Wi-Fi configuration structure
esp_err_t wifi_prov_mgr_reset_provisioning(void)
Reset Wi-Fi provisioning config.
Calling this API will restore WiFi stack persistent settings to default values.
Return
• ESP_OK : Reset provisioning config successfully
• ESP_FAIL : Failed to reset provisioning config
esp_err_t wifi_prov_mgr_reset_sm_state_on_failure(void)
Reset internal state machine and clear provisioned credentials.
This API can be used to restart provisioning in case invalid credentials are entered.
Return
• ESP_OK : Reset provisioning state machine successfully
• ESP_FAIL : Failed to reset provisioning state machine
• ESP_ERR_INVALID_STATE : Manager not initialized
Structures
struct wifi_prov_event_handler_t
Event handler that is used by the manager while provisioning service is active.
Public Members
wifi_prov_cb_func_t event_cb
Callback function to be executed on provisioning events
void *user_data
User context data to pass as parameter to callback function
struct wifi_prov_scheme
Structure for specifying the provisioning scheme to be followed by the manager.
Note Ready to use schemes are available:
• wifi_prov_scheme_ble : for provisioning over BLE transport + GATT server
• wifi_prov_scheme_softap : for provisioning over SoftAP transport + HTTP server
• wifi_prov_scheme_console : for provisioning over Serial UART transport + Console (for debugging)
Espressif Systems 689
Submit Document Feedback
Release v4.4