1 /******************************************************************************
2  *
3  *  Copyright (C) 2003-2012 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 /******************************************************************************
20  *
21  *  This is the private interface file for the BTA device manager.
22  *
23  ******************************************************************************/
24 #ifndef BTA_DM_INT_H
25 #define BTA_DM_INT_H
26 
27 #include "common/bt_target.h"
28 #include "freertos/semphr.h"
29 #include "bta/bta_sys.h"
30 #if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
31 #include "bta/bta_gatt_api.h"
32 #endif
33 
34 
35 
36 /*****************************************************************************
37 **  Constants and data types
38 *****************************************************************************/
39 
40 
41 #define BTA_COPY_DEVICE_CLASS(coddst, codsrc)   {((UINT8 *)(coddst))[0] = ((UINT8 *)(codsrc))[0]; \
42                                                  ((UINT8 *)(coddst))[1] = ((UINT8 *)(codsrc))[1];  \
43                                                  ((UINT8 *)(coddst))[2] = ((UINT8 *)(codsrc))[2];}
44 
45 
46 #define BTA_DM_MSG_LEN 50
47 
48 #define BTA_SERVICE_ID_TO_SERVICE_MASK(id)       (1 << (id))
49 
50 /* DM events */
51 enum {
52     /* device manager local device API events */
53     BTA_DM_API_ENABLE_EVT = BTA_SYS_EVT_START(BTA_ID_DM),
54     BTA_DM_API_DISABLE_EVT,
55     BTA_DM_API_SET_NAME_EVT,
56 #if (CLASSIC_BT_INCLUDED == TRUE)
57     BTA_DM_API_CONFIG_EIR_EVT,
58 #endif
59     BTA_DM_API_SET_AFH_CHANNELS_EVT,
60 #if (SDP_INCLUDED == TRUE)
61     BTA_DM_API_GET_REMOTE_NAME_EVT,
62 #endif
63     BTA_DM_API_SET_VISIBILITY_EVT,
64 
65     BTA_DM_ACL_CHANGE_EVT,
66     BTA_DM_API_ADD_DEVICE_EVT,
67     BTA_DM_API_REMOVE_ACL_EVT,
68 #if (SMP_INCLUDED == TRUE)
69     /* security API events */
70     BTA_DM_API_BOND_EVT,
71     BTA_DM_API_BOND_CANCEL_EVT,
72     BTA_DM_API_SET_PIN_TYPE_EVT,
73     BTA_DM_API_PIN_REPLY_EVT,
74 #endif  ///SMP_INCLUDED == TRUE
75 #if (BTA_DM_PM_INCLUDED == TRUE)
76     /* power manger events */
77     BTA_DM_PM_BTM_STATUS_EVT,
78     BTA_DM_PM_TIMER_EVT,
79 #endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
80 #if (BTA_DM_QOS_INCLUDED == TRUE)
81     /* Quality of Service set events */
82     BTA_DM_API_QOS_SET_EVT,
83 #endif /* #if (BTA_DM_QOS_INCLUDED == TRUE) */
84 #if (SMP_INCLUDED == TRUE)
85     /* simple pairing events */
86     BTA_DM_API_CONFIRM_EVT,
87 #if (BT_SSP_INCLUDED == TRUE)
88     BTA_DM_API_KEY_REQ_EVT,
89 #endif ///BT_SSP_INCLUDED == TRUE
90     BTA_DM_API_SET_ENCRYPTION_EVT,
91 #endif  ///SMP_INCLUDED == TRUE
92 #if (BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
93     BTA_DM_API_LOC_OOB_EVT,
94     BTA_DM_API_OOB_REPLY_EVT,
95     BTA_DM_CI_IO_REQ_EVT,
96     BTA_DM_CI_RMT_OOB_EVT,
97 #endif /* BTM_OOB_INCLUDED */
98 
99 
100 #if BLE_INCLUDED == TRUE
101 #if SMP_INCLUDED == TRUE
102     BTA_DM_API_ADD_BLEKEY_EVT,
103     BTA_DM_API_ADD_BLEDEVICE_EVT,
104     BTA_DM_API_BLE_PASSKEY_REPLY_EVT,
105     BTA_DM_API_BLE_SET_STATIC_PASSKEY_EVT,
106     BTA_DM_API_BLE_CONFIRM_REPLY_EVT,
107     BTA_DM_API_BLE_SEC_GRANT_EVT,
108 #endif  ///SMP_INCLUDED == TRUE
109     BTA_DM_API_BLE_SET_BG_CONN_TYPE,
110     BTA_DM_API_BLE_CONN_PARAM_EVT,
111     BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT,
112     BTA_DM_API_BLE_SCAN_PARAM_EVT,
113     /*******This event added by Yulong at 2016/10/25 to
114     support the scan filter setting for the APP******/
115     BTA_DM_API_BLE_SCAN_FIL_PARAM_EVT,
116     BTA_DM_API_BLE_OBSERVE_EVT,
117     BTA_DM_API_BLE_SCAN_EVT,
118     BTA_DM_API_UPDATE_CONN_PARAM_EVT,
119     /*******This event added by Yulong at 2016/9/9 to
120     support the random address setting for the APP******/
121     BTA_DM_API_SET_RAND_ADDR_EVT,
122     BTA_DM_API_CLEAR_RAND_ADDR_EVT,
123     /*******This event added by Yulong at 2016/10/19 to
124     support stop the ble advertising setting by the APP******/
125     BTA_DM_API_BLE_STOP_ADV_EVT,
126 #if BLE_PRIVACY_SPT == TRUE
127     BTA_DM_API_LOCAL_PRIVACY_EVT,
128 #endif
129     BTA_DM_API_LOCAL_ICON_EVT,
130     BTA_DM_API_BLE_ADV_PARAM_EVT,
131 
132     /*******This event added by Yulong at 2016/10/20 to
133     support setting the ble advertising param by the APP******/
134     BTA_DM_API_BLE_ADV_PARAM_All_EVT,
135     BTA_DM_API_BLE_SET_ADV_CONFIG_EVT,
136     /* Add for set raw advertising data */
137     BTA_DM_API_BLE_SET_ADV_CONFIG_RAW_EVT,
138     BTA_DM_API_BLE_SET_SCAN_RSP_EVT,
139     /* Add for set raw scan response data */
140     BTA_DM_API_BLE_SET_SCAN_RSP_RAW_EVT,
141     BTA_DM_API_BLE_BROADCAST_EVT,
142     BTA_DM_API_SET_DATA_LENGTH_EVT,
143     BTA_DM_API_BLE_SET_LONG_ADV_EVT,
144 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
145     BTA_DM_API_CFG_FILTER_COND_EVT,
146     BTA_DM_API_SCAN_FILTER_SETUP_EVT,
147     BTA_DM_API_SCAN_FILTER_ENABLE_EVT,
148 #endif
149     BTA_DM_API_BLE_MULTI_ADV_ENB_EVT,
150     BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT,
151     BTA_DM_API_BLE_MULTI_ADV_DATA_EVT,
152     BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT,
153     BTA_DM_API_BLE_SETUP_STORAGE_EVT,
154     BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT,
155     BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT,
156     BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT,
157     BTA_DM_API_BLE_TRACK_ADVERTISER_EVT,
158     BTA_DM_API_BLE_ENERGY_INFO_EVT,
159     BTA_DM_API_BLE_DISCONNECT_EVT,
160 
161 #endif
162 
163     BTA_DM_API_ENABLE_TEST_MODE_EVT,
164     BTA_DM_API_DISABLE_TEST_MODE_EVT,
165     BTA_DM_API_EXECUTE_CBACK_EVT,
166     BTA_DM_API_REMOVE_ALL_ACL_EVT,
167     BTA_DM_API_REMOVE_DEVICE_EVT,
168     BTA_DM_API_BLE_SET_CHANNELS_EVT,
169     BTA_DM_API_UPDATE_WHITE_LIST_EVT,
170     BTA_DM_API_CLEAR_WHITE_LIST_EVT,
171     BTA_DM_API_BLE_READ_ADV_TX_POWER_EVT,
172     BTA_DM_API_READ_RSSI_EVT,
173 #if BLE_INCLUDED == TRUE
174     BTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_EVT,
175 #endif
176 #if (BLE_50_FEATURE_SUPPORT == TRUE)
177     BTA_DM_API_READ_PHY_EVT,
178     BTA_DM_API_SET_PER_DEF_PHY_EVT,
179     BTA_DM_API_SET_PER_PHY_EVT,
180     BTA_DM_API_SET_EXT_ADV_RAND_ADDR_EVT,
181     BTA_DM_API_SET_EXT_ADV_PARAMS_EVT,
182     BTA_DM_API_CFG_ADV_DATA_RAW_EVT,
183     BTA_DM_API_EXT_ADV_ENABLE_EVT,
184     BTA_DM_API_EXT_ADV_SET_REMOVE_EVT,
185     BTA_DM_API_EXT_ADV_SET_CLEAR_EVT,
186     BTA_DM_API_PERIODIC_ADV_SET_PARAMS_EVT,
187     BTA_DM_API_PERIODIC_ADV_CFG_DATA_EVT,
188     BTA_DM_API_PERIODIC_ADV_ENABLE_EVT,
189     BTA_DM_API_PERIODIC_ADV_SYNC_EVT,
190     BTA_DM_API_PERIODIC_ADV_SYNC_CANCEL_EVT,
191     BTA_DM_API_PERIODIC_ADV_SYNC_TERMINATE_EVT,
192     BTA_DM_API_PERIODIC_ADV_ADD_DEV_TO_LSIT_EVT,
193     BTA_DM_API_PERIODIC_ADV_REMOVE_DEV_FROM_LSIT_EVT,
194     BTA_DM_API_PERIODIC_ADV_CLEAR_DEV_EVT,
195     BTA_DM_API_SET_EXT_SCAN_PARAMS_EVT,
196     BTA_DM_API_START_EXT_SCAN_EVT,
197     BTA_DM_API_SET_PERF_EXT_CONN_PARAMS_EVT,
198     BTA_DM_API_EXT_CONN_EVT,
199 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
200     BTA_DM_MAX_EVT
201 };
202 
203 
204 /* DM search events */
205 enum {
206     /* DM search API events */
207     BTA_DM_API_SEARCH_EVT = BTA_SYS_EVT_START(BTA_ID_DM_SEARCH),
208     BTA_DM_API_SEARCH_CANCEL_EVT,
209     BTA_DM_API_DISCOVER_EVT,
210     BTA_DM_INQUIRY_CMPL_EVT,
211     BTA_DM_REMT_NAME_EVT,
212     BTA_DM_SDP_RESULT_EVT,
213     BTA_DM_SEARCH_CMPL_EVT,
214     BTA_DM_DISCOVERY_RESULT_EVT,
215     BTA_DM_API_DI_DISCOVER_EVT,
216     BTA_DM_DISC_CLOSE_TOUT_EVT,
217 };
218 
219 /* data type for BTA_DM_API_ENABLE_EVT */
220 typedef struct {
221     BT_HDR              hdr;
222     tBTA_DM_SEC_CBACK *p_sec_cback;
223 } tBTA_DM_API_ENABLE;
224 
225 /* data type for BTA_DM_API_SET_NAME_EVT */
226 typedef struct {
227     BT_HDR              hdr;
228     BD_NAME             name; /* max 248 bytes name, plus must be Null terminated */
229 } tBTA_DM_API_SET_NAME;
230 
231 /* data type for BTA_DM_API_CONFIG_EIR_EVT */
232 typedef struct {
233     BT_HDR              hdr;
234     BOOLEAN             eir_fec_required;
235     BOOLEAN             eir_included_tx_power;
236     BOOLEAN             eir_included_uuid;
237     UINT8               eir_flags;
238     UINT8               eir_manufac_spec_len;
239     UINT8               *eir_manufac_spec;
240     UINT8               eir_url_len;
241     UINT8               *eir_url;
242     UINT8               data[];
243 }tBTA_DM_API_CONFIG_EIR;
244 
245 /* data type for BTA_DM_API_SET_AFH_CHANNELS_EVT */
246 typedef struct {
247     BT_HDR              hdr;
248     AFH_CHANNELS        channels;
249     tBTA_CMPL_CB        *set_afh_cb;
250 }tBTA_DM_API_SET_AFH_CHANNELS;
251 
252 /* data type for BTA_DM_API_GET_REMOTE_NAME_EVT */
253 typedef struct {
254     BT_HDR         hdr;
255     BD_ADDR        rmt_addr;
256     BD_NAME        rmt_name;
257     tBTA_TRANSPORT transport;
258     tBTA_CMPL_CB   *rmt_name_cb;
259 } tBTA_DM_API_GET_REMOTE_NAME;
260 
261 #if (BLE_INCLUDED == TRUE)
262 /* data type for BTA_DM_API_BLE_SET_CHANNELS_EVT */
263 typedef struct {
264     BT_HDR              hdr;
265     AFH_CHANNELS        channels;
266     tBTA_CMPL_CB        *set_channels_cb;
267 }tBTA_DM_API_BLE_SET_CHANNELS;
268 
269 typedef struct {
270     BT_HDR    hdr;
271     BOOLEAN   add_remove;
272     BD_ADDR   remote_addr;
273     tBLE_ADDR_TYPE addr_type;
274     tBTA_ADD_WHITELIST_CBACK *add_wl_cb;
275 }tBTA_DM_API_UPDATE_WHITE_LIST;
276 
277 typedef struct {
278     BT_HDR    hdr;
279     UINT8     subcode;
280     UINT32    type;
281     BD_ADDR   device_info;
282     tBTA_UPDATE_DUPLICATE_EXCEPTIONAL_LIST_CMPL_CBACK *exceptional_list_cb;
283 }tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST;
284 
285 typedef struct {
286     BT_HDR       hdr;
287     tBTA_CMPL_CB *read_tx_power_cb;
288 }tBTA_DM_API_READ_ADV_TX_POWER;
289 #endif  ///BLE_INCLUDED == TRUE
290 
291 typedef struct {
292     BT_HDR        hdr;
293     BD_ADDR       remote_addr;
294     tBTA_TRANSPORT  transport;
295     tBTA_CMPL_CB  *read_rssi_cb;
296 }tBTA_DM_API_READ_RSSI;
297 
298 /* data type for BTA_DM_API_SET_VISIBILITY_EVT */
299 typedef struct {
300     BT_HDR              hdr;
301     tBTA_DM_DISC    disc_mode;
302     tBTA_DM_CONN    conn_mode;
303     UINT8           pair_mode;
304     UINT8           conn_paired_only;
305 } tBTA_DM_API_SET_VISIBILITY;
306 
307 enum {
308     BTA_DM_RS_NONE,     /* straight API call */
309     BTA_DM_RS_OK,       /* the role switch result - successful */
310     BTA_DM_RS_FAIL      /* the role switch result - failed */
311 };
312 typedef UINT8 tBTA_DM_RS_RES;
313 
314 /* data type for BTA_DM_API_SEARCH_EVT */
315 typedef struct {
316     BT_HDR      hdr;
317     tBTA_DM_INQ inq_params;
318     tBTA_SERVICE_MASK services;
319     tBTA_DM_SEARCH_CBACK *p_cback;
320     tBTA_DM_RS_RES  rs_res;
321 #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
322     UINT8           num_uuid;
323     tBT_UUID        *p_uuid;
324 #endif
325 } tBTA_DM_API_SEARCH;
326 
327 #if (SDP_INCLUDED == TRUE)
328 /* data type for BTA_DM_API_DISCOVER_EVT */
329 typedef struct {
330     BT_HDR      hdr;
331     BD_ADDR bd_addr;
332     tBTA_SERVICE_MASK services;
333     tBTA_DM_SEARCH_CBACK *p_cback;
334     BOOLEAN         sdp_search;
335     tBTA_TRANSPORT  transport;
336 #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
337     UINT8           num_uuid;
338     tBT_UUID        *p_uuid;
339 #endif
340     tSDP_UUID    uuid;
341 } tBTA_DM_API_DISCOVER;
342 #endif  ///SDP_INCLUDED == TRUE
343 
344 /* data type for BTA_DM_API_DI_DISC_EVT */
345 typedef struct {
346     BT_HDR              hdr;
347     BD_ADDR             bd_addr;
348 #if (SDP_INCLUDED == TRUE)
349     tBTA_DISCOVERY_DB   *p_sdp_db;
350 #endif  ///SDP_INCLUDED == TRUE
351     UINT32              len;
352     tBTA_DM_SEARCH_CBACK *p_cback;
353 } tBTA_DM_API_DI_DISC;
354 
355 /* data type for BTA_DM_API_BOND_EVT */
356 typedef struct {
357     BT_HDR      hdr;
358     BD_ADDR bd_addr;
359     tBTA_TRANSPORT transport;
360 } tBTA_DM_API_BOND;
361 
362 /* data type for BTA_DM_API_BOND_CANCEL_EVT */
363 typedef struct {
364     BT_HDR          hdr;
365     BD_ADDR         bd_addr;
366     tBTA_TRANSPORT  transport;
367 } tBTA_DM_API_BOND_CANCEL;
368 
369 /* data type for BTA_DM_API_SET_PIN_TYPE_EVT */
370 typedef struct {
371     BT_HDR      hdr;
372     UINT8       pin_type;
373     UINT8       pin_len;
374     UINT8       p_pin[PIN_CODE_LEN];
375 } tBTA_DM_API_SET_PIN_TYPE;
376 
377 /* data type for BTA_DM_API_PIN_REPLY_EVT */
378 typedef struct {
379     BT_HDR      hdr;
380     BD_ADDR bd_addr;
381     BOOLEAN accept;
382     UINT8 pin_len;
383     UINT8 p_pin[PIN_CODE_LEN];
384 } tBTA_DM_API_PIN_REPLY;
385 
386 /* data type for BTA_DM_API_LOC_OOB_EVT */
387 typedef struct {
388     BT_HDR      hdr;
389 } tBTA_DM_API_LOC_OOB;
390 
391 /* data type for BTA_DM_API_OOB_REPLY_EVT */
392 typedef struct {
393     BT_HDR      hdr;
394     BD_ADDR bd_addr;
395     UINT8       len;
396     UINT8       value[BT_OCTET16_LEN];
397 } tBTA_DM_API_OOB_REPLY;
398 
399 /* data type for BTA_DM_API_CONFIRM_EVT */
400 typedef struct {
401     BT_HDR      hdr;
402     BD_ADDR     bd_addr;
403     BOOLEAN     accept;
404 } tBTA_DM_API_CONFIRM;
405 
406 /* data type for BTA_DM_API_KEY_REQ_EVT */
407 typedef struct {
408     BT_HDR      hdr;
409     BD_ADDR     bd_addr;
410     BOOLEAN     accept;
411     UINT32      passkey;
412 } tBTA_DM_API_KEY_REQ;
413 
414 /* data type for BTA_DM_CI_IO_REQ_EVT */
415 typedef struct {
416     BT_HDR          hdr;
417     BD_ADDR         bd_addr;
418     tBTA_IO_CAP     io_cap;
419     tBTA_OOB_DATA   oob_data;
420     tBTA_AUTH_REQ   auth_req;
421 } tBTA_DM_CI_IO_REQ;
422 
423 /* data type for BTA_DM_CI_RMT_OOB_EVT */
424 typedef struct {
425     BT_HDR      hdr;
426     BD_ADDR     bd_addr;
427     BT_OCTET16  c;
428     BT_OCTET16  r;
429     BOOLEAN     accept;
430 } tBTA_DM_CI_RMT_OOB;
431 
432 /* data type for BTA_DM_REMT_NAME_EVT */
433 typedef struct {
434     BT_HDR      hdr;
435     tBTA_DM_SEARCH  result;
436 } tBTA_DM_REM_NAME;
437 
438 /* data type for tBTA_DM_DISC_RESULT */
439 typedef struct {
440     BT_HDR      hdr;
441     tBTA_DM_SEARCH  result;
442 } tBTA_DM_DISC_RESULT;
443 
444 
445 /* data type for BTA_DM_INQUIRY_CMPL_EVT */
446 typedef struct {
447     BT_HDR      hdr;
448     UINT8       num;
449 } tBTA_DM_INQUIRY_CMPL;
450 
451 /* data type for BTA_DM_SDP_RESULT_EVT */
452 typedef struct {
453     BT_HDR      hdr;
454     UINT16 sdp_result;
455 } tBTA_DM_SDP_RESULT;
456 
457 /* data type for BTA_DM_ACL_CHANGE_EVT */
458 typedef struct {
459     BT_HDR          hdr;
460     tBTM_BL_EVENT   event;
461     UINT8           busy_level;
462     UINT8           busy_level_flags;
463     BOOLEAN         is_new;
464     UINT8           new_role;
465     BD_ADDR         bd_addr;
466     UINT8           hci_status;
467     BOOLEAN         sc_downgrade;
468 #if BLE_INCLUDED == TRUE
469     UINT16          handle;
470 #endif
471     tBT_TRANSPORT   transport;
472 } tBTA_DM_ACL_CHANGE;
473 
474 #if (BTA_DM_PM_INCLUDED == TRUE)
475 /* data type for BTA_DM_PM_BTM_STATUS_EVT */
476 typedef struct {
477 
478     BT_HDR          hdr;
479     BD_ADDR         bd_addr;
480     tBTM_PM_STATUS  status;
481     UINT16          value;
482     UINT8           hci_status;
483 
484 } tBTA_DM_PM_BTM_STATUS;
485 
486 /* data type for BTA_DM_PM_TIMER_EVT */
487 typedef struct {
488     BT_HDR          hdr;
489     BD_ADDR         bd_addr;
490     tBTA_DM_PM_ACTION  pm_request;
491 } tBTA_DM_PM_TIMER;
492 #endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
493 
494 #if (BTA_DM_QOS_INCLUDED == TRUE)
495 /* data type for BTA_DM_API_QOS_SET_EVT */
496 typedef struct {
497     BT_HDR          hdr;
498     BD_ADDR         bd_addr;
499     UINT32          t_poll;
500     tBTM_CMPL_CB    *p_cb;
501 } tBTA_DM_API_QOS_SET;
502 #endif /* #if (BTA_DM_QOS_INCLUDED == TRUE) */
503 
504 /* data type for BTA_DM_API_ADD_DEVICE_EVT */
505 typedef struct {
506     BT_HDR              hdr;
507     BD_ADDR             bd_addr;
508     DEV_CLASS           dc;
509     LINK_KEY            link_key;
510     tBTA_SERVICE_MASK   tm;
511     BOOLEAN             is_trusted;
512     UINT8               key_type;
513     tBTA_IO_CAP         io_cap;
514     BOOLEAN             link_key_known;
515     BOOLEAN             dc_known;
516     BD_NAME             bd_name;
517     UINT8               features[BTA_FEATURE_BYTES_PER_PAGE * (BTA_EXT_FEATURES_PAGE_MAX + 1)];
518     UINT8               pin_length;
519     UINT8               sc_support;
520 } tBTA_DM_API_ADD_DEVICE;
521 
522 /* data type for BTA_DM_API_REMOVE_ACL_EVT */
523 typedef struct {
524     BT_HDR              hdr;
525     BD_ADDR             bd_addr;
526     UINT8               transport;
527 } tBTA_DM_API_REMOVE_DEVICE;
528 
529 /* data type for BTA_DM_API_EXECUTE_CBACK_EVT */
530 typedef struct {
531     BT_HDR               hdr;
532     void                *p_param;
533     tBTA_DM_EXEC_CBACK  *p_exec_cback;
534 } tBTA_DM_API_EXECUTE_CBACK;
535 
536 /* data type for tBTA_DM_API_SET_ENCRYPTION */
537 typedef struct {
538     BT_HDR                    hdr;
539     tBTA_TRANSPORT            transport;
540     tBTA_DM_ENCRYPT_CBACK     *p_callback;
541     tBTA_DM_BLE_SEC_ACT       sec_act;
542     BD_ADDR                   bd_addr;
543 } tBTA_DM_API_SET_ENCRYPTION;
544 
545 #if BLE_INCLUDED == TRUE
546 typedef struct {
547     BT_HDR                  hdr;
548     BD_ADDR                 bd_addr;
549     tBTA_LE_KEY_VALUE       blekey;
550     tBTA_LE_KEY_TYPE        key_type;
551 
552 } tBTA_DM_API_ADD_BLEKEY;
553 
554 typedef struct {
555     BT_HDR                  hdr;
556     BD_ADDR                 bd_addr;
557     tBT_DEVICE_TYPE         dev_type ;
558     UINT32                  auth_mode;
559     tBLE_ADDR_TYPE          addr_type;
560 
561 } tBTA_DM_API_ADD_BLE_DEVICE;
562 
563 typedef struct {
564     BT_HDR                  hdr;
565     BD_ADDR                 bd_addr;
566     BOOLEAN                 accept;
567     UINT32                  passkey;
568 } tBTA_DM_API_PASSKEY_REPLY;
569 
570 typedef struct {
571     BT_HDR                  hdr;
572     BOOLEAN                 add;
573     UINT32                  static_passkey;
574 } tBTA_DM_API_SET_DEFAULT_PASSKEY;
575 
576 typedef struct {
577     BT_HDR                  hdr;
578     BD_ADDR                 bd_addr;
579     tBTA_DM_BLE_SEC_GRANT   res;
580 } tBTA_DM_API_BLE_SEC_GRANT;
581 
582 
583 typedef struct {
584     BT_HDR                  hdr;
585     tBTA_DM_BLE_CONN_TYPE   bg_conn_type;
586     tBTA_DM_BLE_SEL_CBACK   *p_select_cback;
587 } tBTA_DM_API_BLE_SET_BG_CONN_TYPE;
588 
589 /* set prefered BLE connection parameters for a device */
590 typedef struct {
591     BT_HDR                  hdr;
592     BD_ADDR                 peer_bda;
593     UINT16                  conn_int_min;
594     UINT16                  conn_int_max;
595     UINT16                  supervision_tout;
596     UINT16                  slave_latency;
597 
598 } tBTA_DM_API_BLE_CONN_PARAMS;
599 
600 typedef struct {
601     BT_HDR                  hdr;
602     BD_ADDR                 peer_bda;
603     BOOLEAN                 privacy_enable;
604 
605 } tBTA_DM_API_ENABLE_PRIVACY;
606 
607 typedef struct {
608     BT_HDR                  hdr;
609     BOOLEAN                 privacy_enable;
610     tBTA_SET_LOCAL_PRIVACY_CBACK *set_local_privacy_cback;
611 } tBTA_DM_API_LOCAL_PRIVACY;
612 
613 typedef struct {
614     BT_HDR                  hdr;
615     uint16_t                icon;
616 } tBTA_DM_API_LOCAL_ICON;
617 
618 /* set scan parameter for BLE connections */
619 typedef struct {
620     BT_HDR hdr;
621     tBTA_GATTC_IF client_if;
622     UINT32 scan_int;
623     UINT32 scan_window;
624     tBLE_SCAN_MODE scan_mode;
625     tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback;
626 } tBTA_DM_API_BLE_SCAN_PARAMS;
627 
628 typedef struct {
629     BT_HDR hdr;
630     tBTA_GATTC_IF client_if;
631     UINT32 scan_int;
632     UINT32 scan_window;
633     tBLE_SCAN_MODE scan_mode;
634     UINT8 addr_type_own;
635     UINT8 scan_duplicate_filter;
636     UINT8 scan_filter_policy;
637     tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback;
638 } tBTA_DM_API_BLE_SCAN_FILTER_PARAMS;
639 
640 
641 /* set scan parameter for BLE connections */
642 typedef struct {
643     BT_HDR                  hdr;
644     UINT16                  scan_int;
645     UINT16                  scan_window;
646 } tBTA_DM_API_BLE_CONN_SCAN_PARAMS;
647 
648 /* Data type for start/stop observe */
649 typedef struct {
650     BT_HDR                  hdr;
651     BOOLEAN                 start;
652     UINT32                  duration;
653     tBTA_DM_SEARCH_CBACK    *p_cback;
654     tBTA_START_STOP_SCAN_CMPL_CBACK *p_start_scan_cback;
655     tBTA_START_STOP_SCAN_CMPL_CBACK *p_stop_scan_cback;
656     tBTA_START_STOP_ADV_CMPL_CBACK  *p_stop_adv_cback;
657 } tBTA_DM_API_BLE_OBSERVE;
658 
659 /* Data type for start/stop scan */
660 typedef struct {
661     BT_HDR                  hdr;
662     BOOLEAN                 start;
663     UINT32                  duration;
664     tBTA_DM_SEARCH_CBACK    *p_cback;
665     tBTA_START_STOP_SCAN_CMPL_CBACK *p_start_scan_cback;
666     tBTA_START_STOP_SCAN_CMPL_CBACK *p_stop_scan_cback;
667     tBTA_START_STOP_ADV_CMPL_CBACK  *p_stop_adv_cback;
668 } tBTA_DM_API_BLE_SCAN;
669 
670 typedef struct {
671     BT_HDR      hdr;
672     BD_ADDR     remote_bda;
673     UINT16      tx_data_length;
674     tBTA_SET_PKT_DATA_LENGTH_CBACK *p_set_pkt_data_cback;
675 } tBTA_DM_API_BLE_SET_DATA_LENGTH;
676 
677 /* set the address for BLE device
678    this type added by Yulong at 2016/9/9*/
679 typedef struct {
680     BT_HDR      hdr;
681     tBLE_ADDR_TYPE addr_type;
682     BD_ADDR address;
683     tBTA_SET_RAND_ADDR_CBACK *p_set_rand_addr_cback;
684 } tBTA_DM_APT_SET_DEV_ADDR;
685 
686 typedef struct {
687     BT_HDR      hdr;
688 } tBTA_DM_APT_CLEAR_ADDR;
689 
690 /* set adv parameter for BLE advertising */
691 typedef struct {
692     BT_HDR                  hdr;
693     UINT16                  adv_int_min;
694     UINT16                  adv_int_max;
695     tBLE_BD_ADDR            *p_dir_bda;
696 } tBTA_DM_API_BLE_ADV_PARAMS;
697 
698 /* set adv parameter for BLE advertising */
699 typedef struct {
700     BT_HDR                  hdr;
701     UINT16                  adv_int_min;
702     UINT16                  adv_int_max;
703     UINT8                   adv_type;
704     tBLE_ADDR_TYPE          addr_type_own;
705     tBTM_BLE_ADV_CHNL_MAP   channel_map;
706     tBTM_BLE_AFP            adv_filter_policy;
707     tBLE_BD_ADDR            *p_dir_bda;
708     tBTA_START_ADV_CMPL_CBACK  *p_start_adv_cback;
709 } tBTA_DM_API_BLE_ADV_PARAMS_ALL;
710 
711 
712 typedef struct {
713     BT_HDR                  hdr;
714     BOOLEAN                 enable;
715 
716 } tBTA_DM_API_BLE_FEATURE;
717 
718 /* multi adv data structure */
719 typedef struct {
720     BT_HDR                      hdr;
721     tBTA_BLE_MULTI_ADV_CBACK    *p_cback;
722     void                        *p_ref;
723     tBTA_BLE_ADV_PARAMS         *p_params;
724 } tBTA_DM_API_BLE_MULTI_ADV_ENB;
725 
726 typedef struct {
727     BT_HDR                      hdr;
728     UINT8                        inst_id;
729     tBTA_BLE_ADV_PARAMS         *p_params;
730 } tBTA_DM_API_BLE_MULTI_ADV_PARAM;
731 
732 typedef struct {
733     BT_HDR                  hdr;
734     UINT8                   inst_id;
735     BOOLEAN                 is_scan_rsp;
736     tBTA_BLE_AD_MASK        data_mask;
737     tBTA_BLE_ADV_DATA      *p_data;
738 } tBTA_DM_API_BLE_MULTI_ADV_DATA;
739 
740 typedef struct {
741     BT_HDR                  hdr;
742     UINT8                   inst_id;
743 } tBTA_DM_API_BLE_MULTI_ADV_DISABLE;
744 
745 typedef struct {
746     BT_HDR                  hdr;
747     UINT32                  data_mask;
748     tBTA_BLE_ADV_DATA       *p_adv_cfg;
749     tBTA_SET_ADV_DATA_CMPL_CBACK    *p_adv_data_cback;
750 } tBTA_DM_API_SET_ADV_CONFIG;
751 
752 /* raw scan response and raw advertising data use
753    the same structure */
754 typedef struct {
755     BT_HDR                  hdr;
756     UINT8                   *p_raw_adv;
757     UINT32                  raw_adv_len;
758     tBTA_SET_ADV_DATA_CMPL_CBACK    *p_adv_data_cback;
759 } tBTA_DM_API_SET_ADV_CONFIG_RAW;
760 
761 typedef struct {
762     BT_HDR                  hdr;
763     UINT8                   *adv_data;
764     UINT8                   adv_data_len;
765     tBTA_SET_ADV_DATA_CMPL_CBACK    *p_adv_data_cback;
766 } tBTA_DM_API_SET_LONG_ADV;
767 
768 typedef struct {
769     BT_HDR                  hdr;
770     UINT8                   batch_scan_full_max;
771     UINT8                   batch_scan_trunc_max;
772     UINT8                   batch_scan_notify_threshold;
773     tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback;
774     tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback;
775     tBTA_BLE_SCAN_REP_CBACK *p_read_rep_cback;
776     tBTA_DM_BLE_REF_VALUE    ref_value;
777 } tBTA_DM_API_SET_STORAGE_CONFIG;
778 
779 typedef struct {
780     BT_HDR                  hdr;
781     tBTA_BLE_BATCH_SCAN_MODE  scan_mode;
782     UINT32                  scan_int;
783     UINT32                  scan_window;
784     tBTA_BLE_DISCARD_RULE   discard_rule;
785     tBLE_ADDR_TYPE          addr_type;
786     tBTA_DM_BLE_REF_VALUE   ref_value;
787 } tBTA_DM_API_ENABLE_SCAN;
788 
789 typedef struct {
790     BT_HDR                  hdr;
791     tBTA_DM_BLE_REF_VALUE    ref_value;
792 } tBTA_DM_API_DISABLE_SCAN;
793 
794 typedef struct {
795     BT_HDR                  hdr;
796     tBTA_BLE_BATCH_SCAN_MODE scan_type;
797     tBTA_DM_BLE_REF_VALUE    ref_value;
798 } tBTA_DM_API_READ_SCAN_REPORTS;
799 
800 typedef struct {
801     BT_HDR                  hdr;
802     tBTA_DM_BLE_REF_VALUE ref_value;
803     tBTA_BLE_TRACK_ADV_CBACK *p_track_adv_cback;
804 } tBTA_DM_API_TRACK_ADVERTISER;
805 
806 typedef struct {
807     BT_HDR                  hdr;
808     tBTA_BLE_ENERGY_INFO_CBACK *p_energy_info_cback;
809 } tBTA_DM_API_ENERGY_INFO;
810 
811 typedef struct {
812     BT_HDR      hdr;
813     BD_ADDR     remote_bda;
814 } tBTA_DM_API_BLE_DISCONNECT;
815 
816 #endif /* BLE_INCLUDED */
817 
818 /* data type for BTA_DM_API_REMOVE_ACL_EVT */
819 typedef struct {
820     BT_HDR      hdr;
821     BD_ADDR     bd_addr;
822     BOOLEAN     remove_dev;
823     tBTA_TRANSPORT transport;
824 
825 } tBTA_DM_API_REMOVE_ACL;
826 
827 /* data type for BTA_DM_API_REMOVE_ALL_ACL_EVT */
828 typedef struct {
829     BT_HDR      hdr;
830     tBTA_DM_LINK_TYPE link_type;
831 
832 } tBTA_DM_API_REMOVE_ALL_ACL;
833 typedef struct {
834     BT_HDR      hdr;
835     BD_ADDR     bd_addr;
836     UINT16      min_int;
837     UINT16      max_int;
838     UINT16      latency;
839     UINT16      timeout;
840 } tBTA_DM_API_UPDATE_CONN_PARAM;
841 
842 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
843 typedef struct {
844     BT_HDR                          hdr;
845     tBTA_DM_BLE_SCAN_COND_OP        action;
846     tBTA_DM_BLE_PF_COND_TYPE        cond_type;
847     tBTA_DM_BLE_PF_FILT_INDEX       filt_index;
848     tBTA_DM_BLE_PF_COND_PARAM       *p_cond_param;
849     tBTA_DM_BLE_PF_CFG_CBACK      *p_filt_cfg_cback;
850     tBTA_DM_BLE_REF_VALUE            ref_value;
851 } tBTA_DM_API_CFG_FILTER_COND;
852 
853 typedef struct {
854     BT_HDR                          hdr;
855     UINT8                           action;
856     tBTA_DM_BLE_PF_STATUS_CBACK    *p_filt_status_cback;
857     tBTA_DM_BLE_REF_VALUE            ref_value;
858 } tBTA_DM_API_ENABLE_SCAN_FILTER;
859 
860 typedef struct {
861     BT_HDR                          hdr;
862     UINT8                           action;
863     tBTA_DM_BLE_PF_FILT_INDEX       filt_index;
864     tBTA_DM_BLE_PF_FILT_PARAMS      filt_params;
865     tBLE_BD_ADDR                    *p_target;
866     tBTA_DM_BLE_PF_PARAM_CBACK      *p_filt_param_cback;
867     tBTA_DM_BLE_REF_VALUE            ref_value;
868 } tBTA_DM_API_SCAN_FILTER_PARAM_SETUP;
869 #endif
870 #if (BLE_50_FEATURE_SUPPORT == TRUE)
871 
872 #define BTA_PHY_1M_MASK                   (1 << 0)
873 #define BTA_PHY_2M_MASK                   (1 << 1)
874 #define BTAS_PHY_CODED_MASK               (1 << 2)
875 typedef struct {
876     BT_HDR                          hdr;
877     BD_ADDR                         bd_addr;
878 } tBTA_DM_API_READ_PHY;
879 
880 typedef struct {
881     BT_HDR                          hdr;
882     tBTA_DM_BLE_GAP_PHY_MASK        tx_phy_mask;
883     tBTA_DM_BLE_GAP_PHY_MASK        rx_phy_mask;
884 } tBTA_DM_API_SET_PER_DEF_PHY;
885 
886 typedef struct {
887     BT_HDR                          hdr;
888     BD_ADDR                         bd_addr;
889     UINT8                           all_phys;
890     tBTA_DM_BLE_GAP_PHY_MASK        tx_phy_mask;
891     tBTA_DM_BLE_GAP_PHY_MASK        rx_phy_mask;
892     UINT16                          phy_options;
893 } tBTA_DM_API_SET_PER_PHY;
894 
895 typedef struct {
896     BT_HDR                          hdr;
897     UINT16                          instance;
898     BD_ADDR                         rand_addr;
899 } tBTA_DM_API_EXT_ADV_SET_RAND_ADDR;
900 
901 typedef struct {
902     BT_HDR                          hdr;
903     UINT16                          instance;
904     tBTA_DM_BLE_GAP_EXT_ADV_PARAMS  params;
905 } tBTA_DM_API_EXT_ADV_SET_PARAMS;
906 
907 typedef struct {
908     BT_HDR                          hdr;
909     BOOLEAN                         is_scan_rsp;
910     UINT8                           instance;
911     UINT16                          length;
912     UINT8                           *data;
913 } tBTA_DM_API_CFG_EXT_ADV_DATA;
914 
915 typedef struct {
916     BT_HDR                         hdr;
917     BOOLEAN                        enable;
918     UINT8                          num;
919     tBTA_DM_BLE_EXT_ADV            *ext_adv;
920 } tBTA_DM_API_BLE_EXT_ADV;
921 
922 typedef struct {
923     BT_HDR                         hdr;
924     UINT16                         instance;
925 } tBTA_DM_API_BLE_EXT_ADV_SET_REMOVE;
926 
927 typedef struct {
928     BT_HDR                         hdr;
929 } tBTA_DM_API_BLE_EXT_ADV_SET_CLEAR;
930 
931 typedef struct {
932     BT_HDR                         hdr;
933     UINT8                          instance;
934     tBTA_DM_BLE_Periodic_Adv_Params params;
935 } tBTA_DM_API_BLE_PERIODIC_ADV_SET_PARAMS;
936 
937 typedef struct {
938     BT_HDR                          hdr;
939     UINT8                           instance;
940     UINT16                          length;
941     UINT8                           *data;
942 } tBTA_DM_API_CFG_PERIODIC_ADV_DATA;
943 
944 typedef struct {
945     BT_HDR                          hdr;
946     UINT8                           instance;
947     BOOLEAN                         enable;
948 } tBTA_DM_API_ENABLE_PERIODIC_ADV;
949 
950 typedef struct {
951     BT_HDR                          hdr;
952     tBTA_DM_BLE_Periodic_Sync_Params params;
953 } tBTA_DM_API_PERIODIC_ADV_SYNC;
954 
955 typedef struct {
956     BT_HDR                          hdr;
957 } tBTA_DM_API_PERIODIC_ADV_SYNC_CANCEL;
958 
959 typedef struct {
960     BT_HDR                          hdr;
961     UINT16                          sync_handle;
962 } tBTA_DM_API_PERIODIC_ADV_SYNC_TERM;
963 
964 typedef struct {
965     BT_HDR                          hdr;
966     tBLE_ADDR_TYPE                  addr_type;
967     BD_ADDR                         addr;
968     UINT16                          sid;
969 } tBTA_DM_API_PERIODIC_ADV_ADD_DEV_TO_LIST;
970 
971 typedef struct {
972     BT_HDR                          hdr;
973     tBLE_ADDR_TYPE                  addr_type;
974     BD_ADDR                         addr;
975     UINT16                          sid;
976 } tBTA_DM_API_PERIODIC_ADV_REMOVE_DEV_FROM_LIST;
977 
978 typedef struct {
979     BT_HDR                          hdr;
980 } tBTA_DM_API_PERIODIC_ADV_DEV_CLEAR;
981 
982 
983 typedef struct {
984     BT_HDR                          hdr;
985     tBTA_DM_BLE_EXT_SCAN_PARAMS     params;
986 } tBTA_DM_API_SET_EXT_SCAN_PARAMS;
987 
988 typedef struct {
989     BT_HDR                          hdr;
990     BOOLEAN                         start;
991     UINT32                          duration;
992     UINT16                          period;
993 } tBTA_DM_API_EXT_SCAN;
994 
995 typedef struct {
996     BT_HDR                          hdr;
997     BD_ADDR                         bd_addr;
998     UINT8                           phy_mask;
999     tBTA_DM_BLE_CONN_PARAMS         phy_1m_conn_params;
1000     tBTA_DM_BLE_CONN_PARAMS         phy_2m_conn_params;
1001     tBTA_DM_BLE_CONN_PARAMS         phy_coded_conn_params;
1002 } tBTA_DM_API_SET_PER_EXT_CONN_PARAMS;
1003 
1004 typedef struct {
1005     BT_HDR                          hdr;
1006     tBLE_ADDR_TYPE                  own_addr_type;
1007     BD_ADDR                         peer_addr;
1008 } tBTA_DM_API_EXT_CONN;
1009 #endif //#if (BLE_50_FEATURE_SUPPORT == TRUE)
1010 /* union of all data types */
1011 typedef union {
1012     /* event buffer header */
1013     BT_HDR              hdr;
1014     tBTA_DM_API_ENABLE  enable;
1015 
1016     tBTA_DM_API_SET_NAME set_name;
1017     tBTA_DM_API_CONFIG_EIR config_eir;
1018 
1019     tBTA_DM_API_SET_AFH_CHANNELS set_afh_channels;
1020 #if (SDP_INCLUDED == TRUE)
1021     tBTA_DM_API_GET_REMOTE_NAME  get_rmt_name;
1022 #endif
1023 
1024 #if (BLE_INCLUDED == TRUE)
1025     tBTA_DM_API_BLE_SET_CHANNELS  ble_set_channels;
1026     tBTA_DM_API_UPDATE_WHITE_LIST white_list;
1027     tBTA_DM_API_READ_ADV_TX_POWER read_tx_power;
1028 #endif  ///BLE_INCLUDED == TRUE
1029     tBTA_DM_API_READ_RSSI rssi;
1030 
1031     tBTA_DM_API_SET_VISIBILITY set_visibility;
1032 
1033     tBTA_DM_API_ADD_DEVICE  add_dev;
1034 
1035     tBTA_DM_API_REMOVE_DEVICE remove_dev;
1036 
1037     tBTA_DM_API_SEARCH search;
1038 #if (SDP_INCLUDED == TRUE)
1039     tBTA_DM_API_DISCOVER discover;
1040 #endif  ///SDP_INCLUDED == TRUE
1041     tBTA_DM_API_BOND bond;
1042 
1043     tBTA_DM_API_BOND_CANCEL bond_cancel;
1044 
1045     tBTA_DM_API_SET_PIN_TYPE set_pin_type;
1046     tBTA_DM_API_PIN_REPLY pin_reply;
1047 
1048     tBTA_DM_API_LOC_OOB     loc_oob;
1049     tBTA_DM_API_OOB_REPLY   oob_reply;
1050     tBTA_DM_API_CONFIRM     confirm;
1051     tBTA_DM_API_KEY_REQ     key_req;
1052     tBTA_DM_CI_IO_REQ       ci_io_req;
1053     tBTA_DM_CI_RMT_OOB      ci_rmt_oob;
1054 
1055     tBTA_DM_REM_NAME rem_name;
1056 
1057     tBTA_DM_DISC_RESULT disc_result;
1058 
1059     tBTA_DM_INQUIRY_CMPL inq_cmpl;
1060 
1061     tBTA_DM_SDP_RESULT sdp_event;
1062 
1063     tBTA_DM_ACL_CHANGE  acl_change;
1064 
1065 #if (BTA_DM_PM_INCLUDED == TRUE)
1066     tBTA_DM_PM_BTM_STATUS pm_status;
1067 
1068     tBTA_DM_PM_TIMER pm_timer;
1069 #endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
1070 
1071 #if (BTA_DM_QOS_INCLUDED == TRUE)
1072     /* Quality of Service set events */
1073     tBTA_DM_API_QOS_SET qos_set;
1074 #endif /* #if (BTA_DM_QOS_INCLUDED == TRUE) */
1075 
1076     tBTA_DM_API_DI_DISC     di_disc;
1077 
1078     tBTA_DM_API_EXECUTE_CBACK exec_cback;
1079 
1080     tBTA_DM_API_SET_ENCRYPTION     set_encryption;
1081 
1082 #if BLE_INCLUDED == TRUE
1083     tBTA_DM_API_ADD_BLEKEY              add_ble_key;
1084     tBTA_DM_API_ADD_BLE_DEVICE          add_ble_device;
1085     tBTA_DM_API_PASSKEY_REPLY           ble_passkey_reply;
1086     tBTA_DM_API_SET_DEFAULT_PASSKEY     ble_set_static_passkey;
1087     tBTA_DM_API_BLE_SEC_GRANT           ble_sec_grant;
1088     tBTA_DM_API_BLE_SET_BG_CONN_TYPE    ble_set_bd_conn_type;
1089     tBTA_DM_API_BLE_CONN_PARAMS         ble_set_conn_params;
1090     tBTA_DM_API_BLE_CONN_SCAN_PARAMS    ble_set_conn_scan_params;
1091     tBTA_DM_API_BLE_SCAN_PARAMS         ble_set_scan_params;
1092     tBTA_DM_API_BLE_SCAN_FILTER_PARAMS  ble_set_scan_fil_params;
1093     tBTA_DM_API_BLE_OBSERVE             ble_observe;
1094     tBTA_DM_API_BLE_SCAN                ble_scan;
1095     tBTA_DM_API_ENABLE_PRIVACY          ble_remote_privacy;
1096     tBTA_DM_API_LOCAL_PRIVACY           ble_local_privacy;
1097     tBTA_DM_API_LOCAL_ICON              ble_local_icon;
1098     tBTA_DM_API_BLE_ADV_PARAMS          ble_set_adv_params;
1099     tBTA_DM_API_BLE_ADV_PARAMS_ALL      ble_set_adv_params_all;
1100     tBTA_DM_API_SET_ADV_CONFIG          ble_set_adv_data;
1101     tBTA_DM_API_SET_ADV_CONFIG_RAW      ble_set_adv_data_raw;
1102     tBTA_DM_API_SET_LONG_ADV            ble_set_long_adv_data;
1103 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
1104     tBTA_DM_API_SCAN_FILTER_PARAM_SETUP ble_scan_filt_param_setup;
1105     tBTA_DM_API_CFG_FILTER_COND         ble_cfg_filter_cond;
1106     tBTA_DM_API_ENABLE_SCAN_FILTER      ble_enable_scan_filt;
1107 #endif
1108     tBTA_DM_API_UPDATE_CONN_PARAM       ble_update_conn_params;
1109     tBTA_DM_API_BLE_SET_DATA_LENGTH     ble_set_data_length;
1110     tBTA_DM_APT_SET_DEV_ADDR            set_addr;
1111     tBTA_DM_APT_CLEAR_ADDR              clear_addr;
1112     tBTA_DM_API_BLE_MULTI_ADV_ENB       ble_multi_adv_enb;
1113     tBTA_DM_API_BLE_MULTI_ADV_PARAM     ble_multi_adv_param;
1114     tBTA_DM_API_BLE_MULTI_ADV_DATA      ble_multi_adv_data;
1115     tBTA_DM_API_BLE_MULTI_ADV_DISABLE   ble_multi_adv_disable;
1116 
1117     tBTA_DM_API_SET_STORAGE_CONFIG      ble_set_storage;
1118     tBTA_DM_API_ENABLE_SCAN             ble_enable_scan;
1119     tBTA_DM_API_READ_SCAN_REPORTS       ble_read_reports;
1120     tBTA_DM_API_DISABLE_SCAN            ble_disable_scan;
1121     tBTA_DM_API_TRACK_ADVERTISER        ble_track_advert;
1122     tBTA_DM_API_ENERGY_INFO             ble_energy_info;
1123     tBTA_DM_API_BLE_DISCONNECT          ble_disconnect;
1124     tBTA_DM_API_UPDATE_DUPLICATE_EXCEPTIONAL_LIST ble_duplicate_exceptional_list;
1125 #if (BLE_50_FEATURE_SUPPORT == TRUE)
1126     tBTA_DM_API_READ_PHY                ble_read_phy;
1127     tBTA_DM_API_SET_PER_DEF_PHY         ble_set_per_def_phy;
1128     tBTA_DM_API_SET_PER_PHY             ble_set_per_phy;
1129     tBTA_DM_API_EXT_ADV_SET_RAND_ADDR   ble_set_ext_adv_rand_addr;
1130     tBTA_DM_API_EXT_ADV_SET_PARAMS      ble_set_ext_adv_params;
1131     tBTA_DM_API_CFG_EXT_ADV_DATA        ble_cfg_ext_adv_data;
1132     tBTA_DM_API_BLE_EXT_ADV             ble_start_ext_adv;
1133     tBTA_DM_API_BLE_EXT_ADV_SET_REMOVE  ble_ext_adv_set_remove;
1134     tBTA_DM_API_BLE_EXT_ADV_SET_CLEAR   ble_ext_adv_set_clear;
1135     tBTA_DM_API_BLE_PERIODIC_ADV_SET_PARAMS ble_set_periodic_adv_params;
1136     tBTA_DM_API_CFG_PERIODIC_ADV_DATA   ble_cfg_periodic_adv_data;
1137     tBTA_DM_API_ENABLE_PERIODIC_ADV     ble_enable_periodic_adv;
1138     tBTA_DM_API_PERIODIC_ADV_SYNC       ble_periodic_adv_sync;
1139     tBTA_DM_API_PERIODIC_ADV_SYNC_CANCEL ble_periodic_adv_sync_cancel;
1140     tBTA_DM_API_PERIODIC_ADV_SYNC_TERM   ble_periodic_adv_sync_term;
1141     tBTA_DM_API_PERIODIC_ADV_ADD_DEV_TO_LIST ble_periodic_adv_add_dev_to_list;
1142     tBTA_DM_API_PERIODIC_ADV_REMOVE_DEV_FROM_LIST ble_periodic_adv_remove_dev_from_list;
1143     tBTA_DM_API_PERIODIC_ADV_DEV_CLEAR  ble_periodic_adv_clear_dev;
1144     tBTA_DM_API_SET_EXT_SCAN_PARAMS     ble_set_ext_scan_params;
1145     tBTA_DM_API_EXT_SCAN                ble_ext_scan;
1146     tBTA_DM_API_SET_PER_EXT_CONN_PARAMS ble_set_per_ext_conn_params;
1147 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
1148 #endif
1149 
1150     tBTA_DM_API_REMOVE_ACL              remove_acl;
1151     tBTA_DM_API_REMOVE_ALL_ACL          remove_all_acl;
1152 
1153 } tBTA_DM_MSG;
1154 
1155 
1156 #define BTA_DM_NUM_PEER_DEVICE 7
1157 
1158 #define BTA_DM_NOT_CONNECTED  0
1159 #define BTA_DM_CONNECTED      1
1160 #define BTA_DM_UNPAIRING      2
1161 typedef UINT8 tBTA_DM_CONN_STATE;
1162 
1163 
1164 #define BTA_DM_DI_NONE          0x00       /* nothing special */
1165 #define BTA_DM_DI_USE_SSR       0x10       /* set this bit if ssr is supported for this link */
1166 #define BTA_DM_DI_AV_ACTIVE     0x20       /* set this bit if AV is active for this link */
1167 #define BTA_DM_DI_SET_SNIFF     0x01       /* set this bit if call BTM_SetPowerMode(sniff) */
1168 #define BTA_DM_DI_INT_SNIFF     0x02       /* set this bit if call BTM_SetPowerMode(sniff) & enter sniff mode */
1169 #define BTA_DM_DI_ACP_SNIFF     0x04       /* set this bit if peer init sniff */
1170 typedef UINT8 tBTA_DM_DEV_INFO;
1171 
1172 /* set power mode request type */
1173 #define BTA_DM_PM_RESTART       1
1174 #define BTA_DM_PM_NEW_REQ       2
1175 #define BTA_DM_PM_EXECUTE       3
1176 typedef UINT8   tBTA_DM_PM_REQ;
1177 
1178 typedef struct {
1179     BD_ADDR                     peer_bdaddr;
1180     UINT16                      link_policy;
1181     tBTA_DM_CONN_STATE          conn_state;
1182     tBTA_PREF_ROLES             pref_role;
1183     BOOLEAN                     in_use;
1184     tBTA_DM_DEV_INFO            info;
1185     tBTA_DM_ENCRYPT_CBACK      *p_encrypt_cback;
1186 #if (BTM_SSR_INCLUDED == TRUE)
1187     tBTM_PM_STATUS              prev_low;   /* previous low power mode used */
1188 #endif
1189     tBTA_DM_PM_ACTION           pm_mode_attempted;
1190     tBTA_DM_PM_ACTION           pm_mode_failed;
1191     BOOLEAN                     remove_dev_pending;
1192 #if BLE_INCLUDED == TRUE
1193     UINT16                      conn_handle;
1194 #endif
1195     tBT_TRANSPORT               transport;
1196 } tBTA_DM_PEER_DEVICE;
1197 
1198 
1199 
1200 /* structure to store list of
1201   active connections */
1202 typedef struct {
1203     tBTA_DM_PEER_DEVICE    peer_device[BTA_DM_NUM_PEER_DEVICE];
1204     UINT8                  count;
1205 #if BLE_INCLUDED == TRUE
1206     UINT8                  le_count;
1207 #endif
1208 } tBTA_DM_ACTIVE_LINK;
1209 
1210 
1211 typedef struct {
1212     BD_ADDR                 peer_bdaddr;
1213     tBTA_SYS_ID             id;
1214     UINT8                   app_id;
1215     tBTA_SYS_CONN_STATUS    state;
1216     BOOLEAN                 new_request;
1217 
1218 } tBTA_DM_SRVCS;
1219 
1220 #ifndef BTA_DM_NUM_CONN_SRVS
1221 #define BTA_DM_NUM_CONN_SRVS   10
1222 #endif
1223 
1224 typedef struct {
1225 
1226     UINT8 count;
1227     tBTA_DM_SRVCS  conn_srvc[BTA_DM_NUM_CONN_SRVS];
1228 
1229 }  tBTA_DM_CONNECTED_SRVCS;
1230 
1231 
1232 #if (BTA_DM_PM_INCLUDED == TRUE)
1233 
1234 typedef struct {
1235 #define BTA_DM_PM_SNIFF_TIMER_IDX   0
1236 #define BTA_DM_PM_PARK_TIMER_IDX    1
1237 #define BTA_DM_PM_SUSPEND_TIMER_IDX 2
1238 #define BTA_DM_PM_MODE_TIMER_MAX    3
1239     /*
1240      * Keep three different timers for PARK, SNIFF and SUSPEND if TBFC is
1241      * supported.
1242      */
1243     TIMER_LIST_ENT          timer[BTA_DM_PM_MODE_TIMER_MAX];
1244 
1245     UINT8                   srvc_id[BTA_DM_PM_MODE_TIMER_MAX];
1246     UINT8                   pm_action[BTA_DM_PM_MODE_TIMER_MAX];
1247     UINT8                   active;     /* number of active timer */
1248 
1249     BD_ADDR                 peer_bdaddr;
1250     BOOLEAN                 in_use;
1251 } tBTA_PM_TIMER;
1252 
1253 #define BTA_DM_NUM_PM_TIMER 7
1254 #endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
1255 
1256 /* DM control block */
1257 typedef struct {
1258     BOOLEAN                     is_bta_dm_active;
1259     tBTA_DM_ACTIVE_LINK         device_list;
1260     tBTA_DM_SEC_CBACK           *p_sec_cback;
1261 #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
1262     tBTA_BLE_SCAN_SETUP_CBACK   *p_setup_cback;
1263     tBTA_DM_BLE_PF_CFG_CBACK     *p_scan_filt_cfg_cback;
1264     tBTA_DM_BLE_PF_STATUS_CBACK  *p_scan_filt_status_cback;
1265     tBTA_DM_BLE_PF_PARAM_CBACK   *p_scan_filt_param_cback;
1266     tBTA_BLE_MULTI_ADV_CBACK     *p_multi_adv_cback;
1267     tBTA_BLE_ENERGY_INFO_CBACK   *p_energy_info_cback;
1268 #endif
1269     UINT16                      state;
1270     BOOLEAN                     disabling;
1271     TIMER_LIST_ENT              disable_timer;
1272     UINT32                      wbt_sdp_handle;          /* WIDCOMM Extensions SDP record handle */
1273     UINT8                       wbt_scn;                 /* WIDCOMM Extensions SCN */
1274     UINT8                       num_master_only;
1275 #if (BTA_DM_PM_INCLUDED == TRUE)
1276     UINT8                       pm_id;
1277     tBTA_PM_TIMER               pm_timer[BTA_DM_NUM_PM_TIMER];
1278 #endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
1279     UINT32                      role_policy_mask;   /* the bits set indicates the modules that wants to remove role switch from the default link policy */
1280     UINT16                      cur_policy;         /* current default link policy */
1281     UINT16                      rs_event;           /* the event waiting for role switch */
1282     UINT8                       cur_av_count;       /* current AV connecions */
1283     BOOLEAN                     disable_pair_mode;          /* disable pair mode or not */
1284     BOOLEAN                     conn_paired_only;   /* allow connectable to paired device only or not */
1285     tBTA_DM_API_SEARCH          search_msg;
1286 
1287 #if (CLASSIC_BT_INCLUDED == TRUE)
1288     UINT16                      page_scan_interval;
1289     UINT16                      page_scan_window;
1290     UINT16                      inquiry_scan_interval;
1291     UINT16                      inquiry_scan_window;
1292 
1293     /* Storage for pin code request parameters */
1294     BD_ADDR                     pin_bd_addr;
1295     DEV_CLASS                   pin_dev_class;
1296     tBTA_DM_SEC_EVT             pin_evt;
1297     UINT32                      num_val;        /* the numeric value for comparison. If just_works, do not show this number to UI */
1298     BOOLEAN                     just_works;     /* TRUE, if "Just Works" association model */
1299 #endif
1300 
1301 #if ( BTA_EIR_CANNED_UUID_LIST != TRUE )
1302     /* store UUID list for EIR */
1303     TIMER_LIST_ENT              app_ready_timer;
1304     UINT32                      eir_uuid[BTM_EIR_SERVICE_ARRAY_SIZE];
1305 #if (BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0)
1306     tBT_UUID                    custom_uuid[BTA_EIR_SERVER_NUM_CUSTOM_UUID];
1307 #endif
1308 
1309 #endif
1310 
1311 
1312     tBTA_DM_ENCRYPT_CBACK      *p_encrypt_cback;
1313     TIMER_LIST_ENT              switch_delay_timer[BTA_DM_NUM_PEER_DEVICE];
1314 
1315 } tBTA_DM_CB;
1316 
1317 #ifndef BTA_DM_SDP_DB_SIZE
1318 #define BTA_DM_SDP_DB_SIZE 250
1319 #endif
1320 
1321 /* DM search control block */
1322 typedef struct {
1323 
1324     tBTA_DM_SEARCH_CBACK *p_search_cback;
1325     tBTM_INQ_INFO         *p_btm_inq_info;
1326     tBTA_SERVICE_MASK      services;
1327     tBTA_SERVICE_MASK      services_to_search;
1328     tBTA_SERVICE_MASK      services_found;
1329 #if (SDP_INCLUDED == TRUE)
1330     tSDP_DISCOVERY_DB     *p_sdp_db;
1331 #endif  ///SDP_INCLUDED == TRUE
1332     UINT16                 state;
1333     BD_ADDR                peer_bdaddr;
1334     BOOLEAN                name_discover_done;
1335     BD_NAME                peer_name;
1336     TIMER_LIST_ENT         search_timer;
1337     UINT8                  service_index;
1338     tBTA_DM_MSG           *p_search_queue;   /* search or discover commands during search cancel stored here */
1339     BOOLEAN                wait_disc;
1340     BOOLEAN                sdp_results;
1341 #if (SDP_INCLUDED == TRUE)
1342     tSDP_UUID              uuid;
1343 #endif  ///SDP_INCLUDED == TRUE
1344     UINT8                  peer_scn;
1345     BOOLEAN                sdp_search;
1346     BOOLEAN                cancel_pending; /* inquiry cancel is pending */
1347     tBTA_TRANSPORT         transport;
1348 #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
1349     tBTA_DM_SEARCH_CBACK *p_scan_cback;
1350 #if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE)
1351     tBTA_GATTC_IF          client_if;
1352     UINT8                  num_uuid;
1353     tBT_UUID               *p_srvc_uuid;
1354     UINT8                  uuid_to_search;
1355     BOOLEAN                gatt_disc_active;
1356     UINT16                 conn_id;
1357     UINT8                  *p_ble_rawdata;
1358     UINT32                 ble_raw_size;
1359     UINT32                 ble_raw_used;
1360     TIMER_LIST_ENT         gatt_close_timer; /* GATT channel close delay timer */
1361     BD_ADDR                pending_close_bda; /* pending GATT channel remote device address */
1362 #endif
1363 #endif
1364 
1365 
1366 } tBTA_DM_SEARCH_CB;
1367 
1368 /* DI control block */
1369 typedef struct {
1370 #if (SDP_INCLUDED == TRUE)
1371     tSDP_DISCOVERY_DB     *p_di_db;     /* pointer to the DI discovery database */
1372 #endif  ///SDP_INCLUDED == TRUE
1373     UINT8               di_num;         /* total local DI record number */
1374     UINT32              di_handle[BTA_DI_NUM_MAX];  /* local DI record handle, the first one is primary record */
1375 } tBTA_DM_DI_CB;
1376 
1377 /* DM search state */
1378 enum {
1379 
1380     BTA_DM_SEARCH_IDLE,
1381     BTA_DM_SEARCH_ACTIVE,
1382     BTA_DM_SEARCH_CANCELLING,
1383     BTA_DM_DISCOVER_ACTIVE
1384 
1385 };
1386 
1387 
1388 
1389 typedef struct {
1390     DEV_CLASS      dev_class;          /* local device class */
1391     UINT16         policy_settings;    /* link policy setting hold, sniff, park, MS switch */
1392     UINT16         page_timeout;       /* timeout for page in slots */
1393     UINT16         link_timeout;       /* link supervision timeout in slots */
1394     BOOLEAN        avoid_scatter;      /* TRUE to avoid scatternet when av is streaming (be the master) */
1395 
1396 } tBTA_DM_CFG;
1397 
1398 extern const UINT32 bta_service_id_to_btm_srv_id_lkup_tbl[];
1399 
1400 
1401 typedef struct {
1402     UINT8   id;
1403     UINT8   app_id;
1404     UINT8   cfg;
1405 
1406 } tBTA_DM_RM ;
1407 
1408 extern tBTA_DM_CFG *const p_bta_dm_cfg;
1409 extern tBTA_DM_RM *const p_bta_dm_rm_cfg;
1410 
1411 typedef struct {
1412 
1413     UINT8  id;
1414     UINT8  app_id;
1415     UINT8  spec_idx;  /* index of spec table to use */
1416 
1417 } tBTA_DM_PM_CFG;
1418 
1419 
1420 typedef struct {
1421 
1422     tBTA_DM_PM_ACTION   power_mode;
1423     UINT16              timeout;
1424 
1425 } tBTA_DM_PM_ACTN;
1426 
1427 typedef struct {
1428 
1429     UINT8  allow_mask;         /* mask of sniff/hold/park modes to allow */
1430 #if (BTM_SSR_INCLUDED == TRUE)
1431     UINT8  ssr;                /* set SSR on conn open/unpark */
1432 #endif
1433     tBTA_DM_PM_ACTN actn_tbl [BTA_DM_PM_NUM_EVTS][2];
1434 
1435 } tBTA_DM_PM_SPEC;
1436 
1437 typedef struct {
1438     UINT16      max_lat;
1439     UINT16      min_rmt_to;
1440     UINT16      min_loc_to;
1441 } tBTA_DM_SSR_SPEC;
1442 
1443 typedef struct {
1444     UINT16 manufacturer;
1445     UINT16 lmp_sub_version;
1446     UINT8 lmp_version;
1447 } tBTA_DM_LMP_VER_INFO;
1448 
1449 #if (BTA_DM_PM_INCLUDED == TRUE)
1450 extern tBTA_DM_PM_CFG *const p_bta_dm_pm_cfg;
1451 extern tBTA_DM_PM_SPEC *const p_bta_dm_pm_spec;
1452 extern tBTM_PM_PWR_MD *const p_bta_dm_pm_md;
1453 #if (BTM_SSR_INCLUDED == TRUE)
1454 extern tBTA_DM_SSR_SPEC *const p_bta_dm_ssr_spec;
1455 #endif
1456 #endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
1457 
1458 /* update dynamic BRCM Aware EIR data */
1459 extern tBTA_DM_EIR_CONF bta_dm_eir_cfg;
1460 extern tBTA_DM_EIR_CONF *p_bta_dm_eir_cfg;
1461 
1462 /* DM control block */
1463 #if BTA_DYNAMIC_MEMORY == FALSE
1464 extern tBTA_DM_CB  bta_dm_cb;
1465 #else
1466 extern tBTA_DM_CB *bta_dm_cb_ptr;
1467 #define bta_dm_cb (*bta_dm_cb_ptr)
1468 #endif
1469 
1470 /* DM search control block */
1471 #if BTA_DYNAMIC_MEMORY == FALSE
1472 extern tBTA_DM_SEARCH_CB  bta_dm_search_cb;
1473 #else
1474 extern tBTA_DM_SEARCH_CB *bta_dm_search_cb_ptr;
1475 #define bta_dm_search_cb (*bta_dm_search_cb_ptr)
1476 #endif
1477 
1478 /* DI control block */
1479 #if BTA_DYNAMIC_MEMORY == FALSE
1480 extern tBTA_DM_DI_CB  bta_dm_di_cb;
1481 #else
1482 extern tBTA_DM_DI_CB *bta_dm_di_cb_ptr;
1483 #define bta_dm_di_cb (*bta_dm_di_cb_ptr)
1484 SemaphoreHandle_t deinit_semaphore;
1485 #endif
1486 
1487 #if BTA_DYNAMIC_MEMORY == FALSE
1488 extern tBTA_DM_CONNECTED_SRVCS  bta_dm_conn_srvcs;
1489 #else
1490 extern tBTA_DM_CONNECTED_SRVCS *bta_dm_conn_srvcs_ptr;
1491 #define bta_dm_conn_srvcs (*bta_dm_conn_srvcs_ptr)
1492 #endif
1493 
1494 /* Discovery raw data buffer */
1495 #define MAX_DISC_RAW_DATA_BUF       (1024)
1496 #if BTA_DYNAMIC_MEMORY == TRUE
1497 extern UINT8 *g_disc_raw_data_buf;
1498 #endif
1499 
1500 extern BOOLEAN bta_dm_sm_execute(BT_HDR *p_msg);
1501 extern void bta_dm_sm_disable( void );
1502 extern void bta_dm_sm_deinit(void);
1503 extern BOOLEAN bta_dm_search_sm_execute(BT_HDR *p_msg);
1504 extern void bta_dm_search_sm_disable( void );
1505 
1506 
1507 extern void bta_dm_enable (tBTA_DM_MSG *p_data);
1508 extern void bta_dm_disable (tBTA_DM_MSG *p_data);
1509 extern void bta_dm_set_dev_name (tBTA_DM_MSG *p_data);
1510 #if (CLASSIC_BT_INCLUDED == TRUE)
1511 extern void bta_dm_config_eir (tBTA_DM_MSG *p_data);
1512 #endif
1513 extern void bta_dm_set_afh_channels (tBTA_DM_MSG *p_data);
1514 extern void bta_dm_read_rmt_name(tBTA_DM_MSG *p_data);
1515 extern void bta_dm_ble_set_channels (tBTA_DM_MSG *p_data);
1516 extern void bta_dm_update_white_list(tBTA_DM_MSG *p_data);
1517 extern void bta_dm_clear_white_list(tBTA_DM_MSG *p_data);
1518 extern void bta_dm_ble_read_adv_tx_power(tBTA_DM_MSG *p_data);
1519 extern void bta_dm_read_rssi(tBTA_DM_MSG *p_data);
1520 extern void bta_dm_set_visibility (tBTA_DM_MSG *p_data);
1521 
1522 extern void bta_dm_set_scan_config(tBTA_DM_MSG *p_data);
1523 extern void bta_dm_vendor_spec_command(tBTA_DM_MSG *p_data);
1524 extern void bta_dm_bond (tBTA_DM_MSG *p_data);
1525 extern void bta_dm_bond_cancel (tBTA_DM_MSG *p_data);
1526 extern void bta_dm_set_pin_type (tBTA_DM_MSG *p_data);
1527 extern void bta_dm_pin_reply (tBTA_DM_MSG *p_data);
1528 extern void bta_dm_acl_change(tBTA_DM_MSG *p_data);
1529 extern void bta_dm_add_device (tBTA_DM_MSG *p_data);
1530 extern void bta_dm_remove_device (tBTA_DM_MSG *p_data);
1531 extern void bta_dm_close_acl(tBTA_DM_MSG *p_data);
1532 
1533 extern void bta_dm_add_ampkey (tBTA_DM_MSG *p_data);
1534 
1535 #if BLE_INCLUDED == TRUE
1536 extern void bta_dm_add_blekey (tBTA_DM_MSG *p_data);
1537 extern void bta_dm_add_ble_device (tBTA_DM_MSG *p_data);
1538 extern void bta_dm_ble_passkey_reply (tBTA_DM_MSG *p_data);
1539 extern void bta_dm_ble_set_static_passkey(tBTA_DM_MSG *p_data);
1540 extern void bta_dm_ble_confirm_reply (tBTA_DM_MSG *p_data);
1541 extern void bta_dm_security_grant (tBTA_DM_MSG *p_data);
1542 extern void bta_dm_ble_set_bg_conn_type (tBTA_DM_MSG *p_data);
1543 extern void bta_dm_ble_set_conn_params (tBTA_DM_MSG *p_data);
1544 extern void bta_dm_ble_set_scan_params(tBTA_DM_MSG *p_data);
1545 extern void bta_dm_ble_set_scan_fil_params(tBTA_DM_MSG *p_data);
1546 extern void bta_dm_ble_set_conn_scan_params (tBTA_DM_MSG *p_data);
1547 #if ((defined BTA_GATT_INCLUDED) &&  (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE)
1548 extern void bta_dm_close_gatt_conn(tBTA_DM_MSG *p_data);
1549 #endif /* ((defined BTA_GATT_INCLUDED) &&  (BTA_GATT_INCLUDED == TRUE) && SDP_INCLUDED == TRUE) && (GATTC_INCLUDED == TRUE) */
1550 extern void bta_dm_ble_observe (tBTA_DM_MSG *p_data);
1551 extern void bta_dm_ble_scan (tBTA_DM_MSG *p_data);
1552 extern void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data);
1553 extern void bta_dm_ble_disconnect (tBTA_DM_MSG *p_data);
1554 extern void bta_dm_ble_set_rand_address(tBTA_DM_MSG *p_data);
1555 extern void bta_dm_ble_clear_rand_address(tBTA_DM_MSG *p_data);
1556 extern void bta_dm_ble_stop_advertising(tBTA_DM_MSG *p_data);
1557 extern void bta_dm_ble_config_local_privacy (tBTA_DM_MSG *p_data);
1558 extern void bta_dm_ble_config_local_icon (tBTA_DM_MSG *p_data);
1559 extern void bta_dm_ble_set_adv_params (tBTA_DM_MSG *p_data);
1560 extern void bta_dm_ble_set_adv_params_all(tBTA_DM_MSG *p_data);
1561 extern void bta_dm_ble_set_adv_config (tBTA_DM_MSG *p_data);
1562 extern void bta_dm_ble_set_long_adv (tBTA_DM_MSG *p_data);
1563 extern void bta_dm_ble_set_adv_config_raw (tBTA_DM_MSG *p_data);
1564 extern void bta_dm_ble_set_scan_rsp (tBTA_DM_MSG *p_data);
1565 extern void bta_dm_ble_set_scan_rsp_raw (tBTA_DM_MSG *p_data);
1566 extern void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data);
1567 extern void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data);
1568 extern void bta_dm_ble_update_duplicate_exceptional_list(tBTA_DM_MSG *p_data);
1569 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
1570 extern void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data);
1571 extern void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data);
1572 extern void bta_dm_enable_scan_filter(tBTA_DM_MSG *p_data);
1573 #endif
1574 extern void btm_dm_ble_multi_adv_disable(tBTA_DM_MSG *p_data);
1575 extern void bta_dm_ble_multi_adv_data(tBTA_DM_MSG *p_data);
1576 extern void bta_dm_ble_multi_adv_upd_param(tBTA_DM_MSG *p_data);
1577 extern void bta_dm_ble_multi_adv_enb(tBTA_DM_MSG *p_data);
1578 #if (BLE_50_FEATURE_SUPPORT == TRUE)
1579 extern void bta_dm_ble_gap_read_phy(tBTA_DM_MSG *p_data);
1580 extern void bta_dm_ble_gap_set_prefer_default_phy(tBTA_DM_MSG *p_data);
1581 extern void bta_dm_ble_gap_set_prefer_phy(tBTA_DM_MSG *p_data);
1582 extern void bta_dm_ble_gap_ext_adv_set_rand_addr(tBTA_DM_MSG *p_data);
1583 extern void bta_dm_ble_gap_ext_adv_set_params(tBTA_DM_MSG *p_data);
1584 extern void bta_dm_ble_gap_config_ext_adv_data_raw(tBTA_DM_MSG *p_data);
1585 extern void bta_dm_ble_gap_set_ext_scan_params(tBTA_DM_MSG *p_data);
1586 extern void bta_dm_ble_gap_ext_scan(tBTA_DM_MSG *p_data);
1587 extern void bta_dm_ble_gap_set_prefer_ext_conn_params(tBTA_DM_MSG *p_data);
1588 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
1589 extern void bta_dm_ble_setup_storage(tBTA_DM_MSG *p_data);
1590 extern void bta_dm_ble_enable_batch_scan(tBTA_DM_MSG *p_data);
1591 extern void bta_dm_ble_disable_batch_scan(tBTA_DM_MSG *p_data);
1592 extern void bta_dm_ble_read_scan_reports(tBTA_DM_MSG *p_data);
1593 extern void bta_dm_ble_track_advertiser(tBTA_DM_MSG *p_data);
1594 extern void bta_dm_ble_get_energy_info(tBTA_DM_MSG *p_data);
1595 
1596 #endif
1597 extern void bta_dm_set_encryption(tBTA_DM_MSG *p_data);
1598 extern void bta_dm_confirm(tBTA_DM_MSG *p_data);
1599 extern void bta_dm_key_req(tBTA_DM_MSG *p_data);
1600 
1601 #if (BTA_HD_INCLUDED == TRUE)
1602 extern BOOLEAN bta_dm_check_if_only_hd_connected(BD_ADDR peer_addr);
1603 #endif /* BTA_HD_INCLUDED */
1604 
1605 #if (BTM_OOB_INCLUDED == TRUE)
1606 extern void bta_dm_loc_oob(tBTA_DM_MSG *p_data);
1607 extern void bta_dm_oob_reply(tBTA_DM_MSG *p_data);
1608 extern void bta_dm_ci_io_req_act(tBTA_DM_MSG *p_data);
1609 extern void bta_dm_ci_rmt_oob_act(tBTA_DM_MSG *p_data);
1610 #endif /* BTM_OOB_INCLUDED */
1611 
1612 #if (BTA_DM_PM_INCLUDED == TRUE)
1613 extern void bta_dm_init_pm(void);
1614 extern void bta_dm_disable_pm(void);
1615 extern void bta_dm_pm_active(BD_ADDR peer_addr);
1616 extern void bta_dm_pm_btm_status(tBTA_DM_MSG *p_data);
1617 extern void bta_dm_pm_timer(tBTA_DM_MSG *p_data);
1618 #endif /* #if (BTA_DM_PM_INCLUDED == TRUE) */
1619 
1620 #if (BTA_DM_QOS_INCLUDED == TRUE)
1621 extern void bta_dm_set_qos(tBTA_DM_MSG *p_data);
1622 #endif /* #if (BTA_DM_QOS_INCLUDED == TRUE) */
1623 
1624 extern UINT8 bta_dm_get_av_count(void);
1625 extern void bta_dm_search_start (tBTA_DM_MSG *p_data);
1626 extern void bta_dm_search_cancel (tBTA_DM_MSG *p_data);
1627 extern void bta_dm_discover (tBTA_DM_MSG *p_data);
1628 #if (SDP_INCLUDED == TRUE)
1629 extern void bta_dm_di_disc (tBTA_DM_MSG *p_data);
1630 #endif  ///SDP_INCLUDED == TRUE
1631 extern void bta_dm_inq_cmpl (tBTA_DM_MSG *p_data);
1632 extern void bta_dm_rmt_name (tBTA_DM_MSG *p_data);
1633 #if (SDP_INCLUDED == TRUE)
1634 extern void bta_dm_sdp_result (tBTA_DM_MSG *p_data);
1635 #endif  ///SDP_INCLUDED == TRUE
1636 extern void bta_dm_search_cmpl (tBTA_DM_MSG *p_data);
1637 extern void bta_dm_free_sdp_db (tBTA_DM_MSG *p_data);
1638 extern void bta_dm_disc_result (tBTA_DM_MSG *p_data);
1639 extern void bta_dm_search_result (tBTA_DM_MSG *p_data);
1640 extern void bta_dm_discovery_cmpl (tBTA_DM_MSG *p_data);
1641 extern void bta_dm_queue_search (tBTA_DM_MSG *p_data);
1642 extern void bta_dm_queue_disc (tBTA_DM_MSG *p_data);
1643 extern void bta_dm_search_clear_queue (tBTA_DM_MSG *p_data);
1644 extern void bta_dm_search_cancel_cmpl (tBTA_DM_MSG *p_data);
1645 extern void bta_dm_search_cancel_notify (tBTA_DM_MSG *p_data);
1646 extern void bta_dm_search_cancel_transac_cmpl(tBTA_DM_MSG *p_data);
1647 extern void bta_dm_disc_rmt_name (tBTA_DM_MSG *p_data);
1648 extern tBTA_DM_PEER_DEVICE *bta_dm_find_peer_device(BD_ADDR peer_addr);
1649 void bta_dm_eir_update_uuid(UINT16 uuid16, BOOLEAN adding);
1650 
1651 extern void bta_dm_enable_test_mode(tBTA_DM_MSG *p_data);
1652 extern void bta_dm_disable_test_mode(tBTA_DM_MSG *p_data);
1653 extern void bta_dm_execute_callback(tBTA_DM_MSG *p_data);
1654 
1655 
1656 extern void bta_dm_remove_all_acl(tBTA_DM_MSG *p_data);
1657 #if (BLE_50_FEATURE_SUPPORT == TRUE)
1658 extern void bta_dm_ble_gap_read_phy(tBTA_DM_MSG *p_data);
1659 
1660 extern void bta_dm_ble_gap_set_prefer_default_phy(tBTA_DM_MSG *p_data);
1661 
1662 extern void bta_dm_ble_gap_set_prefer_phy(tBTA_DM_MSG *p_data);
1663 
1664 extern void bta_dm_ble_gap_ext_adv_set_rand_addr(tBTA_DM_MSG *p_data);
1665 
1666 extern void bta_dm_ble_gap_ext_adv_set_params(tBTA_DM_MSG *p_data);
1667 
1668 extern void bta_dm_ble_gap_config_ext_adv_data_raw(tBTA_DM_MSG *p_data);
1669 
1670 extern void bta_dm_ble_gap_start_ext_adv(tBTA_DM_MSG *p_data);
1671 
1672 extern void bta_dm_ble_gap_ext_adv_set_remove(tBTA_DM_MSG *p_data);
1673 
1674 extern void bta_dm_ble_gap_ext_adv_set_clear(tBTA_DM_MSG *p_data);
1675 
1676 extern void bta_dm_ble_gap_periodic_adv_set_params(tBTA_DM_MSG *p_data);
1677 
1678 extern void bta_dm_ble_gap_periodic_adv_cfg_data_raw(tBTA_DM_MSG *p_data);
1679 
1680 extern void bta_dm_ble_gap_periodic_adv_enable(tBTA_DM_MSG *p_data);
1681 
1682 extern void bta_dm_ble_gap_periodic_adv_create_sync(tBTA_DM_MSG *p_data);
1683 
1684 extern void bta_dm_ble_gap_periodic_adv_sync_cancel(tBTA_DM_MSG *p_data);
1685 
1686 extern void bta_dm_ble_gap_periodic_adv_sync_terminate(tBTA_DM_MSG *p_data);
1687 
1688 extern void bta_dm_ble_gap_periodic_adv_add_dev_to_list(tBTA_DM_MSG *p_data);
1689 
1690 extern void bta_dm_ble_gap_periodic_adv_remove_dev_from_list(tBTA_DM_MSG *p_data);
1691 
1692 extern void bta_dm_ble_gap_periodic_adv_clear_dev(tBTA_DM_MSG *p_data);
1693 
1694 extern void bta_dm_ble_gap_set_ext_scan_params(tBTA_DM_MSG *p_data);
1695 
1696 extern void bta_dm_ble_gap_ext_scan(tBTA_DM_MSG *p_data);
1697 
1698 extern void bta_dm_ble_gap_set_prefer_ext_conn_params(tBTA_DM_MSG *p_data);
1699 #endif // #if (BLE_50_FEATURE_SUPPORT == TRUE)
1700 
1701 #endif /* BTA_DM_INT_H */
1702