1
6
7
8
16
17
18
19
20
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
43
44
48
49
56
57
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
98
99
100
101
102
103
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
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
/* ... */
/* ... */
#ifndef __BTC_AV_H__
#define __BTC_AV_H__
#include "common/bt_target.h"
#include "esp_a2dp_api.h"
#include "btc/btc_task.h"
#include "btc/btc_common.h"
#include "btc/btc_sm.h"
#include "bta/bta_av_api.h"6 includes
#if (BTC_AV_INCLUDED == TRUE)
extern bool g_av_with_rc;
extern bool g_a2dp_on_init;
extern bool g_a2dp_on_deinit;
extern bool g_a2dp_source_ongoing_deinit;
extern bool g_a2dp_sink_ongoing_deinit;
/* ... */
enum {
BTC_AV_DATAPATH_OPEN_EVT,
BTC_AV_DATAPATH_MAX_EVT,
}{...};
typedef enum {
BTC_AV_CONNECT_REQ_EVT = BTA_AV_MAX_EVT,
BTC_AV_DISCONNECT_REQ_EVT,
BTC_AV_START_STREAM_REQ_EVT,
BTC_AV_SUSPEND_STREAM_REQ_EVT,
BTC_AV_SINK_CONFIG_REQ_EVT,
}{...} btc_av_sm_event_t;
typedef enum {
#if BTC_AV_SINK_INCLUDED
BTC_AV_SINK_API_INIT_EVT = 0,
BTC_AV_SINK_API_DEINIT_EVT,
BTC_AV_SINK_API_CONNECT_EVT,
BTC_AV_SINK_API_DISCONNECT_EVT,
BTC_AV_SINK_API_REG_DATA_CB_EVT,
BTC_AV_SINK_API_SET_DELAY_VALUE_EVT,
BTC_AV_SINK_API_GET_DELAY_VALUE_EVT,/* ... */
#endif
#if BTC_AV_SRC_INCLUDED
BTC_AV_SRC_API_INIT_EVT,
BTC_AV_SRC_API_DEINIT_EVT,
BTC_AV_SRC_API_CONNECT_EVT,
BTC_AV_SRC_API_DISCONNECT_EVT,
BTC_AV_SRC_API_REG_DATA_CB_EVT,/* ... */
#endif
BTC_AV_API_MEDIA_CTRL_EVT,
}{...} btc_av_act_t;
typedef union {
#if BTC_AV_SINK_INCLUDED
esp_a2d_mcc_t mcc;
bt_bdaddr_t connect;
bt_bdaddr_t disconn;
esp_a2d_sink_data_cb_t data_cb;
uint16_t delay_value;/* ... */
#endif
#if BTC_AV_SRC_INCLUDED
esp_a2d_source_data_cb_t src_data_cb;
bt_bdaddr_t src_connect;
bt_bdaddr_t src_disconn;/* ... */
#endif
esp_a2d_media_ctrl_t ctrl;
}{...} btc_av_args_t;
/* ... */
void btc_a2dp_call_handler(btc_msg_t *msg);
void btc_a2dp_cb_handler(btc_msg_t *msg);
void btc_a2dp_sink_reg_data_cb(esp_a2d_sink_data_cb_t callback);
void btc_a2dp_src_reg_data_cb(esp_a2d_source_data_cb_t callback);
/* ... */
btc_sm_handle_t btc_av_get_sm_handle(void);
/* ... */
BOOLEAN btc_av_stream_ready(void);
/* ... */
BOOLEAN btc_av_stream_started_ready(void);
/* ... */
void btc_dispatch_sm_event(btc_av_sm_event_t event, void *p_data, int len);
/* ... */
BOOLEAN btc_av_is_connected(void);
/* ... */
uint8_t btc_av_get_peer_sep(void);
/* ... */
BOOLEAN btc_av_is_peer_edr(void);
/* ... */
void btc_av_clear_remote_suspend_flag(void);
/* ... */
uint8_t btc_av_get_service_id(void);
/* ... */
#endif
/* ... */
#endif