1 /* btp_ccp.h - Bluetooth tester headers */ 2 3 /* 4 * Copyright (c) 2023 Oticon 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 */ 8 9 #include <stdbool.h> 10 #include <stdint.h> 11 12 #include <zephyr/bluetooth/addr.h> 13 #include <zephyr/bluetooth/audio/tbs.h> 14 15 /* CCP commands */ 16 #define BTP_CCP_READ_SUPPORTED_COMMANDS 0x01 17 struct btp_ccp_read_supported_commands_rp { 18 uint8_t data[0]; 19 } __packed; 20 21 #define BTP_CCP_DISCOVER_TBS 0x02 22 struct btp_ccp_discover_tbs_cmd { 23 bt_addr_le_t address; 24 } __packed; 25 26 #define BTP_CCP_ACCEPT_CALL 0x03 27 struct btp_ccp_accept_call_cmd { 28 bt_addr_le_t address; 29 uint8_t inst_index; 30 uint8_t call_id; 31 } __packed; 32 33 #define BTP_CCP_TERMINATE_CALL 0x04 34 struct btp_ccp_terminate_call_cmd { 35 bt_addr_le_t address; 36 uint8_t inst_index; 37 uint8_t call_id; 38 } __packed; 39 40 #define BTP_CCP_ORIGINATE_CALL 0x05 41 struct btp_ccp_originate_call_cmd { 42 bt_addr_le_t address; 43 uint8_t inst_index; 44 uint8_t uri_len; 45 char uri[0]; 46 } __packed; 47 48 #define BTP_CCP_READ_CALL_STATE 0x06 49 struct btp_ccp_read_call_state_cmd { 50 bt_addr_le_t address; 51 uint8_t inst_index; 52 } __packed; 53 54 #define BTP_CCP_READ_BEARER_NAME 0x07 55 struct btp_ccp_read_bearer_name_cmd { 56 bt_addr_le_t address; 57 uint8_t inst_index; 58 } __packed; 59 60 #define BTP_CCP_READ_BEARER_UCI 0x08 61 struct btp_ccp_read_bearer_uci_cmd { 62 bt_addr_le_t address; 63 uint8_t inst_index; 64 } __packed; 65 66 #define BTP_CCP_READ_BEARER_TECH 0x09 67 struct btp_ccp_read_bearer_technology_cmd { 68 bt_addr_le_t address; 69 uint8_t inst_index; 70 } __packed; 71 72 #define BTP_CCP_READ_URI_LIST 0x0a 73 struct btp_ccp_read_uri_list_cmd { 74 bt_addr_le_t address; 75 uint8_t inst_index; 76 } __packed; 77 78 #define BTP_CCP_READ_SIGNAL_STRENGTH 0x0b 79 struct btp_ccp_read_signal_strength_cmd { 80 bt_addr_le_t address; 81 uint8_t inst_index; 82 } __packed; 83 84 #define BTP_CCP_READ_SIGNAL_INTERVAL 0x0c 85 struct btp_ccp_read_signal_interval_cmd { 86 bt_addr_le_t address; 87 uint8_t inst_index; 88 } __packed; 89 90 #define BTP_CCP_READ_CURRENT_CALLS 0x0d 91 struct btp_ccp_read_current_calls_cmd { 92 bt_addr_le_t address; 93 uint8_t inst_index; 94 } __packed; 95 96 #define BTP_CCP_READ_CCID 0x0e 97 struct btp_ccp_read_ccid_cmd { 98 bt_addr_le_t address; 99 uint8_t inst_index; 100 } __packed; 101 102 #define BTP_CCP_READ_CALL_URI 0x0f 103 struct btp_ccp_read_call_uri_cmd { 104 bt_addr_le_t address; 105 uint8_t inst_index; 106 } __packed; 107 108 #define BTP_CCP_READ_STATUS_FLAGS 0x10 109 struct btp_ccp_read_status_flags_cmd { 110 bt_addr_le_t address; 111 uint8_t inst_index; 112 } __packed; 113 114 #define BTP_CCP_READ_OPTIONAL_OPCODES 0x11 115 struct btp_ccp_read_optional_opcodes_cmd { 116 bt_addr_le_t address; 117 uint8_t inst_index; 118 } __packed; 119 120 #define BTP_CCP_READ_FRIENDLY_NAME 0x12 121 struct btp_ccp_read_friendly_name_cmd { 122 bt_addr_le_t address; 123 uint8_t inst_index; 124 } __packed; 125 126 #define BTP_CCP_READ_REMOTE_URI 0x13 127 struct btp_ccp_read_remote_uri_cmd { 128 bt_addr_le_t address; 129 uint8_t inst_index; 130 } __packed; 131 132 #define BTP_CCP_SET_SIGNAL_INTERVAL 0x14 133 struct btp_ccp_set_signal_interval_cmd { 134 bt_addr_le_t address; 135 uint8_t inst_index; 136 uint8_t interval; 137 } __packed; 138 139 #define BTP_CCP_HOLD_CALL 0x15 140 struct btp_ccp_hold_call_cmd { 141 bt_addr_le_t address; 142 uint8_t inst_index; 143 uint8_t call_id; 144 } __packed; 145 146 #define BTP_CCP_RETRIEVE_CALL 0x16 147 struct btp_ccp_retrieve_call_cmd { 148 bt_addr_le_t address; 149 uint8_t inst_index; 150 uint8_t call_id; 151 } __packed; 152 153 #define BTP_CCP_JOIN_CALLS 0x17 154 struct btp_ccp_join_calls_cmd { 155 bt_addr_le_t address; 156 uint8_t inst_index; 157 uint8_t count; 158 uint8_t call_index[]; 159 } __packed; 160 161 /* CCP events */ 162 #define BTP_CCP_EV_DISCOVERED 0x80 163 struct btp_ccp_discovered_ev { 164 int status; 165 uint8_t tbs_count; 166 bool gtbs_found; 167 } __packed; 168 169 #define BTP_CCP_EV_CALL_STATES 0x81 170 struct btp_ccp_call_states_ev { 171 int status; 172 uint8_t inst_index; 173 uint8_t call_count; 174 struct bt_tbs_client_call_state call_states[0]; 175 } __packed; 176 177 #define BTP_CCP_EV_CHRC_HANDLES 0x82 178 struct btp_ccp_chrc_handles_ev { 179 uint16_t provider_name; 180 uint16_t bearer_uci; 181 uint16_t bearer_technology; 182 uint16_t uri_list; 183 uint16_t signal_strength; 184 uint16_t signal_interval; 185 uint16_t current_calls; 186 uint16_t ccid; 187 uint16_t status_flags; 188 uint16_t bearer_uri; 189 uint16_t call_state; 190 uint16_t control_point; 191 uint16_t optional_opcodes; 192 uint16_t termination_reason; 193 uint16_t incoming_call; 194 uint16_t friendly_name; 195 }; 196 197 #define BTP_CCP_EV_CHRC_VAL 0x83 198 struct btp_ccp_chrc_val_ev { 199 bt_addr_le_t address; 200 uint8_t status; 201 uint8_t inst_index; 202 uint8_t value; 203 }; 204 205 #define BTP_CCP_EV_CHRC_STR 0x84 206 struct btp_ccp_chrc_str_ev { 207 bt_addr_le_t address; 208 uint8_t status; 209 uint8_t inst_index; 210 uint8_t data_len; 211 char data[0]; 212 } __packed; 213 214 #define BTP_CCP_EV_CP 0x85 215 struct btp_ccp_cp_ev { 216 bt_addr_le_t address; 217 uint8_t status; 218 } __packed; 219 220 #define BTP_CCP_EV_CURRENT_CALLS 0x86 221 struct btp_ccp_current_calls_ev { 222 bt_addr_le_t address; 223 uint8_t status; 224 } __packed; 225