[Info]: BLE: service_uuid_len must be multiple of 16
Posted: Sun Jun 25, 2017 7:00 pm
Ive been working on BLE recently and trying to set up a BLE peripheral that advertises itself. I was trying to advertise a service with 16bit UUID of "180d". To that end, I was calling:
esp_ble_gap_config_adv_data(&m_advData)
where in the m_advData structure I was setting:
m_advData.service_uuid_len = 2
m_advData.p_service_uuid = &(myUint16t)
When I called esp_ble_gap_config_adv_data() I failed and got the return code indicating an invalid argument. I hunted the docs high and low and eventually resorted to looking at the ESP-IDF source code. It was there that I found an explicit check that tested to see if service_uuid_len was a multiple of 16. So 0, 16, 32 ... etc would have passed but 2 would not.
I wanted to call this out in case someone else trips over this in future. If I were to make a guess, I'd say that ESP-IDF is explicitly ONLY allowing 16 byte UUIDs in advertising packets which seems odd given the apparent desire to minimize the byte size of adverts.
As is always the case, I may be missing something so would welcome any discussions on this topic.
esp_ble_gap_config_adv_data(&m_advData)
where in the m_advData structure I was setting:
m_advData.service_uuid_len = 2
m_advData.p_service_uuid = &(myUint16t)
When I called esp_ble_gap_config_adv_data() I failed and got the return code indicating an invalid argument. I hunted the docs high and low and eventually resorted to looking at the ESP-IDF source code. It was there that I found an explicit check that tested to see if service_uuid_len was a multiple of 16. So 0, 16, 32 ... etc would have passed but 2 would not.
I wanted to call this out in case someone else trips over this in future. If I were to make a guess, I'd say that ESP-IDF is explicitly ONLY allowing 16 byte UUIDs in advertising packets which seems odd given the apparent desire to minimize the byte size of adverts.
As is always the case, I may be missing something so would welcome any discussions on this topic.