1 /* btp_cap.h - Bluetooth tester headers */ 2 3 /* 4 * Copyright (c) 2023 Codecoup 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 /* CAP commands */ 10 #define BTP_CAP_READ_SUPPORTED_COMMANDS 0x01 11 struct btp_cap_read_supported_commands_rp { 12 uint8_t data[0]; 13 } __packed; 14 15 #define BTP_CAP_DISCOVER 0x02 16 struct btp_cap_discover_cmd { 17 bt_addr_le_t address; 18 } __packed; 19 20 #define BTP_CAP_UNICAST_SETUP_ASE 0x03 21 struct btp_cap_unicast_setup_ase_cmd { 22 bt_addr_le_t address; 23 uint8_t ase_id; 24 uint8_t cis_id; 25 uint8_t cig_id; 26 uint8_t coding_format; 27 uint16_t vid; 28 uint16_t cid; 29 uint8_t sdu_interval[3]; 30 uint8_t framing; 31 uint16_t max_sdu; 32 uint8_t retransmission_num; 33 uint16_t max_transport_latency; 34 uint8_t presentation_delay[3]; 35 uint8_t cc_ltvs_len; 36 uint8_t metadata_ltvs_len; 37 uint8_t ltvs[0]; 38 } __packed; 39 40 #define BTP_CAP_UNICAST_AUDIO_START 0x04 41 struct btp_cap_unicast_audio_start_cmd { 42 uint8_t cig_id; 43 uint8_t set_type; 44 } __packed; 45 #define BTP_CAP_UNICAST_AUDIO_START_SET_TYPE_AD_HOC 0x00 46 #define BTP_CAP_UNICAST_AUDIO_START_SET_TYPE_CSIP 0x01 47 48 #define BTP_CAP_UNICAST_AUDIO_UPDATE 0x05 49 struct btp_cap_unicast_audio_update_cmd { 50 uint8_t stream_count; 51 uint8_t update_data[0]; 52 } __packed; 53 struct btp_cap_unicast_audio_update_data { 54 bt_addr_le_t address; 55 uint8_t ase_id; 56 uint8_t metadata_ltvs_len; 57 uint8_t metadata_ltvs[0]; 58 } __packed; 59 60 #define BTP_CAP_UNICAST_AUDIO_STOP 0x06 61 struct btp_cap_unicast_audio_stop_cmd { 62 uint8_t cig_id; 63 uint8_t flags; 64 } __packed; 65 #define BTP_CAP_UNICAST_AUDIO_STOP_FLAG_RELEASE BIT(0) 66 67 #define BTP_CAP_BROADCAST_SOURCE_SETUP_STREAM 0x07 68 struct btp_cap_broadcast_source_setup_stream_cmd { 69 uint8_t source_id; 70 uint8_t subgroup_id; 71 uint8_t coding_format; 72 uint16_t vid; 73 uint16_t cid; 74 uint8_t cc_ltvs_len; 75 uint8_t metadata_ltvs_len; 76 uint8_t ltvs[0]; 77 } __packed; 78 79 #define BTP_CAP_BROADCAST_SOURCE_SETUP_SUBGROUP 0x08 80 struct btp_cap_broadcast_source_setup_subgroup_cmd { 81 uint8_t source_id; 82 uint8_t subgroup_id; 83 uint8_t coding_format; 84 uint16_t vid; 85 uint16_t cid; 86 uint8_t cc_ltvs_len; 87 uint8_t metadata_ltvs_len; 88 uint8_t ltvs[0]; 89 } __packed; 90 91 #define BTP_CAP_BROADCAST_SOURCE_SETUP 0x09 92 struct btp_cap_broadcast_source_setup_cmd { 93 uint8_t source_id; 94 uint8_t broadcast_id[3]; 95 uint8_t sdu_interval[3]; 96 uint8_t framing; 97 uint16_t max_sdu; 98 uint8_t retransmission_num; 99 uint16_t max_transport_latency; 100 uint8_t presentation_delay[3]; 101 uint8_t flags; 102 uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; 103 } __packed; 104 struct btp_cap_broadcast_source_setup_rp { 105 uint8_t source_id; 106 uint32_t gap_settings; 107 uint8_t broadcast_id[BT_AUDIO_BROADCAST_ID_SIZE]; 108 } __packed; 109 #define BTP_CAP_BROADCAST_SOURCE_SETUP_FLAG_ENCRYPTION BIT(0) 110 #define BTP_CAP_BROADCAST_SOURCE_SETUP_FLAG_SUBGROUP_CODEC BIT(1) 111 112 #define BTP_CAP_BROADCAST_SOURCE_RELEASE 0x0a 113 struct btp_cap_broadcast_source_release_cmd { 114 uint8_t source_id; 115 } __packed; 116 117 #define BTP_CAP_BROADCAST_ADV_START 0x0b 118 struct btp_cap_broadcast_adv_start_cmd { 119 uint8_t source_id; 120 } __packed; 121 122 #define BTP_CAP_BROADCAST_ADV_STOP 0x0c 123 struct btp_cap_broadcast_adv_stop_cmd { 124 uint8_t source_id; 125 } __packed; 126 127 #define BTP_CAP_BROADCAST_SOURCE_START 0x0d 128 struct btp_cap_broadcast_source_start_cmd { 129 uint8_t source_id; 130 } __packed; 131 132 #define BTP_CAP_BROADCAST_SOURCE_STOP 0x0e 133 struct btp_cap_broadcast_source_stop_cmd { 134 uint8_t source_id; 135 } __packed; 136 137 #define BTP_CAP_BROADCAST_SOURCE_UPDATE 0x0f 138 struct btp_cap_broadcast_source_update_cmd { 139 uint8_t source_id; 140 uint8_t metadata_ltvs_len; 141 uint8_t metadata_ltvs[0]; 142 } __packed; 143 144 /* CAP events */ 145 #define BTP_CAP_EV_DISCOVERY_COMPLETED 0x80 146 struct btp_cap_discovery_completed_ev { 147 bt_addr_le_t address; 148 uint8_t status; 149 } __packed; 150 #define BTP_CAP_DISCOVERY_STATUS_SUCCESS 0x00 151 #define BTP_CAP_DISCOVERY_STATUS_FAILED 0x01 152 153 #define BTP_CAP_EV_UNICAST_START_COMPLETED 0x81 154 struct btp_cap_unicast_start_completed_ev { 155 uint8_t cig_id; 156 uint8_t status; 157 } __packed; 158 #define BTP_CAP_UNICAST_START_STATUS_SUCCESS 0x00 159 #define BTP_CAP_UNICAST_START_STATUS_FAILED 0x01 160 161 #define BTP_CAP_EV_UNICAST_STOP_COMPLETED 0x82 162 struct btp_cap_unicast_stop_completed_ev { 163 uint8_t cig_id; 164 uint8_t status; 165 } __packed; 166 #define BTP_CAP_UNICAST_STOP_STATUS_SUCCESS 0x00 167 #define BTP_CAP_UNICAST_STOP_STATUS_FAILED 0x01 168