EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #691 background imageLoading...
Page #691 background image
Chapter 2. API Reference
scheme : This is used to specify the provisioning scheme. Each scheme corresponds to one of the
modes of transport supported by protocomm. Hence, we have three options :
wifi_prov_scheme_ble : BLE transport and GATT Server for handling provisioning
commands
wifi_prov_scheme_softap : Wi-Fi SoftAP transport and HTTP Server for handling
provisioning commands
wifi_prov_scheme_console : Serial transport and console for handling provisioning
commands
scheme_event_handler : An event handler defined along with scheme. Choosing appropriate
scheme specific event handler allows the manager to take care of certain matters automatically.
Presently this is not used for either SoftAP or Console based provisioning, but is very convenient
for BLE. To understand how, we must recall that Bluetooth requires quite some amount of memory
to function and once provisioning is finished, the main application may want to reclaim back this
memory (or part of it, if it needs to use either BLE or classic BT). Also, upon every future re-
boot of a provisioned device, this reclamation of memory needs to be performed again. To reduce
this complication in using wifi_prov_scheme_ble, the scheme specific handlers have been
defined, and depending upon the chosen handler, the BLE / classic BT / BTDM memory will be
freed automatically when the provisioning manager is de-initialized. The available options are:
WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BTDM - Free both classic BT
and BLE (BTDM) memory. Used when main application doesnt require Bluetooth at all.
WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BLE - Free only BLE memory.
Used when main application requires classic BT.
WIFI_PROV_SCHEME_BLE_EVENT_HANDLER_FREE_BT - Free only classic BT. Used
when main application requires BLE. In this case freeing happens right when the manager is
initialized.
WIFI_PROV_EVENT_HANDLER_NONE - Dont use any scheme specific handler. Used
when provisioning scheme is not BLE (i.e. SoftAP or Console), or when main application
wants to handle the memory reclaiming on its own, or needs both BLE and classic BT to
function.
app_event_handler (Deprecated) : It is now recommended to catch WIFI_PROV_EVENT``s
that are emitted to the default event loop handler. See definition
of ``wifi_prov_cb_event_t for the list of events that are generated by the provisioning
service. Here is an excerpt showing some of the provisioning events:
static void event_handler(void* arg, esp_event_base_t event_base,
int event_id, void* event_data)
{
if (event_base == WIFI_PROV_EVENT) {
switch (event_id) {
case WIFI_PROV_START:
ESP_LOGI(TAG, "Provisioning started");
break;
case WIFI_PROV_CRED_RECV: {
wifi_sta_config_t *wifi_sta_cfg = (wifi_sta_config_t
,*)event_data;
ESP_LOGI(TAG, "Received Wi-Fi credentials"
"\n\tSSID : %s\n\tPassword : %s",
(const char *) wifi_sta_cfg->ssid,
(const char *) wifi_sta_cfg->password);
break;
}
case WIFI_PROV_CRED_FAIL: {
wifi_prov_sta_fail_reason_t *reason = (wifi_prov_sta_fail_
,reason_t *)event_data;
ESP_LOGE(TAG, "Provisioning failed!\n\tReason : %s"
"\n\tPlease reset to factory and retry
,provisioning",
(*reason == WIFI_PROV_STA_AUTH_ERROR) ?
"Wi-Fi station authentication failed" : "Wi-Fi
,access-point not found");
(continues on next page)
Espressif Systems 680
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish