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