Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions tests/bluetooth/tester/src/audio/btp_bap_unicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -694,21 +694,21 @@ static void stream_started_cb(struct bt_bap_stream *stream)
static void stream_connected_cb(struct bt_bap_stream *stream)
{
struct bt_conn_info conn_info;
struct bt_bap_ep_info ep_info;
int err;

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

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

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

return;
}
(void)bt_conn_get_info(stream->conn, &conn_info);

if (conn_info.role == BT_HCI_ROLE_CENTRAL) {
if (ep_info.dir == BT_AUDIO_DIR_SOURCE) {
if (ep_info.state == BT_BAP_EP_STATE_ENABLING) {
/* Automatically do the receiver start ready operation for source
Expand All @@ -728,6 +728,18 @@ static void stream_connected_cb(struct bt_bap_stream *stream)
BT_ASCS_START_OP,
BTP_ASCS_STATUS_SUCCESS);
}
} else {
if (ep_info.dir == BT_AUDIO_DIR_SINK && ep_info.state == BT_BAP_EP_STATE_ENABLING) {
/* Automatically do the receiver start ready operation for sink
* ASEs as the server when in the enabling state.
* The CIS may be connected in the QoS Configured state as well, in
* which case we should wait until we enter the enabling state.
*/
err = bt_bap_stream_start(stream);
if (err != 0) {
LOG_ERR("Failed to start stream %p", stream);
}
}
}

btp_send_ascs_cis_connected_ev(stream);
Expand Down