- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Solved! Go to Solution.
- Labels:
-
ReadWrite Characteristics
-
SDK 2.X
- Tags:
- gatt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
// 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Stefan,
This seems correct. Have you tried it?
Thanks
JT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi JT,
yes, I tried it and it seems to be correct.
Stefan