I'm developing a BLE project using Zephyr NCS and I am having trouble advertising multiple custom services. The sample applications are configuring advertising data using the following arrays:
static const struct bt_data ad[] = {}
and
static const struct bt_data sd[] = {}
There's a number of different elements in the array depending on the example application. I can't seem to find any clear documentation on how to properly define these arrays for my advertising information. I have a mix of 16bit and 128bit UUIDs that I would like to advertise. The HID keyboard example has the following code in the bt_data ad[] array:
BT_DATA_BYTES(BT_DATA_UUID16_ALL, 0x12, 0x18, /* HID Service */ 0x0f, 0x18),
But, when I replicate this structure like so:
#define MY_SERVICE_UUID 0xd4, 0x86, 0x48, 0x24, 0x54, 0xB3, 0x43, 0xA1, \ 0xBC, 0x20, 0x97, 0x8F, 0xC3, 0x76, 0xC2, 0x75 #define MY_OTHER_SERVICE_UUID 0xd4, 0x86, 0x48, 0x24, 0x54, 0xB3, 0x43, 0xA1, \ 0xBC, 0x20, 0x97, 0x8F, 0xC3, 0x76, 0xC2, 0x73 BT_DATA_BYTES(BT_DATA_UUID128_ALL, MY_SERVICE_UUID, MY_OTHER_SERVICE_UUID),
My device fails with the following error: Advertising failed to start (err -22)
What am I missing here? Are there any good resources explaining how to configure my advertising data?