From 65bc5668da702dead5424bc238bf548361a2ca1c Mon Sep 17 00:00:00 2001 From: monoliths Date: Mon, 13 Nov 2023 12:10:51 +0800 Subject: [PATCH] Add check prov mgr is stopped --- .../include/wifi_provisioning/manager.h | 11 +++++++++++ components/wifi_provisioning/src/manager.c | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/components/wifi_provisioning/include/wifi_provisioning/manager.h b/components/wifi_provisioning/include/wifi_provisioning/manager.h index 72c6d6d50b79..e6cfa5dbedfc 100644 --- a/components/wifi_provisioning/include/wifi_provisioning/manager.h +++ b/components/wifi_provisioning/include/wifi_provisioning/manager.h @@ -282,6 +282,17 @@ void wifi_prov_mgr_deinit(void); */ esp_err_t wifi_prov_mgr_is_provisioned(bool *provisioned); +/** + * @brief Checks if prov mgr is stopped + * + * This checks if prov_ctx->prov_state == WIFI_PROV_STATE_IDLE + * + * @return + * - ture : prov mgr state is idle + * - false : prov mgr is not idle + */ +bool wifi_prov_mgr_is_stopped(); + /** * @brief Start provisioning service * diff --git a/components/wifi_provisioning/src/manager.c b/components/wifi_provisioning/src/manager.c index 07022ecbfd3f..b39ba83a93a4 100644 --- a/components/wifi_provisioning/src/manager.c +++ b/components/wifi_provisioning/src/manager.c @@ -1214,6 +1214,11 @@ esp_err_t wifi_prov_mgr_is_provisioned(bool *provisioned) return ESP_OK; } +bool wifi_prov_mgr_is_stopped() +{ + return (prov_ctx->prov_state == WIFI_PROV_STATE_IDLE); +} + static void wifi_connect_timer_cb(void *arg) { if (esp_wifi_connect() != ESP_OK) {