All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH BlueZ v4 1/2] shared/gatt-db: Add gatt_db_attribute_get_service
@ 2022-12-17  1:10 Luiz Augusto von Dentz
  2022-12-17  1:10 ` [PATCH BlueZ v4 2/2] shared/gatt-client: Fix not removing pending services Luiz Augusto von Dentz
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2022-12-17  1:10 UTC (permalink / raw)
  To: linux-bluetooth

From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>

This adds gatt_db_attribute_get_service which can be used to get the
service which the given attribute belongs to.
---
 src/shared/gatt-db.c | 9 +++++++++
 src/shared/gatt-db.h | 3 +++
 2 files changed, 12 insertions(+)

diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c
index 9a92090ec493..b696fe33da93 100644
--- a/src/shared/gatt-db.c
+++ b/src/shared/gatt-db.c
@@ -1712,6 +1712,15 @@ uint16_t gatt_db_attribute_get_handle(const struct gatt_db_attribute *attrib)
 	return attrib->handle;
 }
 
+struct gatt_db_attribute *
+gatt_db_attribute_get_service(const struct gatt_db_attribute *attrib)
+{
+	if (!attrib)
+		return NULL;
+
+	return attrib->service->attributes[0];
+}
+
 bool gatt_db_attribute_get_service_uuid(const struct gatt_db_attribute *attrib,
 							bt_uuid_t *uuid)
 {
diff --git a/src/shared/gatt-db.h b/src/shared/gatt-db.h
index 41464ad3e7e0..163a981df233 100644
--- a/src/shared/gatt-db.h
+++ b/src/shared/gatt-db.h
@@ -225,6 +225,9 @@ const bt_uuid_t *gatt_db_attribute_get_type(
 
 uint16_t gatt_db_attribute_get_handle(const struct gatt_db_attribute *attrib);
 
+struct gatt_db_attribute *
+gatt_db_attribute_get_service(const struct gatt_db_attribute *attrib);
+
 bool gatt_db_attribute_get_service_uuid(const struct gatt_db_attribute *attrib,
 							bt_uuid_t *uuid);
 
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-12-19 20:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-17  1:10 [PATCH BlueZ v4 1/2] shared/gatt-db: Add gatt_db_attribute_get_service Luiz Augusto von Dentz
2022-12-17  1:10 ` [PATCH BlueZ v4 2/2] shared/gatt-client: Fix not removing pending services Luiz Augusto von Dentz
2022-12-17  3:19 ` [BlueZ,v4,1/2] shared/gatt-db: Add gatt_db_attribute_get_service bluez.test.bot
2022-12-19 20:50 ` [PATCH BlueZ v4 1/2] " patchwork-bot+bluetooth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.