1 /* btp_bap.h - Bluetooth tester headers */ 2 3 /* 4 * Copyright (c) 2023 Codecoup 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 #include <zephyr/bluetooth/audio/audio.h> 10 11 /* BAP commands */ 12 #define BTP_BAP_READ_SUPPORTED_COMMANDS 0x01 13 struct btp_bap_read_supported_commands_rp { 14 uint8_t data[0]; 15 } __packed; 16 17 #define BTP_BAP_DISCOVER 0x02 18 struct btp_bap_discover_cmd { 19 bt_addr_le_t address; 20 } __packed; 21 22 #define BTP_BAP_DISCOVERY_STATUS_SUCCESS 0x00 23 #define BTP_BAP_DISCOVERY_STATUS_FAILED 0x01 24 25 #define BTP_BAP_SEND 0x03 26 struct btp_bap_send_cmd { 27 bt_addr_le_t address; 28 uint8_t ase_id; 29 uint8_t data_len; 30 uint8_t data[0]; 31 } __packed; 32 33 struct btp_bap_send_rp { 34 uint8_t data_len; 35 } __packed; 36 37 #define BTP_BAP_BROADCAST_SOURCE_SETUP 0x04 38 struct btp_bap_broadcast_source_setup_cmd { 39 uint8_t streams_per_subgroup; 40 uint8_t subgroups; 41 uint8_t sdu_interval[3]; 42 uint8_t framing; 43 uint16_t max_sdu; 44 uint8_t retransmission_num; 45 uint16_t max_transport_latency; 46 uint8_t presentation_delay[3]; 47 uint8_t coding_format; 48 uint16_t vid; 49 uint16_t cid; 50 uint8_t cc_ltvs_len; 51 uint8_t cc_ltvs[]; 52 } __packed; 53 struct btp_bap_broadcast_source_setup_rp { 54 uint32_t gap_settings; 55 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 56 } __packed; 57 58 #define BTP_BAP_BROADCAST_SOURCE_RELEASE 0x05 59 struct btp_bap_broadcast_source_release_cmd { 60 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 61 } __packed; 62 63 #define BTP_BAP_BROADCAST_ADV_START 0x06 64 struct btp_bap_broadcast_adv_start_cmd { 65 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 66 } __packed; 67 68 #define BTP_BAP_BROADCAST_ADV_STOP 0x07 69 struct btp_bap_broadcast_adv_stop_cmd { 70 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 71 } __packed; 72 73 #define BTP_BAP_BROADCAST_SOURCE_START 0x08 74 struct btp_bap_broadcast_source_start_cmd { 75 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 76 } __packed; 77 78 #define BTP_BAP_BROADCAST_SOURCE_STOP 0x09 79 struct btp_bap_broadcast_source_stop_cmd { 80 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 81 } __packed; 82 83 #define BTP_BAP_BROADCAST_SINK_SETUP 0x0a 84 struct btp_bap_broadcast_sink_setup_cmd { 85 } __packed; 86 87 #define BTP_BAP_BROADCAST_SINK_RELEASE 0x0b 88 struct btp_bap_broadcast_sink_release_cmd { 89 } __packed; 90 91 #define BTP_BAP_BROADCAST_SCAN_START 0x0c 92 struct btp_bap_broadcast_scan_start_cmd { 93 } __packed; 94 95 #define BTP_BAP_BROADCAST_SCAN_STOP 0x0d 96 struct btp_bap_broadcast_scan_stop_cmd { 97 } __packed; 98 99 #define BTP_BAP_BROADCAST_SINK_SYNC 0x0e 100 struct btp_bap_broadcast_sink_sync_cmd { 101 bt_addr_le_t address; 102 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 103 uint8_t advertiser_sid; 104 uint16_t skip; 105 uint16_t sync_timeout; 106 uint8_t past_avail; 107 uint8_t src_id; 108 } __packed; 109 110 #define BTP_BAP_BROADCAST_SINK_STOP 0x0f 111 struct btp_bap_broadcast_sink_stop_cmd { 112 bt_addr_le_t address; 113 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 114 } __packed; 115 116 #define BTP_BAP_BROADCAST_SINK_BIS_SYNC 0x10 117 struct btp_bap_broadcast_sink_bis_sync_cmd { 118 bt_addr_le_t address; 119 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 120 uint32_t requested_bis_sync; 121 } __packed; 122 123 #define BTP_BAP_DISCOVER_SCAN_DELEGATORS 0x11 124 struct btp_bap_discover_scan_delegators_cmd { 125 bt_addr_le_t address; 126 } __packed; 127 128 #define BTP_BAP_BROADCAST_ASSISTANT_SCAN_START 0x12 129 struct btp_bap_broadcast_assistant_scan_start_cmd { 130 bt_addr_le_t address; 131 } __packed; 132 133 #define BTP_BAP_BROADCAST_ASSISTANT_SCAN_STOP 0x13 134 struct btp_bap_broadcast_assistant_scan_stop_cmd { 135 bt_addr_le_t address; 136 } __packed; 137 138 #define BTP_BAP_ADD_BROADCAST_SRC 0x14 139 struct btp_bap_add_broadcast_src_cmd { 140 bt_addr_le_t address; 141 bt_addr_le_t broadcaster_address; 142 uint8_t advertiser_sid; 143 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 144 uint8_t padv_sync; 145 uint16_t padv_interval; 146 uint8_t num_subgroups; 147 uint8_t subgroups[0]; 148 } __packed; 149 150 #define BTP_BAP_REMOVE_BROADCAST_SRC 0x15 151 struct btp_bap_remove_broadcast_src_cmd { 152 bt_addr_le_t address; 153 uint8_t src_id; 154 } __packed; 155 156 #define BTP_BAP_MODIFY_BROADCAST_SRC 0x16 157 struct btp_bap_modify_broadcast_src_cmd { 158 bt_addr_le_t address; 159 uint8_t src_id; 160 uint8_t padv_sync; 161 uint16_t padv_interval; 162 uint8_t num_subgroups; 163 uint8_t subgroups[0]; 164 } __packed; 165 166 #define BTP_BAP_SET_BROADCAST_CODE 0x17 167 struct btp_bap_set_broadcast_code_cmd { 168 bt_addr_le_t address; 169 uint8_t src_id; 170 uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; 171 } __packed; 172 173 #define BTP_BAP_SEND_PAST 0x18 174 struct btp_bap_send_past_cmd { 175 bt_addr_le_t address; 176 uint8_t src_id; 177 } __packed; 178 179 /* BAP events */ 180 #define BTP_BAP_EV_DISCOVERY_COMPLETED 0x80 181 struct btp_bap_discovery_completed_ev { 182 bt_addr_le_t address; 183 uint8_t status; 184 } __packed; 185 186 #define BTP_BAP_EV_CODEC_CAP_FOUND 0x81 187 struct btp_bap_codec_cap_found_ev { 188 bt_addr_le_t address; 189 uint8_t dir; 190 uint8_t coding_format; 191 uint16_t frequencies; 192 uint8_t frame_durations; 193 uint32_t octets_per_frame; 194 uint8_t channel_counts; 195 } __packed; 196 197 #define BTP_BAP_EV_ASE_FOUND 0x82 198 struct btp_ascs_ase_found_ev { 199 bt_addr_le_t address; 200 uint8_t dir; 201 uint8_t ase_id; 202 } __packed; 203 204 #define BTP_BAP_EV_STREAM_RECEIVED 0x83 205 struct btp_bap_stream_received_ev { 206 bt_addr_le_t address; 207 uint8_t ase_id; 208 uint8_t data_len; 209 uint8_t data[]; 210 } __packed; 211 212 #define BTP_BAP_EV_BAA_FOUND 0x84 213 struct btp_bap_baa_found_ev { 214 bt_addr_le_t address; 215 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 216 uint8_t advertiser_sid; 217 uint16_t padv_interval; 218 } __packed; 219 220 #define BTP_BAP_EV_BIS_FOUND 0x85 221 struct btp_bap_bis_found_ev { 222 bt_addr_le_t address; 223 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 224 uint8_t presentation_delay[3]; 225 uint8_t subgroup_id; 226 uint8_t bis_id; 227 uint8_t coding_format; 228 uint16_t vid; 229 uint16_t cid; 230 uint8_t cc_ltvs_len; 231 uint8_t cc_ltvs[]; 232 } __packed; 233 234 #define BTP_BAP_EV_BIS_SYNCED 0x86 235 struct btp_bap_bis_syned_ev { 236 bt_addr_le_t address; 237 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 238 uint8_t bis_id; 239 } __packed; 240 241 #define BTP_BAP_EV_BIS_STREAM_RECEIVED 0x87 242 struct btp_bap_bis_stream_received_ev { 243 bt_addr_le_t address; 244 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 245 uint8_t bis_id; 246 uint8_t data_len; 247 uint8_t data[]; 248 } __packed; 249 250 #define BTP_BAP_EV_SCAN_DELEGATOR_FOUND 0x88 251 struct btp_bap_scan_delegator_found_ev { 252 bt_addr_le_t address; 253 } __packed; 254 255 #define BTP_BAP_EV_BROADCAST_RECEIVE_STATE 0x89 256 struct btp_bap_broadcast_receive_state_ev { 257 bt_addr_le_t address; 258 uint8_t src_id; 259 bt_addr_le_t broadcaster_address; 260 uint8_t advertiser_sid; 261 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 262 uint8_t pa_sync_state; 263 uint8_t big_encryption; 264 uint8_t num_subgroups; 265 uint8_t subgroups[0]; 266 } __packed; 267 268 #define BTP_BAP_EV_PA_SYNC_REQ 0x8a 269 struct btp_bap_pa_sync_req_ev { 270 bt_addr_le_t address; 271 uint8_t src_id; 272 uint8_t advertiser_sid; 273 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 274 uint8_t past_avail; 275 uint16_t pa_interval; 276 } __packed; 277