Hi,
I have some similar problem when trying to add the custom 128bit characteristic UUID. The service UUID is advertised correctly but the characteristic UUID not.
I add the Service like this
#define MIDI_SERVICE_UUID {0x00,0xC7,0xC4,0x4E,0xE3,0x6C,0x51,0xA7,0x33,0x4B,0xE8,0xED,0x5A,0x0E,0xB8,0x03}
ble_uuid_t ble_uuid;
// Initialize service structure
p_lbs->conn_handle = BLE_CONN_HANDLE_INVALID;
p_lbs->led_write_handler = p_lbs_init->led_write_handler;
// Add service
ble_uuid128_t base_uuid = {MIDI_SERVICE_UUID};
err_code = sd_ble_uuid_vs_add(&base_uuid, &p_lbs->uuid_type);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
sd_ble_uuid_decode(16, (uint8_t *)&base_uuid, &ble_uuid);
err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_lbs->service_handle);
if (err_code != NRF_SUCCESS)
{
return err_code;
}
And the characteristic like this:
#define MIDI_CHAR_IO_UUID {0xF3,0x6B,0x10,0x9D,0x66,0xF2,0xA9,0xA1,0x12,0x41,0x68,0x38,0xDB,0xE5,0x72,0x77}
ble_gatts_char_md_t char_md;
ble_gatts_attr_md_t cccd_md;
ble_gatts_attr_t attr_char_value;
ble_uuid_t ble_uuid;
ble_gatts_attr_md_t attr_md;
ble_uuid128_t base_uuid = {MIDI_CHAR_IO_UUID};
memset(&cccd_md, 0, sizeof(cccd_md));
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&cccd_md.write_perm);
cccd_md.vloc = BLE_GATTS_VLOC_STACK;
memset(&char_md, 0, sizeof(char_md));
char_md.char_props.read = 1;
char_md.char_props.notify = 1;
char_md.p_char_user_desc = NULL;
char_md.p_char_pf = NULL;
char_md.p_user_desc_md = NULL;
char_md.p_cccd_md = &cccd_md;
char_md.p_sccd_md = NULL;
sd_ble_uuid_decode(16, (uint8_t *)&base_uuid, &ble_uuid);
ble_uuid.type = BLE_UUID_TYPE_VENDOR_BEGIN;
memset(&attr_md, 0, sizeof(attr_md));
BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);
BLE_GAP_CONN_SEC_MODE_SET_NO_ACCESS(&attr_md.write_perm);
attr_md.vloc = BLE_GATTS_VLOC_STACK;
attr_md.rd_auth = 0;
attr_md.wr_auth = 0;
attr_md.vlen = 0;
memset(&attr_char_value, 0, sizeof(attr_char_value));
attr_char_value.p_uuid = &ble_uuid;
attr_char_value.p_attr_md = &attr_md;
attr_char_value.init_len = sizeof(uint8_t);
attr_char_value.init_offs = 0;
attr_char_value.max_len = sizeof(uint8_t);
attr_char_value.p_value = NULL;
sd_ble_gatts_characteristic_add(p_lbs->service_handle, &char_md,
&attr_char_value,
&p_lbs->button_char_handles);
So what i want to achieve is to add a service with a custom 128bit uuid that has a characteristic with a completely different 128bit uuid (it's not based on the service uuid)