This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to change Characteristic UUID?

Hi. I'm using nRF51822 as Peripheral.

To init the service for example "NUS", i have to call NUS_BASE_UUID as below.. #define NUS_BASE_UUID {{0x9E, 0xCA, 0xDC, 0x24, 0x0E, 0xE5, 0xA9, 0xE0, 0x93, 0xF3, 0xA3, 0xB5, 0x00, 0x00, 0x40, 0x6E}} /**< Used vendor specific UUID. */

Then I add characteristic as below. err_code = rx_char_add(p_nus, p_nus_init);

static uint32_t rx_char_add(ble_nus_t * p_nus, const ble_nus_init_t * p_nus_init) { ...... ble_uuid.type = p_nus->uuid_type; ble_uuid.uuid = BLE_UUID_NUS_RX_CHARACTERISTIC;

...... }

And it works very well. I can see "BLE_UUID_NUS_RX_CHARACTERISTIC" 2 bytes.

But I want to change characteristic's UUID not only 2Bytes also 16Bytes. Is it possible? How can I change?

I need your help.

Parents
  • Well ble_uuid is type composed by two parts: 128-byte base index as provisioned to SoftDevice GATT stack and 16-bit "short" UUID. If you want to change base then simply point to the right index (note that after boot there is only one UUID base hard-coded to the SD = BT SIG default UUID base used for all BT SIG standardized GATT objects). See where and how sd_ble_uuid_vs_add function is called in NUS example and how the index is stored as p_nus->uuid_type for later use. If you use the SDK example more or less unchanged then simply change UUID in NUS_BASE_UUID constant and it should all work instantly.

Reply Children
No Data
Related