From 1e2ca78aacec93ca4da9e361e9ccfa8c882bed49 Mon Sep 17 00:00:00 2001 From: Prasad Alatkar Date: Wed, 11 Mar 2020 10:59:52 +0530 Subject: [PATCH 1/2] Wifi_provisioning_ble: Change service_uuid to non standard 128 bit UUID (v4.0) - Modifies UUIDs in scheme_ble, manager example and esp_prov tool to custom 128 bit UUID --- components/wifi_provisioning/src/scheme_ble.c | 4 ++-- examples/provisioning/manager/main/app_main.c | 4 ++-- tools/esp_prov/esp_prov.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components/wifi_provisioning/src/scheme_ble.c b/components/wifi_provisioning/src/scheme_ble.c index add908401..6faf49bd2 100644 --- a/components/wifi_provisioning/src/scheme_ble.c +++ b/components/wifi_provisioning/src/scheme_ble.c @@ -72,8 +72,8 @@ static void *new_config(void) const uint8_t service_uuid[16] = { /* LSB <--------------------------------------- * ---------------------------------------> MSB */ - 0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80, - 0x00, 0x10, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, + 0x07, 0xed, 0x9b, 0x2d, 0x0f, 0x06, 0x7c, 0x87, + 0x9b, 0x43, 0x43, 0x6b, 0x4d, 0x24, 0x75, 0x17, }; memcpy(ble_config->service_uuid, service_uuid, sizeof(ble_config->service_uuid)); diff --git a/examples/provisioning/manager/main/app_main.c b/examples/provisioning/manager/main/app_main.c index 96634fa71..4f3136e16 100644 --- a/examples/provisioning/manager/main/app_main.c +++ b/examples/provisioning/manager/main/app_main.c @@ -192,8 +192,8 @@ void app_main() uint8_t custom_service_uuid[] = { /* LSB <--------------------------------------- * ---------------------------------------> MSB */ - 0x21, 0x43, 0x65, 0x87, 0x09, 0xba, 0xdc, 0xfe, - 0xef, 0xcd, 0xab, 0x90, 0x78, 0x56, 0x34, 0x12 + 0xb4, 0xdf, 0x5a, 0x1c, 0x3f, 0x6b, 0xf4, 0xbf, + 0xea, 0x4a, 0x82, 0x03, 0x04, 0x90, 0x1a, 0x02, }; wifi_prov_scheme_ble_set_service_uuid(custom_service_uuid); diff --git a/tools/esp_prov/esp_prov.py b/tools/esp_prov/esp_prov.py index 52fb394f2..3ce67d700 100644 --- a/tools/esp_prov/esp_prov.py +++ b/tools/esp_prov/esp_prov.py @@ -77,7 +77,7 @@ def get_transport(sel_transport, service_name): # will fallback to using the provided UUIDs instead nu_lookup = {'prov-session': 'ff51', 'prov-config': 'ff52', 'proto-ver': 'ff53'} tp = transport.Transport_BLE(devname=service_name, - service_uuid='0000ffff-0000-1000-8000-00805f9b34fb', + service_uuid='021a9004-0382-4aea-bff4-6b3f1c5adfb4', nu_lookup=nu_lookup) elif (sel_transport == 'console'): tp = transport.Transport_Console() From dfd197b4c52e3f736ee2ef73e33fd8b32aff780e Mon Sep 17 00:00:00 2001 From: Prasad Alatkar Date: Thu, 12 Mar 2020 20:23:04 +0530 Subject: [PATCH 2/2] Wifi_provisioning_mgr_test: Allow three attempts to connect to AP before concluding provisioning failure (v4.0) --- examples/provisioning/manager/wifi_prov_mgr_test.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/provisioning/manager/wifi_prov_mgr_test.py b/examples/provisioning/manager/wifi_prov_mgr_test.py index 1a9e48080..c8727c8ad 100644 --- a/examples/provisioning/manager/wifi_prov_mgr_test.py +++ b/examples/provisioning/manager/wifi_prov_mgr_test.py @@ -87,6 +87,7 @@ def test_examples_wifi_prov_mgr(env, extra_data): raise RuntimeError("Failed to send apply config") success = False + retry = 0 while True: time.sleep(5) print("Wi-Fi connection state") @@ -96,6 +97,10 @@ def test_examples_wifi_prov_mgr(env, extra_data): elif (ret == 0): print("Provisioning was successful") success = True + elif (ret == 3 and retry < 3): + retry = retry + 1 + print("Connection failed.. retry again...: ", ret) + continue break if not success: