diff --git a/src/ble/att_db_util.c b/src/ble/att_db_util.c index 8a78519ba..f0a755524 100644 --- a/src/ble/att_db_util.c +++ b/src/ble/att_db_util.c @@ -195,6 +195,18 @@ uint16_t att_db_util_add_characteristic_uuid128(uint8_t * uuid128, uint16_t prop return value_handle; } +uint16_t att_db_util_add_descriptor_uuid16(uint16_t uuid16, uint16_t properties, uint8_t * data, uint16_t data_len){ + uint16_t value_handle = att_db_next_handle; + att_db_util_add_attribute_uuid16(uuid16, properties, data, data_len); + return value_handle; +} + +uint16_t att_db_util_add_descriptor_uuid128(uint8_t * uuid128, uint16_t properties, uint8_t * data, uint16_t data_len){ + uint16_t value_handle = att_db_next_handle; + att_db_util_add_attribute_uuid128(uuid128, properties, data, data_len); + return value_handle; + } + uint8_t * att_db_util_get_address(void){ return att_db; } diff --git a/src/ble/att_db_util.h b/src/ble/att_db_util.h index f4211f3c0..bc604ac27 100644 --- a/src/ble/att_db_util.h +++ b/src/ble/att_db_util.h @@ -75,6 +75,8 @@ void att_db_util_add_service_uuid128(uint8_t * udid128); /** * @brief Add Characteristic with 16-bit UUID, properties, and data * @returns attribute value handle + * @note If properties contains ATT_PROPERTY_NOTIFY or ATT_PROPERTY_INDICATE flags, a Client Configuration Characteristic Descriptor (CCCD) + * is created as well. The attribute value handle of the CCCD is the attribute value handle plus 1 * @see ATT_PROPERTY_* in ble/att_db.h */ uint16_t att_db_util_add_characteristic_uuid16(uint16_t udid16, uint16_t properties, uint8_t * data, uint16_t data_len); @@ -82,10 +84,26 @@ uint16_t att_db_util_add_characteristic_uuid16(uint16_t udid16, uint16_t prop /** * @brief Add Characteristic with 128-bit UUID, properties, and data * @returns attribute value handle + * @note If properties contains ATT_PROPERTY_NOTIFY or ATT_PROPERTY_INDICATE flags, a Client Configuration Characteristic Descriptor (CCCD) + * is created as well. The attribute value handle of the CCCD is the attribute value handle plus 1 * @see ATT_PROPERTY_* in ble/att_db.h */ uint16_t att_db_util_add_characteristic_uuid128(uint8_t * udid128, uint16_t properties, uint8_t * data, uint16_t data_len); +/** +* @brief Add descriptor with 16-bit UUID, properties, and data +* @returns attribute value handle +* @see ATT_PROPERTY_* in ble/att_db.h +*/ +uint16_t att_db_util_add_descriptor_uuid16(uint16_t uuid16, uint16_t properties, uint8_t * data, uint16_t data_len); + +/** +* @brief Add descriptor with 128-bit UUID, properties, and data +* @returns attribute value handle +* @see ATT_PROPERTY_* in ble/att_db.h +*/ +uint16_t att_db_util_add_descriptor_uuid128(uint8_t * udid128, uint16_t properties, uint8_t * data, uint16_t data_len); + /** * @brief Get address of constructed ATT DB */