diff mbox series

[BlueZ,12/14] shared/bass: Add API to check BIS required for sync

Message ID 20240821145602.92083-13-iulia.tanasescu@nxp.com
State Superseded
Headers show
Series Add Scan Delegator support for Add Source op | expand

Commit Message

Iulia Tanasescu Aug. 21, 2024, 2:56 p.m. UTC
This adds a shared/bass API to check if a BIS index of a Broadcast Source
has been requested by the Broadcast Assistant to be synced with. This will
be used by BAP after parsing the BASE, to filter out the streams that don't
need to be created.
---
 src/shared/bass.c | 14 ++++++++++++++
 src/shared/bass.h |  1 +
 2 files changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/src/shared/bass.c b/src/shared/bass.c
index 8f02086a1..76287cfbc 100644
--- a/src/shared/bass.c
+++ b/src/shared/bass.c
@@ -1818,3 +1818,17 @@  int bt_bass_clear_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis)
 
 	return 0;
 }
+
+bool bt_bass_check_bis(struct bt_bcast_src *bcast_src, uint8_t bis)
+{
+	for (uint8_t i = 0; i < bcast_src->num_subgroups; i++) {
+		struct bt_bass_subgroup_data *sgrp =
+				&bcast_src->subgroup_data[i];
+		uint32_t bitmask = 1 << (bis - 1);
+
+		if (sgrp->pending_bis_sync & bitmask)
+			return true;
+	}
+
+	return false;
+}
diff --git a/src/shared/bass.h b/src/shared/bass.h
index f3f708246..b21256efd 100644
--- a/src/shared/bass.h
+++ b/src/shared/bass.h
@@ -132,3 +132,4 @@  bool bt_bass_cp_handler_unregister(struct bt_bass *bass,
 int bt_bass_set_pa_sync(struct bt_bcast_src *bcast_src, uint8_t sync_state);
 int bt_bass_set_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis);
 int bt_bass_clear_bis_sync(struct bt_bcast_src *bcast_src, uint8_t bis);
+bool bt_bass_check_bis(struct bt_bcast_src *bcast_src, uint8_t bis);