@@ -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
@@ -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;
new file mode 100644
@@ -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);