@@ -6126,3 +6126,40 @@ 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 the streams are in the checked state, return
+ * a queue with this streams.
+ * Else, return NULL.
+ */
+struct queue *bt_bap_get_streams_by_state(struct bt_bap_stream *stream,
+ uint8_t test_state)
+{
+ const struct queue_entry *entry;
+ struct bt_bap_stream *e_str;
+ struct queue *return_queue = queue_new();
+
+ for (entry = queue_get_entries(stream->bap->streams);
+ entry; entry = entry->next) {
+ e_str = entry->data;
+
+ if ((e_str->lpac->type != BT_BAP_BCAST_SOURCE) ||
+ (e_str->qos.bcast.big != stream->qos.bcast.big))
+ continue;
+
+ if (e_str == stream) {
+ queue_push_tail(return_queue, e_str);
+ continue;
+ }
+
+ if (e_str->ep->state != test_state) {
+ queue_destroy(return_queue, NULL);
+ return NULL;
+ }
+
+ queue_push_tail(return_queue, e_str);
+ }
+
+ return return_queue;
+}
@@ -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);
+struct queue *bt_bap_get_streams_by_state(struct bt_bap_stream *stream,
+ uint8_t test_state);