Skip to content

Commit

Permalink
bluetooth: tester: Add support for BASS
Browse files Browse the repository at this point in the history
Support for BAP/BASS and BASS test cases.

Signed-off-by: Magdalena Kasenberg <[email protected]>
  • Loading branch information
mkasenberg committed Nov 14, 2023
1 parent c248a91 commit 9c8ae2c
Showing 1 changed file with 9 additions and 28 deletions.
37 changes: 9 additions & 28 deletions tests/bluetooth/tester/src/btp_bap.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,8 @@ static void btp_send_ascs_operation_completed_ev(struct bt_conn *conn, uint8_t a
uint8_t opcode, uint8_t status)
{
struct btp_ascs_operation_completed_ev ev;
struct bt_conn_info info;

(void)bt_conn_get_info(conn, &info);
bt_addr_le_copy(&ev.address, info.le.dst);
bt_addr_le_copy(&ev.address, bt_conn_get_dst(conn));
ev.ase_id = ase_id;
ev.opcode = opcode;
ev.status = status;
Expand All @@ -261,10 +259,8 @@ static void btp_send_ascs_operation_completed_ev(struct bt_conn *conn, uint8_t a
static void btp_send_ascs_ase_state_changed_ev(struct bt_conn *conn, uint8_t ase_id, uint8_t state)
{
struct btp_ascs_ase_state_changed_ev ev;
struct bt_conn_info info;

(void)bt_conn_get_info(conn, &info);
bt_addr_le_copy(&ev.address, info.le.dst);
bt_addr_le_copy(&ev.address, bt_conn_get_dst(conn));
ev.ase_id = ase_id;
ev.state = state;

Expand Down Expand Up @@ -496,18 +492,15 @@ static void btp_send_stream_received_ev(struct bt_conn *conn, struct bt_bap_ep *
uint8_t data_len, uint8_t *data)
{
struct btp_bap_stream_received_ev *ev;
struct bt_conn_info info;

LOG_DBG("Stream received, ep %d, dir %d, len %d", ep->status.id, ep->dir,
data_len);

(void)bt_conn_get_info(conn, &info);

net_buf_simple_init(rx_ev_buf, 0);

ev = net_buf_simple_add(rx_ev_buf, sizeof(*ev));

bt_addr_le_copy(&ev->address, info.le.dst);
bt_addr_le_copy(&ev->address, bt_conn_get_dst(conn));

ev->ase_id = ep->status.id;
ev->data_len = data_len;
Expand Down Expand Up @@ -759,10 +752,8 @@ static struct bt_bap_stream_ops stream_ops = {
static void btp_send_discovery_completed_ev(struct bt_conn *conn, uint8_t status)
{
struct btp_bap_discovery_completed_ev ev;
struct bt_conn_info info;

(void) bt_conn_get_info(conn, &info);
bt_addr_le_copy(&ev.address, info.le.dst);
bt_addr_le_copy(&ev.address, bt_conn_get_dst(conn));
ev.status = status;

tester_event(BTP_SERVICE_ID_BAP, BTP_BAP_EV_DISCOVERY_COMPLETED, &ev, sizeof(ev));
Expand Down Expand Up @@ -819,11 +810,9 @@ static void btp_send_pac_codec_found_ev(struct bt_conn *conn,
enum bt_audio_dir dir)
{
struct btp_bap_codec_cap_found_ev ev;
struct bt_conn_info info;
const uint8_t *data;

(void)bt_conn_get_info(conn, &info);
bt_addr_le_copy(&ev.address, info.le.dst);
bt_addr_le_copy(&ev.address, bt_conn_get_dst(conn));

ev.dir = dir;
ev.coding_format = codec_cap->id;
Expand All @@ -850,10 +839,8 @@ static void btp_send_pac_codec_found_ev(struct bt_conn *conn,
static void btp_send_ase_found_ev(struct bt_conn *conn, struct bt_bap_ep *ep)
{
struct btp_ascs_ase_found_ev ev;
struct bt_conn_info info;

(void)bt_conn_get_info(conn, &info);
bt_addr_le_copy(&ev.address, info.le.dst);
bt_addr_le_copy(&ev.address, bt_conn_get_dst(conn));

ev.ase_id = ep->status.id;
ev.dir = ep->dir;
Expand Down Expand Up @@ -1639,10 +1626,8 @@ static void btp_send_pas_sync_req_ev(struct bt_conn *conn, uint8_t src_id,
bool past_avail, uint16_t pa_interval)
{
struct btp_bap_pa_sync_req_ev ev;
struct bt_conn_info info;

(void)bt_conn_get_info(conn, &info);
bt_addr_le_copy(&ev.address, info.le.dst);
bt_addr_le_copy(&ev.address, bt_conn_get_dst(conn));
ev.src_id = src_id;
ev.advertiser_sid = advertiser_sid;
sys_put_le24(broadcast_id, ev.broadcast_id);
Expand All @@ -1655,10 +1640,8 @@ static void btp_send_pas_sync_req_ev(struct bt_conn *conn, uint8_t src_id,
static void btp_send_scan_delegator_found_ev(struct bt_conn *conn)
{
struct btp_bap_scan_delegator_found_ev ev;
struct bt_conn_info info;

(void)bt_conn_get_info(conn, &info);
bt_addr_le_copy(&ev.address, info.le.dst);
bt_addr_le_copy(&ev.address, bt_conn_get_dst(conn));

tester_event(BTP_SERVICE_ID_BAP, BTP_BAP_EV_SCAN_DELEGATOR_FOUND, &ev, sizeof(ev));
}
Expand All @@ -1667,7 +1650,6 @@ static void btp_send_broadcast_receive_state_ev(struct bt_conn *conn,
const struct bt_bap_scan_delegator_recv_state *state)
{
struct btp_bap_broadcast_receive_state_ev *ev;
struct bt_conn_info info;
size_t len;
uint8_t *ptr;

Expand All @@ -1676,8 +1658,7 @@ static void btp_send_broadcast_receive_state_ev(struct bt_conn *conn,
sizeof(struct bt_bap_scan_delegator_subgroup), (uint8_t **)&ev);

if (conn) {
(void)bt_conn_get_info(conn, &info);
bt_addr_le_copy(&ev->address, info.le.dst);
bt_addr_le_copy(&ev->address, bt_conn_get_dst(conn));
} else {
(void)memset(&ev->address, 0, sizeof(ev->address));
}
Expand Down

0 comments on commit 9c8ae2c

Please sign in to comment.