Only active services can be read by client. --- src/shared/gatt-db.c | 28 ++++++++++++++++++++++++++++ src/shared/gatt-db.h | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c index 2886bb8..976885a 100644 --- a/src/shared/gatt-db.c +++ b/src/shared/gatt-db.c @@ -358,3 +358,31 @@ uint16_t gatt_db_new_included_service(struct gatt_db *db, uint16_t handle, return update_attribute_handle(service, index); } + +bool gatt_db_start_service(struct gatt_db *db, uint16_t handle) +{ + struct gatt_db_service *service; + + service = queue_find(db->services, match_service_by_handle, + INT_TO_PTR(handle)); + if (!service) + return false; + + service->active = true; + + return true; +} + +bool gatt_db_stop_service(struct gatt_db *db, uint16_t handle) +{ + struct gatt_db_service *service; + + service = queue_find(db->services, match_service_by_handle, + INT_TO_PTR(handle)); + if (!service) + return false; + + service->active = false; + + return true; +} diff --git a/src/shared/gatt-db.h b/src/shared/gatt-db.h index a421e9e..ff371e6 100644 --- a/src/shared/gatt-db.h +++ b/src/shared/gatt-db.h @@ -61,3 +61,7 @@ uint16_t gatt_db_new_char_descriptor(struct gatt_db *db, uint16_t handle, uint16_t gatt_db_new_included_service(struct gatt_db *db, uint16_t handle, uint16_t included_handle); + +bool gatt_db_start_service(struct gatt_db *db, uint16_t handle); + +bool gatt_db_stop_service(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