This helper will return end group handle of attribute. --- src/shared/gatt-db.c | 12 ++++++++++++ src/shared/gatt-db.h | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c index 532e0b7..41457e2 100644 --- a/src/shared/gatt-db.c +++ b/src/shared/gatt-db.c @@ -744,3 +744,15 @@ const bt_uuid_t *gatt_db_get_attribute_type(struct gatt_db *db, return &attribute->uuid; } + +uint16_t gatt_db_get_end_handle(struct gatt_db *db, uint16_t handle) +{ + struct gatt_db_service *service; + + service = queue_find(db->services, find_service_for_handle, + INT_TO_PTR(handle)); + if (!service) + return 0; + + return service->attributes[0]->handle + service->num_handles - 1; +} diff --git a/src/shared/gatt-db.h b/src/shared/gatt-db.h index cc9120c..ddb40da 100644 --- a/src/shared/gatt-db.h +++ b/src/shared/gatt-db.h @@ -104,3 +104,5 @@ bool gatt_db_write(struct gatt_db *db, uint16_t handle, uint16_t offset, const bt_uuid_t *gatt_db_get_attribute_type(struct gatt_db *db, uint16_t handle); + +uint16_t gatt_db_get_end_handle(struct gatt_db *db, uint16_t handle); -- 1.8.5.3 -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html