Unable to advertise 128 bit UUID

rf.akram.karimi
Posts: 4
Joined: Thu Sep 14, 2017 11:22 am

Unable to advertise 128 bit UUID

Postby rf.akram.karimi » Wed Sep 27, 2017 8:27 pm

Hi,
I am facing very basic problem which I think is because of very low experience with ESP32.
Actually, I wanna advertise complete list of 128bit service UUID in advertisement packet (which obviously is doable), but I am unable to do it with the following code:

Code: Select all

uint8_t adv_service_uuid128[16] = {
    /* LSB <--------------------------------------------------------------------------------> MSB */
    0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xAA, 0xBB, 0xCC, 0x00, 0xFC, 0xDD, 0xDD,
};

esp_ble_adv_data_t adv_data = {
    .set_scan_rsp = false,
    .include_name = true,
    .include_txpower = true,
    .min_interval = 0x20,
    .max_interval = 0x40,
    .appearance = 0x00,
    .manufacturer_len = 0, //TEST_MANUFACTURER_DATA_LEN,
    .p_manufacturer_data =  NULL, //&test_manufacturer[0],
    .service_data_len = 0,
    .p_service_data = NULL,
    .service_uuid_len = 128,		
    .p_service_uuid = adv_service_uuid128,
    .flag = (ESP_BLE_ADV_FLAG_GEN_DISC | ESP_BLE_ADV_FLAG_BREDR_NOT_SPT),   //ADV Data Type= 0x01
};

And then using

Code: Select all

esp_err_t ret = esp_ble_gap_config_adv_data(&adv_data);
As you can see that the I am not using Base UUID and also using .service_uuid_len=128 (tried 16 as well; I am not sure if this length is in bits or bytes) but of no use.

I don't get any service UUID in the advertisement packet and get the following error in the log:

Code: Select all

E (1862) BT: btc128_to_bta_uuid: Unknown UUID length 0!
E (1862) BT: btc128_to_bta_uuid: Unknown UUID length 0!
E (1868) BT: btc128_to_bta_uuid: Unknown UUID length 0!
E (1874) BT: btc128_to_bta_uuid: Unknown UUID length 0!
Can anyone help me in resolving this problem. Will be very grateful.
Thanks in advance.

halfro
Posts: 18
Joined: Sat Jul 15, 2017 11:13 am

Re: Unable to advertise 128 bit UUID

Postby halfro » Sun Oct 08, 2017 10:30 am

Quite simple: The advertisement length of BLE is 32 bytes. With a 128bit UUID you cant even fit 2 withing an advertisement let alone a complete list.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Unable to advertise 128 bit UUID

Postby kolban » Sun Oct 08, 2017 3:57 pm

Two random thoughts on this area ...

The first is that in BLE, when we perform an advertisement, there are **two** packets available to us. The BLE Server broadcasts one packet at a regular interval. When a BLE Client receives the packet, it can immediately turn around and request a second packet which the BLE Server will honor. This means that an advertisement can be of two packets in length, not just one. The second packet is governed by the set_scan_rsp flag.

The second is an issue Ive been thinking about as queried by a user of the BLE C++ classes ... this has been raised here as a Github issue:

https://github.com/espressif/esp-idf/issues/1090

It asks about the puzzle of advertising service uuids and how to advertise more than one.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

MarcoT1337
Posts: 1
Joined: Sun Jan 21, 2018 11:24 am

Re: Unable to advertise 128 bit UUID

Postby MarcoT1337 » Sun Jan 21, 2018 11:28 am

Hi,

I know, it's a quite old post, but your problem is in your initialized adv_data struct.

Code: Select all

.service_uuid_len = 128
It is supposed to be:

Code: Select all

.service_uuid_len = ESP_UUID_LEN_128
That's why you are getting theses errors:

Code: Select all

E (1862) BT: btc128_to_bta_uuid: Unknown UUID length 0!

Who is online

Users browsing this forum: No registered users and 192 guests