feat(provisioning): Addded api to set Authmode in provisioning

Added api to set threshold authmode for provisioning demo
This commit is contained in:
hrushikesh.bhosale
2024-09-17 14:09:39 +05:30
committed by Hrushikesh Bhosale
parent ffdf59a898
commit 95f5b29ffc
4 changed files with 52 additions and 4 deletions

View File

@@ -280,6 +280,34 @@ static void wifi_prov_print_qr(const char *name, const char *username, const cha
ESP_LOGI(TAG, "If QR code is not visible, copy paste the below URL in a browser.\n%s?data=%s", QRCODE_BASE_URL, payload);
}
#ifdef CONFIG_EXAMPLE_PROV_ENABLE_APP_CALLBACK
void wifi_prov_app_callback(void *user_data, wifi_prov_cb_event_t event, void *event_data)
{
/**
* This is blocking callback, any configurations that needs to be set when a particular
* provisioning event is triggered can be set here.
*/
switch (event) {
case WIFI_PROV_SET_STA_CONFIG: {
/**
* Wi-Fi configurations can be set here before the Wi-Fi is enabled in
* STA mode.
*/
wifi_config_t *wifi_config = (wifi_config_t*)event_data;
(void) wifi_config;
break;
}
default:
break;
}
}
const wifi_prov_event_handler_t wifi_prov_event_handler = {
.event_cb = wifi_prov_app_callback,
.user_data = NULL,
};
#endif /* EXAMPLE_PROV_ENABLE_APP_CALLBACK */
void app_main(void)
{
/* Initialize NVS partition */
@@ -327,6 +355,9 @@ void app_main(void)
#ifdef CONFIG_EXAMPLE_PROV_TRANSPORT_SOFTAP
.scheme = wifi_prov_scheme_softap,
#endif /* CONFIG_EXAMPLE_PROV_TRANSPORT_SOFTAP */
#ifdef CONFIG_EXAMPLE_PROV_ENABLE_APP_CALLBACK
.app_event_handler = wifi_prov_event_handler,
#endif /* EXAMPLE_PROV_ENABLE_APP_CALLBACK */
/* Any default scheme specific event handler that you would
* like to choose. Since our example application requires