[PATCH BlueZ 5/7] shared/bap: Check the state of all the streams with the same BIG ID

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a function to check the state of all the streams with the same BIG ID

---
 src/shared/bap.c | 26 ++++++++++++++++++++++++++
 src/shared/bap.h |  2 ++
 2 files changed, 28 insertions(+)

diff --git a/src/shared/bap.c b/src/shared/bap.c
index a4c6a1bcd..244bd8c4e 100644
--- a/src/shared/bap.c
+++ b/src/shared/bap.c
@@ -5884,3 +5884,29 @@ struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream)
 
 	return base_iov;
 }
+
+/*
+ * Check the state of all streams with the same BIG ID.
+ * If all these streams are in the checked state, return true.
+ * Else, return false.
+ */
+bool bt_bap_test_bcast_streams_state(struct bt_bap_stream *stream,
+						uint8_t test_state)
+{
+	const struct queue_entry *entry;
+	struct bt_bap_stream *e_str;
+
+	for (entry = queue_get_entries(stream->bap->streams);
+				entry; entry = entry->next) {
+		e_str = entry->data;
+
+		if ((e_str == stream) ||
+			(e_str->qos.bcast.big != stream->qos.bcast.big))
+			continue;
+
+		if (e_str->ep->state != test_state)
+			return false;
+	}
+
+	return true;
+}
diff --git a/src/shared/bap.h b/src/shared/bap.h
index 2c3550921..9d46c5ad4 100644
--- a/src/shared/bap.h
+++ b/src/shared/bap.h
@@ -323,3 +323,5 @@ void bt_bap_update_bcast_source(struct bt_bap_pac *pac,
 bool bt_bap_pac_bcast_is_local(struct bt_bap *bap, struct bt_bap_pac *pac);
 
 struct iovec *bt_bap_stream_get_base(struct bt_bap_stream *stream);
+bool bt_bap_test_bcast_streams_state(struct bt_bap_stream *stream,
+						uint8_t test_state);
-- 
2.39.2





[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux