Hi!
I am trying to add service data to my scan response service data for a custom service. I am unsure of how to set the UUID correctly for this.
UUID declaration:
#define TIMECODE_SERVICE_UUID_BASE \
{ 0x8B, 056, 0x74, 0xC2, 0x14, 0x2D, 0xFA, 0xA4, \
0x94, 0x41, 0x73, 0x30, 0xDA, 0x19, 0xE1, 0x3F }
#define TIMECODE_SERVICE_UUID 0x01
#define TIMECODE_DEVICE_NAME_CHARACTERISTIC_UUID 0x02
Where I set the UUID for the service:
// Add Custom Service UUID
ble_uuid128_t base_uuid = {TIMECODE_SERVICE_UUID_BASE};
err_code = sd_ble_uuid_vs_add(&base_uuid, &p_timecode_service->uuid_type);
VERIFY_SUCCESS(err_code);
ble_uuid.type = p_timecode_service->uuid_type;
ble_uuid.uuid = TIMECODE_SERVICE_UUID;
// Add the Custom Service
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_timecode_service->service_handle);
VERIFY_SUCCESS(err_code);
Setting the response service data:
static ble_advdata_t new_response_data;
ble_advdata_service_data_t service_data;
uint8_array_t data_array;
uint8_t data[] = {device_state_flags, device_state_color};
data_array.p_data = data;
data_array.size = sizeof(data);
service_data.service_uuid = TIMECODE_SERVICE_UUID;
service_data.data = data_array;
memset(&new_response_data, 0, sizeof(new_response_data));
new_response_data.p_service_data_array = &service_data;
new_response_data.service_data_count = 1;
err_code = ble_advertising_advdata_update(&m_advertising, &new_advertising_data, &new_response_data);
APP_ERROR_CHECK(err_code);
This runs correctly, but the service UUID in the service data is the exact same as "TIMECODE_SERVICE_UUID" (0x0001). How do I combine this with the base UUID to set it to the actual service UUID (3fe10001-3073-4194-a4fa-2d14c2742e8b)? I've tried searching the documentation as well as these help forms and haven't found anything that is different from what I'm currently doing.


