att_db_util: add functions to create descriptors. document how to calculate cccd attribute handle

This commit is contained in:
Matthias Ringwald 2018-01-30 17:29:10 +01:00
parent b489552907
commit 9f28d85d18
2 changed files with 30 additions and 0 deletions

View File

@ -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;
}

View File

@ -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
*/