mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-12-22 10:23:27 +08:00
shared/gatt: Add method to set service active
This function will set active flag in database. Only active services can be read by client from database. This falg will be checked when remote will read attributes from this database. Non-active services won't be exposed.
This commit is contained in:
parent
de16594cd9
commit
d11de55a40
@ -57,6 +57,7 @@ struct gatt_db_attribute {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct gatt_db_service {
|
struct gatt_db_service {
|
||||||
|
bool active;
|
||||||
uint16_t num_handles;
|
uint16_t num_handles;
|
||||||
struct gatt_db_attribute **attributes;
|
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);
|
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;
|
||||||
|
}
|
||||||
|
@ -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 gatt_db_add_included_service(struct gatt_db *db, uint16_t handle,
|
||||||
uint16_t included_handle);
|
uint16_t included_handle);
|
||||||
|
|
||||||
|
bool gatt_db_service_set_active(struct gatt_db *db, uint16_t handle,
|
||||||
|
bool active);
|
||||||
|
Loading…
Reference in New Issue
Block a user