|
35 | 35 | #include <wifi_provisioning/manager.h>
|
36 | 36 | #undef IPADDR_NONE
|
37 | 37 | #include "WiFi.h"
|
| 38 | +#if CONFIG_IDF_TARGET_ESP32 |
| 39 | +#include "SimpleBLE.h" |
| 40 | +#endif |
38 | 41 |
|
39 | 42 | bool wifiLowLevelInit(bool persistent);
|
40 | 43 |
|
@@ -114,7 +117,8 @@ void WiFiProvClass :: beginProvision(prov_scheme_t prov_scheme, scheme_handler_t
|
114 | 117 | return;
|
115 | 118 | }
|
116 | 119 | #endif
|
117 |
| - |
| 120 | + config.app_event_handler.event_cb = NULL; |
| 121 | + config.app_event_handler.user_data = NULL; |
118 | 122 | wifiLowLevelInit(true);
|
119 | 123 | if(wifi_prov_mgr_init(config) != ESP_OK){
|
120 | 124 | log_e("wifi_prov_mgr_init failed!");
|
@@ -154,28 +158,19 @@ void WiFiProvClass :: beginProvision(prov_scheme_t prov_scheme, scheme_handler_t
|
154 | 158 | #if CONFIG_BLUEDROID_ENABLED
|
155 | 159 | }
|
156 | 160 | #endif
|
157 |
| - |
158 |
| - if(wifi_prov_mgr_endpoint_create("custom-data") != ESP_OK){ |
159 |
| - log_e("wifi_prov_mgr_endpoint_create failed!"); |
160 |
| - return; |
161 |
| - } |
162 | 161 | if(wifi_prov_mgr_start_provisioning(security, pop, service_name, service_key) != ESP_OK){
|
163 | 162 | log_e("wifi_prov_mgr_start_provisioning failed!");
|
164 | 163 | return;
|
165 | 164 | }
|
166 |
| - if(wifi_prov_mgr_endpoint_register("custom-data", custom_prov_data_handler, NULL) != ESP_OK){ |
167 |
| - log_e("wifi_prov_mgr_endpoint_register failed!"); |
168 |
| - return; |
169 |
| - } |
170 | 165 | } else {
|
171 |
| - wifi_prov_mgr_deinit(); |
172 |
| - log_i("Aleardy Provisioned"); |
| 166 | + log_i("Already Provisioned"); |
173 | 167 | #if ARDUHAL_LOG_LEVEL >= ARDUHAL_LOG_LEVEL_INFO
|
174 | 168 | static wifi_config_t conf;
|
175 | 169 | esp_wifi_get_config(WIFI_IF_STA,&conf);
|
176 | 170 | log_i("Attempting connect to AP: %s\n",conf.sta.ssid);
|
177 | 171 | #endif
|
178 |
| - esp_wifi_start(); |
| 172 | + esp_wifi_start(); |
| 173 | + wifi_prov_mgr_deinit(); |
179 | 174 | WiFi.begin();
|
180 | 175 | }
|
181 | 176 | }
|
|
0 commit comments