• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /******************************************************************************
2  *
3  *  Copyright 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 <base/strings/stringprintf.h>
28 
29 #include <memory>
30 #include <string>
31 
32 #include "bt_target.h"  // Must be first to define build configuration
33 #include "bta/include/bta_api.h"
34 #include "bta/include/bta_gatt_api.h"
35 #include "bta/sys/bta_sys.h"
36 #include "main/shim/dumpsys.h"
37 #include "stack/include/bt_hdr.h"
38 #include "stack/include/bt_octets.h"
39 #include "types/bluetooth/uuid.h"
40 #include "types/raw_address.h"
41 
42 #ifndef CASE_RETURN_TEXT
43 #define CASE_RETURN_TEXT(code) \
44   case code:                   \
45     return #code
46 #endif
47 
48 /*****************************************************************************
49  *  Constants and data types
50  ****************************************************************************/
51 
52 #define BTA_COPY_DEVICE_CLASS(coddst, codsrc)          \
53   {                                                    \
54     ((uint8_t*)(coddst))[0] = ((uint8_t*)(codsrc))[0]; \
55     ((uint8_t*)(coddst))[1] = ((uint8_t*)(codsrc))[1]; \
56     ((uint8_t*)(coddst))[2] = ((uint8_t*)(codsrc))[2]; \
57   }
58 
59 #define BTA_DM_MSG_LEN 50
60 
61 #define BTA_SERVICE_ID_TO_SERVICE_MASK(id) (1 << (id))
62 
63 /* DM search events */
64 typedef enum : uint16_t {
65   /* DM search API events */
66   BTA_DM_API_SEARCH_EVT = BTA_SYS_EVT_START(BTA_ID_DM_SEARCH),
67   BTA_DM_API_SEARCH_CANCEL_EVT,
68   BTA_DM_API_DISCOVER_EVT,
69   BTA_DM_INQUIRY_CMPL_EVT,
70   BTA_DM_REMT_NAME_EVT,
71   BTA_DM_SDP_RESULT_EVT,
72   BTA_DM_SEARCH_CMPL_EVT,
73   BTA_DM_DISCOVERY_RESULT_EVT,
74   BTA_DM_DISC_CLOSE_TOUT_EVT,
75 } tBTA_DM_EVT;
76 
bta_dm_event_text(const tBTA_DM_EVT & event)77 inline std::string bta_dm_event_text(const tBTA_DM_EVT& event) {
78   switch (event) {
79     CASE_RETURN_TEXT(BTA_DM_API_SEARCH_EVT);
80     CASE_RETURN_TEXT(BTA_DM_API_SEARCH_CANCEL_EVT);
81     CASE_RETURN_TEXT(BTA_DM_API_DISCOVER_EVT);
82     CASE_RETURN_TEXT(BTA_DM_INQUIRY_CMPL_EVT);
83     CASE_RETURN_TEXT(BTA_DM_REMT_NAME_EVT);
84     CASE_RETURN_TEXT(BTA_DM_SDP_RESULT_EVT);
85     CASE_RETURN_TEXT(BTA_DM_SEARCH_CMPL_EVT);
86     CASE_RETURN_TEXT(BTA_DM_DISCOVERY_RESULT_EVT);
87     CASE_RETURN_TEXT(BTA_DM_DISC_CLOSE_TOUT_EVT);
88     default:
89       return base::StringPrintf("UNKNOWN[0x%04x]", event);
90   }
91 }
92 
93 /* data type for BTA_DM_API_SEARCH_EVT */
94 typedef struct {
95   BT_HDR_RIGID hdr;
96   tBTA_SERVICE_MASK services;
97   tBTA_DM_SEARCH_CBACK* p_cback;
98 } tBTA_DM_API_SEARCH;
99 
100 /* data type for BTA_DM_API_DISCOVER_EVT */
101 typedef struct {
102   BT_HDR_RIGID hdr;
103   RawAddress bd_addr;
104   tBTA_DM_SEARCH_CBACK* p_cback;
105   tBT_TRANSPORT transport;
106 } tBTA_DM_API_DISCOVER;
107 
108 typedef struct {
109   BT_HDR_RIGID hdr;
110 } tBTA_DM_API_DISCOVERY_CANCEL;
111 
112 typedef struct {
113   RawAddress bd_addr;
114   bool accept;
115   uint8_t pin_len;
116   uint8_t p_pin[PIN_CODE_LEN];
117 } tBTA_DM_API_PIN_REPLY;
118 
119 typedef struct {
120   BT_HDR_RIGID hdr;
121   RawAddress bd_addr;
122   tBTM_IO_CAP io_cap;
123   tBTM_OOB_DATA oob_data;
124   tBTM_AUTH_REQ auth_req;
125 } tBTA_DM_CI_IO_REQ;
126 
127 typedef struct {
128   RawAddress bd_addr;
129   Octet16 c;
130   Octet16 r;
131   bool accept;
132 } tBTA_DM_CI_RMT_OOB;
133 
134 /* data type for BTA_DM_REMT_NAME_EVT */
135 typedef struct {
136   BT_HDR_RIGID hdr;
137   tBTA_DM_SEARCH result;
138 } tBTA_DM_REM_NAME;
139 
140 /* data type for tBTA_DM_DISC_RESULT */
141 typedef struct {
142   BT_HDR_RIGID hdr;
143   tBTA_DM_SEARCH result;
144 } tBTA_DM_DISC_RESULT;
145 
146 /* data type for BTA_DM_INQUIRY_CMPL_EVT */
147 typedef struct {
148   BT_HDR_RIGID hdr;
149   uint8_t num;
150 } tBTA_DM_INQUIRY_CMPL;
151 
152 /* data type for BTA_DM_SDP_RESULT_EVT */
153 typedef struct {
154   BT_HDR_RIGID hdr;
155   tSDP_RESULT sdp_result;
156 } tBTA_DM_SDP_RESULT;
157 
158 typedef struct {
159   RawAddress bd_addr;
160   DEV_CLASS dc;
161   LinkKey link_key;
162   uint8_t key_type;
163   bool link_key_known;
164   bool dc_known;
165   BD_NAME bd_name;
166   uint8_t pin_length;
167 } tBTA_DM_API_ADD_DEVICE;
168 
169 typedef struct {
170   BT_HDR_RIGID hdr;
171   bool enable;
172 } tBTA_DM_API_BLE_FEATURE;
173 
174 /* union of all data types */
175 typedef union {
176   /* GKI event buffer header */
177   BT_HDR_RIGID hdr;
178 
179   tBTA_DM_API_SEARCH search;
180 
181   tBTA_DM_API_DISCOVER discover;
182 
183   tBTA_DM_REM_NAME rem_name;
184 
185   tBTA_DM_DISC_RESULT disc_result;
186 
187   tBTA_DM_INQUIRY_CMPL inq_cmpl;
188 
189   tBTA_DM_SDP_RESULT sdp_event;
190 
191 } tBTA_DM_MSG;
192 
193 #define BTA_DM_NUM_PEER_DEVICE 7
194 
195 typedef enum : uint8_t {
196   BTA_DM_NOT_CONNECTED = 0,
197   BTA_DM_CONNECTED = 1,
198   BTA_DM_UNPAIRING = 2,
199 } tBTA_DM_CONN_STATE;
200 
bta_conn_state_text(tBTA_DM_CONN_STATE state)201 inline std::string bta_conn_state_text(tBTA_DM_CONN_STATE state) {
202   switch (state) {
203     CASE_RETURN_TEXT(BTA_DM_NOT_CONNECTED);
204     CASE_RETURN_TEXT(BTA_DM_CONNECTED);
205     CASE_RETURN_TEXT(BTA_DM_UNPAIRING);
206     default:
207       return std::string("UNKNOWN");
208   }
209 }
210 
211 typedef enum : uint8_t {
212   BTA_DM_DI_NONE = 0x00,      /* nothing special */
213   BTA_DM_DI_SET_SNIFF = 0x01, /* set this bit if call BTM_SetPowerMode(sniff) */
214   BTA_DM_DI_INT_SNIFF = 0x02, /* set this bit if call BTM_SetPowerMode(sniff) &
215                                  enter sniff mode */
216   BTA_DM_DI_ACP_SNIFF = 0x04, /* set this bit if peer init sniff */
217   BTA_DM_DI_UNUSED = 0x08,
218   BTA_DM_DI_USE_SSR = 0x10, /* set this bit if ssr is supported for this link */
219   BTA_DM_DI_AV_ACTIVE = 0x20, /* set this bit if AV is active for this link */
220 } tBTA_DM_DEV_INFO_BITMASK;
221 typedef uint8_t tBTA_DM_DEV_INFO;
222 
device_info_text(tBTA_DM_DEV_INFO info)223 inline std::string device_info_text(tBTA_DM_DEV_INFO info) {
224   const char* const device_info_text[] = {
225       ":set_sniff", ":int_sniff", ":acp_sniff",
226       ":unused",    ":use_ssr",   ":av_active",
227   };
228 
229   std::string s = base::StringPrintf("0x%02x", info);
230   if (info == BTA_DM_DI_NONE) return s + std::string(":none");
231   for (size_t i = 0; i < sizeof(device_info_text) / sizeof(device_info_text[0]);
232        i++) {
233     if (info & (1u << i)) s += std::string(device_info_text[i]);
234   }
235   return s;
236 }
237 
238 /* set power mode request type */
239 #define BTA_DM_PM_RESTART 1
240 #define BTA_DM_PM_NEW_REQ 2
241 #define BTA_DM_PM_EXECUTE 3
242 typedef uint8_t tBTA_DM_PM_REQ;
243 
244 struct tBTA_DM_PEER_DEVICE {
245   RawAddress peer_bdaddr;
246   tBTA_DM_CONN_STATE conn_state;
247   tBTA_PREF_ROLES pref_role;
248   bool in_use;
249 
250  private:
251   friend void bta_dm_acl_up(const RawAddress& bd_addr, tBT_TRANSPORT transport,
252                             uint16_t acl_handle);
253   friend void bta_dm_pm_btm_status(const RawAddress& bd_addr,
254                                    tBTM_PM_STATUS status, uint16_t value,
255                                    tHCI_STATUS hci_status);
256   friend void bta_dm_pm_sniff(struct tBTA_DM_PEER_DEVICE* p_peer_dev,
257                               uint8_t index);
258   friend void bta_dm_rm_cback(tBTA_SYS_CONN_STATUS status, uint8_t id,
259                               uint8_t app_id, const RawAddress& peer_addr);
260   friend void handle_remote_features_complete(const RawAddress& bd_addr);
261   tBTA_DM_DEV_INFO info;
262 
263  public:
InfotBTA_DM_PEER_DEVICE264   tBTA_DM_DEV_INFO Info() const { return info; }
265 
266   tBTA_DM_ENCRYPT_CBACK* p_encrypt_cback;
267   tBTM_PM_STATUS prev_low; /* previous low power mode used */
268   tBTA_DM_PM_ACTION pm_mode_attempted;
269   tBTA_DM_PM_ACTION pm_mode_failed;
270   bool remove_dev_pending;
271   tBT_TRANSPORT transport;
272 };
273 
274 /* structure to store list of
275   active connections */
276 typedef struct {
277   tBTA_DM_PEER_DEVICE peer_device[BTA_DM_NUM_PEER_DEVICE];
278   uint8_t count;
279   uint8_t le_count;
280 } tBTA_DM_ACTIVE_LINK;
281 
282 typedef struct {
283   RawAddress peer_bdaddr;
284   tBTA_SYS_ID id;
285   uint8_t app_id;
286   tBTA_SYS_CONN_STATUS state;
287   bool new_request;
288 
ToString__anon2e22df601208289   std::string ToString() const {
290     return base::StringPrintf(
291         "peer:%s sys_name:%s app_id:%hhu state:%s new:request:%s",
292         ADDRESS_TO_LOGGABLE_CSTR(peer_bdaddr), BtaIdSysText(id).c_str(), app_id,
293         bta_sys_conn_status_text(state).c_str(), logbool(new_request).c_str());
294   }
295 
296 } tBTA_DM_SRVCS;
297 
298 #ifndef BTA_DM_NUM_CONN_SRVS
299 #define BTA_DM_NUM_CONN_SRVS 30
300 #endif
301 
302 typedef struct {
303   uint8_t count;
304   tBTA_DM_SRVCS conn_srvc[BTA_DM_NUM_CONN_SRVS];
305 
306 } tBTA_DM_CONNECTED_SRVCS;
307 
308 typedef struct {
309 #define BTA_DM_PM_SNIFF_TIMER_IDX 0
310 #define BTA_DM_PM_PARK_TIMER_IDX 1
311 #define BTA_DM_PM_SUSPEND_TIMER_IDX 2
312 #define BTA_DM_PM_MODE_TIMER_MAX 3
313   /*
314    * Keep three different timers for PARK, SNIFF and SUSPEND if TBFC is
315    * supported.
316    */
317   alarm_t* timer[BTA_DM_PM_MODE_TIMER_MAX];
318 
319   uint8_t srvc_id[BTA_DM_PM_MODE_TIMER_MAX];
320   uint8_t pm_action[BTA_DM_PM_MODE_TIMER_MAX];
321   uint8_t active; /* number of active timer */
322 
323   RawAddress peer_bdaddr;
324   bool in_use;
325 } tBTA_PM_TIMER;
326 
327 extern tBTA_DM_CONNECTED_SRVCS bta_dm_conn_srvcs;
328 
329 #define BTA_DM_NUM_PM_TIMER 7
330 
331 /* DM control block */
332 typedef struct {
333   tBTA_DM_ACTIVE_LINK device_list;
334   tBTA_DM_SEC_CBACK* p_sec_cback;
335   tBTA_BLE_ENERGY_INFO_CBACK* p_energy_info_cback;
336   bool disabling;
337   alarm_t* disable_timer;
338   uint8_t pm_id;
339   tBTA_PM_TIMER pm_timer[BTA_DM_NUM_PM_TIMER];
340   uint8_t cur_av_count;   /* current AV connecions */
341 
342   /* Storage for pin code request parameters */
343   RawAddress pin_bd_addr;
344   DEV_CLASS pin_dev_class;
345   tBTA_DM_SEC_EVT pin_evt;
346   tBTM_IO_CAP loc_io_caps;    /* IO Capabilities of local device */
347   tBTM_IO_CAP rmt_io_caps;    /* IO Capabilities of remote device */
348   tBTM_AUTH_REQ loc_auth_req; /* Authentication required for local device */
349   tBTM_AUTH_REQ rmt_auth_req;
350   uint32_t num_val; /* the numeric value for comparison. If just_works, do not
351                        show this number to UI */
352   bool just_works;  /* true, if "Just Works" association model */
353 #if (BTA_EIR_CANNED_UUID_LIST != TRUE)
354   /* store UUID list for EIR */
355   uint32_t eir_uuid[BTM_EIR_SERVICE_ARRAY_SIZE];
356 #if (BTA_EIR_SERVER_NUM_CUSTOM_UUID > 0)
357   tBTA_CUSTOM_UUID bta_custom_uuid[BTA_EIR_SERVER_NUM_CUSTOM_UUID];
358 #endif
359 
360 #endif
361 
362   tBTA_DM_ENCRYPT_CBACK* p_encrypt_cback;
363   alarm_t* switch_delay_timer;
364 } tBTA_DM_CB;
365 
366 /* DM search state */
367 typedef enum {
368 
369   BTA_DM_SEARCH_IDLE,
370   BTA_DM_SEARCH_ACTIVE,
371   BTA_DM_SEARCH_CANCELLING,
372   BTA_DM_DISCOVER_ACTIVE
373 
374 } tBTA_DM_STATE;
375 
bta_dm_state_text(const tBTA_DM_STATE & state)376 inline std::string bta_dm_state_text(const tBTA_DM_STATE& state) {
377   switch (state) {
378     CASE_RETURN_TEXT(BTA_DM_SEARCH_IDLE);
379     CASE_RETURN_TEXT(BTA_DM_SEARCH_ACTIVE);
380     CASE_RETURN_TEXT(BTA_DM_SEARCH_CANCELLING);
381     CASE_RETURN_TEXT(BTA_DM_DISCOVER_ACTIVE);
382     default:
383       return base::StringPrintf("UNKNOWN[%d]", state);
384   }
385 }
386 
387 /* DM search control block */
388 typedef struct {
389   tBTA_DM_SEARCH_CBACK* p_search_cback;
390   tBTM_INQ_INFO* p_btm_inq_info;
391   tBTA_SERVICE_MASK services;
392   tBTA_SERVICE_MASK services_to_search;
393   tBTA_SERVICE_MASK services_found;
394   tSDP_DISCOVERY_DB* p_sdp_db;
395   tBTA_DM_STATE state;
396   RawAddress peer_bdaddr;
397   bool name_discover_done;
398   BD_NAME peer_name;
399   alarm_t* search_timer;
400   uint8_t service_index;
401   tBTA_DM_MSG* p_pending_search;
402   fixed_queue_t* pending_discovery_queue;
403   bool wait_disc;
404   bool sdp_results;
405   bluetooth::Uuid uuid;
406   uint8_t peer_scn;
407   tBT_TRANSPORT transport;
408   tBTA_DM_SEARCH_CBACK* p_scan_cback;
409   tBTA_DM_SEARCH_CBACK* p_csis_scan_cback;
410   tGATT_IF client_if;
411   uint8_t uuid_to_search;
412   bool gatt_disc_active;
413   uint16_t conn_id;
414   alarm_t* gatt_close_timer; /* GATT channel close delay timer */
415   RawAddress pending_close_bda; /* pending GATT channel remote device address */
416 
417 } tBTA_DM_SEARCH_CB;
418 
419 /* DI control block */
420 typedef struct {
421   uint8_t di_num;                     /* total local DI record number */
422   uint32_t di_handle[BTA_DI_NUM_MAX]; /* local DI record handle, the first one
423                                          is primary record */
424 } tBTA_DM_DI_CB;
425 
426 typedef struct {
427   uint16_t page_timeout; /* timeout for page in slots */
428   bool avoid_scatter; /* true to avoid scatternet when av is streaming (be the
429                          central) */
430 
431 } tBTA_DM_CFG;
432 
433 extern const uint32_t bta_service_id_to_btm_srv_id_lkup_tbl[];
434 
435 typedef struct {
436   uint8_t id;
437   uint8_t app_id;
438   uint8_t cfg;
439 
440 } tBTA_DM_RM;
441 
442 extern const tBTA_DM_CFG* p_bta_dm_cfg;
443 extern const tBTA_DM_RM* p_bta_dm_rm_cfg;
444 
445 typedef struct {
446   uint8_t id;
447   uint8_t app_id;
448   uint8_t spec_idx; /* index of spec table to use */
449 
450 } tBTA_DM_PM_CFG;
451 
452 typedef struct {
453   tBTA_DM_PM_ACTION power_mode;
454   uint16_t timeout;
455 
456 } tBTA_DM_PM_ACTN;
457 
458 typedef struct {
459   uint8_t allow_mask; /* mask of sniff/hold/park modes to allow */
460   uint8_t ssr; /* set SSR on conn open/unpark */
461   tBTA_DM_PM_ACTN actn_tbl[BTA_DM_PM_NUM_EVTS][2];
462 
463 } tBTA_DM_PM_SPEC;
464 
465 typedef struct {
466   uint16_t max_lat;
467   uint16_t min_rmt_to;
468   uint16_t min_loc_to;
469   const char* name{nullptr};
470 } tBTA_DM_SSR_SPEC;
471 
472 typedef struct {
473   uint16_t manufacturer;
474   uint16_t lmp_sub_version;
475   uint8_t lmp_version;
476 } tBTA_DM_LMP_VER_INFO;
477 
478 extern const uint16_t bta_service_id_to_uuid_lkup_tbl[];
479 
480 /* For Insight, PM cfg lookup tables are runtime configurable (to allow tweaking
481  * of params for power consumption measurements) */
482 #ifndef BTE_SIM_APP
483 #define tBTA_DM_PM_TYPE_QUALIFIER const
484 #else
485 #define tBTA_DM_PM_TYPE_QUALIFIER
486 #endif
487 
488 extern const tBTA_DM_PM_CFG* p_bta_dm_pm_cfg;
489 tBTA_DM_PM_TYPE_QUALIFIER tBTA_DM_PM_SPEC* get_bta_dm_pm_spec();
490 extern const tBTM_PM_PWR_MD* p_bta_dm_pm_md;
491 extern tBTA_DM_SSR_SPEC* p_bta_dm_ssr_spec;
492 
493 /* update dynamic BRCM Aware EIR data */
494 extern const tBTA_DM_EIR_CONF bta_dm_eir_cfg;
495 extern const tBTA_DM_EIR_CONF* p_bta_dm_eir_cfg;
496 
497 /* DM control block */
498 extern tBTA_DM_CB bta_dm_cb;
499 
500 /* DM search control block */
501 extern tBTA_DM_SEARCH_CB bta_dm_search_cb;
502 
503 /* DI control block */
504 extern tBTA_DM_DI_CB bta_dm_di_cb;
505 
506 bool bta_dm_search_sm_execute(BT_HDR_RIGID* p_msg);
507 void bta_dm_search_sm_disable(void);
508 
509 void bta_dm_enable(tBTA_DM_SEC_CBACK*);
510 void bta_dm_disable();
511 void bta_dm_init_cb(void);
512 void bta_dm_deinit_cb(void);
513 void bta_dm_set_dev_name(const std::vector<uint8_t>&);
514 void bta_dm_set_visibility(tBTA_DM_DISC, tBTA_DM_CONN);
515 void bta_dm_set_scan_config(tBTA_DM_MSG* p_data);
516 void bta_dm_vendor_spec_command(tBTA_DM_MSG* p_data);
517 void bta_dm_bond(const RawAddress&, tBLE_ADDR_TYPE, tBT_TRANSPORT,
518                  tBT_DEVICE_TYPE);
519 void bta_dm_bond_cancel(const RawAddress&);
520 void bta_dm_pin_reply(std::unique_ptr<tBTA_DM_API_PIN_REPLY> msg);
521 void bta_dm_add_device(std::unique_ptr<tBTA_DM_API_ADD_DEVICE> msg);
522 void bta_dm_remove_device(const RawAddress& bd_addr);
523 void bta_dm_close_acl(const RawAddress&, bool, tBT_TRANSPORT);
524 
525 void bta_dm_pm_btm_status(const RawAddress&, tBTM_PM_STATUS, uint16_t,
526                           tHCI_STATUS);
527 void bta_dm_pm_timer(const RawAddress&, tBTA_DM_PM_ACTION);
528 void bta_dm_add_ampkey(tBTA_DM_MSG* p_data);
529 
530 void bta_dm_add_blekey(const RawAddress& bd_addr, tBTA_LE_KEY_VALUE blekey,
531                        tBTM_LE_KEY_TYPE key_type);
532 void bta_dm_add_ble_device(const RawAddress& bd_addr, tBLE_ADDR_TYPE addr_type,
533                            tBT_DEVICE_TYPE dev_type);
534 void bta_dm_ble_passkey_reply(const RawAddress& bd_addr, bool accept,
535                               uint32_t passkey);
536 void bta_dm_ble_confirm_reply(const RawAddress&, bool);
537 void bta_dm_ble_set_conn_params(const RawAddress&, uint16_t, uint16_t, uint16_t,
538                                 uint16_t);
539 void bta_dm_close_gatt_conn(tBTA_DM_MSG* p_data);
540 void bta_dm_ble_observe(bool, uint8_t, tBTA_DM_SEARCH_CBACK*);
541 void bta_dm_ble_scan(bool, uint8_t, bool);
542 void bta_dm_ble_csis_observe(bool, tBTA_DM_SEARCH_CBACK*);
543 void bta_dm_ble_update_conn_params(const RawAddress&, uint16_t, uint16_t,
544                                    uint16_t, uint16_t, uint16_t, uint16_t);
545 void bta_dm_ble_config_local_privacy(bool);
546 
547 void bta_dm_ble_set_data_length(const RawAddress& bd_addr);
548 
549 void bta_dm_ble_get_energy_info(tBTA_BLE_ENERGY_INFO_CBACK*);
550 
551 void bta_dm_set_encryption(const RawAddress&, tBT_TRANSPORT,
552                            tBTA_DM_ENCRYPT_CBACK*, tBTM_BLE_SEC_ACT);
553 void bta_dm_confirm(const RawAddress&, bool);
554 
555 void bta_dm_ci_rmt_oob_act(std::unique_ptr<tBTA_DM_CI_RMT_OOB> msg);
556 
557 void bta_dm_init_pm(void);
558 void bta_dm_disable_pm(void);
559 
560 uint8_t bta_dm_get_av_count(void);
561 void bta_dm_search_start(tBTA_DM_MSG* p_data);
562 void bta_dm_search_cancel();
563 void bta_dm_discover(tBTA_DM_MSG* p_data);
564 void bta_dm_inq_cmpl(uint8_t num);
565 void bta_dm_rmt_name(tBTA_DM_MSG* p_data);
566 void bta_dm_sdp_result(tBTA_DM_MSG* p_data);
567 void bta_dm_search_cmpl();
568 void bta_dm_free_sdp_db();
569 void bta_dm_disc_result(tBTA_DM_MSG* p_data);
570 void bta_dm_search_result(tBTA_DM_MSG* p_data);
571 void bta_dm_discovery_cmpl(tBTA_DM_MSG* p_data);
572 void bta_dm_queue_search(tBTA_DM_MSG* p_data);
573 void bta_dm_queue_disc(tBTA_DM_MSG* p_data);
574 void bta_dm_execute_queued_request();
575 bool bta_dm_is_search_request_queued();
576 void bta_dm_search_clear_queue();
577 void bta_dm_search_cancel_notify();
578 void bta_dm_disc_rmt_name(tBTA_DM_MSG* p_data);
579 tBTA_DM_PEER_DEVICE* bta_dm_find_peer_device(const RawAddress& peer_addr);
580 
581 void bta_dm_clear_event_filter(void);
582 void bta_dm_clear_event_mask(void);
583 void bta_dm_clear_filter_accept_list(void);
584 void bta_dm_disconnect_all_acls(void);
585 void bta_dm_le_rand(LeRandCallback cb);
586 void bta_dm_set_event_filter_connection_setup_all_devices();
587 void bta_dm_allow_wake_by_hid(
588     std::vector<RawAddress> classic_hid_devices,
589     std::vector<std::pair<RawAddress, uint8_t>> le_hid_devices);
590 void bta_dm_restore_filter_accept_list(
591     std::vector<std::pair<RawAddress, uint8_t>> le_devices);
592 void bta_dm_set_default_event_mask_except(uint64_t mask, uint64_t le_mask);
593 void bta_dm_set_event_filter_inquiry_result_all_devices();
594 
595 void bta_dm_ble_reset_id(void);
596 
597 tBTA_DM_STATE bta_dm_search_get_state();
598 void bta_dm_search_set_state(tBTA_DM_STATE state);
599 
600 void bta_dm_eir_update_uuid(uint16_t uuid16, bool adding);
601 void bta_dm_eir_update_cust_uuid(const tBTA_CUSTOM_UUID &curr, bool adding);
602 
603 void bta_dm_ble_subrate_request(const RawAddress& bd_addr, uint16_t subrate_min,
604                                 uint16_t subrate_max, uint16_t max_latency,
605                                 uint16_t cont_num, uint16_t timeout);
606 void bta_dm_consolidate(const RawAddress& identity_addr, const RawAddress& rpa);
607 
608 #undef CASE_RETURN_TEXT
609 #endif /* BTA_DM_INT_H */
610