From 025a8378ef304f8623afa1481153ae9fbfe10618 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Thu, 1 Sep 2022 15:24:19 +0530 Subject: [PATCH 1/2] wifi_provisioning: decouple `wifi_prov_mgr_is_provisioned` from manager state `wifi_prov_mgr_is_provisioned()` API uses the `esp_wifi_get_config()` API to check if Wi-Fi credentials are configured. It does not really require any other information from the wifi_prov component. Hence, this commit removed dependency of this API on provisioning manager initialization state. Closes IDF-5878 --- .../wifi_provisioning/include/wifi_provisioning/manager.h | 1 - components/wifi_provisioning/src/manager.c | 5 ----- 2 files changed, 6 deletions(-) diff --git a/components/wifi_provisioning/include/wifi_provisioning/manager.h b/components/wifi_provisioning/include/wifi_provisioning/manager.h index a1ead0d4dc53..417ff3af8e00 100644 --- a/components/wifi_provisioning/include/wifi_provisioning/manager.h +++ b/components/wifi_provisioning/include/wifi_provisioning/manager.h @@ -266,7 +266,6 @@ void wifi_prov_mgr_deinit(void); * - ESP_OK : Retrieved provision state successfully * - ESP_FAIL : Wi-Fi not initialized * - ESP_ERR_INVALID_ARG : Null argument supplied - * - ESP_ERR_INVALID_STATE : Manager not initialized */ esp_err_t wifi_prov_mgr_is_provisioned(bool *provisioned); diff --git a/components/wifi_provisioning/src/manager.c b/components/wifi_provisioning/src/manager.c index aa8caab0546b..1d36a38b0ab3 100644 --- a/components/wifi_provisioning/src/manager.c +++ b/components/wifi_provisioning/src/manager.c @@ -1112,11 +1112,6 @@ esp_err_t wifi_prov_mgr_is_provisioned(bool *provisioned) *provisioned = false; - if (!prov_ctx_lock) { - ESP_LOGE(TAG, "Provisioning manager not initialized"); - return ESP_ERR_INVALID_STATE; - } - /* Get Wi-Fi Station configuration */ wifi_config_t wifi_cfg; if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) { From 2137cf5e8ed1655aae67ef4cf8a1ac73599a6cd6 Mon Sep 17 00:00:00 2001 From: Mahavir Jain Date: Thu, 1 Sep 2022 15:43:12 +0530 Subject: [PATCH 2/2] docs: add migration guide entry about provisioning API change --- docs/en/migration-guides/release-5.x/provisioning.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/en/migration-guides/release-5.x/provisioning.rst b/docs/en/migration-guides/release-5.x/provisioning.rst index 96f2617fff7a..84f51af72d8e 100644 --- a/docs/en/migration-guides/release-5.x/provisioning.rst +++ b/docs/en/migration-guides/release-5.x/provisioning.rst @@ -13,9 +13,10 @@ For example, when using security version 2, the ``sec_params`` parameter should Wi-Fi Provisioning ------------------ -The ``pop`` field in the :cpp:func:`wifi_prov_mgr_start_provisioning` API is now deprecated. Please use the ``wifi_prov_sec_params`` field instead of ``pop``. This parameter should contain the structure (containing the security parameters) as required by the protocol version used. +.. list:: + * The ``pop`` field in the :cpp:func:`wifi_prov_mgr_start_provisioning` API is now deprecated. Please use the ``wifi_prov_sec_params`` field instead of ``pop``. This parameter should contain the structure (containing the security parameters) as required by the protocol version used. For example, when using security version 2, the ``wifi_prov_sec_params`` parameter should contain the pointer to the structure of type :cpp:type:`wifi_prov_security2_params_t`. -For example, when using security version 2, the ``wifi_prov_sec_params`` parameter should contain the pointer to the structure of type :cpp:type:`wifi_prov_security2_params_t`. + * The API :cpp:func:`wifi_prov_mgr_is_provisioned` does not return :c:macro:`ESP_ERR_INVALID_STATE` error any more. This API now works without any dependency on provisioning manager initialization state. ESP Local Control -----------------