Diff between 2c98c478863ee9e213a4129f0f4fee2b16b678da and f163913488106929081026c56c236800aa6f8269

Changed Files

File Additions Deletions Status
Makefile.plugins +1 -1 modified
profiles/audio/bap.c +21 -0 modified
profiles/audio/bap.h +10 -0 added

Full Patch

diff --git a/Makefile.plugins b/Makefile.plugins
index 44fda45..9dd8134 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
@@ -115,7 +115,7 @@ endif
 
 if BAP
 builtin_modules += bap
-builtin_sources += profiles/audio/bap.c
+builtin_sources += profiles/audio/bap.h profiles/audio/bap.c
 endif
 
 if BASS
diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index b76d538..79e9cc5 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -56,6 +56,8 @@
 #include "src/log.h"
 #include "src/error.h"
 
+#include "bap.h"
+
 #define ISO_SOCKET_UUID "6fbaf188-05e0-496a-9885-d6ddfdb4e03e"
 #define PACS_UUID_STR "00001850-0000-1000-8000-00805f9b34fb"
 #define BCAAS_UUID_STR "00001852-0000-1000-8000-00805f9b34fb"
@@ -2751,6 +2753,25 @@ static void pac_removed_broadcast(struct bt_bap_pac *pac, void *user_data)
 	ep_unregister(ep);
 }
 
+static bool match_device(const void *data, const void *match_data)
+{
+	const struct bap_data *bdata = data;
+	const struct btd_device *device = match_data;
+
+	return bdata->device == device;
+}
+
+struct bt_bap *bap_get_session(struct btd_device *device)
+{
+	struct bap_data *data;
+
+	data = queue_find(sessions, match_device, device);
+	if (!data)
+		return NULL;
+
+	return data->bap;
+}
+
 static struct bap_data *bap_data_new(struct btd_device *device)
 {
 	struct bap_data *data;
diff --git a/profiles/audio/bap.h b/profiles/audio/bap.h
new file mode 100644
index 0000000..66f8db8
--- /dev/null
+++ b/profiles/audio/bap.h
@@ -0,0 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright 2024 NXP
+ *
+ */
+
+struct bt_bap *bap_get_session(struct btd_device *device);