diff --git a/Makefile.plugins b/Makefile.plugins
index 44fda45..9dd8134 100644
--- a/Makefile.plugins
+++ b/Makefile.plugins
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
#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"
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
+/* 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);