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 "bt_target.h"
28 
29 #if (BLE_INCLUDED == TRUE && (defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
30     #include "bta_gatt_api.h"
31 #endif
32 
33 
34 
35 /*****************************************************************************
36 **  Constants and data types
37 *****************************************************************************/
38 
39 
40 #define BTA_COPY_DEVICE_CLASS(coddst, codsrc)   {((UINT8 *)(coddst))[0] = ((UINT8 *)(codsrc))[0]; \
41                                                  ((UINT8 *)(coddst))[1] = ((UINT8 *)(codsrc))[1];  \
42                                                  ((UINT8 *)(coddst))[2] = ((UINT8 *)(codsrc))[2];}
43 
44 
45 #define BTA_DM_MSG_LEN 50
46 
47 #define BTA_SERVICE_ID_TO_SERVICE_MASK(id)       (1 << (id))
48 
49 /* DM events */
50 enum
51 {
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_SET_VISIBILITY_EVT,
57 
58     BTA_DM_ACL_CHANGE_EVT,
59     BTA_DM_API_ADD_DEVICE_EVT,
60     BTA_DM_API_REMOVE_ACL_EVT,
61 
62     /* security API events */
63     BTA_DM_API_BOND_EVT,
64     BTA_DM_API_BOND_CANCEL_EVT,
65     BTA_DM_API_PIN_REPLY_EVT,
66 
67     /* power manger events */
68     BTA_DM_PM_BTM_STATUS_EVT,
69     BTA_DM_PM_TIMER_EVT,
70 
71     /* simple pairing events */
72     BTA_DM_API_CONFIRM_EVT,
73 
74     BTA_DM_API_SET_ENCRYPTION_EVT,
75 
76 #if (BTM_OOB_INCLUDED == TRUE)
77     BTA_DM_API_LOC_OOB_EVT,
78     BTA_DM_CI_IO_REQ_EVT,
79     BTA_DM_CI_RMT_OOB_EVT,
80 #endif /* BTM_OOB_INCLUDED */
81 
82 
83 #if BLE_INCLUDED == TRUE
84     BTA_DM_API_ADD_BLEKEY_EVT,
85     BTA_DM_API_ADD_BLEDEVICE_EVT,
86     BTA_DM_API_BLE_PASSKEY_REPLY_EVT,
87     BTA_DM_API_BLE_CONFIRM_REPLY_EVT,
88     BTA_DM_API_BLE_SEC_GRANT_EVT,
89     BTA_DM_API_BLE_SET_BG_CONN_TYPE,
90     BTA_DM_API_BLE_CONN_PARAM_EVT,
91     BTA_DM_API_BLE_CONN_SCAN_PARAM_EVT,
92     BTA_DM_API_BLE_SCAN_PARAM_EVT,
93     BTA_DM_API_BLE_OBSERVE_EVT,
94     BTA_DM_API_UPDATE_CONN_PARAM_EVT,
95 #if BLE_PRIVACY_SPT == TRUE
96     BTA_DM_API_LOCAL_PRIVACY_EVT,
97 #endif
98     BTA_DM_API_BLE_ADV_PARAM_EVT,
99     BTA_DM_API_BLE_SET_ADV_CONFIG_EVT,
100     BTA_DM_API_BLE_SET_SCAN_RSP_EVT,
101     BTA_DM_API_BLE_BROADCAST_EVT,
102     BTA_DM_API_SET_DATA_LENGTH_EVT,
103 
104 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
105     BTA_DM_API_CFG_FILTER_COND_EVT,
106     BTA_DM_API_SCAN_FILTER_SETUP_EVT,
107     BTA_DM_API_SCAN_FILTER_ENABLE_EVT,
108 #endif
109     BTA_DM_API_BLE_MULTI_ADV_ENB_EVT,
110     BTA_DM_API_BLE_MULTI_ADV_PARAM_UPD_EVT,
111     BTA_DM_API_BLE_MULTI_ADV_DATA_EVT,
112     BTA_DM_API_BLE_MULTI_ADV_DISABLE_EVT,
113     BTA_DM_API_BLE_SETUP_STORAGE_EVT,
114     BTA_DM_API_BLE_ENABLE_BATCH_SCAN_EVT,
115     BTA_DM_API_BLE_DISABLE_BATCH_SCAN_EVT,
116     BTA_DM_API_BLE_READ_SCAN_REPORTS_EVT,
117     BTA_DM_API_BLE_TRACK_ADVERTISER_EVT,
118     BTA_DM_API_BLE_ENERGY_INFO_EVT,
119 
120 #endif
121 
122     BTA_DM_API_ENABLE_TEST_MODE_EVT,
123     BTA_DM_API_DISABLE_TEST_MODE_EVT,
124     BTA_DM_API_EXECUTE_CBACK_EVT,
125     BTA_DM_API_REMOVE_ALL_ACL_EVT,
126     BTA_DM_API_REMOVE_DEVICE_EVT,
127     BTA_DM_MAX_EVT
128 };
129 
130 
131 /* DM search events */
132 enum
133 {
134     /* DM search API events */
135     BTA_DM_API_SEARCH_EVT = BTA_SYS_EVT_START(BTA_ID_DM_SEARCH),
136     BTA_DM_API_SEARCH_CANCEL_EVT,
137     BTA_DM_API_DISCOVER_EVT,
138     BTA_DM_INQUIRY_CMPL_EVT,
139     BTA_DM_REMT_NAME_EVT,
140     BTA_DM_SDP_RESULT_EVT,
141     BTA_DM_SEARCH_CMPL_EVT,
142     BTA_DM_DISCOVERY_RESULT_EVT,
143     BTA_DM_API_DI_DISCOVER_EVT,
144     BTA_DM_DISC_CLOSE_TOUT_EVT
145 
146 };
147 
148 /* data type for BTA_DM_API_ENABLE_EVT */
149 typedef struct
150 {
151     BT_HDR              hdr;
152     tBTA_DM_SEC_CBACK *p_sec_cback;
153 } tBTA_DM_API_ENABLE;
154 
155 /* data type for BTA_DM_API_SET_NAME_EVT */
156 typedef struct
157 {
158     BT_HDR              hdr;
159     BD_NAME             name; /* max 248 bytes name, plus must be Null terminated */
160 } tBTA_DM_API_SET_NAME;
161 
162 /* data type for BTA_DM_API_SET_VISIBILITY_EVT */
163 typedef struct
164 {
165     BT_HDR              hdr;
166     tBTA_DM_DISC    disc_mode;
167     tBTA_DM_CONN    conn_mode;
168     UINT8           pair_mode;
169     UINT8           conn_paired_only;
170 } tBTA_DM_API_SET_VISIBILITY;
171 
172 enum
173 {
174     BTA_DM_RS_NONE,     /* straight API call */
175     BTA_DM_RS_OK,       /* the role switch result - successful */
176     BTA_DM_RS_FAIL      /* the role switch result - failed */
177 };
178 typedef UINT8 tBTA_DM_RS_RES;
179 
180 /* data type for BTA_DM_API_SEARCH_EVT */
181 typedef struct
182 {
183     BT_HDR      hdr;
184     tBTA_DM_INQ inq_params;
185     tBTA_SERVICE_MASK services;
186     tBTA_DM_SEARCH_CBACK * p_cback;
187     tBTA_DM_RS_RES  rs_res;
188 #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
189     UINT8           num_uuid;
190     tBT_UUID        *p_uuid;
191 #endif
192 } tBTA_DM_API_SEARCH;
193 
194 /* data type for BTA_DM_API_DISCOVER_EVT */
195 typedef struct
196 {
197     BT_HDR      hdr;
198     BD_ADDR bd_addr;
199     tBTA_SERVICE_MASK services;
200     tBTA_DM_SEARCH_CBACK * p_cback;
201     BOOLEAN         sdp_search;
202     tBTA_TRANSPORT  transport;
203 #if BLE_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE
204     UINT8           num_uuid;
205     tBT_UUID        *p_uuid;
206 #endif
207     tSDP_UUID    uuid;
208 } tBTA_DM_API_DISCOVER;
209 
210 /* data type for BTA_DM_API_DI_DISC_EVT */
211 typedef struct
212 {
213     BT_HDR              hdr;
214     BD_ADDR             bd_addr;
215     tBTA_DISCOVERY_DB   *p_sdp_db;
216     UINT32              len;
217     tBTA_DM_SEARCH_CBACK * p_cback;
218 }tBTA_DM_API_DI_DISC;
219 
220 /* data type for BTA_DM_API_BOND_EVT */
221 typedef struct
222 {
223     BT_HDR      hdr;
224     BD_ADDR bd_addr;
225     tBTA_TRANSPORT transport;
226 } tBTA_DM_API_BOND;
227 
228 /* data type for BTA_DM_API_BOND_CANCEL_EVT */
229 typedef struct
230 {
231     BT_HDR          hdr;
232     BD_ADDR         bd_addr;
233     tBTA_TRANSPORT  transport;
234 } tBTA_DM_API_BOND_CANCEL;
235 
236 /* data type for BTA_DM_API_PIN_REPLY_EVT */
237 typedef struct
238 {
239     BT_HDR      hdr;
240     BD_ADDR bd_addr;
241     BOOLEAN accept;
242     UINT8 pin_len;
243     UINT8 p_pin[PIN_CODE_LEN];
244 } tBTA_DM_API_PIN_REPLY;
245 
246 /* data type for BTA_DM_API_LOC_OOB_EVT */
247 typedef struct
248 {
249     BT_HDR      hdr;
250 } tBTA_DM_API_LOC_OOB;
251 
252 /* data type for BTA_DM_API_CONFIRM_EVT */
253 typedef struct
254 {
255     BT_HDR      hdr;
256     BD_ADDR     bd_addr;
257     BOOLEAN     accept;
258 } tBTA_DM_API_CONFIRM;
259 
260 /* data type for BTA_DM_CI_IO_REQ_EVT */
261 typedef struct
262 {
263     BT_HDR          hdr;
264     BD_ADDR         bd_addr;
265     tBTA_IO_CAP     io_cap;
266     tBTA_OOB_DATA   oob_data;
267     tBTA_AUTH_REQ   auth_req;
268 } tBTA_DM_CI_IO_REQ;
269 
270 /* data type for BTA_DM_CI_RMT_OOB_EVT */
271 typedef struct
272 {
273     BT_HDR      hdr;
274     BD_ADDR     bd_addr;
275     BT_OCTET16  c;
276     BT_OCTET16  r;
277     BOOLEAN     accept;
278 } tBTA_DM_CI_RMT_OOB;
279 
280 /* data type for BTA_DM_REMT_NAME_EVT */
281 typedef struct
282 {
283     BT_HDR      hdr;
284     tBTA_DM_SEARCH  result;
285 } tBTA_DM_REM_NAME;
286 
287 /* data type for tBTA_DM_DISC_RESULT */
288 typedef struct
289 {
290     BT_HDR      hdr;
291     tBTA_DM_SEARCH  result;
292 } tBTA_DM_DISC_RESULT;
293 
294 
295 /* data type for BTA_DM_INQUIRY_CMPL_EVT */
296 typedef struct
297 {
298     BT_HDR      hdr;
299     UINT8       num;
300 } tBTA_DM_INQUIRY_CMPL;
301 
302 /* data type for BTA_DM_SDP_RESULT_EVT */
303 typedef struct
304 {
305     BT_HDR      hdr;
306     UINT16 sdp_result;
307 } tBTA_DM_SDP_RESULT;
308 
309 /* data type for BTA_DM_ACL_CHANGE_EVT */
310 typedef struct
311 {
312     BT_HDR          hdr;
313     tBTM_BL_EVENT   event;
314     UINT8           busy_level;
315     UINT8           busy_level_flags;
316     BOOLEAN         is_new;
317     UINT8           new_role;
318     BD_ADDR         bd_addr;
319     UINT8           hci_status;
320 #if BLE_INCLUDED == TRUE
321     UINT16          handle;
322     tBT_TRANSPORT   transport;
323 #endif
324 } tBTA_DM_ACL_CHANGE;
325 
326 /* data type for BTA_DM_PM_BTM_STATUS_EVT */
327 typedef struct
328 {
329 
330     BT_HDR          hdr;
331     BD_ADDR         bd_addr;
332     tBTM_PM_STATUS  status;
333     UINT16          value;
334     UINT8           hci_status;
335 
336 } tBTA_DM_PM_BTM_STATUS;
337 
338 /* data type for BTA_DM_PM_TIMER_EVT */
339 typedef struct
340 {
341     BT_HDR          hdr;
342     BD_ADDR         bd_addr;
343     tBTA_DM_PM_ACTION  pm_request;
344 } tBTA_DM_PM_TIMER;
345 
346 
347 /* data type for BTA_DM_API_ADD_DEVICE_EVT */
348 typedef struct
349 {
350     BT_HDR              hdr;
351     BD_ADDR             bd_addr;
352     DEV_CLASS           dc;
353     LINK_KEY            link_key;
354     tBTA_SERVICE_MASK   tm;
355     BOOLEAN             is_trusted;
356     UINT8               key_type;
357     tBTA_IO_CAP         io_cap;
358     BOOLEAN             link_key_known;
359     BOOLEAN             dc_known;
360     BD_NAME             bd_name;
361     UINT8               features[BTA_FEATURE_BYTES_PER_PAGE * (BTA_EXT_FEATURES_PAGE_MAX + 1)];
362     UINT8               pin_length;
363 } tBTA_DM_API_ADD_DEVICE;
364 
365 /* data type for BTA_DM_API_REMOVE_ACL_EVT */
366 typedef struct
367 {
368     BT_HDR              hdr;
369     BD_ADDR             bd_addr;
370 } tBTA_DM_API_REMOVE_DEVICE;
371 
372 /* data type for BTA_DM_API_EXECUTE_CBACK_EVT */
373 typedef struct
374 {
375     BT_HDR               hdr;
376     void *               p_param;
377     tBTA_DM_EXEC_CBACK  *p_exec_cback;
378 } tBTA_DM_API_EXECUTE_CBACK;
379 
380 /* data type for tBTA_DM_API_SET_ENCRYPTION */
381 typedef struct
382 {
383     BT_HDR                    hdr;
384     tBTA_TRANSPORT            transport;
385     tBTA_DM_ENCRYPT_CBACK     *p_callback;
386     tBTA_DM_BLE_SEC_ACT       sec_act;
387     BD_ADDR                   bd_addr;
388 } tBTA_DM_API_SET_ENCRYPTION;
389 
390 #if BLE_INCLUDED == TRUE
391 typedef struct
392 {
393     BT_HDR                  hdr;
394     BD_ADDR                 bd_addr;
395     tBTA_LE_KEY_VALUE       blekey;
396     tBTA_LE_KEY_TYPE        key_type;
397 
398 }tBTA_DM_API_ADD_BLEKEY;
399 
400 typedef struct
401 {
402     BT_HDR                  hdr;
403     BD_ADDR                 bd_addr;
404     tBT_DEVICE_TYPE         dev_type ;
405     tBLE_ADDR_TYPE          addr_type;
406 
407 }tBTA_DM_API_ADD_BLE_DEVICE;
408 
409 typedef struct
410 {
411     BT_HDR                  hdr;
412     BD_ADDR                 bd_addr;
413     BOOLEAN                 accept;
414     UINT32                  passkey;
415 }tBTA_DM_API_PASSKEY_REPLY;
416 
417 typedef struct
418 {
419     BT_HDR                  hdr;
420     BD_ADDR                 bd_addr;
421     tBTA_DM_BLE_SEC_GRANT   res;
422 }tBTA_DM_API_BLE_SEC_GRANT;
423 
424 
425 typedef struct
426 {
427     BT_HDR                  hdr;
428     tBTA_DM_BLE_CONN_TYPE   bg_conn_type;
429     tBTA_DM_BLE_SEL_CBACK   *p_select_cback;
430 }tBTA_DM_API_BLE_SET_BG_CONN_TYPE;
431 
432 /* set prefered BLE connection parameters for a device */
433 typedef struct
434 {
435     BT_HDR                  hdr;
436     BD_ADDR                 peer_bda;
437     UINT16                  conn_int_min;
438     UINT16                  conn_int_max;
439     UINT16                  supervision_tout;
440     UINT16                  slave_latency;
441 
442 }tBTA_DM_API_BLE_CONN_PARAMS;
443 
444 typedef struct
445 {
446     BT_HDR                  hdr;
447     BD_ADDR                 peer_bda;
448     BOOLEAN                 privacy_enable;
449 
450 }tBTA_DM_API_ENABLE_PRIVACY;
451 
452 typedef struct
453 {
454     BT_HDR                  hdr;
455     BOOLEAN                 privacy_enable;
456 }tBTA_DM_API_LOCAL_PRIVACY;
457 
458 /* set scan parameter for BLE connections */
459 typedef struct
460 {
461     BT_HDR hdr;
462     tBTA_GATTC_IF client_if;
463     UINT32 scan_int;
464     UINT32 scan_window;
465     tBLE_SCAN_MODE scan_mode;
466     tBLE_SCAN_PARAM_SETUP_CBACK scan_param_setup_cback;
467 }tBTA_DM_API_BLE_SCAN_PARAMS;
468 
469 /* set scan parameter for BLE connections */
470 typedef struct
471 {
472     BT_HDR                  hdr;
473     UINT16                  scan_int;
474     UINT16                  scan_window;
475 } tBTA_DM_API_BLE_CONN_SCAN_PARAMS;
476 
477 /* Data type for start/stop observe */
478 typedef struct
479 {
480     BT_HDR                  hdr;
481     BOOLEAN                 start;
482     UINT16                  duration;
483     tBTA_DM_SEARCH_CBACK * p_cback;
484 }tBTA_DM_API_BLE_OBSERVE;
485 
486 typedef struct
487 {
488     BT_HDR      hdr;
489     BD_ADDR     remote_bda;
490     UINT16      tx_data_length;
491 }tBTA_DM_API_BLE_SET_DATA_LENGTH;
492 
493 /* set adv parameter for BLE advertising */
494 typedef struct
495 {
496     BT_HDR                  hdr;
497     UINT16                  adv_int_min;
498     UINT16                  adv_int_max;
499     tBLE_BD_ADDR            *p_dir_bda;
500 }tBTA_DM_API_BLE_ADV_PARAMS;
501 
502 typedef struct
503 {
504     BT_HDR                  hdr;
505     BOOLEAN                 enable;
506 
507 }tBTA_DM_API_BLE_FEATURE;
508 
509 /* multi adv data structure */
510 typedef struct
511 {
512     BT_HDR                      hdr;
513     tBTA_BLE_MULTI_ADV_CBACK    *p_cback;
514     void                        *p_ref;
515     tBTA_BLE_ADV_PARAMS         *p_params;
516 }tBTA_DM_API_BLE_MULTI_ADV_ENB;
517 
518 typedef struct
519 {
520     BT_HDR                      hdr;
521     UINT8                        inst_id;
522     tBTA_BLE_ADV_PARAMS         *p_params;
523 }tBTA_DM_API_BLE_MULTI_ADV_PARAM;
524 
525 typedef struct
526 {
527     BT_HDR                  hdr;
528     UINT8                   inst_id;
529     BOOLEAN                 is_scan_rsp;
530     tBTA_BLE_AD_MASK        data_mask;
531     tBTA_BLE_ADV_DATA      *p_data;
532 }tBTA_DM_API_BLE_MULTI_ADV_DATA;
533 
534 typedef struct
535 {
536     BT_HDR                  hdr;
537     UINT8                   inst_id;
538 }tBTA_DM_API_BLE_MULTI_ADV_DISABLE;
539 
540 typedef struct
541 {
542     BT_HDR                  hdr;
543     UINT32                  data_mask;
544     tBTA_BLE_ADV_DATA       *p_adv_cfg;
545     tBTA_SET_ADV_DATA_CMPL_CBACK    *p_adv_data_cback;
546 }tBTA_DM_API_SET_ADV_CONFIG;
547 
548 typedef struct
549 {
550     BT_HDR                  hdr;
551     UINT8                   batch_scan_full_max;
552     UINT8                   batch_scan_trunc_max;
553     UINT8                   batch_scan_notify_threshold;
554     tBTA_BLE_SCAN_SETUP_CBACK *p_setup_cback;
555     tBTA_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback;
556     tBTA_BLE_SCAN_REP_CBACK *p_read_rep_cback;
557     tBTA_DM_BLE_REF_VALUE    ref_value;
558 } tBTA_DM_API_SET_STORAGE_CONFIG;
559 
560 typedef struct
561 {
562     BT_HDR                  hdr;
563     tBTA_BLE_BATCH_SCAN_MODE  scan_mode;
564     UINT32                  scan_int;
565     UINT32                  scan_window;
566     tBTA_BLE_DISCARD_RULE   discard_rule;
567     tBLE_ADDR_TYPE          addr_type;
568     tBTA_DM_BLE_REF_VALUE   ref_value;
569 } tBTA_DM_API_ENABLE_SCAN;
570 
571 typedef struct
572 {
573     BT_HDR                  hdr;
574     tBTA_DM_BLE_REF_VALUE    ref_value;
575 } tBTA_DM_API_DISABLE_SCAN;
576 
577 typedef struct
578 {
579     BT_HDR                  hdr;
580     tBTA_BLE_BATCH_SCAN_MODE scan_type;
581     tBTA_DM_BLE_REF_VALUE    ref_value;
582 } tBTA_DM_API_READ_SCAN_REPORTS;
583 
584 typedef struct
585 {
586     BT_HDR                  hdr;
587     tBTA_DM_BLE_REF_VALUE ref_value;
588     tBTA_BLE_TRACK_ADV_CBACK *p_track_adv_cback;
589 } tBTA_DM_API_TRACK_ADVERTISER;
590 
591 typedef struct
592 {
593     BT_HDR                  hdr;
594     tBTA_BLE_ENERGY_INFO_CBACK *p_energy_info_cback;
595 } tBTA_DM_API_ENERGY_INFO;
596 
597 #endif /* BLE_INCLUDED */
598 
599 /* data type for BTA_DM_API_REMOVE_ACL_EVT */
600 typedef struct
601 {
602     BT_HDR      hdr;
603     BD_ADDR     bd_addr;
604     BOOLEAN     remove_dev;
605     tBTA_TRANSPORT transport;
606 
607 }tBTA_DM_API_REMOVE_ACL;
608 
609 /* data type for BTA_DM_API_REMOVE_ALL_ACL_EVT */
610 typedef struct
611 {
612     BT_HDR      hdr;
613     tBTA_DM_LINK_TYPE link_type;
614 
615 } tBTA_DM_API_REMOVE_ALL_ACL;
616 typedef struct
617 {
618     BT_HDR      hdr;
619     BD_ADDR     bd_addr;
620     UINT16      min_int;
621     UINT16      max_int;
622     UINT16      latency;
623     UINT16      timeout;
624 }tBTA_DM_API_UPDATE_CONN_PARAM;
625 
626 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
627 typedef struct
628 {
629     BT_HDR                          hdr;
630     tBTA_DM_BLE_SCAN_COND_OP        action;
631     tBTA_DM_BLE_PF_COND_TYPE        cond_type;
632     tBTA_DM_BLE_PF_FILT_INDEX       filt_index;
633     tBTA_DM_BLE_PF_COND_PARAM       *p_cond_param;
634     tBTA_DM_BLE_PF_CFG_CBACK      *p_filt_cfg_cback;
635     tBTA_DM_BLE_REF_VALUE            ref_value;
636 }tBTA_DM_API_CFG_FILTER_COND;
637 
638 typedef struct
639 {
640     BT_HDR                          hdr;
641     UINT8                           action;
642     tBTA_DM_BLE_PF_STATUS_CBACK    *p_filt_status_cback;
643     tBTA_DM_BLE_REF_VALUE            ref_value;
644 }tBTA_DM_API_ENABLE_SCAN_FILTER;
645 
646 typedef struct
647 {
648     BT_HDR                          hdr;
649     UINT8                           action;
650     tBTA_DM_BLE_PF_FILT_INDEX       filt_index;
651     tBTA_DM_BLE_PF_FILT_PARAMS      filt_params;
652     tBLE_BD_ADDR                    *p_target;
653     tBTA_DM_BLE_PF_PARAM_CBACK      *p_filt_param_cback;
654     tBTA_DM_BLE_REF_VALUE            ref_value;
655 }tBTA_DM_API_SCAN_FILTER_PARAM_SETUP;
656 #endif
657 
658 /* union of all data types */
659 typedef union
660 {
661     /* GKI event buffer header */
662     BT_HDR              hdr;
663     tBTA_DM_API_ENABLE  enable;
664 
665     tBTA_DM_API_SET_NAME set_name;
666 
667     tBTA_DM_API_SET_VISIBILITY set_visibility;
668 
669     tBTA_DM_API_ADD_DEVICE  add_dev;
670 
671     tBTA_DM_API_REMOVE_DEVICE remove_dev;
672 
673     tBTA_DM_API_SEARCH search;
674 
675     tBTA_DM_API_DISCOVER discover;
676 
677     tBTA_DM_API_BOND bond;
678 
679     tBTA_DM_API_BOND_CANCEL bond_cancel;
680 
681     tBTA_DM_API_PIN_REPLY pin_reply;
682 
683     tBTA_DM_API_LOC_OOB     loc_oob;
684     tBTA_DM_API_CONFIRM     confirm;
685     tBTA_DM_CI_IO_REQ       ci_io_req;
686     tBTA_DM_CI_RMT_OOB      ci_rmt_oob;
687 
688     tBTA_DM_REM_NAME rem_name;
689 
690     tBTA_DM_DISC_RESULT disc_result;
691 
692     tBTA_DM_INQUIRY_CMPL inq_cmpl;
693 
694     tBTA_DM_SDP_RESULT sdp_event;
695 
696     tBTA_DM_ACL_CHANGE  acl_change;
697 
698     tBTA_DM_PM_BTM_STATUS pm_status;
699 
700     tBTA_DM_PM_TIMER pm_timer;
701 
702     tBTA_DM_API_DI_DISC     di_disc;
703 
704     tBTA_DM_API_EXECUTE_CBACK exec_cback;
705 
706     tBTA_DM_API_SET_ENCRYPTION     set_encryption;
707 
708 #if BLE_INCLUDED == TRUE
709     tBTA_DM_API_ADD_BLEKEY              add_ble_key;
710     tBTA_DM_API_ADD_BLE_DEVICE          add_ble_device;
711     tBTA_DM_API_PASSKEY_REPLY           ble_passkey_reply;
712     tBTA_DM_API_BLE_SEC_GRANT           ble_sec_grant;
713     tBTA_DM_API_BLE_SET_BG_CONN_TYPE    ble_set_bd_conn_type;
714     tBTA_DM_API_BLE_CONN_PARAMS         ble_set_conn_params;
715     tBTA_DM_API_BLE_CONN_SCAN_PARAMS    ble_set_conn_scan_params;
716     tBTA_DM_API_BLE_SCAN_PARAMS         ble_set_scan_params;
717     tBTA_DM_API_BLE_OBSERVE             ble_observe;
718     tBTA_DM_API_ENABLE_PRIVACY          ble_remote_privacy;
719     tBTA_DM_API_LOCAL_PRIVACY           ble_local_privacy;
720     tBTA_DM_API_BLE_ADV_PARAMS          ble_set_adv_params;
721     tBTA_DM_API_SET_ADV_CONFIG          ble_set_adv_data;
722 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
723     tBTA_DM_API_SCAN_FILTER_PARAM_SETUP ble_scan_filt_param_setup;
724     tBTA_DM_API_CFG_FILTER_COND         ble_cfg_filter_cond;
725     tBTA_DM_API_ENABLE_SCAN_FILTER      ble_enable_scan_filt;
726 #endif
727     tBTA_DM_API_UPDATE_CONN_PARAM       ble_update_conn_params;
728     tBTA_DM_API_BLE_SET_DATA_LENGTH     ble_set_data_length;
729 
730     tBTA_DM_API_BLE_MULTI_ADV_ENB       ble_multi_adv_enb;
731     tBTA_DM_API_BLE_MULTI_ADV_PARAM     ble_multi_adv_param;
732     tBTA_DM_API_BLE_MULTI_ADV_DATA      ble_multi_adv_data;
733     tBTA_DM_API_BLE_MULTI_ADV_DISABLE   ble_multi_adv_disable;
734 
735     tBTA_DM_API_SET_STORAGE_CONFIG      ble_set_storage;
736     tBTA_DM_API_ENABLE_SCAN             ble_enable_scan;
737     tBTA_DM_API_READ_SCAN_REPORTS       ble_read_reports;
738     tBTA_DM_API_DISABLE_SCAN            ble_disable_scan;
739     tBTA_DM_API_TRACK_ADVERTISER        ble_track_advert;
740     tBTA_DM_API_ENERGY_INFO             ble_energy_info;
741 #endif
742 
743     tBTA_DM_API_REMOVE_ACL              remove_acl;
744     tBTA_DM_API_REMOVE_ALL_ACL          remove_all_acl;
745 
746 } tBTA_DM_MSG;
747 
748 
749 #define BTA_DM_NUM_PEER_DEVICE 7
750 
751 #define BTA_DM_NOT_CONNECTED  0
752 #define BTA_DM_CONNECTED      1
753 #define BTA_DM_UNPAIRING      2
754 typedef UINT8 tBTA_DM_CONN_STATE;
755 
756 
757 #define BTA_DM_DI_NONE          0x00       /* nothing special */
758 #define BTA_DM_DI_USE_SSR       0x10       /* set this bit if ssr is supported for this link */
759 #define BTA_DM_DI_AV_ACTIVE     0x20       /* set this bit if AV is active for this link */
760 #define BTA_DM_DI_SET_SNIFF     0x01       /* set this bit if call BTM_SetPowerMode(sniff) */
761 #define BTA_DM_DI_INT_SNIFF     0x02       /* set this bit if call BTM_SetPowerMode(sniff) & enter sniff mode */
762 #define BTA_DM_DI_ACP_SNIFF     0x04       /* set this bit if peer init sniff */
763 typedef UINT8 tBTA_DM_DEV_INFO;
764 
765 /* set power mode request type */
766 #define BTA_DM_PM_RESTART       1
767 #define BTA_DM_PM_NEW_REQ       2
768 #define BTA_DM_PM_EXECUTE       3
769 typedef UINT8   tBTA_DM_PM_REQ;
770 
771 typedef struct
772 {
773     BD_ADDR                     peer_bdaddr;
774     UINT16                      link_policy;
775     tBTA_DM_CONN_STATE          conn_state;
776     tBTA_PREF_ROLES             pref_role;
777     BOOLEAN                     in_use;
778     tBTA_DM_DEV_INFO            info;
779     tBTA_DM_ENCRYPT_CBACK      *p_encrypt_cback;
780 #if (BTM_SSR_INCLUDED == TRUE)
781     tBTM_PM_STATUS              prev_low;   /* previous low power mode used */
782 #endif
783     tBTA_DM_PM_ACTION           pm_mode_attempted;
784     tBTA_DM_PM_ACTION           pm_mode_failed;
785     BOOLEAN                     remove_dev_pending;
786 #if BLE_INCLUDED == TRUE
787     UINT16                      conn_handle;
788     tBT_TRANSPORT               transport;
789 #endif
790 } tBTA_DM_PEER_DEVICE;
791 
792 
793 
794 /* structure to store list of
795   active connections */
796 typedef struct
797 {
798     tBTA_DM_PEER_DEVICE    peer_device[BTA_DM_NUM_PEER_DEVICE];
799     UINT8                  count;
800 #if BLE_INCLUDED == TRUE
801     UINT8                  le_count;
802 #endif
803 } tBTA_DM_ACTIVE_LINK;
804 
805 
806 typedef struct
807 {
808     BD_ADDR                 peer_bdaddr;
809     tBTA_SYS_ID             id;
810     UINT8                   app_id;
811     tBTA_SYS_CONN_STATUS    state;
812     BOOLEAN                 new_request;
813 
814 } tBTA_DM_SRVCS;
815 
816 #ifndef BTA_DM_NUM_CONN_SRVS
817 #define BTA_DM_NUM_CONN_SRVS   10
818 #endif
819 
820 typedef struct
821 {
822 
823     UINT8 count;
824     tBTA_DM_SRVCS  conn_srvc[BTA_DM_NUM_CONN_SRVS];
825 
826 }  tBTA_DM_CONNECTED_SRVCS;
827 
828 typedef struct
829 {
830 #define BTA_DM_PM_SNIFF_TIMER_IDX   0
831 #define BTA_DM_PM_PARK_TIMER_IDX    1
832 #define BTA_DM_PM_SUSPEND_TIMER_IDX 2
833 #define BTA_DM_PM_MODE_TIMER_MAX    3
834     /*
835      * Keep three different timers for PARK, SNIFF and SUSPEND if TBFC is
836      * supported.
837      */
838     TIMER_LIST_ENT          timer[BTA_DM_PM_MODE_TIMER_MAX];
839 
840     UINT8                   srvc_id[BTA_DM_PM_MODE_TIMER_MAX];
841     UINT8                   pm_action[BTA_DM_PM_MODE_TIMER_MAX];
842     UINT8                   active;     /* number of active timer */
843 
844     BD_ADDR                 peer_bdaddr;
845     BOOLEAN                 in_use;
846 } tBTA_PM_TIMER;
847 
848 extern tBTA_DM_CONNECTED_SRVCS bta_dm_conn_srvcs;
849 
850 #define BTA_DM_NUM_PM_TIMER 7
851 
852 /* DM control block */
853 typedef struct
854 {
855     BOOLEAN                     is_bta_dm_active;
856     tBTA_DM_ACTIVE_LINK         device_list;
857     tBTA_DM_SEC_CBACK           *p_sec_cback;
858 #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
859     tBTA_BLE_SCAN_SETUP_CBACK   *p_setup_cback;
860     tBTA_DM_BLE_PF_CFG_CBACK     *p_scan_filt_cfg_cback;
861     tBTA_DM_BLE_PF_STATUS_CBACK  *p_scan_filt_status_cback;
862     tBTA_DM_BLE_PF_PARAM_CBACK   *p_scan_filt_param_cback;
863     tBTA_BLE_MULTI_ADV_CBACK     *p_multi_adv_cback;
864     tBTA_BLE_ENERGY_INFO_CBACK   *p_energy_info_cback;
865 #endif
866     UINT16                      state;
867     BOOLEAN                     disabling;
868     TIMER_LIST_ENT              disable_timer;
869     UINT32                      wbt_sdp_handle;          /* WIDCOMM Extensions SDP record handle */
870     UINT8                       wbt_scn;                 /* WIDCOMM Extensions SCN */
871     UINT8                       num_master_only;
872     UINT8                       pm_id;
873     tBTA_PM_TIMER               pm_timer[BTA_DM_NUM_PM_TIMER];
874     UINT32                      role_policy_mask;   /* the bits set indicates the modules that wants to remove role switch from the default link policy */
875     UINT16                      cur_policy;         /* current default link policy */
876     UINT16                      rs_event;           /* the event waiting for role switch */
877     UINT8                       cur_av_count;       /* current AV connecions */
878     BOOLEAN                     disable_pair_mode;          /* disable pair mode or not */
879     BOOLEAN                     conn_paired_only;   /* allow connectable to paired device only or not */
880     tBTA_DM_API_SEARCH          search_msg;
881     UINT16                      page_scan_interval;
882     UINT16                      page_scan_window;
883     UINT16                      inquiry_scan_interval;
884     UINT16                      inquiry_scan_window;
885 
886     /* Storage for pin code request parameters */
887     BD_ADDR                     pin_bd_addr;
888     DEV_CLASS                   pin_dev_class;
889     tBTA_DM_SEC_EVT             pin_evt;
890     UINT32          num_val;        /* the numeric value for comparison. If just_works, do not show this number to UI */
891     BOOLEAN         just_works;     /* TRUE, if "Just Works" association model */
892 #if ( BTA_EIR_CANNED_UUID_LIST != TRUE )
893     /* store UUID list for EIR */
894     TIMER_LIST_ENT              app_ready_timer;
895     UINT32                      eir_uuid[BTM_EIR_SERVICE_ARRAY_SIZE];
896 #if (BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0)
897     tBT_UUID                    custom_uuid[BTA_EIR_SERVER_NUM_CUSTOM_UUID];
898 #endif
899 
900 #endif
901 
902 
903     tBTA_DM_ENCRYPT_CBACK      *p_encrypt_cback;
904     TIMER_LIST_ENT              switch_delay_timer;
905 
906 } tBTA_DM_CB;
907 
908 #ifndef BTA_DM_SDP_DB_SIZE
909 #define BTA_DM_SDP_DB_SIZE 250
910 #endif
911 
912 /* DM search control block */
913 typedef struct
914 {
915 
916     tBTA_DM_SEARCH_CBACK * p_search_cback;
917     tBTM_INQ_INFO        * p_btm_inq_info;
918     tBTA_SERVICE_MASK      services;
919     tBTA_SERVICE_MASK      services_to_search;
920     tBTA_SERVICE_MASK      services_found;
921     tSDP_DISCOVERY_DB    * p_sdp_db;
922     UINT16                 state;
923     BD_ADDR                peer_bdaddr;
924     BOOLEAN                name_discover_done;
925     BD_NAME                peer_name;
926     TIMER_LIST_ENT         search_timer;
927     UINT8                  service_index;
928     tBTA_DM_MSG          * p_search_queue;   /* search or discover commands during search cancel stored here */
929     BOOLEAN                wait_disc;
930     BOOLEAN                sdp_results;
931     tSDP_UUID              uuid;
932     UINT8                  peer_scn;
933     BOOLEAN                sdp_search;
934     BOOLEAN                cancel_pending; /* inquiry cancel is pending */
935     tBTA_TRANSPORT         transport;
936 #if ((defined BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
937     tBTA_DM_SEARCH_CBACK * p_scan_cback;
938 #if ((defined BTA_GATT_INCLUDED) && (BTA_GATT_INCLUDED == TRUE))
939     tBTA_GATTC_IF          client_if;
940     UINT8                  num_uuid;
941     tBT_UUID               *p_srvc_uuid;
942     UINT8                  uuid_to_search;
943     BOOLEAN                gatt_disc_active;
944     UINT16                 conn_id;
945     UINT8 *                 p_ble_rawdata;
946     UINT32                 ble_raw_size;
947     UINT32                 ble_raw_used;
948     TIMER_LIST_ENT         gatt_close_timer; /* GATT channel close delay timer */
949     BD_ADDR                pending_close_bda; /* pending GATT channel remote device address */
950 #endif
951 #endif
952 
953 
954 } tBTA_DM_SEARCH_CB;
955 
956 /* DI control block */
957 typedef struct
958 {
959     tSDP_DISCOVERY_DB    * p_di_db;     /* pointer to the DI discovery database */
960     UINT8               di_num;         /* total local DI record number */
961     UINT32              di_handle[BTA_DI_NUM_MAX];  /* local DI record handle, the first one is primary record */
962 }tBTA_DM_DI_CB;
963 
964 /* DM search state */
965 enum
966 {
967 
968     BTA_DM_SEARCH_IDLE,
969     BTA_DM_SEARCH_ACTIVE,
970     BTA_DM_SEARCH_CANCELLING,
971     BTA_DM_DISCOVER_ACTIVE
972 
973 };
974 
975 
976 
977 typedef struct
978 {
979     DEV_CLASS      dev_class;          /* local device class */
980     UINT16         policy_settings;    /* link policy setting hold, sniff, park, MS switch */
981     UINT16         page_timeout;       /* timeout for page in slots */
982     UINT16         link_timeout;       /* link supervision timeout in slots */
983     BOOLEAN        avoid_scatter;      /* TRUE to avoid scatternet when av is streaming (be the master) */
984 
985 } tBTA_DM_CFG;
986 
987 extern const UINT32 bta_service_id_to_btm_srv_id_lkup_tbl[];
988 
989 
990 typedef struct
991 {
992     UINT8   id;
993     UINT8   app_id;
994     UINT8   cfg;
995 
996 } tBTA_DM_RM ;
997 
998 extern tBTA_DM_CFG *p_bta_dm_cfg;
999 extern tBTA_DM_RM *p_bta_dm_rm_cfg;
1000 
1001 typedef struct
1002 {
1003 
1004   UINT8  id;
1005   UINT8  app_id;
1006   UINT8  spec_idx;  /* index of spec table to use */
1007 
1008 } tBTA_DM_PM_CFG;
1009 
1010 
1011 typedef struct
1012 {
1013 
1014   tBTA_DM_PM_ACTION   power_mode;
1015   UINT16              timeout;
1016 
1017 } tBTA_DM_PM_ACTN;
1018 
1019 typedef struct
1020 {
1021 
1022   UINT8  allow_mask;         /* mask of sniff/hold/park modes to allow */
1023 #if (BTM_SSR_INCLUDED == TRUE)
1024   UINT8  ssr;                /* set SSR on conn open/unpark */
1025 #endif
1026   tBTA_DM_PM_ACTN actn_tbl [BTA_DM_PM_NUM_EVTS][2];
1027 
1028 } tBTA_DM_PM_SPEC;
1029 
1030 typedef struct
1031 {
1032     UINT16      max_lat;
1033     UINT16      min_rmt_to;
1034     UINT16      min_loc_to;
1035 } tBTA_DM_SSR_SPEC;
1036 
1037 typedef struct
1038 {
1039    UINT16 manufacturer;
1040    UINT16 lmp_sub_version;
1041    UINT8 lmp_version;
1042 }tBTA_DM_LMP_VER_INFO;
1043 
1044 extern tBTA_DM_PM_CFG *p_bta_dm_pm_cfg;
1045 extern tBTA_DM_PM_SPEC *p_bta_dm_pm_spec;
1046 extern tBTM_PM_PWR_MD *p_bta_dm_pm_md;
1047 #if (BTM_SSR_INCLUDED == TRUE)
1048 extern tBTA_DM_SSR_SPEC *p_bta_dm_ssr_spec;
1049 #endif
1050 
1051 /* update dynamic BRCM Aware EIR data */
1052 extern const tBTA_DM_EIR_CONF bta_dm_eir_cfg;
1053 extern tBTA_DM_EIR_CONF *p_bta_dm_eir_cfg;
1054 
1055 /* DM control block */
1056 #if BTA_DYNAMIC_MEMORY == FALSE
1057 extern tBTA_DM_CB  bta_dm_cb;
1058 #else
1059 extern tBTA_DM_CB *bta_dm_cb_ptr;
1060 #define bta_dm_cb (*bta_dm_cb_ptr)
1061 #endif
1062 
1063 /* DM search control block */
1064 #if BTA_DYNAMIC_MEMORY == FALSE
1065 extern tBTA_DM_SEARCH_CB  bta_dm_search_cb;
1066 #else
1067 extern tBTA_DM_SEARCH_CB *bta_dm_search_cb_ptr;
1068 #define bta_dm_search_cb (*bta_dm_search_cb_ptr)
1069 #endif
1070 
1071 /* DI control block */
1072 #if BTA_DYNAMIC_MEMORY == FALSE
1073 extern tBTA_DM_DI_CB  bta_dm_di_cb;
1074 #else
1075 extern tBTA_DM_DI_CB *bta_dm_di_cb_ptr;
1076 #define bta_dm_di_cb (*bta_dm_di_cb_ptr)
1077 #endif
1078 
1079 extern BOOLEAN bta_dm_sm_execute(BT_HDR *p_msg);
1080 extern void bta_dm_sm_disable( void );
1081 extern BOOLEAN bta_dm_search_sm_execute(BT_HDR *p_msg);
1082 extern void bta_dm_search_sm_disable( void );
1083 
1084 
1085 extern void bta_dm_enable (tBTA_DM_MSG *p_data);
1086 extern void bta_dm_disable (tBTA_DM_MSG *p_data);
1087 extern void bta_dm_set_dev_name (tBTA_DM_MSG *p_data);
1088 extern void bta_dm_set_visibility (tBTA_DM_MSG *p_data);
1089 
1090 extern void bta_dm_set_scan_config(tBTA_DM_MSG *p_data);
1091 extern void bta_dm_vendor_spec_command(tBTA_DM_MSG *p_data);
1092 extern void bta_dm_bond (tBTA_DM_MSG *p_data);
1093 extern void bta_dm_bond_cancel (tBTA_DM_MSG *p_data);
1094 extern void bta_dm_pin_reply (tBTA_DM_MSG *p_data);
1095 extern void bta_dm_acl_change(tBTA_DM_MSG *p_data);
1096 extern void bta_dm_add_device (tBTA_DM_MSG *p_data);
1097 extern void bta_dm_remove_device (tBTA_DM_MSG *p_data);
1098 extern void bta_dm_close_acl(tBTA_DM_MSG *p_data);
1099 
1100 
1101 extern void bta_dm_pm_btm_status(tBTA_DM_MSG *p_data);
1102 extern void bta_dm_pm_timer(tBTA_DM_MSG *p_data);
1103 extern void bta_dm_add_ampkey (tBTA_DM_MSG *p_data);
1104 
1105 #if BLE_INCLUDED == TRUE
1106 extern void bta_dm_add_blekey (tBTA_DM_MSG *p_data);
1107 extern void bta_dm_add_ble_device (tBTA_DM_MSG *p_data);
1108 extern void bta_dm_ble_passkey_reply (tBTA_DM_MSG *p_data);
1109 extern void bta_dm_ble_confirm_reply (tBTA_DM_MSG *p_data);
1110 extern void bta_dm_security_grant (tBTA_DM_MSG *p_data);
1111 extern void bta_dm_ble_set_bg_conn_type (tBTA_DM_MSG *p_data);
1112 extern void bta_dm_ble_set_conn_params (tBTA_DM_MSG *p_data);
1113 extern void bta_dm_ble_set_scan_params(tBTA_DM_MSG *p_data);
1114 extern void bta_dm_ble_set_conn_scan_params (tBTA_DM_MSG *p_data);
1115 extern void bta_dm_close_gatt_conn(tBTA_DM_MSG *p_data);
1116 extern void bta_dm_ble_observe (tBTA_DM_MSG *p_data);
1117 extern void bta_dm_ble_update_conn_params (tBTA_DM_MSG *p_data);
1118 extern void bta_dm_ble_config_local_privacy (tBTA_DM_MSG *p_data);
1119 extern void bta_dm_ble_set_adv_params (tBTA_DM_MSG *p_data);
1120 extern void bta_dm_ble_set_adv_config (tBTA_DM_MSG *p_data);
1121 extern void bta_dm_ble_set_scan_rsp (tBTA_DM_MSG *p_data);
1122 extern void bta_dm_ble_broadcast (tBTA_DM_MSG *p_data);
1123 extern void bta_dm_ble_set_data_length(tBTA_DM_MSG *p_data);
1124 
1125 #if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
1126 extern void bta_dm_cfg_filter_cond (tBTA_DM_MSG *p_data);
1127 extern void bta_dm_scan_filter_param_setup (tBTA_DM_MSG *p_data);
1128 extern void bta_dm_enable_scan_filter(tBTA_DM_MSG *p_data);
1129 #endif
1130 extern void btm_dm_ble_multi_adv_disable(tBTA_DM_MSG *p_data);
1131 extern void bta_dm_ble_multi_adv_data(tBTA_DM_MSG *p_data);
1132 extern void bta_dm_ble_multi_adv_upd_param(tBTA_DM_MSG *p_data);
1133 extern void bta_dm_ble_multi_adv_enb(tBTA_DM_MSG *p_data);
1134 
1135 extern void bta_dm_ble_setup_storage(tBTA_DM_MSG *p_data);
1136 extern void bta_dm_ble_enable_batch_scan(tBTA_DM_MSG * p_data);
1137 extern void bta_dm_ble_disable_batch_scan(tBTA_DM_MSG * p_data);
1138 extern void bta_dm_ble_read_scan_reports(tBTA_DM_MSG * p_data);
1139 extern void bta_dm_ble_track_advertiser(tBTA_DM_MSG * p_data);
1140 extern void bta_dm_ble_get_energy_info(tBTA_DM_MSG *p_data);
1141 
1142 #endif
1143 extern void bta_dm_set_encryption(tBTA_DM_MSG *p_data);
1144 extern void bta_dm_confirm(tBTA_DM_MSG *p_data);
1145 #if (BTM_OOB_INCLUDED == TRUE)
1146 extern void bta_dm_loc_oob(tBTA_DM_MSG *p_data);
1147 extern void bta_dm_ci_io_req_act(tBTA_DM_MSG *p_data);
1148 extern void bta_dm_ci_rmt_oob_act(tBTA_DM_MSG *p_data);
1149 #endif /* BTM_OOB_INCLUDED */
1150 
1151 extern void bta_dm_init_pm(void);
1152 extern void bta_dm_disable_pm(void);
1153 
1154 extern UINT8 bta_dm_get_av_count(void);
1155 extern void bta_dm_search_start (tBTA_DM_MSG *p_data);
1156 extern void bta_dm_search_cancel (tBTA_DM_MSG *p_data);
1157 extern void bta_dm_discover (tBTA_DM_MSG *p_data);
1158 extern void bta_dm_di_disc (tBTA_DM_MSG *p_data);
1159 extern void bta_dm_inq_cmpl (tBTA_DM_MSG *p_data);
1160 extern void bta_dm_rmt_name (tBTA_DM_MSG *p_data);
1161 extern void bta_dm_sdp_result (tBTA_DM_MSG *p_data);
1162 extern void bta_dm_search_cmpl (tBTA_DM_MSG *p_data);
1163 extern void bta_dm_free_sdp_db (tBTA_DM_MSG *p_data);
1164 extern void bta_dm_disc_result (tBTA_DM_MSG *p_data);
1165 extern void bta_dm_search_result (tBTA_DM_MSG *p_data);
1166 extern void bta_dm_discovery_cmpl (tBTA_DM_MSG *p_data);
1167 extern void bta_dm_queue_search (tBTA_DM_MSG *p_data);
1168 extern void bta_dm_queue_disc (tBTA_DM_MSG *p_data);
1169 extern void bta_dm_search_clear_queue (tBTA_DM_MSG *p_data);
1170 extern void bta_dm_search_cancel_cmpl (tBTA_DM_MSG *p_data);
1171 extern void bta_dm_search_cancel_notify (tBTA_DM_MSG *p_data);
1172 extern void bta_dm_search_cancel_transac_cmpl(tBTA_DM_MSG *p_data);
1173 extern void bta_dm_disc_rmt_name (tBTA_DM_MSG *p_data);
1174 extern tBTA_DM_PEER_DEVICE * bta_dm_find_peer_device(BD_ADDR peer_addr);
1175 
1176 extern void bta_dm_pm_active(BD_ADDR peer_addr);
1177 
1178 void bta_dm_eir_update_uuid(UINT16 uuid16, BOOLEAN adding);
1179 
1180 extern void bta_dm_enable_test_mode(tBTA_DM_MSG *p_data);
1181 extern void bta_dm_disable_test_mode(tBTA_DM_MSG *p_data);
1182 extern void bta_dm_execute_callback(tBTA_DM_MSG *p_data);
1183 
1184 
1185 extern void bta_dm_remove_all_acl(tBTA_DM_MSG *p_data);
1186 #endif /* BTA_DM_INT_H */
1187