diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c index 1a8469bed..5d732e8d5 100644 --- a/src/shared/gatt-db.c +++ b/src/shared/gatt-db.c @@ -57,6 +57,7 @@ struct gatt_db_attribute { }; struct gatt_db_service { + bool active; uint16_t num_handles; struct gatt_db_attribute **attributes; }; @@ -379,3 +380,18 @@ uint16_t gatt_db_add_included_service(struct gatt_db *db, uint16_t handle, return update_attribute_handle(service, index); } + +bool gatt_db_service_set_active(struct gatt_db *db, uint16_t handle, + bool active) +{ + struct gatt_db_service *service; + + service = queue_find(db->services, match_service_by_handle, + INT_TO_PTR(handle)); + if (!service) + return false; + + service->active = active; + + return true; +} diff --git a/src/shared/gatt-db.h b/src/shared/gatt-db.h index e6e8331c3..f68f4b357 100644 --- a/src/shared/gatt-db.h +++ b/src/shared/gatt-db.h @@ -54,3 +54,6 @@ uint16_t gatt_db_add_char_descriptor(struct gatt_db *db, uint16_t handle, uint16_t gatt_db_add_included_service(struct gatt_db *db, uint16_t handle, uint16_t included_handle); + +bool gatt_db_service_set_active(struct gatt_db *db, uint16_t handle, + bool active);