protocomm_ble : Example updated to use custom 128bit service UUID

Also removed old hardcoded UUIDs from README of esp_prov
This commit is contained in:
Anurag Kar
2019-05-29 13:42:40 +05:30
committed by bot
parent 09cf34c9aa
commit e5fe1c0e68
2 changed files with 32 additions and 11 deletions
+26 -5
View 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",