* [PATCH BlueZ 1/3] shared/bap: Add support to register bis callbacks
2025-02-25 8:44 [PATCH BlueZ 0/3] bass: Register bis probe/remove callbacks Iulia Tanasescu
@ 2025-02-25 8:44 ` Iulia Tanasescu
2025-02-25 10:12 ` bass: Register bis probe/remove callbacks bluez.test.bot
2025-02-25 15:05 ` [PATCH BlueZ 1/3] shared/bap: Add support to register bis callbacks Luiz Augusto von Dentz
2025-02-25 8:44 ` [PATCH BlueZ 2/3] bass: Create BASS session with Broadcasters Iulia Tanasescu
2025-02-25 8:44 ` [PATCH BlueZ 3/3] bass: Register bis probe/remove callbacks Iulia Tanasescu
2 siblings, 2 replies; 7+ messages in thread
From: Iulia Tanasescu @ 2025-02-25 8:44 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
luiz.dentz, Iulia Tanasescu
This adds support for registering BIS probe/remove calllbacks with
shared/bap. This is needed by the BAP Broadcast Assistant (BASS Client)
implementation, so that the BAP plugin can notify BISes discovered
after parsing the BASE to BASS, avoiding direct function calls
between plugins.
---
src/shared/bap.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++
src/shared/bap.h | 12 +++++-
2 files changed, 108 insertions(+), 1 deletion(-)
diff --git a/src/shared/bap.c b/src/shared/bap.c
index 6ffeefa41..76df7f4e4 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -80,6 +80,14 @@ struct bt_bap_state {
void *data;
};
+struct bt_bap_bis_cb {
+ unsigned int id;
+ bt_bap_bis_func_t probe;
+ bt_bap_func_t remove;
+ bt_bap_destroy_func_t destroy;
+ void *data;
+};
+
struct bt_bap_cb {
unsigned int id;
bt_bap_func_t attached;
@@ -180,6 +188,7 @@ struct bt_bap {
struct queue *pac_cbs;
struct queue *ready_cbs;
struct queue *state_cbs;
+ struct queue *bis_cbs;
bt_bap_debug_func_t debug_func;
bt_bap_destroy_func_t debug_destroy;
@@ -4190,6 +4199,16 @@ static void bap_state_free(void *data)
free(state);
}
+static void bap_bis_cb_free(void *data)
+{
+ struct bt_bap_bis_cb *bis_cb = data;
+
+ if (bis_cb->destroy)
+ bis_cb->destroy(bis_cb->data);
+
+ free(bis_cb);
+}
+
static void bap_ep_free(void *data)
{
struct bt_bap_endpoint *ep = data;
@@ -4228,6 +4247,7 @@ static void bap_free(void *data)
queue_destroy(bap->pac_cbs, pac_changed_free);
queue_destroy(bap->ready_cbs, bap_ready_free);
queue_destroy(bap->state_cbs, bap_state_free);
+ queue_destroy(bap->bis_cbs, bap_bis_cb_free);
queue_destroy(bap->local_eps, free);
queue_destroy(bap->remote_eps, bap_ep_free);
@@ -4310,6 +4330,7 @@ struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb)
bap->ready_cbs = queue_new();
bap->streams = queue_new();
bap->state_cbs = queue_new();
+ bap->bis_cbs = queue_new();
bap->local_eps = queue_new();
if (!rdb)
@@ -5519,6 +5540,82 @@ bool bt_bap_state_unregister(struct bt_bap *bap, unsigned int id)
return false;
}
+unsigned int bt_bap_bis_cb_register(struct bt_bap *bap,
+ bt_bap_bis_func_t probe,
+ bt_bap_func_t remove,
+ void *user_data,
+ bt_bap_destroy_func_t destroy)
+{
+ struct bt_bap_bis_cb *bis_cb;
+ static unsigned int id;
+
+ if (!bap)
+ return 0;
+
+ bis_cb = new0(struct bt_bap_bis_cb, 1);
+ bis_cb->id = ++id ? id : ++id;
+ bis_cb->probe = probe;
+ bis_cb->remove = remove;
+ bis_cb->destroy = destroy;
+ bis_cb->data = user_data;
+
+ queue_push_tail(bap->bis_cbs, bis_cb);
+
+ return bis_cb->id;
+}
+
+static bool match_bis_cb_id(const void *data, const void *match_data)
+{
+ const struct bt_bap_bis_cb *bis_cb = data;
+ unsigned int id = PTR_TO_UINT(match_data);
+
+ return (bis_cb->id == id);
+}
+
+bool bt_bap_bis_cb_unregister(struct bt_bap *bap, unsigned int id)
+{
+ struct bt_bap_bis_cb *bis_cb;
+
+ if (!bap)
+ return false;
+
+ bis_cb = queue_remove_if(bap->bis_cbs, match_bis_cb_id,
+ UINT_TO_PTR(id));
+ if (!bis_cb)
+ return false;
+
+ bap_bis_cb_free(bis_cb);
+
+ return false;
+}
+
+void bt_bap_bis_probe(struct bt_bap *bap, uint8_t bis, uint8_t sgrp,
+ struct iovec *caps, struct iovec *meta, struct bt_bap_qos *qos)
+{
+ const struct queue_entry *entry;
+
+ for (entry = queue_get_entries(bap->bis_cbs); entry;
+ entry = entry->next) {
+ struct bt_bap_bis_cb *cb = entry->data;
+
+ if (cb->probe)
+ cb->probe(bis, sgrp, caps, meta, qos, cb->data);
+ }
+}
+
+void bt_bap_bis_remove(struct bt_bap *bap)
+{
+ const struct queue_entry *entry;
+
+ for (entry = queue_get_entries(bap->bis_cbs); entry;
+ entry = entry->next) {
+ struct bt_bap_bis_cb *cb = entry->data;
+
+ if (cb->remove)
+ cb->remove(bap, cb->data);
+ }
+}
+
const char *bt_bap_stream_statestr(uint8_t state)
{
switch (state) {
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 200dc8f13..adb531b4c 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -4,7 +4,7 @@
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2022 Intel Corporation. All rights reserved.
- * Copyright 2023-2024 NXP
+ * Copyright 2023-2025 NXP
*
*/
@@ -269,3 +269,13 @@ bool bt_bap_parse_base(struct iovec *base,
bt_bap_bis_func_t handler,
void *user_data);
+unsigned int bt_bap_bis_cb_register(struct bt_bap *bap,
+ bt_bap_bis_func_t probe,
+ bt_bap_func_t remove,
+ void *user_data,
+ bt_bap_destroy_func_t destroy);
+bool bt_bap_bis_cb_unregister(struct bt_bap *bap, unsigned int id);
+
+void bt_bap_bis_probe(struct bt_bap *bap, uint8_t bis, uint8_t sgrp,
+ struct iovec *caps, struct iovec *meta, struct bt_bap_qos *qos);
+void bt_bap_bis_remove(struct bt_bap *bap);
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* RE: bass: Register bis probe/remove callbacks
2025-02-25 8:44 ` [PATCH BlueZ 1/3] shared/bap: Add support to register bis callbacks Iulia Tanasescu
@ 2025-02-25 10:12 ` bluez.test.bot
2025-02-25 15:05 ` [PATCH BlueZ 1/3] shared/bap: Add support to register bis callbacks Luiz Augusto von Dentz
1 sibling, 0 replies; 7+ messages in thread
From: bluez.test.bot @ 2025-02-25 10:12 UTC (permalink / raw)
To: linux-bluetooth, iulia.tanasescu
[-- Attachment #1: Type: text/plain, Size: 1863 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=937397
---Test result---
Test Summary:
CheckPatch PENDING 0.20 seconds
GitLint PENDING 0.27 seconds
BuildEll PASS 20.65 seconds
BluezMake PASS 1567.34 seconds
MakeCheck PASS 13.22 seconds
MakeDistcheck PASS 158.55 seconds
CheckValgrind PASS 214.36 seconds
CheckSmatch WARNING 287.70 seconds
bluezmakeextell PASS 98.16 seconds
IncrementalBuild PENDING 0.31 seconds
ScanBuild PASS 879.92 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: CheckSmatch - WARNING
Desc: Run smatch tool with source
Output:
src/shared/bap.c:305:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:305:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structuressrc/shared/bap.c:305:25: warning: array of flexible structuressrc/shared/bap.c: note: in included file:./src/shared/ascs.h:88:25: warning: array of flexible structures
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH BlueZ 1/3] shared/bap: Add support to register bis callbacks
2025-02-25 8:44 ` [PATCH BlueZ 1/3] shared/bap: Add support to register bis callbacks Iulia Tanasescu
2025-02-25 10:12 ` bass: Register bis probe/remove callbacks bluez.test.bot
@ 2025-02-25 15:05 ` Luiz Augusto von Dentz
1 sibling, 0 replies; 7+ messages in thread
From: Luiz Augusto von Dentz @ 2025-02-25 15:05 UTC (permalink / raw)
To: Iulia Tanasescu
Cc: linux-bluetooth, claudia.rosu, mihai-octavian.urzica,
andrei.istodorescu
Hi Iulia,
On Tue, Feb 25, 2025 at 3:44 AM Iulia Tanasescu <iulia.tanasescu@nxp.com> wrote:
>
> This adds support for registering BIS probe/remove calllbacks with
> shared/bap. This is needed by the BAP Broadcast Assistant (BASS Client)
> implementation, so that the BAP plugin can notify BISes discovered
> after parsing the BASE to BASS, avoiding direct function calls
> between plugins.
> ---
> src/shared/bap.c | 97 ++++++++++++++++++++++++++++++++++++++++++++++++
> src/shared/bap.h | 12 +++++-
> 2 files changed, 108 insertions(+), 1 deletion(-)
>
> diff --git a/src/shared/bap.c b/src/shared/bap.c
> index 6ffeefa41..76df7f4e4 100644
> --- a/src/shared/bap.c
> +++ b/src/shared/bap.c
> @@ -80,6 +80,14 @@ struct bt_bap_state {
> void *data;
> };
>
> +struct bt_bap_bis_cb {
> + unsigned int id;
> + bt_bap_bis_func_t probe;
> + bt_bap_func_t remove;
> + bt_bap_destroy_func_t destroy;
> + void *data;
> +};
> +
> struct bt_bap_cb {
> unsigned int id;
> bt_bap_func_t attached;
> @@ -180,6 +188,7 @@ struct bt_bap {
> struct queue *pac_cbs;
> struct queue *ready_cbs;
> struct queue *state_cbs;
> + struct queue *bis_cbs;
>
> bt_bap_debug_func_t debug_func;
> bt_bap_destroy_func_t debug_destroy;
> @@ -4190,6 +4199,16 @@ static void bap_state_free(void *data)
> free(state);
> }
>
> +static void bap_bis_cb_free(void *data)
> +{
> + struct bt_bap_bis_cb *bis_cb = data;
> +
> + if (bis_cb->destroy)
> + bis_cb->destroy(bis_cb->data);
> +
> + free(bis_cb);
> +}
> +
> static void bap_ep_free(void *data)
> {
> struct bt_bap_endpoint *ep = data;
> @@ -4228,6 +4247,7 @@ static void bap_free(void *data)
> queue_destroy(bap->pac_cbs, pac_changed_free);
> queue_destroy(bap->ready_cbs, bap_ready_free);
> queue_destroy(bap->state_cbs, bap_state_free);
> + queue_destroy(bap->bis_cbs, bap_bis_cb_free);
> queue_destroy(bap->local_eps, free);
> queue_destroy(bap->remote_eps, bap_ep_free);
>
> @@ -4310,6 +4330,7 @@ struct bt_bap *bt_bap_new(struct gatt_db *ldb, struct gatt_db *rdb)
> bap->ready_cbs = queue_new();
> bap->streams = queue_new();
> bap->state_cbs = queue_new();
> + bap->bis_cbs = queue_new();
> bap->local_eps = queue_new();
>
> if (!rdb)
> @@ -5519,6 +5540,82 @@ bool bt_bap_state_unregister(struct bt_bap *bap, unsigned int id)
> return false;
> }
>
> +unsigned int bt_bap_bis_cb_register(struct bt_bap *bap,
> + bt_bap_bis_func_t probe,
> + bt_bap_func_t remove,
> + void *user_data,
> + bt_bap_destroy_func_t destroy)
> +{
> + struct bt_bap_bis_cb *bis_cb;
> + static unsigned int id;
> +
> + if (!bap)
> + return 0;
> +
> + bis_cb = new0(struct bt_bap_bis_cb, 1);
> + bis_cb->id = ++id ? id : ++id;
> + bis_cb->probe = probe;
> + bis_cb->remove = remove;
> + bis_cb->destroy = destroy;
> + bis_cb->data = user_data;
> +
> + queue_push_tail(bap->bis_cbs, bis_cb);
> +
> + return bis_cb->id;
> +}
> +
> +static bool match_bis_cb_id(const void *data, const void *match_data)
> +{
> + const struct bt_bap_bis_cb *bis_cb = data;
> + unsigned int id = PTR_TO_UINT(match_data);
> +
> + return (bis_cb->id == id);
> +}
> +
> +bool bt_bap_bis_cb_unregister(struct bt_bap *bap, unsigned int id)
> +{
> + struct bt_bap_bis_cb *bis_cb;
> +
> + if (!bap)
> + return false;
> +
> + bis_cb = queue_remove_if(bap->bis_cbs, match_bis_cb_id,
> + UINT_TO_PTR(id));
> + if (!bis_cb)
> + return false;
> +
> + bap_bis_cb_free(bis_cb);
> +
> + return false;
> +}
> +
> +void bt_bap_bis_probe(struct bt_bap *bap, uint8_t bis, uint8_t sgrp,
> + struct iovec *caps, struct iovec *meta, struct bt_bap_qos *qos)
> +{
> + const struct queue_entry *entry;
> +
> + for (entry = queue_get_entries(bap->bis_cbs); entry;
> + entry = entry->next) {
> + struct bt_bap_bis_cb *cb = entry->data;
> +
> + if (cb->probe)
> + cb->probe(bis, sgrp, caps, meta, qos, cb->data);
It is probably a good idea to take a reference before the for loop to
prevent bap instance from being destroyed by the callbacks if they
drop the reference to 0, also you may need to move the entry =
entry->next before the calling the cb since it may also call
unregister.
> + }
> +}
> +
> +void bt_bap_bis_remove(struct bt_bap *bap)
> +{
> + const struct queue_entry *entry;
> +
> + for (entry = queue_get_entries(bap->bis_cbs); entry;
> + entry = entry->next) {
> + struct bt_bap_bis_cb *cb = entry->data;
> +
> + if (cb->remove)
> + cb->remove(bap, cb->data);
> + }
> +}
> +
> const char *bt_bap_stream_statestr(uint8_t state)
> {
> switch (state) {
> diff --git a/src/shared/bap.h b/src/shared/bap.h
> index 200dc8f13..adb531b4c 100644
> --- a/src/shared/bap.h
> +++ b/src/shared/bap.h
> @@ -4,7 +4,7 @@
> * BlueZ - Bluetooth protocol stack for Linux
> *
> * Copyright (C) 2022 Intel Corporation. All rights reserved.
> - * Copyright 2023-2024 NXP
> + * Copyright 2023-2025 NXP
> *
> */
>
> @@ -269,3 +269,13 @@ bool bt_bap_parse_base(struct iovec *base,
> bt_bap_bis_func_t handler,
> void *user_data);
>
> +unsigned int bt_bap_bis_cb_register(struct bt_bap *bap,
> + bt_bap_bis_func_t probe,
> + bt_bap_func_t remove,
> + void *user_data,
> + bt_bap_destroy_func_t destroy);
> +bool bt_bap_bis_cb_unregister(struct bt_bap *bap, unsigned int id);
> +
> +void bt_bap_bis_probe(struct bt_bap *bap, uint8_t bis, uint8_t sgrp,
> + struct iovec *caps, struct iovec *meta, struct bt_bap_qos *qos);
> +void bt_bap_bis_remove(struct bt_bap *bap);
> --
> 2.43.0
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH BlueZ 2/3] bass: Create BASS session with Broadcasters
2025-02-25 8:44 [PATCH BlueZ 0/3] bass: Register bis probe/remove callbacks Iulia Tanasescu
2025-02-25 8:44 ` [PATCH BlueZ 1/3] shared/bap: Add support to register bis callbacks Iulia Tanasescu
@ 2025-02-25 8:44 ` Iulia Tanasescu
2025-02-25 8:44 ` [PATCH BlueZ 3/3] bass: Register bis probe/remove callbacks Iulia Tanasescu
2 siblings, 0 replies; 7+ messages in thread
From: Iulia Tanasescu @ 2025-02-25 8:44 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
luiz.dentz, Iulia Tanasescu
In the BASS plugin, BAP sessions created with scanned Broadcasters are
notified in the bap attached callback. This creates BASS data for these
devices as well, to internally keep information about the sessions.
---
profiles/audio/bass.c | 42 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c
index 67ee847b8..96e767744 100644
--- a/profiles/audio/bass.c
+++ b/profiles/audio/bass.c
@@ -137,6 +137,10 @@ static struct queue *delegators;
static const char *state2str(enum assistant_state state);
+static struct bass_data *bass_data_new(struct btd_device *device);
+static void bass_data_add(struct bass_data *data);
+static void bass_data_remove(struct bass_data *data);
+
static void bass_debug(const char *str, void *user_data)
{
DBG_IDX(0xffff, "%s", str);
@@ -560,9 +564,11 @@ static void confirm_cb(GIOChannel *io, void *user_data)
static void bap_attached(struct bt_bap *bap, void *user_data)
{
struct btd_service *service;
+ struct btd_profile *p;
struct btd_device *device;
struct btd_adapter *adapter;
struct bass_delegator *dg;
+ struct bass_data *data;
GError *err = NULL;
DBG("%p", bap);
@@ -571,9 +577,22 @@ static void bap_attached(struct bt_bap *bap, void *user_data)
if (!service)
return;
+ p = btd_service_get_profile(service);
+ if (!p)
+ return;
+
+ /* Only handle sessions with Broadcast Sources */
+ if (!g_str_equal(p->remote_uuid, BCAAS_UUID_STR))
+ return;
+
device = btd_service_get_device(service);
adapter = device_get_adapter(device);
+ /* Create BASS session with the Broadcast Source */
+ data = bass_data_new(device);
+
+ bass_data_add(data);
+
dg = queue_find(delegators, delegator_match_device, device);
if (!dg)
/* Only probe devices added via Broadcast Assistants */
@@ -625,11 +644,21 @@ static void setup_free(void *data)
bt_bass_clear_bis_sync(setup->dg->src, setup->bis);
}
+static bool match_device(const void *data, const void *match_data)
+{
+ const struct bass_data *bdata = data;
+ const struct btd_device *device = match_data;
+
+ return bdata->device == device;
+}
+
static void bap_detached(struct bt_bap *bap, void *user_data)
{
struct btd_service *service;
+ struct btd_profile *p;
struct btd_device *device;
struct bass_delegator *dg;
+ struct bass_data *data;
DBG("%p", bap);
@@ -637,8 +666,21 @@ static void bap_detached(struct bt_bap *bap, void *user_data)
if (!service)
return;
+ p = btd_service_get_profile(service);
+ if (!p)
+ return;
+
+ /* Only handle sessions with Broadcast Sources */
+ if (!g_str_equal(p->remote_uuid, BCAAS_UUID_STR))
+ return;
+
device = btd_service_get_device(service);
+ /* Remove BASS session with the Broadcast Source device */
+ data = queue_find(sessions, match_device, device);
+ if (data)
+ bass_data_remove(data);
+
dg = queue_remove_if(delegators, delegator_match_device, device);
if (!dg)
return;
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH BlueZ 3/3] bass: Register bis probe/remove callbacks
2025-02-25 8:44 [PATCH BlueZ 0/3] bass: Register bis probe/remove callbacks Iulia Tanasescu
2025-02-25 8:44 ` [PATCH BlueZ 1/3] shared/bap: Add support to register bis callbacks Iulia Tanasescu
2025-02-25 8:44 ` [PATCH BlueZ 2/3] bass: Create BASS session with Broadcasters Iulia Tanasescu
@ 2025-02-25 8:44 ` Iulia Tanasescu
2 siblings, 0 replies; 7+ messages in thread
From: Iulia Tanasescu @ 2025-02-25 8:44 UTC (permalink / raw)
To: linux-bluetooth
Cc: claudia.rosu, mihai-octavian.urzica, andrei.istodorescu,
luiz.dentz, Iulia Tanasescu
This removes the BASS add/remove stream APIs and uses shared/bap to
register BIS probe/remove callbacks instead, to avoid making direct
calls between plugins.
---
profiles/audio/bap.c | 6 +++---
profiles/audio/bass.c | 22 +++++++++++++++++-----
profiles/audio/bass.h | 5 -----
3 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/profiles/audio/bap.c b/profiles/audio/bap.c
index b36e45ea4..37168e58c 100644
--- a/profiles/audio/bap.c
+++ b/profiles/audio/bap.c
@@ -1178,7 +1178,7 @@ static void bis_handler(uint8_t bis, uint8_t sgrp, struct iovec *caps,
struct bt_bap_pac *lpac;
char *path;
- bass_add_stream(data->device, meta, caps, qos, sgrp, bis);
+ bt_bap_bis_probe(data->bap, bis, sgrp, caps, meta, qos);
/* Check if this BIS matches any local PAC */
bt_bap_verify_bis(data->bap, bis,
@@ -3128,9 +3128,9 @@ static void bap_bcast_remove(struct btd_service *service)
return;
}
- bap_data_remove(data);
+ bt_bap_bis_remove(data->bap);
- bass_remove_stream(device);
+ bap_data_remove(data);
}
static int bap_probe(struct btd_service *service)
diff --git a/profiles/audio/bass.c b/profiles/audio/bass.c
index 96e767744..f5fe60652 100644
--- a/profiles/audio/bass.c
+++ b/profiles/audio/bass.c
@@ -86,6 +86,7 @@ struct bass_data {
struct bt_bass *bass;
unsigned int src_id;
unsigned int cp_id;
+ unsigned int bis_id;
};
struct bass_assistant {
@@ -141,6 +142,11 @@ static struct bass_data *bass_data_new(struct btd_device *device);
static void bass_data_add(struct bass_data *data);
static void bass_data_remove(struct bass_data *data);
+static void bis_probe(uint8_t bis, uint8_t sgrp, struct iovec *caps,
+ struct iovec *meta, struct bt_bap_qos *qos, void *user_data);
+static void bis_remove(struct bt_bap *bap, void *user_data);
+
+
static void bass_debug(const char *str, void *user_data)
{
DBG_IDX(0xffff, "%s", str);
@@ -590,6 +596,8 @@ static void bap_attached(struct bt_bap *bap, void *user_data)
/* Create BASS session with the Broadcast Source */
data = bass_data_new(device);
+ data->bis_id = bt_bap_bis_cb_register(bap, bis_probe,
+ bis_remove, device, NULL);
bass_data_add(data);
@@ -678,8 +686,10 @@ static void bap_detached(struct bt_bap *bap, void *user_data)
/* Remove BASS session with the Broadcast Source device */
data = queue_find(sessions, match_device, device);
- if (data)
+ if (data) {
+ bt_bap_bis_cb_unregister(bap, data->bis_id);
bass_data_remove(data);
+ }
dg = queue_remove_if(delegators, delegator_match_device, device);
if (!dg)
@@ -1077,10 +1087,10 @@ static struct bass_assistant *assistant_new(struct btd_adapter *adapter,
return assistant;
}
-void bass_add_stream(struct btd_device *device, struct iovec *meta,
- struct iovec *caps, struct bt_bap_qos *qos,
- uint8_t sgrp, uint8_t bis)
+static void bis_probe(uint8_t bis, uint8_t sgrp, struct iovec *caps,
+ struct iovec *meta, struct bt_bap_qos *qos, void *user_data)
{
+ struct btd_device *device = user_data;
const struct queue_entry *entry;
struct bt_bap *bap;
struct bt_bap_pac *pac;
@@ -1142,8 +1152,10 @@ static void unregister_assistant(void *data)
assistant->path, MEDIA_ASSISTANT_INTERFACE);
}
-void bass_remove_stream(struct btd_device *device)
+static void bis_remove(struct bt_bap *bap, void *user_data)
{
+ struct btd_device *device = user_data;
+
queue_remove_all(assistants, assistant_match_device,
device, unregister_assistant);
}
diff --git a/profiles/audio/bass.h b/profiles/audio/bass.h
index 99b755259..42a2c047f 100644
--- a/profiles/audio/bass.h
+++ b/profiles/audio/bass.h
@@ -7,11 +7,6 @@
*
*/
-void bass_add_stream(struct btd_device *device, struct iovec *meta,
- struct iovec *caps, struct bt_bap_qos *qos,
- uint8_t sgrp, uint8_t bis);
-void bass_remove_stream(struct btd_device *device);
-
typedef void (*bt_bass_bcode_func_t)(void *user_data, int err);
void bass_req_bcode(struct bt_bap_stream *stream,
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread