Hi,
I am trying to include the 128 bit service UUID in the advertising payload. I have tried to include in the adv_data as I did for other advertising elements like local. Please find the code attached below. If I try to run this, I cannot detect the peripheral at all. Firstly, I wanted to know is this the correct way to include the 128 bit UUID in the advertising payload or do I need to make use of functions defined in the ble_UUID.h. If so, could you explain how to do this (with an example if possible).
code
static const uint8_t adv_data[] = {
0 x04 GAP_DATA_TYPE_SHORT_LOCAL_NAME
'P', 'A', 'C',
0x03, GAP_DATA_TYPE_MANUFACTURER_SPEC, 0, 210,
0x02, GAP_DATA_TYPE_TX_POWER_LEVEL, 3,
0x11, GAP_DATA_TYPE_UUID128_LIST, 38, 174, 43, 4, 28, 220, 124, 186, 74, 74, 2,
189, 7, 77, 231, 35
};
Thanks in advance.
Hi prasanna
Please read the comments above the ble_gap_adv_data_set() :
"...The maximum Advertising Data length for undirected connectable advertising is BLE_ADV_DATA_LEN_MAX bytes (31 minus 3 that are reserved to set the Advertising Data type flags - which shall not be set in Advertising Data using this function)...*
In your case, the advertising data exceed the max value, so you should use the scan response data as well.
You could use different UUID and manufacturer data according to your requirements.
Thanks, PM_Dialog
Dear PM_Dialog,
According to the maximum data you said (31 bytes -3), we are remained with 28 bytes. In my case I am using 4Bytes for local name, 3 for manufacturer data, 2 for tx power and 17 for UUID which results in 26 bytes lower than the allowed maximum bytes. I don't understand how am I exceeding the maximum payload.
注册ards,
Prasanna
Dear PM_Dialog,
I understood what was wrong. Some confusion in counting the number of bytes of payload. Now its clear. Thanks once again :)
注册ards, Prasanna
Hi prasanna,
Thanks for accepting my answer and glad that you make it working. If you have any other follow-up question, please raise a new forum thread.
Thanks, PM_Dialog