1 /*
2  *  Copyright 1999-2012 Broadcom Corporation
3  *
4  *  Licensed under the Apache License, Version 2.0 (the "License");
5  *  you may not use this file except in compliance with the License.
6  *  You may obtain a copy of the License at:
7  *
8  *  http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *  Unless required by applicable law or agreed to in writing, software
11  *  distributed under the License is distributed on an "AS IS" BASIS,
12  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *  See the License for the specific language governing permissions and
14  *  limitations under the License.
15  *
16  ******************************************************************************/
17 
18 /******************************************************************************
19  *
20  *  This file contains the Bluetooth Manager (BTM) API function external
21  *  definitions.
22  *
23  ******************************************************************************/
24 #ifndef BTM_API_H
25 #define BTM_API_H
26 
27 #include <cstdint>
28 
29 #include "device/include/esco_parameters.h"
30 #include "stack/btm/neighbor_inquiry.h"
31 #include "stack/include/btm_api_types.h"
32 #include "stack/include/btm_status.h"
33 #include "types/bt_transport.h"
34 #include "types/raw_address.h"
35 
36 void btm_init();
37 void btm_free();
38 
39 /*****************************************************************************
40  *  DEVICE CONTROL and COMMON
41  ****************************************************************************/
42 
43 /*****************************************************************************
44  *  EXTERNAL FUNCTION DECLARATIONS
45  ****************************************************************************/
46 
47 /*****************************************************************************
48  *  DEVICE CONTROL and COMMON FUNCTIONS
49  ****************************************************************************/
50 
51 void BTM_reset_complete();
52 
53 /*******************************************************************************
54  *
55  * Function         BTM_IsDeviceUp
56  *
57  * Description      This function is called to check if the device is up.
58  *
59  * Returns          true if device is up, else false
60  *
61  ******************************************************************************/
62 [[nodiscard]] bool BTM_IsDeviceUp(void);
63 
64 /*******************************************************************************
65  *
66  * Function         BTM_SetLocalDeviceName
67  *
68  * Description      This function is called to set the local device name.
69  *
70  * Returns          BTM_CMD_STARTED if successful, otherwise an error
71  *
72  ******************************************************************************/
73 [[nodiscard]] tBTM_STATUS BTM_SetLocalDeviceName(const char* p_name);
74 
75 /*******************************************************************************
76  *
77  * Function         BTM_SetDeviceClass
78  *
79  * Description      This function is called to set the local device class
80  *
81  * Returns          BTM_SUCCESS if successful, otherwise an error
82  *
83  ******************************************************************************/
84 [[nodiscard]] tBTM_STATUS BTM_SetDeviceClass(DEV_CLASS dev_class);
85 
86 /*******************************************************************************
87  *
88  * Function         BTM_ReadLocalDeviceName
89  *
90  * Description      This function is called to read the local device name.
91  *
92  * Returns          status of the operation
93  *                  If success, BTM_SUCCESS is returned and p_name points stored
94  *                              local device name
95  *                  If BTM doesn't store local device name, BTM_NO_RESOURCES is
96  *                              is returned and p_name is set to NULL
97  *
98  ******************************************************************************/
99 [[nodiscard]] tBTM_STATUS BTM_ReadLocalDeviceName(const char** p_name);
100 
101 /*******************************************************************************
102  *
103  * Function         BTM_ReadLocalDeviceNameFromController
104  *
105  * Description      Get local device name from controller. Do not use cached
106  *                  name (used to get chip-id prior to btm reset complete).
107  *
108  * Returns          BTM_CMD_STARTED if successful, otherwise an error
109  *
110  ******************************************************************************/
111 [[nodiscard]] tBTM_STATUS BTM_ReadLocalDeviceNameFromController(
112     tBTM_CMPL_CB* p_rln_cmpl_cback);
113 
114 /*******************************************************************************
115  *
116  * Function         BTM_ReadDeviceClass
117  *
118  * Description      This function is called to read the local device class
119  *
120  * Returns          the device class
121  *
122  ******************************************************************************/
123 [[nodiscard]] DEV_CLASS BTM_ReadDeviceClass(void);
124 
125 /*******************************************************************************
126  *
127  * Function         BTM_VendorSpecificCommand
128  *
129  * Description      Send a vendor specific HCI command to the controller.
130  *
131  ******************************************************************************/
132 void BTM_VendorSpecificCommand(uint16_t opcode, uint8_t param_len,
133                                uint8_t* p_param_buf, tBTM_VSC_CMPL_CB* p_cb);
134 
135 /*******************************************************************************
136  *
137  * Function         BTM_WritePageTimeout
138  *
139  * Description      Send HCI Wite Page Timeout.
140  *
141  ******************************************************************************/
142 void BTM_WritePageTimeout(uint16_t timeout);
143 
144 /*******************************************************************************
145  *
146  * Function         BTM_WriteVoiceSettings
147  *
148  * Description      Send HCI Write Voice Settings command.
149  *                  See hcidefs.h for settings bitmask values.
150  *
151  ******************************************************************************/
152 void BTM_WriteVoiceSettings(uint16_t settings);
153 
154 /*******************************************************************************
155  *
156  * Function         BTM_EnableTestMode
157  *
158  * Description      Send HCI the enable device under test command.
159  *
160  *                  Note: Controller can only be taken out of this mode by
161  *                      resetting the controller.
162  *
163  * Returns
164  *      BTM_SUCCESS         Command sent.
165  *      BTM_NO_RESOURCES    If out of resources to send the command.
166  *
167  *
168  ******************************************************************************/
169 [[nodiscard]] tBTM_STATUS BTM_EnableTestMode(void);
170 
171 /*******************************************************************************
172  * DEVICE DISCOVERY FUNCTIONS - Inquiry, Remote Name, Discovery, Class of Device
173  ******************************************************************************/
174 
175 /*******************************************************************************
176  *
177  * Function         BTM_SetDiscoverability
178  *
179  * Description      This function is called to set the device into or out of
180  *                  discoverable mode. Discoverable mode means inquiry
181  *                  scans are enabled.  If a value of '0' is entered for window
182  *                  or interval, the default values are used.
183  *
184  * Returns          BTM_SUCCESS if successful
185  *                  BTM_BUSY if a setting of the filter is already in progress
186  *                  BTM_NO_RESOURCES if couldn't get a memory pool buffer
187  *                  BTM_ILLEGAL_VALUE if a bad parameter was detected
188  *                  BTM_WRONG_MODE if the device is not up.
189  *
190  ******************************************************************************/
191 [[nodiscard]] tBTM_STATUS BTM_SetDiscoverability(uint16_t inq_mode);
192 
193 /*******************************************************************************
194  *
195  * Function         BTM_StartInquiry
196  *
197  * Description      This function is called to start an inquiry.
198  *
199  * Parameters:      p_inqparms - pointer to the inquiry information
200  *                      mode - GENERAL or LIMITED inquiry
201  *                      duration - length in 1.28 sec intervals (If '0', the
202  *                                 inquiry is CANCELLED)
203  *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
204  *                                         BTM_FILTER_COND_DEVICE_CLASS, or
205  *                                         BTM_FILTER_COND_BD_ADDR
206  *                      filter_cond - value for the filter (based on
207  *                                                          filter_cond_type)
208  *
209  *                  p_results_cb  - Pointer to the callback routine which gets
210  *                                called upon receipt of an inquiry result. If
211  *                                this field is NULL, the application is not
212  *                                notified.
213  *
214  *                  p_cmpl_cb   - Pointer to the callback routine which gets
215  *                                called upon completion.  If this field is
216  *                                NULL, the application is not notified when
217  *                                completed.
218  * Returns          tBTM_STATUS
219  *                  BTM_CMD_STARTED if successfully initiated
220  *                  BTM_BUSY if already in progress
221  *                  BTM_ILLEGAL_VALUE if parameter(s) are out of range
222  *                  BTM_NO_RESOURCES if could not allocate resources to start
223  *                                   the command
224  *                  BTM_WRONG_MODE if the device is not up.
225  *
226  ******************************************************************************/
227 [[nodiscard]] tBTM_STATUS BTM_StartInquiry(tBTM_INQ_RESULTS_CB* p_results_cb,
228                                            tBTM_CMPL_CB* p_cmpl_cb);
229 
230 /*******************************************************************************
231  *
232  * Function         BTM_IsInquiryActive
233  *
234  * Description      Return a bit mask of the current inquiry state
235  *
236  * Returns          Bitmask of current inquiry state
237  *
238  ******************************************************************************/
239 [[nodiscard]] uint16_t BTM_IsInquiryActive(void);
240 
241 /*******************************************************************************
242  *
243  * Function         BTM_CancelInquiry
244  *
245  * Description      This function cancels an inquiry if active
246  *
247  ******************************************************************************/
248 void BTM_CancelInquiry(void);
249 
250 /*******************************************************************************
251  *
252  * Function         BTM_SetConnectability
253  *
254  * Description      This function is called to set the device into or out of
255  *                  connectable mode. Discoverable mode means page scans are
256  *                  enabled.
257  *
258  * Returns          BTM_SUCCESS if successful
259  *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
260  *                  BTM_NO_RESOURCES if could not allocate a message buffer
261  *                  BTM_WRONG_MODE if the device is not up.
262  *
263  ******************************************************************************/
264 [[nodiscard]] tBTM_STATUS BTM_SetConnectability(uint16_t page_mode);
265 
266 /*******************************************************************************
267  *
268  * Function         BTM_SetInquiryMode
269  *
270  * Description      This function is called to set standard, with RSSI
271  *                  mode or extended of the inquiry for local device.
272  *
273  * Input Params:    BTM_INQ_RESULT_STANDARD, BTM_INQ_RESULT_WITH_RSSI or
274  *                  BTM_INQ_RESULT_EXTENDED
275  *
276  * Returns          BTM_SUCCESS if successful
277  *                  BTM_NO_RESOURCES if couldn't get a memory pool buffer
278  *                  BTM_ILLEGAL_VALUE if a bad parameter was detected
279  *                  BTM_WRONG_MODE if the device is not up.
280  *
281  ******************************************************************************/
282 [[nodiscard]] tBTM_STATUS BTM_SetInquiryMode(uint8_t mode);
283 
284 void BTM_EnableInterlacedInquiryScan();
285 
286 void BTM_EnableInterlacedPageScan();
287 
288 /*******************************************************************************
289  *
290  * Function         BTM_ReadRemoteDeviceName
291  *
292  * Description      This function initiates a remote device HCI command to the
293  *                  controller and calls the callback when the process has
294  *                  completed.
295  *
296  * Input Params:    remote_bda      - device address of name to retrieve
297  *                  p_cb            - callback function called when
298  *                                    BTM_CMD_STARTED is returned.
299  *                                    A pointer to tBTM_REMOTE_DEV_NAME is
300  *                                    passed to the callback.
301  *
302  * Returns
303  *                  BTM_CMD_STARTED is returned if the request was successfully
304  *                                  sent to HCI.
305  *                  BTM_BUSY if already in progress
306  *                  BTM_UNKNOWN_ADDR if device address is bad
307  *                  BTM_NO_RESOURCES if resources could not be allocated to
308  *                                   start the command
309  *                  BTM_WRONG_MODE if the device is not up.
310  *
311  ******************************************************************************/
312 [[nodiscard]] tBTM_STATUS BTM_ReadRemoteDeviceName(const RawAddress& remote_bda,
313                                                    tBTM_NAME_CMPL_CB* p_cb,
314                                                    tBT_TRANSPORT transport);
315 
316 /*******************************************************************************
317  *
318  * Function         BTM_CancelRemoteDeviceName
319  *
320  * Description      This function initiates the cancel request for the specified
321  *                  remote device.
322  *
323  * Input Params:    None
324  *
325  * Returns
326  *                  BTM_CMD_STARTED is returned if the request was successfully
327  *                                  sent to HCI.
328  *                  BTM_NO_RESOURCES if resources could not be allocated to
329  *                                   start the command
330  *                  BTM_WRONG_MODE if there is no active remote name request.
331  *
332  ******************************************************************************/
333 [[nodiscard]] tBTM_STATUS BTM_CancelRemoteDeviceName(void);
334 
335 /*******************************************************************************
336  *
337  * Function         BTM_IsRemoteVersionReceived
338  *
339  * Returns          Returns true if "LE Read remote version info" was already
340  *                  received on LE transport for this device.
341  *
342  ******************************************************************************/
343 [[nodiscard]] bool BTM_IsRemoteVersionReceived(const RawAddress& remote_bda);
344 
345 /*******************************************************************************
346  *
347  * Function         BTM_ReadRemoteVersion
348  *
349  * Description      This function is called to read a remote device's version
350  *
351  * Returns          true if data valid, false otherwise
352  *
353  ******************************************************************************/
354 [[nodiscard]] bool BTM_ReadRemoteVersion(const RawAddress& addr,
355                                          uint8_t* lmp_version,
356                                          uint16_t* manufacturer,
357                                          uint16_t* lmp_sub_version);
358 
359 /*******************************************************************************
360  *
361  * Function         BTM_ReadRemoteFeatures
362  *
363  * Description      This function is called to read a remote device's
364  *                  supported features mask (features mask located at page 0)
365  *
366  * Returns          pointer to the remote supported features mask
367  *                  The size of device features mask page is
368  *                  HCI_FEATURE_BYTES_PER_PAGE bytes.
369  *
370  ******************************************************************************/
371 [[nodiscard]] uint8_t* BTM_ReadRemoteFeatures(const RawAddress& addr);
372 
373 /*******************************************************************************
374  *
375  * Function         BTM_InqDbRead
376  *
377  * Description      This function looks through the inquiry database for a match
378  *                  based on Bluetooth Device Address. This is the application's
379  *                  interface to get the inquiry details of a specific BD
380  *                  address.
381  *
382  * Returns          pointer to entry, or NULL if not found
383  *
384  ******************************************************************************/
385 [[nodiscard]] tBTM_INQ_INFO* BTM_InqDbRead(const RawAddress& p_bda);
386 
387 /*******************************************************************************
388  *
389  * Function         BTM_InqDbFirst
390  *
391  * Description      This function looks through the inquiry database for the
392  *                  first used entry, and returns that. This is used in
393  *                  conjunction with BTM_InqDbNext by applications as a way to
394  *                  walk through the inquiry database.
395  *
396  * Returns          pointer to first in-use entry, or NULL if DB is empty
397  *
398  ******************************************************************************/
399 [[nodiscard]] tBTM_INQ_INFO* BTM_InqDbFirst(void);
400 
401 /*******************************************************************************
402  *
403  * Function         BTM_InqDbNext
404  *
405  * Description      This function looks through the inquiry database for the
406  *                  next used entry, and returns that.  If the input parameter
407  *                  is NULL, the first entry is returned.
408  *
409  * Returns          pointer to next in-use entry, or NULL if no more found.
410  *
411  ******************************************************************************/
412 [[nodiscard]] tBTM_INQ_INFO* BTM_InqDbNext(tBTM_INQ_INFO* p_cur);
413 
414 /*******************************************************************************
415  *
416  * Function         BTM_ClearInqDb
417  *
418  * Description      This function is called to clear out a device or all devices
419  *                  from the inquiry database.
420  *
421  * Parameter        p_bda - (input) BD_ADDR ->  Address of device to clear
422  *                                              (NULL clears all entries)
423  *
424  * Returns          BTM_BUSY if an inquiry, get remote name, or event filter
425  *                          is active, otherwise BTM_SUCCESS
426  *
427  ******************************************************************************/
428 [[nodiscard]] tBTM_STATUS BTM_ClearInqDb(const RawAddress* p_bda);
429 
430 /*****************************************************************************
431  *  (e)SCO CHANNEL MANAGEMENT FUNCTIONS
432  ****************************************************************************/
433 /*******************************************************************************
434  *
435  * Function         BTM_CreateSco
436  *
437  * Description      This function is called to create an SCO connection. If the
438  *                  "is_orig" flag is true, the connection will be originated,
439  *                  otherwise BTM will wait for the other side to connect.
440  *
441  * Returns          BTM_UNKNOWN_ADDR if the ACL connection is not up
442  *                  BTM_BUSY         if another SCO being set up to
443  *                                   the same BD address
444  *                  BTM_NO_RESOURCES if the max SCO limit has been reached
445  *                  BTM_CMD_STARTED  if the connection establishment is started.
446  *                                   In this case, "*p_sco_inx" is filled in
447  *                                   with the sco index used for the connection.
448  *
449  ******************************************************************************/
450 [[nodiscard]] tBTM_STATUS BTM_CreateSco(const RawAddress* remote_bda,
451                                         bool is_orig, uint16_t pkt_types,
452                                         uint16_t* p_sco_inx,
453                                         tBTM_SCO_CB* p_conn_cb,
454                                         tBTM_SCO_CB* p_disc_cb);
455 
456 /*******************************************************************************
457  *
458  * Function         BTM_RemoveSco
459  *
460  * Description      This function is called to remove a specific SCO connection.
461  *
462  * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
463  *
464  ******************************************************************************/
465 [[nodiscard]] tBTM_STATUS BTM_RemoveSco(uint16_t sco_inx);
466 void BTM_RemoveSco(const RawAddress& bda);
467 
468 /*******************************************************************************
469  *
470  * Function         BTM_ReadScoBdAddr
471  *
472  * Description      This function is read the remote BD Address for a specific
473  *                  SCO connection,
474  *
475  * Returns          pointer to BD address or NULL if not known
476  *
477  ******************************************************************************/
478 [[nodiscard]] const RawAddress* BTM_ReadScoBdAddr(uint16_t sco_inx);
479 
480 /*******************************************************************************
481  *
482  * Function         BTM_SetEScoMode
483  *
484  * Description      This function sets up the negotiated parameters for SCO or
485  *                  eSCO, and sets as the default mode used for calls to
486  *                  BTM_CreateSco.  It can be called only when there are no
487  *                  active (e)SCO links.
488  *
489  * Returns          BTM_SUCCESS if the successful.
490  *                  BTM_BUSY if there are one or more active (e)SCO links.
491  *
492  ******************************************************************************/
493 [[nodiscard]] tBTM_STATUS BTM_SetEScoMode(enh_esco_params_t* p_parms);
494 
495 /*******************************************************************************
496  *
497  * Function         BTM_RegForEScoEvts
498  *
499  * Description      This function registers a SCO event callback with the
500  *                  specified instance.  It should be used to received
501  *                  connection indication events and change of link parameter
502  *                  events.
503  *
504  * Returns          BTM_SUCCESS if the successful.
505  *                  BTM_ILLEGAL_VALUE if there is an illegal sco_inx
506  *
507  ******************************************************************************/
508 [[nodiscard]] tBTM_STATUS BTM_RegForEScoEvts(uint16_t sco_inx,
509                                              tBTM_ESCO_CBACK* p_esco_cback);
510 
511 /*******************************************************************************
512  *
513  * Function         BTM_EScoConnRsp
514  *
515  * Description      This function is called upon receipt of an (e)SCO connection
516  *                  request event (BTM_ESCO_CONN_REQ_EVT) to accept or reject
517  *                  the request. Parameters used to negotiate eSCO links.
518  *                  If p_parms is NULL, then values set through BTM_SetEScoMode
519  *                  are used.
520  *                  If the link type of the incoming request is SCO, then only
521  *                  the tx_bw, max_latency, content format, and packet_types are
522  *                  valid.  The hci_status parameter should be
523  *                  ([0x0] to accept, [0x0d..0x0f] to reject)
524  *
525  *
526  * Returns          void
527  *
528  ******************************************************************************/
529 void BTM_EScoConnRsp(uint16_t sco_inx, tHCI_STATUS hci_status,
530                      enh_esco_params_t* p_parms);
531 
532 /*******************************************************************************
533  *
534  * Function         BTM_GetNumScoLinks
535  *
536  * Description      This function returns the number of active SCO links.
537  *
538  * Returns          uint8_t
539  *
540  ******************************************************************************/
541 [[nodiscard]] uint8_t BTM_GetNumScoLinks(void);
542 
543 /*******************************************************************************
544  *
545  * Function         BTM_GetScoDebugDump
546  *
547  * Description      Get the status of SCO. This function is only used for
548  *                  testing and debugging purposes.
549  *
550  * Returns          Data with SCO related debug dump.
551  *
552  ******************************************************************************/
553 [[nodiscard]] tBTM_SCO_DEBUG_DUMP BTM_GetScoDebugDump(void);
554 
555 /*******************************************************************************
556  *
557  * Function         BTM_GetPeerDeviceTypeFromFeatures
558  *
559  * Description      This function is called to retrieve the peer device type
560  *                  by referencing the remote features.
561  *
562  * Parameters:      bd_addr - address of the peer
563  *
564  * Returns          BT_DEVICE_TYPE_DUMO if both BR/EDR and BLE transports are
565  *                  supported by the peer,
566  *                  BT_DEVICE_TYPE_BREDR if only BR/EDR transport is supported,
567  *                  BT_DEVICE_TYPE_BLE if only BLE transport is supported.
568  *
569  ******************************************************************************/
570 [[nodiscard]] tBT_DEVICE_TYPE BTM_GetPeerDeviceTypeFromFeatures(
571     const RawAddress& bd_addr);
572 
573 /*******************************************************************************
574  *
575  * Function         BTM_GetHCIConnHandle
576  *
577  * Description      This function is called to get the handle for an ACL
578  *                  connection to a specific remote BD Address.
579  *
580  * Returns          the handle of the connection, or 0xFFFF if none.
581  *
582  ******************************************************************************/
583 [[nodiscard]] uint16_t BTM_GetHCIConnHandle(const RawAddress& remote_bda,
584                                             tBT_TRANSPORT transport);
585 
586 /*******************************************************************************
587  *
588  * Function         BTM_IsPhy2mSupported
589  *
590  * Description      This function is called to check PHY 2M support
591  *                  from peer device
592  * Returns          True when PHY 2M supported false otherwise
593  *
594  ******************************************************************************/
595 [[nodiscard]] bool BTM_IsPhy2mSupported(const RawAddress& remote_bda,
596                                         tBT_TRANSPORT transport);
597 
598 /*******************************************************************************
599  *
600  * Function         BTM_RequestPeerSCA
601  *
602  * Description      This function is called to request sleep clock accuracy
603  *                  from peer device
604  *
605  ******************************************************************************/
606 void BTM_RequestPeerSCA(const RawAddress& remote_bda, tBT_TRANSPORT transport);
607 
608 /*******************************************************************************
609  *
610  * Function         BTM_GetPeerSCA
611  *
612  * Description      This function is called to get peer sleep clock accuracy
613  *
614  * Returns          SCA or 0xFF if SCA was never previously requested, request
615  *                  is not supported by peer device or ACL does not exist
616  *
617  ******************************************************************************/
618 [[nodiscard]] uint8_t BTM_GetPeerSCA(const RawAddress& remote_bda,
619                                      tBT_TRANSPORT transport);
620 
621 /*******************************************************************************
622  *
623  * Function         BTM_WriteEIR
624  *
625  * Description      This function is called to write EIR data to controller.
626  *
627  * Parameters       p_buff - allocated HCI command buffer including extended
628  *                           inquriry response
629  *
630  * Returns          BTM_SUCCESS  - if successful
631  *                  BTM_MODE_UNSUPPORTED - if local device cannot support it
632  *
633  ******************************************************************************/
634 [[nodiscard]] tBTM_STATUS BTM_WriteEIR(BT_HDR* p_buff);
635 
636 /*******************************************************************************
637  *
638  * Function         BTM_HasEirService
639  *
640  * Description      This function is called to know if UUID in bit map of UUID.
641  *
642  * Parameters       p_eir_uuid - bit map of UUID list
643  *                  uuid16 - UUID 16-bit
644  *
645  * Returns          true - if found
646  *                  false - if not found
647  *
648  ******************************************************************************/
649 [[nodiscard]] bool BTM_HasEirService(const uint32_t* p_eir_uuid,
650                                      uint16_t uuid16);
651 
652 /*******************************************************************************
653  *
654  * Function         BTM_AddEirService
655  *
656  * Description      This function is called to add a service in the bit map UUID
657  *                  list.
658  *
659  * Parameters       p_eir_uuid - bit mask of UUID list for EIR
660  *                  uuid16 - UUID 16-bit
661  *
662  * Returns          None
663  *
664  ******************************************************************************/
665 void BTM_AddEirService(uint32_t* p_eir_uuid, uint16_t uuid16);
666 
667 /*******************************************************************************
668  *
669  * Function         BTM_RemoveEirService
670  *
671  * Description      This function is called to remove a service from the bit map
672  *                  UUID list.
673  *
674  * Parameters       p_eir_uuid - bit mask of UUID list for EIR
675  *                  uuid16 - UUID 16-bit
676  *
677  * Returns          None
678  *
679  ******************************************************************************/
680 void BTM_RemoveEirService(uint32_t* p_eir_uuid, uint16_t uuid16);
681 
682 /*******************************************************************************
683  *
684  * Function         BTM_GetEirSupportedServices
685  *
686  * Description      This function is called to get UUID list from bit map UUID
687  *                  list.
688  *
689  * Parameters       p_eir_uuid - bit mask of UUID list for EIR
690  *                  p - reference of current pointer of EIR
691  *                  max_num_uuid16 - max number of UUID can be written in EIR
692  *                  num_uuid16 - number of UUID have been written in EIR
693  *
694  * Returns          HCI_EIR_MORE_16BITS_UUID_TYPE, if it has more than max
695  *                  HCI_EIR_COMPLETE_16BITS_UUID_TYPE, otherwise
696  *
697  ******************************************************************************/
698 [[nodiscard]] uint8_t BTM_GetEirSupportedServices(uint32_t* p_eir_uuid,
699                                                   uint8_t** p,
700                                                   uint8_t max_num_uuid16,
701                                                   uint8_t* p_num_uuid16);
702 
703 /*******************************************************************************
704  *
705  * Function         BTM_GetEirUuidList
706  *
707  * Description      This function parses EIR and returns UUID list.
708  *
709  * Parameters       p_eir - EIR
710  *                  eirl_len - EIR len
711  *                  uuid_size - Uuid::kNumBytes16, Uuid::kNumBytes32,
712  *                              Uuid::kNumBytes128
713  *                  p_num_uuid - return number of UUID in found list
714  *                  p_uuid_list - return UUID 16-bit list
715  *                  max_num_uuid - maximum number of UUID to be returned
716  *
717  * Returns          0 - if not found
718  *                  HCI_EIR_COMPLETE_16BITS_UUID_TYPE
719  *                  HCI_EIR_MORE_16BITS_UUID_TYPE
720  *                  HCI_EIR_COMPLETE_32BITS_UUID_TYPE
721  *                  HCI_EIR_MORE_32BITS_UUID_TYPE
722  *                  HCI_EIR_COMPLETE_128BITS_UUID_TYPE
723  *                  HCI_EIR_MORE_128BITS_UUID_TYPE
724  *
725  ******************************************************************************/
726 [[nodiscard]] uint8_t BTM_GetEirUuidList(const uint8_t* p_eir, size_t eir_len,
727                                          uint8_t uuid_size, uint8_t* p_num_uuid,
728                                          uint8_t* p_uuid_list,
729                                          uint8_t max_num_uuid);
730 
731 [[nodiscard]] bool BTM_IsScoActiveByBdaddr(const RawAddress& remote_bda);
732 
733 /* Read maximum data packet that can be sent over current connection */
734 [[nodiscard]] uint16_t BTM_GetMaxPacketSize(const RawAddress& addr);
735 
736 typedef void(BTM_CONSOLIDATION_CB)(const RawAddress& identity_addr,
737                                    const RawAddress& rpa);
738 void BTM_SetConsolidationCallback(BTM_CONSOLIDATION_CB* cb);
739 
740 #endif /* BTM_API_H */
741