diff mbox series

[BlueZ,v2,4/6] shared/bap: Add Broadcast QOS copy functions

Message ID 20240209164630.92208-5-andrei.istodorescu@nxp.com
State Superseded
Headers show
Series Update Sink BASE management | expand

Commit Message

Andrei Istodorescu Feb. 9, 2024, 4:46 p.m. UTC
BAP works with bt_bap_qos structures and kernel with bt_iso_qos. These
functions are utilitary functions to allow jumping easily from one
structure to another.
---
 src/shared/bap.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
 src/shared/bap.h |  4 ++++
 2 files changed, 48 insertions(+)
diff mbox series

Patch

diff --git a/src/shared/bap.c b/src/shared/bap.c
index d205632b3c80..b88fc60842a3 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -6527,3 +6527,47 @@  void bt_bap_parse_bis(void *data, void *user_data)
 	queue_foreach(subgroup->bises, bis_to_pac, subgroup);
 	cleanup_subgroup(subgroup);
 }
+
+void bt_bap_bcast_qos_iso_to_bap(struct bt_bap_qos *bap_qos,
+		struct bt_iso_qos *iso_qos)
+{
+	bap_qos->bcast.big = iso_qos->bcast.big;
+	bap_qos->bcast.bis = iso_qos->bcast.bis;
+	bap_qos->bcast.sync_factor = iso_qos->bcast.sync_factor;
+	bap_qos->bcast.packing = iso_qos->bcast.packing;
+	bap_qos->bcast.framing = iso_qos->bcast.framing;
+	bap_qos->bcast.encryption = iso_qos->bcast.encryption;
+	if (bap_qos->bcast.bcode && bap_qos->bcast.bcode->iov_base)
+		memcpy(bap_qos->bcast.bcode->iov_base, iso_qos->bcast.bcode,
+				bap_qos->bcast.bcode->iov_len);
+	bap_qos->bcast.options = iso_qos->bcast.options;
+	bap_qos->bcast.skip = iso_qos->bcast.skip;
+	bap_qos->bcast.sync_timeout = iso_qos->bcast.sync_timeout;
+	bap_qos->bcast.sync_cte_type = iso_qos->bcast.sync_cte_type;
+	bap_qos->bcast.mse = iso_qos->bcast.mse;
+	bap_qos->bcast.timeout = iso_qos->bcast.timeout;
+	memcpy(&bap_qos->bcast.io_qos, &iso_qos->bcast.out,
+			sizeof(struct bt_iso_io_qos));
+}
+
+void bt_bap_bcast_qos_bap_to_iso(struct bt_iso_qos *iso_qos,
+		struct bt_bap_qos *bap_qos)
+{
+	iso_qos->bcast.big = bap_qos->bcast.big;
+	iso_qos->bcast.bis = bap_qos->bcast.bis;
+	iso_qos->bcast.sync_factor = bap_qos->bcast.sync_factor;
+	iso_qos->bcast.packing = bap_qos->bcast.packing;
+	iso_qos->bcast.framing = bap_qos->bcast.framing;
+	iso_qos->bcast.encryption = bap_qos->bcast.encryption;
+	if (bap_qos->bcast.bcode && bap_qos->bcast.bcode->iov_base)
+		memcpy(iso_qos->bcast.bcode, bap_qos->bcast.bcode->iov_base,
+				bap_qos->bcast.bcode->iov_len);
+	iso_qos->bcast.options = bap_qos->bcast.options;
+	iso_qos->bcast.skip = bap_qos->bcast.skip;
+	iso_qos->bcast.sync_timeout = bap_qos->bcast.sync_timeout;
+	iso_qos->bcast.sync_cte_type = bap_qos->bcast.sync_cte_type;
+	iso_qos->bcast.mse = bap_qos->bcast.mse;
+	iso_qos->bcast.timeout = bap_qos->bcast.timeout;
+	memcpy(&iso_qos->bcast.out, &bap_qos->bcast.io_qos,
+			sizeof(struct bt_iso_io_qos));
+}
diff --git a/src/shared/bap.h b/src/shared/bap.h
index aed3bf52b8d9..968257651766 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -354,4 +354,8 @@  struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream);
 bool bt_bap_parse_base(struct bt_bap *bap, void *data, size_t len,
 		util_debug_func_t func, struct bt_bap_base *base);
 void bt_bap_parse_bis(void *data, void *user_data);
+void bt_bap_bcast_qos_iso_to_bap(struct bt_bap_qos *bap_qos,
+		struct bt_iso_qos *iso_qos);
+void bt_bap_bcast_qos_bap_to_iso(struct bt_iso_qos *iso_qos,
+		struct bt_bap_qos *bap_qos);