att_db_util: add att_db_util_add_secondary_service_uuid16/128

This commit is contained in:
Matthias Ringwald 2020-01-09 12:07:15 +01:00
parent 8e361704e5
commit d68b9e4710
2 changed files with 30 additions and 0 deletions

View File

@ -161,6 +161,22 @@ uint16_t att_db_util_add_service_uuid128(const uint8_t * uuid128){
return service_handle;
}
uint16_t att_db_util_add_secondary_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_SECONDARY_SERVICE_UUID, ATT_PROPERTY_READ, buffer, 2);
return service_handle;
}
uint16_t att_db_util_add_secondary_service_uuid128(const 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_SECONDARY_SERVICE_UUID, ATT_PROPERTY_READ, buffer, 16);
return service_handle;
}
static void att_db_util_add_client_characteristic_configuration(uint16_t flags){
uint8_t buffer[2];
// drop permission for read (0xc00), keep write permissions (0x0091)

View File

@ -76,6 +76,20 @@ uint16_t att_db_util_add_service_uuid16(uint16_t uuid16);
*/
uint16_t att_db_util_add_service_uuid128(const uint8_t * uuid128);
/**
* @brief Add secondary service for 16-bit UUID
* @param uuid16
* @returns attribute handle for the new service definition
*/
uint16_t att_db_util_add_secondary_service_uuid16(uint16_t uuid16);
/**
* @brief Add secondary service for 128-bit UUID
* @param uuid1286
* @returns attribute handle for the new service definition
*/
uint16_t att_db_util_add_secondary_service_uuid128(const uint8_t * uuid128);
/**
* @brief Add Characteristic with 16-bit UUID, properties, and data
* @param uuid16