128-bit characteristic descriptors

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
StBa_721356
Level 5
Level 5
50 likes received 25 likes received 10 likes received

I have to add a 128-bit-UUID descriptor to a characteristic.

There is no macro to do this. Only a 16-bit-UUID macro is available.

Is this supported at all? And if yes then how would the macro need to be?

0 Likes
1 Solution

Hi JT,

sorry, maybe I was not really clear with my question:

I want to add a 128-bit UUID descriptor to a characteristic. Not a 128-bit UUID characteristic to a service.

And for descriptors there are only two macros available: CHAR_DESCRIPTOR_UUID16 and CHAR_DESCRIPTOR_UUID16_WRITABLE. But no CHAR_DESCRIPTOR_UUID128 or CHAR_DESCRIPTOR_UUID128_WRITABLE.

I define my own CHAR_DESCRIPTOR_UUID128 as follows:

#define CHAR_DESCRIPTOR_UUID128(handle, uuid, permission, value_len) \

    BIT16_TO_8((UINT16)(handle)), \

    (UINT8)(permission | LEGATTDB_PERM_SERVCIE_UUID_128), \

    (UINT8)(value_len+16), \

    uuid

Is this correct?

View solution in original post

0 Likes
4 Replies
Anonymous
Not applicable

Hello Stefan,

Yes 128 Bit is supported and you simply have to add it to your code.

A good example is shown in our SDK on the WICED Sense App:

pastedImage_0.png

    // Handle 0x28: WICED Sense Service.
    // This is the main proprietary service of WICED SEnse. Note that
    // UUID of the vendor specific service is 16 bytes, unlike standard Bluetooth
    // UUIDs which are 2 bytes.  _UUID128 version of the macro should be used.
    PRIMARY_SERVICE_UUID128 (HANDLE_WICED_SENSE_SERVICE_UUID, UUID_WICED_SENSE_SERVICE),

    // Handle 0x29: characteristic Sensor Notification, handle 0x2a characteristic value
    // we support both notification and indication.  Peer need to allow notifications
    // or indications by writing in the Characteristic Client Configuration Descriptor
    // (see handle 2b below).  Note that UUID of the vendor specific characteristic is
    // 16 bytes, unlike standard Bluetooth UUIDs which are 2 bytes.  _UUID128 version
    // of the macro should be used.
    CHARACTERISTIC_UUID128 (0x0029, HANDLE_WICED_SENSE_VALUE_NOTIFY, UUID_WICED_SENSE_CHARACTERISTIC_NOTIFY,
                           LEGATTDB_CHAR_PROP_READ | LEGATTDB_CHAR_PROP_NOTIFY,
                           LEGATTDB_PERM_READABLE, 20),
        0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

Thanks

JT

0 Likes

Hi JT,

sorry, maybe I was not really clear with my question:

I want to add a 128-bit UUID descriptor to a characteristic. Not a 128-bit UUID characteristic to a service.

And for descriptors there are only two macros available: CHAR_DESCRIPTOR_UUID16 and CHAR_DESCRIPTOR_UUID16_WRITABLE. But no CHAR_DESCRIPTOR_UUID128 or CHAR_DESCRIPTOR_UUID128_WRITABLE.

I define my own CHAR_DESCRIPTOR_UUID128 as follows:

#define CHAR_DESCRIPTOR_UUID128(handle, uuid, permission, value_len) \

    BIT16_TO_8((UINT16)(handle)), \

    (UINT8)(permission | LEGATTDB_PERM_SERVCIE_UUID_128), \

    (UINT8)(value_len+16), \

    uuid

Is this correct?

0 Likes
Anonymous
Not applicable

Hello Stefan,

This seems correct.  Have you tried it?

Thanks

JT

0 Likes

Hi JT,

yes, I tried it and it seems to be correct.

Stefan

0 Likes