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