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