mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-03 20:54:18 +00:00
att_db_util: return attribute handle for new servics, improve header documentation
This commit is contained in:
parent
838e632c8e
commit
4e5e1eb09e
@ -143,16 +143,20 @@ static void att_db_util_add_attribute_uuid128(uint8_t * uuid128, uint16_t flags,
|
||||
att_db_util_set_end_tag();
|
||||
}
|
||||
|
||||
void att_db_util_add_service_uuid16(uint16_t uuid16){
|
||||
uint16_t att_db_util_add_service_uuid16(uint16_t uuid16){
|
||||
uint8_t buffer[2];
|
||||
little_endian_store_16(buffer, 0, uuid16);
|
||||
uint16_t service_handle = att_db_next_handle;
|
||||
att_db_util_add_attribute_uuid16(GATT_PRIMARY_SERVICE_UUID, ATT_PROPERTY_READ, buffer, 2);
|
||||
return service_handle;
|
||||
}
|
||||
|
||||
void att_db_util_add_service_uuid128(uint8_t * uuid128){
|
||||
uint16_t att_db_util_add_service_uuid128(uint8_t * uuid128){
|
||||
uint8_t buffer[16];
|
||||
reverse_128(uuid128, buffer);
|
||||
uint16_t service_handle = att_db_next_handle;
|
||||
att_db_util_add_attribute_uuid16(GATT_PRIMARY_SERVICE_UUID, ATT_PROPERTY_READ, buffer, 16);
|
||||
return service_handle;
|
||||
}
|
||||
|
||||
static void att_db_util_add_client_characteristic_configuration(uint16_t properties){
|
||||
@ -196,15 +200,15 @@ uint16_t att_db_util_add_characteristic_uuid128(uint8_t * uuid128, uint16_t prop
|
||||
}
|
||||
|
||||
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;
|
||||
uint16_t descriptor_handler = att_db_next_handle;
|
||||
att_db_util_add_attribute_uuid16(uuid16, properties, data, data_len);
|
||||
return value_handle;
|
||||
return descriptor_handler;
|
||||
}
|
||||
|
||||
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;
|
||||
uint16_t descriptor_handler = att_db_next_handle;
|
||||
att_db_util_add_attribute_uuid128(uuid128, properties, data, data_len);
|
||||
return value_handle;
|
||||
return descriptor_handler;
|
||||
}
|
||||
|
||||
uint8_t * att_db_util_get_address(void){
|
||||
|
@ -64,17 +64,19 @@ void att_db_util_init(void);
|
||||
|
||||
/**
|
||||
* @brief Add primary service for 16-bit UUID
|
||||
* @returns attribute handle for the new service definition
|
||||
*/
|
||||
void att_db_util_add_service_uuid16(uint16_t udid16);
|
||||
uint16_t att_db_util_add_service_uuid16(uint16_t udid16);
|
||||
|
||||
/**
|
||||
* @brief Add primary service for 128-bit UUID
|
||||
* @returns attribute handle for the new service definition
|
||||
*/
|
||||
void att_db_util_add_service_uuid128(uint8_t * udid128);
|
||||
uint16_t att_db_util_add_service_uuid128(uint8_t * udid128);
|
||||
|
||||
/**
|
||||
* @brief Add Characteristic with 16-bit UUID, properties, and data
|
||||
* @returns attribute value handle
|
||||
* @returns attribute handle of the new characteristic value declaration
|
||||
* @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
|
||||
@ -83,7 +85,7 @@ 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
|
||||
* @returns attribute handle of the new characteristic value declaration
|
||||
* @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
|
||||
@ -92,14 +94,14 @@ uint16_t att_db_util_add_characteristic_uuid128(uint8_t * udid128, uint16_t prop
|
||||
|
||||
/**
|
||||
* @brief Add descriptor with 16-bit UUID, properties, and data
|
||||
* @returns attribute value handle
|
||||
* @returns attribute handle of the new descriptor
|
||||
* @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
|
||||
* @returns attribute handle of the new characteristic descriptor declaration
|
||||
* @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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user