shared/bass: Add API to set BIG enc state
authorIulia Tanasescu <iulia.tanasescu@nxp.com>
Tue, 8 Oct 2024 08:01:21 +0000 (11:01 +0300)
committerWootak Jung <wootak.jung@samsung.com>
Thu, 20 Feb 2025 07:43:23 +0000 (16:43 +0900)
This adds a shared/bass API to set the BIG encryption state field inside
a Broadcast Receive State characteristic. Notifications are then sent to
inform all peers about the update.

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

index 76287cfbc76db54a17f9763405342767cc4b3b5e..9ee13bf4a59458670728514ae7af7b30403bac64 100644 (file)
@@ -1832,3 +1832,27 @@ bool bt_bass_check_bis(struct bt_bcast_src *bcast_src, uint8_t bis)
 
        return false;
 }
+
+int bt_bass_set_enc(struct bt_bcast_src *bcast_src, uint8_t enc)
+{
+       struct iovec *iov;
+
+       if (!bcast_src)
+               return -EINVAL;
+
+       if (bcast_src->enc == enc)
+               return 0;
+
+       bcast_src->enc = enc;
+
+       iov = bass_parse_bcast_src(bcast_src);
+       if (!iov)
+               return -ENOMEM;
+
+       bt_bass_notify_all(bcast_src->attr, iov);
+
+       free(iov->iov_base);
+       free(iov);
+
+       return 0;
+}
index b21256efdaeacbebb9a3ebf54e4e98eb11b1415c..d256b920d4e55d6c72ca5a7f8a69edd13ada1625 100644 (file)
@@ -133,3 +133,4 @@ 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);
+int bt_bass_set_enc(struct bt_bcast_src *bcast_src, uint8_t enc);