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
parent 9ac5a464cd
commit 1831a375ec
2 changed files with 32 additions and 11 deletions

View File

@ -63,9 +63,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() */
@ -73,12 +73,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",

View 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