]> granicus.if.org Git - esp-idf/commitdiff
protocomm_ble : Example updated to use custom 128bit service UUID
authorAnurag Kar <anurag.kar@espressif.com>
Wed, 29 May 2019 08:12:40 +0000 (13:42 +0530)
committerbot <bot@espressif.com>
Mon, 3 Jun 2019 08:26:48 +0000 (08:26 +0000)
Also removed old hardcoded UUIDs from README of esp_prov

examples/provisioning/ble_prov/main/app_prov.c
tools/esp_prov/README.md

index 646a8de2be4f7e9a66ca46428e7b517650929b1d..cc991aa15c49cd785d8dec4d10e8416193d0c422 100644 (file)
@@ -59,9 +59,9 @@ static esp_err_t app_prov_start_service(void)
 
     /* Endpoint UUIDs */
     protocomm_ble_name_uuid_t nu_lookup_table[] = {
-        {"prov-session", 0xFF51},
-        {"prov-config",  0xFF52},
-        {"proto-ver",    0xFF53},
+        {"prov-session", 0x0001},
+        {"prov-config",  0x0002},
+        {"proto-ver",    0x0003},
     };
 
     /* Config for protocomm_ble_start() */
@@ -69,12 +69,33 @@ static esp_err_t app_prov_start_service(void)
         .service_uuid = {
             /* LSB <---------------------------------------
              * ---------------------------------------> MSB */
-            0xfb, 0x34, 0x9b, 0x5f, 0x80, 0x00, 0x00, 0x80,
-            0x00, 0x10, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00,
+            0xb4, 0xdf, 0x5a, 0x1c, 0x3f, 0x6b, 0xf4, 0xbf,
+            0xea, 0x4a, 0x82, 0x03, 0x04, 0x90, 0x1a, 0x02,
         },
         .nu_lookup_count = sizeof(nu_lookup_table)/sizeof(nu_lookup_table[0]),
         .nu_lookup = nu_lookup_table
     };
+
+    /* With the above selection of 128bit primary service UUID and
+     * 16bit endpoint UUIDs, the 128bit characteristic UUIDs will be
+     * formed by replacing the 12th and 13th bytes of the service UUID
+     * with the 16bit endpoint UUID, i.e. :
+     *    service UUID : 021a9004-0382-4aea-bff4-6b3f1c5adfb4
+     *     masked base : 021a____-0382-4aea-bff4-6b3f1c5adfb4
+     * ------------------------------------------------------
+     * resulting characteristic UUIDs :
+     * 1) prov-session : 021a0001-0382-4aea-bff4-6b3f1c5adfb4
+     * 2)  prov-config : 021a0002-0382-4aea-bff4-6b3f1c5adfb4
+     * 3)    proto-ver : 021a0003-0382-4aea-bff4-6b3f1c5adfb4
+     *
+     * Also, note that each endpoint (characteristic) will have
+     * an associated "Characteristic User Description" descriptor
+     * with 16bit UUID 0x2901, each containing the corresponding
+     * endpoint name. These descriptors can be used by a client
+     * side application to figure out which characteristic is
+     * mapped to which endpoint, without having to hardcode the
+     * UUIDs */
+
     uint8_t eth_mac[6];
     esp_wifi_get_mac(WIFI_IF_STA, eth_mac);
     snprintf(config.device_name, sizeof(config.device_name), "%s%02X%02X%02X",
index 9d7a0e919b53bc6db2f4609a65c915f3ec5a6489..8466e02ad69d73a5c87550e5813e085fa4bddfe5 100644 (file)
@@ -13,12 +13,12 @@ python esp_prov.py --transport < mode of provisioning : softap \ ble \ console >
 
 Usage of `esp-prov` assumes that the provisioning app has specific protocomm endpoints active. These endpoints are active in the provisioning examples and accept specific protobuf data structures:
 
-| Endpoint Name | URI (HTTP server on ip:port) | UUID (BLE)                           | Description                                               |
-|---------------|------------------------------|--------------------------------------|-----------------------------------------------------------|
-| prov-session  | http://ip:port/prov-session  | 0000ff51-0000-1000-8000-00805f9b34fb | Security endpoint used for session establishment          |
-| prov-config   | http://ip:port/prov-config   | 0000ff52-0000-1000-8000-00805f9b34fb | Endpoint used for configuring Wi-Fi credentials on device |
-| proto-ver     | http://ip:port/proto-ver     | 0000ff53-0000-1000-8000-00805f9b34fb | Version endpoint for checking protocol compatibility      |
-| custom-config | http://ip:port/custom-config | NA                                   | Optional endpoint for configuring custom credentials      |
+| Endpoint Name | URI (HTTP server on ip:port) | Description                                               |
+|---------------|------------------------------|-----------------------------------------------------------|
+| prov-session  | http://ip:port/prov-session  | Security endpoint used for session establishment          |
+| prov-config   | http://ip:port/prov-config   | Endpoint used for configuring Wi-Fi credentials on device |
+| proto-ver     | http://ip:port/proto-ver     | Version endpoint for checking protocol compatibility      |
+| custom-config | http://ip:port/custom-config | Optional endpoint for configuring custom credentials      |
 
 # PARAMETERS