Skip to content

Commit f6cbd2f

Browse files
alexsvennashif
authored andcommitted
tests: bluetooth: tester: Start stream from connected_cb
- When we are a peripheral we want to be able to start a stream from the stream_connected_cb, given that we are in an enabling state and the stream is in the sink direction Signed-off-by: Alexander Svensen <[email protected]>
1 parent cfe2d71 commit f6cbd2f

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

tests/bluetooth/tester/src/audio/btp_bap_unicast.c

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -694,21 +694,21 @@ static void stream_started_cb(struct bt_bap_stream *stream)
694694
static void stream_connected_cb(struct bt_bap_stream *stream)
695695
{
696696
struct bt_conn_info conn_info;
697+
struct bt_bap_ep_info ep_info;
698+
int err;
697699

698700
LOG_DBG("Connected stream %p", stream);
699701

700-
(void)bt_conn_get_info(stream->conn, &conn_info);
701-
if (conn_info.role == BT_HCI_ROLE_CENTRAL) {
702-
struct bt_bap_ep_info ep_info;
703-
int err;
702+
err = bt_bap_ep_get_info(stream->ep, &ep_info);
703+
if (err != 0) {
704+
LOG_ERR("Failed to get info: %d", err);
704705

705-
err = bt_bap_ep_get_info(stream->ep, &ep_info);
706-
if (err != 0) {
707-
LOG_ERR("Failed to get info: %d", err);
706+
return;
707+
}
708708

709-
return;
710-
}
709+
(void)bt_conn_get_info(stream->conn, &conn_info);
711710

711+
if (conn_info.role == BT_HCI_ROLE_CENTRAL) {
712712
if (ep_info.dir == BT_AUDIO_DIR_SOURCE) {
713713
if (ep_info.state == BT_BAP_EP_STATE_ENABLING) {
714714
/* Automatically do the receiver start ready operation for source
@@ -728,6 +728,18 @@ static void stream_connected_cb(struct bt_bap_stream *stream)
728728
BT_ASCS_START_OP,
729729
BTP_ASCS_STATUS_SUCCESS);
730730
}
731+
} else {
732+
if (ep_info.dir == BT_AUDIO_DIR_SINK && ep_info.state == BT_BAP_EP_STATE_ENABLING) {
733+
/* Automatically do the receiver start ready operation for sink
734+
* ASEs as the server when in the enabling state.
735+
* The CIS may be connected in the QoS Configured state as well, in
736+
* which case we should wait until we enter the enabling state.
737+
*/
738+
err = bt_bap_stream_start(stream);
739+
if (err != 0) {
740+
LOG_ERR("Failed to start stream %p", stream);
741+
}
742+
}
731743
}
732744

733745
btp_send_ascs_cis_connected_ev(stream);

0 commit comments

Comments
 (0)