1
6
7
15
16
17
18
19
24
25
26
27
28
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
83
84
85
90
91
92
96
97
98
103
104
105
112
113
114
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
156
157
158
159
160
161
165
166
167
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
191
192
193
196
197
198
199
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
239
240
241
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/* ... */
/* ... */
#ifndef __BTC_HF_AG_H__
#define __BTC_HF_AG_H__
#include "common/bt_target.h"
#include "btc/btc_task.h"
#include "btc/btc_common.h"
#include "bta/bta_ag_api.h"
#include "esp_hf_ag_api.h"5 includes
#if (BTC_HF_INCLUDED == TRUE)
/* ... */
typedef enum
{
BTC_HF_INIT_EVT,
BTC_HF_DEINIT_EVT,
BTC_HF_CONNECT_EVT,
BTC_HF_DISCONNECT_EVT,
BTC_HF_CONNECT_AUDIO_EVT,
BTC_HF_DISCONNECT_AUDIO_EVT,
BTC_HF_VRA_EVT,
BTC_HF_VOLUME_CONTROL_EVT,
BTC_HF_UNAT_RESPONSE_EVT,
BTC_HF_CME_ERR_EVT,
BTC_HF_IND_NOTIFICATION_EVT,
BTC_HF_CIEV_REPORT_EVT,
BTC_HF_CIND_RESPONSE_EVT,
BTC_HF_COPS_RESPONSE_EVT,
BTC_HF_CLCC_RESPONSE_EVT,
BTC_HF_CNUM_RESPONSE_EVT,
BTC_HF_INBAND_RING_EVT,
BTC_HF_AC_INCALL_EVT,
BTC_HF_RJ_INCALL_EVT,
BTC_HF_OUT_CALL_EVT,
BTC_HF_END_CALL_EVT,
BTC_HF_REGISTER_DATA_CALLBACK_EVT,
BTC_HF_REQUEST_PKT_STAT_EVT
}{...} btc_hf_act_t;
typedef union
{
bt_bdaddr_t connect;
bt_bdaddr_t disconnect;
bt_bdaddr_t connect_audio;
bt_bdaddr_t disconnect_audio;
struct vra_param {
bt_bdaddr_t remote_addr;
esp_hf_vr_state_t value;
}{...} vra_rep;
struct volcon_args {
bt_bdaddr_t remote_addr;
esp_hf_volume_control_target_t target_type;
int volume;
}{...} volcon;
struct unat_param {
bt_bdaddr_t remote_addr;
char *unat;
}{...} unat_rep;
struct at_ok_err_args {
bt_bdaddr_t remote_addr;
esp_hf_at_response_code_t response_code;
esp_hf_cme_err_t error_code;
}{...} ext_at;
struct indchange_status {
bt_bdaddr_t remote_addr;
esp_hf_call_status_t call_state;
esp_hf_call_setup_status_t call_setup_state;
esp_hf_network_state_t ntk_state;
int signal;
}{...} ind_change;
struct ciev_args {
bt_bdaddr_t remote_addr;
tBTA_AG_IND ind;
}{...} ciev_rep;
struct cind_args {
bt_bdaddr_t remote_addr;
esp_hf_call_status_t call_state;
esp_hf_call_setup_status_t call_setup_state;
esp_hf_network_state_t ntk_state;
int signal;
esp_hf_roaming_status_t roam;
int batt_lev;
esp_hf_call_held_status_t call_held_state;
}{...} cind_rep;
struct cops_args {
bt_bdaddr_t remote_addr;
char *name;
}{...} cops_rep;
struct clcc_args {
bt_bdaddr_t remote_addr;
int index;
esp_hf_current_call_direction_t dir;
esp_hf_current_call_status_t current_call_state;
esp_hf_current_call_mode_t mode;
esp_hf_current_call_mpty_type_t mpty;
char *number;
esp_hf_call_addr_type_t type;
}{...} clcc_rep;
struct cnum_args {
bt_bdaddr_t remote_addr;
char *number;
int number_type;
esp_hf_subscriber_service_type_t service_type;
}{...} cnum_rep;
bt_bdaddr_t nrec_rep;
struct bts_args {
bt_bdaddr_t remote_addr;
char *code;
}{...} vts_rep;
struct bsir_args {
bt_bdaddr_t remote_addr;
esp_hf_in_band_ring_state_t state;
}{...} bsir;
struct phone_args {
bt_bdaddr_t remote_addr;
int num_active;
int num_held;
esp_hf_call_status_t call_state;
esp_hf_call_setup_status_t call_setup_state;
char *number;
esp_hf_call_addr_type_t call_addr_type;
}{...} phone;
struct ag_reg_data_callback {
esp_hf_incoming_data_cb_t recv;
esp_hf_outgoing_data_cb_t send;
}{...} reg_data_cb;
struct ag_req_pkt_stat_sync_handle {
UINT16 sync_conn_handle;
}{...} pkt_sync_hd;
}{...} btc_hf_args_t;
/* ... */
#define BTC_HF_NUM_CB 1
#define BTC_HF_ID_1 0
typedef struct
{
bool initialized;
UINT16 handle;
bt_bdaddr_t connected_bda;
tBTA_AG_PEER_FEAT peer_feat;
tBTA_AG_CHLD_FEAT chld_feat;
struct timespec call_end_timestamp;
struct timespec connected_timestamp;
esp_hf_connection_state_t connection_state;
esp_hf_vr_state_t vr_state;
int num_active;
int num_held;
esp_hf_call_status_t call_state;
esp_hf_call_setup_status_t call_setup_state;
}{...} btc_hf_cb_t;
typedef struct
{
int hf_idx;
UINT32 btc_hf_features;
btc_hf_cb_t btc_hf_cb;
esp_hf_incoming_data_cb_t btc_hf_incoming_data_cb;
esp_hf_outgoing_data_cb_t btc_hf_outgoing_data_cb;
}{...} hf_local_param_t;
#if HFP_DYNAMIC_MEMORY == TRUE
extern hf_local_param_t *hf_local_param_ptr;
#define hf_local_param (hf_local_param_ptr)/* ... */
#endif
/* ... */
void btc_hf_call_handler(btc_msg_t *msg);
void btc_hf_cb_handler(btc_msg_t *msg);
void btc_hf_incoming_data_cb_to_app(const uint8_t *data, uint32_t len);
uint32_t btc_hf_outgoing_data_cb_to_app(uint8_t *data, uint32_t len);
void btc_hf_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
void btc_hf_arg_deep_free(btc_msg_t *msg);
bt_status_t btc_hf_ci_sco_data(void);
/* ... */
#endif
/* ... */
#endif