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 9, 2023
1 parent 3769938 commit ad29b38
Show file tree
Hide file tree
Showing 11 changed files with 865 additions and 48 deletions.
9 changes: 9 additions & 0 deletions tests/bluetooth/tester/overlay-le-audio.conf
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,22 @@ CONFIG_BT_BAP_BROADCAST_SOURCE=y
CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=2
CONFIG_BT_BAP_BROADCAST_SRC_SUBGROUP_COUNT=2
CONFIG_BT_ISO_TX_BUF_COUNT=4
CONFIG_BT_BAP_BROADCAST_ASSISTANT=y

# Broadcast Sink
CONFIG_BT_BAP_SCAN_DELEGATOR=y
CONFIG_BT_BAP_BROADCAST_SINK=y
CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=2
CONFIG_BT_BAP_BROADCAST_SNK_SUBGROUP_COUNT=2

# BASS
CONFIG_BT_PER_ADV_SYNC_TRANSFER_SENDER=y
CONFIG_BT_BAP_SCAN_DELEGATOR_MAX_METADATA_LEN=255
CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER=y
# BASS notifications need higher MTU
CONFIG_BT_L2CAP_TX_MTU=255
CONFIG_BT_BUF_ACL_RX_SIZE=255

# ASCS
CONFIG_BT_ASCS_ASE_SNK_COUNT=2
CONFIG_BT_ASCS_ASE_SRC_COUNT=2
Expand Down
4 changes: 3 additions & 1 deletion tests/bluetooth/tester/src/btp/btp.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "btp_pacs.h"
#include "btp_ascs.h"
#include "btp_bap.h"
#include "btp_bass.h"
#include "btp_has.h"
#include "btp_csis.h"
#include "btp_micp.h"
Expand Down Expand Up @@ -59,8 +60,9 @@
#define BTP_SERVICE_ID_CCP 19
#define BTP_SERVICE_ID_VCP 20
#define BTP_SERVICE_ID_CAS 21
#define BTP_SERVICE_ID_BASS 22

#define BTP_SERVICE_ID_MAX BTP_SERVICE_ID_CAS
#define BTP_SERVICE_ID_MAX BTP_SERVICE_ID_BASS

#define BTP_STATUS_SUCCESS 0x00
#define BTP_STATUS_FAILED 0x01
Expand Down
2 changes: 1 addition & 1 deletion tests/bluetooth/tester/src/btp/btp_ascs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* btp_bap.h - Bluetooth tester headers */
/* btp_ascs.h - Bluetooth tester headers */

