diff mbox series

[BlueZ,07/10] shared/bass: Add API to get GATT client reference

Message ID 20240716142207.4298-8-iulia.tanasescu@nxp.com (mailing list archive)
State Accepted
Commit 88bf423eb525655e15890bdca84d9acb5afab122
Headers show
Series Initial implementation of BAP Broadcast Assistant | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Iulia Tanasescu July 16, 2024, 2:22 p.m. UTC
Some use cases require the BASS plugin to differentiate between client and
server BASS sessions - for example, the BAP Broadcast Assistant role only
considers client BASS sessions.

This adds a BASS API to obtain a reference to the bt_gatt_client structure
attached to the bt_bass session.
---
 src/shared/bass.c | 8 ++++++++
 src/shared/bass.h | 1 +
 2 files changed, 9 insertions(+)
diff mbox series

Patch

diff --git a/src/shared/bass.c b/src/shared/bass.c
index d82c043ac..268e3bd86 100644
--- a/src/shared/bass.c
+++ b/src/shared/bass.c
@@ -1683,6 +1683,14 @@  struct bt_att *bt_bass_get_att(struct bt_bass *bass)
 	return bt_gatt_client_get_att(bass->client);
 }
 
+struct bt_gatt_client *bt_bass_get_client(struct bt_bass *bass)
+{
+	if (!bass)
+		return NULL;
+
+	return bass->client;
+}
+
 bool bt_bass_set_debug(struct bt_bass *bass, bt_bass_debug_func_t func,
 			void *user_data, bt_bass_destroy_func_t destroy)
 {
diff --git a/src/shared/bass.h b/src/shared/bass.h
index c4b5b76ba..1674146bc 100644
--- a/src/shared/bass.h
+++ b/src/shared/bass.h
@@ -121,6 +121,7 @@  typedef void (*bt_bass_destroy_func_t)(void *user_data);
 typedef void (*bt_bass_debug_func_t)(const char *str, void *user_data);
 
 struct bt_att *bt_bass_get_att(struct bt_bass *bass);
+struct bt_gatt_client *bt_bass_get_client(struct bt_bass *bass);
 unsigned int bt_bass_register(bt_bass_func_t attached, bt_bass_func_t detached,
 							void *user_data);
 bool bt_bass_unregister(unsigned int id);