diff --git a/src/ble/att_db_util.c b/src/ble/att_db_util.c index 1244ca57a..de715cbd2 100644 --- a/src/ble/att_db_util.c +++ b/src/ble/att_db_util.c @@ -177,6 +177,16 @@ uint16_t att_db_util_add_secondary_service_uuid128(const uint8_t * uuid128){ return service_handle; } +uint16_t att_db_util_add_included_service_uuid16(uint16_t start_group_handle, uint16_t end_group_handle, uint16_t uuid16){ + uint8_t buffer[6]; + little_endian_store_16(buffer, 0, start_group_handle); + little_endian_store_16(buffer, 2, end_group_handle); + little_endian_store_16(buffer, 4, uuid16); + uint16_t service_handle = att_db_next_handle; + att_db_util_add_attribute_uuid16(GATT_SECONDARY_SERVICE_UUID, ATT_PROPERTY_READ, buffer, sizeof(buffer)); + 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) diff --git a/src/ble/att_db_util.h b/src/ble/att_db_util.h index e11f29bb7..89afaa9d4 100644 --- a/src/ble/att_db_util.h +++ b/src/ble/att_db_util.h @@ -71,7 +71,7 @@ uint16_t att_db_util_add_service_uuid16(uint16_t uuid16); /** * @brief Add primary service for 128-bit UUID - * @param uuid1286 + * @param uuid128 * @returns attribute handle for the new service definition */ uint16_t att_db_util_add_service_uuid128(const uint8_t * uuid128); @@ -85,11 +85,20 @@ uint16_t att_db_util_add_secondary_service_uuid16(uint16_t uuid16); /** * @brief Add secondary service for 128-bit UUID - * @param uuid1286 + * @param uuid128 * @returns attribute handle for the new service definition */ uint16_t att_db_util_add_secondary_service_uuid128(const uint8_t * uuid128); +/** + * @brief Add included service with 16-bit UUID + * @param start_group_handle + * @param end_group_handle + * @param uuid16 + * @returns attribute handle for the new service definition + */ +uint16_t att_db_util_add_included_service_uuid16(uint16_t start_group_handle, uint16_t end_group_handle, uint16_t uuid16); + /** * @brief Add Characteristic with 16-bit UUID, properties, and data * @param uuid16 @@ -142,7 +151,7 @@ uint16_t att_db_util_add_descriptor_uuid16(uint16_t uuid16, uint16_t properties, */ uint16_t att_db_util_add_descriptor_uuid128(const uint8_t * uuid128, uint16_t properties, uint8_t read_permission, uint8_t write_permission, uint8_t * data, uint16_t data_len); -/** +/** * @brief Get address of constructed ATT DB */ uint8_t * att_db_util_get_address(void);