/*
* Copyright (c) 2023 Codecoup
Expand Down
93 changes: 93 additions & 0 deletions tests/bluetooth/tester/src/btp/btp_bap.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ struct btp_bap_broadcast_sink_sync_cmd {
uint8_t advertiser_sid;
uint16_t skip;
uint16_t sync_timeout;
bool past_avail;
uint8_t src_id;
} __packed;

#define BTP_BAP_BROADCAST_SINK_STOP 0x0f
Expand All @@ -109,6 +111,69 @@ struct btp_bap_broadcast_sink_stop_cmd {
uint8_t broadcast_id[3];
} __packed;

#define BTP_BAP_BROADCAST_SINK_BIS_SYNC 0x10
struct btp_bap_broadcast_sink_bis_sync_cmd {
bt_addr_le_t address;
uint8_t broadcast_id[3];
uint32_t requested_bis_sync;
} __packed;

#define BTP_BAP_DISCOVER_SCAN_DELEGATORS 0x11
struct btp_bap_discover_scan_delegators_cmd {
bt_addr_le_t address;
} __packed;

#define BTP_BAP_BROADCAST_ASSISTANT_SCAN_START 0x12
struct btp_bap_broadcast_assistant_scan_start_cmd {
bt_addr_le_t address;
} __packed;

#define BTP_BAP_BROADCAST_ASSISTANT_SCAN_STOP 0x13
struct btp_bap_broadcast_assistant_scan_stop_cmd {
bt_addr_le_t address;
} __packed;

#define BTP_BAP_ADD_BROADCAST_SRC 0x14
struct btp_bap_add_broadcast_src_cmd {
bt_addr_le_t address;
bt_addr_le_t broadcaster_address;
uint8_t advertiser_sid;
uint8_t broadcast_id[3];
uint8_t padv_sync;
uint16_t padv_interval;
uint8_t num_subgroups;
uint32_t bis_sync;
} __packed;

#define BTP_BAP_REMOVE_BROADCAST_SRC 0x15
struct btp_bap_remove_broadcast_src_cmd {
bt_addr_le_t address;
uint8_t src_id;
} __packed;

#define BTP_BAP_MODIFY_BROADCAST_SRC 0x16
struct btp_bap_modify_broadcast_src_cmd {
bt_addr_le_t address;
uint8_t src_id;
uint8_t padv_sync;
uint16_t padv_interval;
uint8_t num_subgroups;
uint32_t bis_sync;
} __packed;

#define BTP_BAP_SET_BROADCAST_CODE 0x17
struct btp_bap_set_broadcast_code_cmd {
bt_addr_le_t address;
uint8_t src_id;
uint8_t broadcast_code[16];
} __packed;

#define BTP_BAP_SEND_PAST 0x18
struct btp_bap_send_past_cmd {
bt_addr_le_t address;
uint8_t src_id;
} __packed;

/* BAP events */
#define BTP_BAP_EV_DISCOVERY_COMPLETED 0x80
struct btp_bap_discovery_completed_ev {
Expand Down Expand Up @@ -179,3 +244,31 @@ struct btp_bap_bis_stream_received_ev {
uint8_t data_len;
uint8_t data[];
} __packed;

#define BTP_BAP_EV_SCAN_DELEGATOR_FOUND 0x88
struct btp_bap_scan_delegator_found_ev {
bt_addr_le_t address;
} __packed;

#define BTP_BAP_EV_BROADCAST_RECEIVE_STATE 0x89
struct btp_bap_broadcast_receive_state_ev {
bt_addr_le_t address;
uint8_t src_id;
bt_addr_le_t broadcaster_address;
uint8_t advertiser_sid;
uint8_t broadcast_id[3];
uint8_t pa_sync_state;
uint8_t big_encryption;
uint8_t num_subgroups;
uint32_t bis_sync;
} __packed;

#define BTP_BAP_EV_PA_SYNC_REQ 0x8a
struct btp_bap_pa_sync_req_ev {
bt_addr_le_t address;
uint8_t src_id;
uint8_t advertiser_sid;
uint8_t broadcast_id[3];
uint8_t past_avail;
uint16_t pa_interval;
} __packed;
13 changes: 13 additions & 0 deletions tests/bluetooth/tester/src/btp/btp_bass.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* btp_bass.h - Bluetooth tester headers */

/*
* Copyright (c) 2023 Codecoup
*
* SPDX-License-Identifier: Apache-2.0
*/

/* BASS commands */
#define BTP_BASS_READ_SUPPORTED_COMMANDS 0x01
struct btp_bass_read_supported_commands_rp {
uint8_t data[0];
} __packed;
3 changes: 2 additions & 1 deletion tests/bluetooth/tester/src/btp/btp_gap.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,5 +456,6 @@ int tester_gap_padv_configure(const struct bt_le_per_adv_param *param);
int tester_gap_padv_set_data(struct bt_data *per_ad, uint8_t ad_len);
int tester_gap_padv_start(void);
int tester_gap_padv_stop(void);
int tester_padv_create_sync(struct bt_le_per_adv_sync_param *create_params);
int tester_gap_padv_create_sync(struct bt_le_per_adv_sync_param *create_params);
int tester_gap_padv_stop_sync(void);
#endif /* defined(CONFIG_BT_EXT_ADV) */
2 changes: 1 addition & 1 deletion tests/bluetooth/tester/src/btp/btp_pacs.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* btp_bap.h - Bluetooth tester headers */
/* btp_pacs.h - Bluetooth tester headers */

/*
* Copyright (c) 2023 Codecoup
Expand Down
3 changes: 3 additions & 0 deletions tests/bluetooth/tester/src/btp/bttester.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ uint8_t tester_unregister_ascs(void);
uint8_t tester_init_bap(void);
uint8_t tester_unregister_bap(void);

uint8_t tester_init_bass(void);
uint8_t tester_unregister_bass(void);

uint8_t tester_init_has(void);
uint8_t tester_unregister_has(void);

Expand Down
Loading

0 comments on commit ad29b38

Please sign in to comment.