diff mbox series

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

Message ID 20240829124918.84809-15-iulia.tanasescu@nxp.com (mailing list archive)
State Accepted
Commit 7c3821f822f8a895ccaeebf56eb4426ba677be3f
Headers show
Series Add Scan Delegator support for Add Source op | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS

Commit Message

Iulia Tanasescu Aug. 29, 2024, 12:49 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);