shared/bass: Call cp handler for the Set Broadcast Code op
authorIulia Tanasescu <iulia.tanasescu@nxp.com>
Tue, 8 Oct 2024 08:01:23 +0000 (11:01 +0300)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 20 Feb 2025 07:43:23 +0000 (16:43 +0900)
This updates the Set Broadcast Code control point handler inside
shared/bass to call the handlers queued inside bt_bass.

Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
src/shared/bass.c

index 9ee13bf4a59458670728514ae7af7b30403bac64..6efacb2dad57a2c661f7501778d5f5015f9e457d 100644 (file)
@@ -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) \