mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-10-30 20:51:41 +00:00 
			
		
		
		
	wifi_prov_manager: Change the name of an internal timer handle to better reflect the purpose
Signed-off-by: Piyush Shah <piyush@espressif.com>
This commit is contained in:
		| @@ -7,4 +7,12 @@ menu "Wi-Fi Provisioning Manager" | |||||||
|         help |         help | ||||||
|             This sets the maximum number of entries of Wi-Fi scan results that will be kept by the provisioning manager |             This sets the maximum number of entries of Wi-Fi scan results that will be kept by the provisioning manager | ||||||
|  |  | ||||||
|  |     config WIFI_PROV_AUTOSTOP_TIMEOUT | ||||||
|  |         int "Provisioning auto-stop timeout" | ||||||
|  |         default 30 | ||||||
|  |         range 5 600 | ||||||
|  |         help | ||||||
|  |             Time (in seconds) after which the Wi-Fi provisioning manager will auto-stop after connecting to | ||||||
|  |             a Wi-Fi network successfully. | ||||||
|  |  | ||||||
| endmenu | endmenu | ||||||
|   | |||||||
| @@ -99,8 +99,8 @@ struct wifi_prov_mgr_ctx { | |||||||
|     /* Pointer to proof of possession */ |     /* Pointer to proof of possession */ | ||||||
|     protocomm_security_pop_t pop; |     protocomm_security_pop_t pop; | ||||||
|  |  | ||||||
|     /* Handle to timer */ |     /* Handle for Provisioning Auto Stop timer */ | ||||||
|     esp_timer_handle_t timer; |     esp_timer_handle_t autostop_timer; | ||||||
|  |  | ||||||
|     /* State of Wi-Fi Station */ |     /* State of Wi-Fi Station */ | ||||||
|     wifi_prov_sta_state_t wifi_state; |     wifi_prov_sta_state_t wifi_state; | ||||||
| @@ -567,10 +567,10 @@ static bool wifi_prov_mgr_stop_service(bool blocking) | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     /* Timer not needed anymore */ |     /* Timer not needed anymore */ | ||||||
|     if (prov_ctx->timer) { |     if (prov_ctx->autostop_timer) { | ||||||
|         esp_timer_stop(prov_ctx->timer); |         esp_timer_stop(prov_ctx->autostop_timer); | ||||||
|         esp_timer_delete(prov_ctx->timer); |         esp_timer_delete(prov_ctx->autostop_timer); | ||||||
|         prov_ctx->timer = NULL; |         prov_ctx->autostop_timer = NULL; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     ESP_LOGD(TAG, "Stopping provisioning"); |     ESP_LOGD(TAG, "Stopping provisioning"); | ||||||
| @@ -836,10 +836,11 @@ static void wifi_prov_mgr_event_handler_internal( | |||||||
|         prov_ctx->prov_state = WIFI_PROV_STATE_SUCCESS; |         prov_ctx->prov_state = WIFI_PROV_STATE_SUCCESS; | ||||||
|  |  | ||||||
|         /* If auto stop is enabled (default), schedule timer to |         /* If auto stop is enabled (default), schedule timer to | ||||||
|          * stop provisioning app after 30 seconds. */ |          * stop provisioning after configured timeout. */ | ||||||
|         if (!prov_ctx->mgr_info.capabilities.no_auto_stop) { |         if (!prov_ctx->mgr_info.capabilities.no_auto_stop) { | ||||||
|             ESP_LOGD(TAG, "Starting 30s timer for stop_prov_timer_cb()"); |             ESP_LOGD(TAG, "Starting %d sec timer for stop_prov_timer_cb()", | ||||||
|             esp_timer_start_once(prov_ctx->timer, 30000 * 1000U); |                         CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT); | ||||||
|  |             esp_timer_start_once(prov_ctx->autostop_timer, CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT * 1000000U); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         /* Execute user registered callback handler */ |         /* Execute user registered callback handler */ | ||||||
| @@ -1457,15 +1458,15 @@ esp_err_t wifi_prov_mgr_start_provisioning(wifi_prov_security_t security, const | |||||||
|     /* If auto stop on completion is enabled (default) create the stopping timer */ |     /* If auto stop on completion is enabled (default) create the stopping timer */ | ||||||
|     if (!prov_ctx->mgr_info.capabilities.no_auto_stop) { |     if (!prov_ctx->mgr_info.capabilities.no_auto_stop) { | ||||||
|         /* Create timer object as a member of app data */ |         /* Create timer object as a member of app data */ | ||||||
|         esp_timer_create_args_t timer_conf = { |         esp_timer_create_args_t autostop_timer_conf = { | ||||||
|             .callback = stop_prov_timer_cb, |             .callback = stop_prov_timer_cb, | ||||||
|             .arg = NULL, |             .arg = NULL, | ||||||
|             .dispatch_method = ESP_TIMER_TASK, |             .dispatch_method = ESP_TIMER_TASK, | ||||||
|             .name = "wifi_prov_mgr_tm" |             .name = "wifi_prov_autostop_tm" | ||||||
|         }; |         }; | ||||||
|         ret = esp_timer_create(&timer_conf, &prov_ctx->timer); |         ret = esp_timer_create(&autostop_timer_conf, &prov_ctx->autostop_timer); | ||||||
|         if (ret != ESP_OK) { |         if (ret != ESP_OK) { | ||||||
|             ESP_LOGE(TAG, "Failed to create timer"); |             ESP_LOGE(TAG, "Failed to create auto-stop timer"); | ||||||
|             free((void *)prov_ctx->pop.data); |             free((void *)prov_ctx->pop.data); | ||||||
|             goto err; |             goto err; | ||||||
|         } |         } | ||||||
| @@ -1480,7 +1481,7 @@ esp_err_t wifi_prov_mgr_start_provisioning(wifi_prov_security_t security, const | |||||||
|     /* Start provisioning service */ |     /* Start provisioning service */ | ||||||
|     ret = wifi_prov_mgr_start_service(service_name, service_key); |     ret = wifi_prov_mgr_start_service(service_name, service_key); | ||||||
|     if (ret != ESP_OK) { |     if (ret != ESP_OK) { | ||||||
|         esp_timer_delete(prov_ctx->timer); |         esp_timer_delete(prov_ctx->autostop_timer); | ||||||
|         free((void *)prov_ctx->pop.data); |         free((void *)prov_ctx->pop.data); | ||||||
|     } |     } | ||||||
|     ACQUIRE_LOCK(prov_ctx_lock); |     ACQUIRE_LOCK(prov_ctx_lock); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Piyush Shah
					Piyush Shah