diff mbox series

[BlueZ,4/7] shared/bass: Call cp handler for the Set Broadcast Code op

Message ID 20241008080126.48703-5-iulia.tanasescu@nxp.com
State New
Headers show
Series Add Scan Delegator support for Set Broadcast Code op | expand

Commit Message

Iulia Tanasescu Oct. 8, 2024, 8:01 a.m. UTC
This updates the Set Broadcast Code control point handler inside
shared/bass to call the handlers queued inside bt_bass.
---
 src/shared/bass.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/shared/bass.c b/src/shared/bass.c
index 9ee13bf4a..6efacb2da 100644
--- a/src/shared/bass.c
+++ b/src/shared/bass.c
@@ -944,6 +944,8 @@  static void bass_handle_set_bcast_code_op(struct bt_bass *bass,
 	struct bt_bass_set_bcast_code_params *params;
 	struct bt_bcast_src *bcast_src;
 	struct iovec *notif;
+	const struct queue_entry *entry;
+	int ret;
 
 	/* Get Set Broadcast Code command parameters */
 	params = util_iov_pull_mem(iov, sizeof(*params));
@@ -978,7 +980,19 @@  static void bass_handle_set_bcast_code_op(struct bt_bass *bass,
 		return;
 	}
 
-	/* TODO: Call BASS plugin callback to sync with required BIS */
+	for (entry = queue_get_entries(bass->cp_handlers); entry;
+						entry = entry->next) {
+		struct bt_bass_cp_handler *cb = entry->data;
+
+		if (cb->handler) {
+			ret = cb->handler(bcast_src,
+					BT_BASS_SET_BCAST_CODE,
+					params, cb->data);
+			if (ret)
+				DBG(bass, "Unable to handle Set "
+						"Broadcast Code operation");
+		}
+	}
 }
 
 #define BASS_OP(_str, _op, _size, _func) \