9 years, 5 months ago.

How to add more than one 128 bit UUID to advertising data?

Hi,

normally this code is used to add 128 bit UUID to advertising data:

const uint16_t MyServiceShortUUID  = 0x0001;
const uint8_t MyServiceUUID[LENGTH_OF_LONG_UUID] = {
    0x6F, 0x40, (uint8_t)(MyServiceShortUUID >> 8), (uint8_t)(MyServiceShortUUID & 0xFF), 0xB5, 0xA3, 0xF3, 0x93,
    0xE0, 0xA9, 0xE5, 0x0E, 0x24, 0xDC, 0xCA, 0x9E,
};

ble.accumulateAdvertisingPayload(GapAdvertisingData::COMPLETE_LIST_128BIT_SERVICE_IDS,(const uint8_t *)MyServiceUUID, sizeof(MyServiceUUID));

But how can I add more than one 128 bit UUID to advertising data?

Thanks, railwaycoder

Question relating to:

High level Bluetooth Low Energy API and radio abstraction layer

1 Answer

9 years, 5 months ago.

Hi,

The advertising payload is limited to 31bytes. A single 128-bit UUID consumes 16 + 1 /* for type */ + 1 /* for len */ bytes. There isn't room for more than one 128-bit UUIDs. You could add additional 128-bit UUIDs to the scan response. There's an API to accumulate scan response as well.

Accepted Answer