OSDN Git Service

Re-format of btm api
authorChris Manton <cmanton@google.com>
Sun, 8 Dec 2019 04:36:58 +0000 (20:36 -0800)
committerChris Manton <cmanton@google.com>
Sun, 8 Dec 2019 04:59:43 +0000 (20:59 -0800)
Order corresponding functions in both cc and h files

Bug: 143578947
Test: bluetooth_gd_test

Change-Id: I077a54566f8c50d38515b92776edb02d0a3bb311

main/shim/btm_api.cc
main/shim/btm_api.h

index a8adee8..6b9fce7 100644 (file)
 
 static bluetooth::shim::Btm shim_btm;
 
-/*******************************************************************************
- *
- * Function         BTM_StartInquiry
- *
- * Description      This function is called to start an inquiry.
- *
- * Parameters:      p_inqparms - pointer to the inquiry information
- *                      mode - GENERAL or LIMITED inquiry, BR/LE bit mask
- *                             seperately
- *                      duration - length in 1.28 sec intervals (If '0', the
- *                                 inquiry is CANCELLED)
- *                      max_resps - maximum amount of devices to search for
- *                                  before ending the inquiry
- *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
- *                                         BTM_FILTER_COND_DEVICE_CLASS, or
- *                                         BTM_FILTER_COND_BD_ADDR
- *                      filter_cond - value for the filter (based on
- *                                                          filter_cond_type)
- *
- *                  p_results_cb   - Pointer to the callback routine which gets
- *                                called upon receipt of an inquiry result. If
- *                                this field is NULL, the application is not
- *                                notified.
- *
- *                  p_cmpl_cb   - Pointer to the callback routine which gets
- *                                called upon completion.  If this field is
- *                                NULL, the application is not notified when
- *                                completed.
- * Returns          tBTM_STATUS
- *                  BTM_CMD_STARTED if successfully initiated
- *                  BTM_BUSY if already in progress
- *                  BTM_ILLEGAL_VALUE if parameter(s) are out of range
- *                  BTM_NO_RESOURCES if could not allocate resources to start
- *                                   the command
- *                  BTM_WRONG_MODE if the device is not up.
- *
- ******************************************************************************/
+/**
+ * Legacy bluetooth module global control block state
+ */
+extern tBTM_CB btm_cb;
+
+extern void btm_acl_update_busy_level(tBTM_BLI_EVENT event);
+
 tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms,
                                               tBTM_INQ_RESULTS_CB* p_results_cb,
                                               tBTM_CMPL_CB* p_cmpl_cb) {
@@ -90,44 +60,6 @@ tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms,
   return BTM_CMD_STARTED;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_SetPeriodicInquiryMode
- *
- * Description      This function is called to set the device periodic inquiry
- *                  mode. If the duration is zero, the periodic inquiry mode is
- *                  cancelled.
- *
- *                  Note: We currently do not allow concurrent inquiry and
- *                  periodic inquiry.
- *
- * Parameters:      p_inqparms - pointer to the inquiry information
- *                      mode - GENERAL or LIMITED inquiry
- *                      duration - length in 1.28 sec intervals (If '0', the
- *                                 inquiry is CANCELLED)
- *                      max_resps - maximum amount of devices to search for
- *                                  before ending the inquiry
- *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
- *                                         BTM_FILTER_COND_DEVICE_CLASS, or
- *                                         BTM_FILTER_COND_BD_ADDR
- *                      filter_cond - value for the filter (based on
- *                                                          filter_cond_type)
- *
- *                  max_delay - maximum amount of time between successive
- *                              inquiries
- *                  min_delay - minimum amount of time between successive
- *                              inquiries
- *                  p_results_cb - callback returning pointer to results
- *                              (tBTM_INQ_RESULTS)
- *
- * Returns          BTM_CMD_STARTED if successfully started
- *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
- *                  BTM_NO_RESOURCES if could not allocate a message buffer
- *                  BTM_SUCCESS - if cancelling the periodic inquiry
- *                  BTM_BUSY - if an inquiry is already active
- *                  BTM_WRONG_MODE if the device is not up.
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_SetPeriodicInquiryMode(
     tBTM_INQ_PARMS* p_inqparms, uint16_t max_delay, uint16_t min_delay,
     tBTM_INQ_RESULTS_CB* p_results_cb) {
@@ -166,22 +98,6 @@ tBTM_STATUS bluetooth::shim::BTM_SetPeriodicInquiryMode(
   return BTM_MODE_UNSUPPORTED;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_SetDiscoverability
- *
- * Description      This function is called to set the device into or out of
- *                  discoverable mode. Discoverable mode means inquiry
- *                  scans are enabled.  If a value of '0' is entered for window
- *                  or interval, the default values are used.
- *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_BUSY if a setting of the filter is already in progress
- *                  BTM_NO_RESOURCES if couldn't get a memory pool buffer
- *                  BTM_ILLEGAL_VALUE if a bad parameter was detected
- *                  BTM_WRONG_MODE if the device is not up.
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_SetDiscoverability(uint16_t discoverable_mode,
                                                     uint16_t window,
                                                     uint16_t interval) {
@@ -214,22 +130,9 @@ tBTM_STATUS bluetooth::shim::BTM_SetDiscoverability(uint16_t discoverable_mode,
       shim_btm.SetClassicGeneralDiscoverability(window, interval);
       break;
   }
-
   return BTM_SUCCESS;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_SetInquiryScanType
- *
- * Description      This function is called to set the iquiry scan-type to
- *                  standard or interlaced.
- *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_MODE_UNSUPPORTED if not a 1.2 device
- *                  BTM_WRONG_MODE if the device is not up.
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_SetInquiryScanType(uint16_t scan_type) {
   switch (scan_type) {
     case kInterlacedScanType:
@@ -246,18 +149,6 @@ tBTM_STATUS bluetooth::shim::BTM_SetInquiryScanType(uint16_t scan_type) {
   return BTM_WRONG_MODE;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_SetPageScanType
- *
- * Description      This function is called to set the page scan-type to
- *                  standard or interlaced.
- *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_MODE_UNSUPPORTED if not a 1.2 device
- *                  BTM_WRONG_MODE if the device is not up.
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_SetPageScanType(uint16_t scan_type) {
   switch (scan_type) {
     case kInterlacedScanType:
@@ -277,21 +168,6 @@ tBTM_STATUS bluetooth::shim::BTM_SetPageScanType(uint16_t scan_type) {
   return BTM_WRONG_MODE;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_SetInquiryMode
- *
- * Description      This function is called to set standard or with RSSI
- *                  mode of the inquiry for local device.
- *
- * Output Params:   mode - standard, with RSSI, extended
- *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_NO_RESOURCES if couldn't get a memory pool buffer
- *                  BTM_ILLEGAL_VALUE if a bad parameter was detected
- *                  BTM_WRONG_MODE if the device is not up.
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_SetInquiryMode(uint8_t inquiry_mode) {
   switch (inquiry_mode) {
     case kStandardInquiryResult:
@@ -315,20 +191,6 @@ tBTM_STATUS bluetooth::shim::BTM_SetInquiryMode(uint8_t inquiry_mode) {
   return BTM_MODE_UNSUPPORTED;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_ReadDiscoverability
- *
- * Description      This function is called to read the current discoverability
- *                  mode of the device.
- *
- * Output Params:   p_window - current inquiry scan duration
- *                  p_interval - current inquiry scan interval
- *
- * Returns          BTM_NON_DISCOVERABLE, BTM_LIMITED_DISCOVERABLE, or
- *                  BTM_GENERAL_DISCOVERABLE
- *
- ******************************************************************************/
 uint16_t bluetooth::shim::BTM_ReadDiscoverability(uint16_t* p_window,
                                                   uint16_t* p_interval) {
   DiscoverabilityState state = shim_btm.GetClassicDiscoverabilityState();
@@ -339,37 +201,11 @@ uint16_t bluetooth::shim::BTM_ReadDiscoverability(uint16_t* p_window,
   return state.mode;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_CancelPeriodicInquiry
- *
- * Description      This function cancels a periodic inquiry
- *
- * Returns
- *                  BTM_NO_RESOURCES if could not allocate a message buffer
- *                  BTM_SUCCESS - if cancelling the periodic inquiry
- *                  BTM_WRONG_MODE if the device is not up.
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_CancelPeriodicInquiry(void) {
   shim_btm.CancelPeriodicInquiry();
   return BTM_SUCCESS;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_SetConnectability
- *
- * Description      This function is called to set the device into or out of
- *                  connectable mode. Discoverable mode means page scans are
- *                  enabled.
- *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
- *                  BTM_NO_RESOURCES if could not allocate a message buffer
- *                  BTM_WRONG_MODE if the device is not up.
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_SetConnectability(uint16_t page_mode,
                                                    uint16_t window,
                                                    uint16_t interval) {
@@ -405,18 +241,6 @@ tBTM_STATUS bluetooth::shim::BTM_SetConnectability(uint16_t page_mode,
   return BTM_SUCCESS;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_ReadConnectability
- *
- * Description      This function is called to read the current discoverability
- *                  mode of the device.
- * Output Params    p_window - current page scan duration
- *                  p_interval - current time between page scans
- *
- * Returns          BTM_NON_CONNECTABLE or BTM_CONNECTABLE
- *
- ******************************************************************************/
 uint16_t bluetooth::shim::BTM_ReadConnectability(uint16_t* p_window,
                                                  uint16_t* p_interval) {
   ConnectabilityState state = shim_btm.GetClassicConnectabilityState();
@@ -427,19 +251,6 @@ uint16_t bluetooth::shim::BTM_ReadConnectability(uint16_t* p_window,
   return state.mode;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_IsInquiryActive
- *
- * Description      This function returns a bit mask of the current inquiry
- *                  state
- *
- * Returns          BTM_INQUIRY_INACTIVE if inactive (0)
- *                  BTM_LIMITED_INQUIRY_ACTIVE if a limted inquiry is active
- *                  BTM_GENERAL_INQUIRY_ACTIVE if a general inquiry is active
- *                  BTM_PERIODIC_INQUIRY_ACTIVE if a periodic inquiry is active
- *
- ******************************************************************************/
 uint16_t bluetooth::shim::BTM_IsInquiryActive(void) {
   if (shim_btm.IsLimitedInquiryActive()) {
     return BTM_LIMITED_INQUIRY_ACTIVE;
@@ -452,46 +263,11 @@ uint16_t bluetooth::shim::BTM_IsInquiryActive(void) {
   return BTM_INQUIRY_INACTIVE;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_CancelInquiry
- *
- * Description      This function cancels an inquiry if active
- *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_NO_RESOURCES if could not allocate a message buffer
- *                  BTM_WRONG_MODE if the device is not up.
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_CancelInquiry(void) {
   shim_btm.CancelInquiry();
   return BTM_SUCCESS;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_ReadRemoteDeviceName
- *
- * Description      This function initiates a remote device HCI command to the
- *                  controller and calls the callback when the process has
- *                  completed.
- *
- * Input Params:    remote_bda      - device address of name to retrieve
- *                  p_cb            - callback function called when
- *                                    BTM_CMD_STARTED is returned.
- *                                    A pointer to tBTM_REMOTE_DEV_NAME is
- *                                    passed to the callback.
- *
- * Returns
- *                  BTM_CMD_STARTED is returned if the request was successfully
- *                                  sent to HCI.
- *                  BTM_BUSY if already in progress
- *                  BTM_UNKNOWN_ADDR if device address is bad
- *                  BTM_NO_RESOURCES if could not allocate resources to start
- *                                   the command
- *                  BTM_WRONG_MODE if the device is not up.
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_ReadRemoteDeviceName(
     const RawAddress& raw_address, tBTM_CMPL_CB* callback,
     tBT_TRANSPORT transport) {
@@ -512,94 +288,26 @@ tBTM_STATUS bluetooth::shim::BTM_ReadRemoteDeviceName(
   return status;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_CancelRemoteDeviceName
- *
- * Description      This function initiates the cancel request for the specified
- *                  remote device.
- *
- * Input Params:    None
- *
- * Returns
- *                  BTM_CMD_STARTED is returned if the request was successfully
- *                                  sent to HCI.
- *                  BTM_NO_RESOURCES if could not allocate resources to start
- *                                   the command
- *                  BTM_WRONG_MODE if there is not an active remote name
- *                                 request.
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_CancelRemoteDeviceName(void) {
   return shim_btm.CancelAllReadRemoteDeviceName();
 }
 
-/*******************************************************************************
- *
- * Function         BTM_InqDbRead
- *
- * Description      This function looks through the inquiry database for a match
- *                  based on Bluetooth Device Address. This is the application's
- *                  interface to get the inquiry details of a specific BD
- *                  address.
- *
- * Returns          pointer to entry, or NULL if not found
- *
- ******************************************************************************/
 tBTM_INQ_INFO* bluetooth::shim::BTM_InqDbRead(const RawAddress& p_bda) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   return nullptr;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_InqDbFirst
- *
- * Description      This function looks through the inquiry database for the
- *                  first used entry, and returns that. This is used in
- *                  conjunction with
- *                  BTM_InqDbNext by applications as a way to walk through the
- *                  inquiry database.
- *
- * Returns          pointer to first in-use entry, or NULL if DB is empty
- *
- ******************************************************************************/
 tBTM_INQ_INFO* bluetooth::shim::BTM_InqDbFirst(void) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   return nullptr;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_InqDbNext
- *
- * Description      This function looks through the inquiry database for the
- *                  next used entry, and returns that.  If the input parameter
- *                  is NULL, the first entry is returned.
- *
- * Returns          pointer to next in-use entry, or NULL if no more found.
- *
- ******************************************************************************/
 tBTM_INQ_INFO* bluetooth::shim::BTM_InqDbNext(tBTM_INQ_INFO* p_cur) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   CHECK(p_cur != nullptr);
   return nullptr;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_ClearInqDb
- *
- * Description      This function is called to clear out a device or all devices
- *                  from the inquiry database.
- *
- * Parameter        p_bda - (input) BD_ADDR ->  Address of device to clear
- *                                              (NULL clears all entries)
- *
- * Returns          BTM_BUSY if an inquiry, get remote name, or event filter
- *                          is active, otherwise BTM_SUCCESS
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_ClearInqDb(const RawAddress* p_bda) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   if (p_bda == nullptr) {
@@ -610,55 +318,18 @@ tBTM_STATUS bluetooth::shim::BTM_ClearInqDb(const RawAddress* p_bda) {
   return BTM_NO_RESOURCES;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_ReadInquiryRspTxPower
- *
- * Description      This command will read the inquiry Transmit Power level used
- *                  to transmit the FHS and EIR data packets. This can be used
- *                  directly in the Tx Power Level EIR data type.
- *
- * Returns          BTM_SUCCESS if successful
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_ReadInquiryRspTxPower(tBTM_CMPL_CB* p_cb) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   CHECK(p_cb != nullptr);
   return BTM_NO_RESOURCES;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_WriteEIR
- *
- * Description      This function is called to write EIR data to controller.
- *
- * Parameters       p_buff - allocated HCI command buffer including extended
- *                           inquriry response
- *
- * Returns          BTM_SUCCESS  - if successful
- *                  BTM_MODE_UNSUPPORTED - if local device cannot support it
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_WriteEIR(BT_HDR* p_buff) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   CHECK(p_buff != nullptr);
   return BTM_NO_RESOURCES;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_HasEirService
- *
- * Description      This function is called to know if UUID in bit map of UUID.
- *
- * Parameters       p_eir_uuid - bit map of UUID list
- *                  uuid16 - UUID 16-bit
- *
- * Returns          true - if found
- *                  false - if not found
- *
- ******************************************************************************/
 bool bluetooth::shim::BTM_HasEirService(const uint32_t* p_eir_uuid,
                                         uint16_t uuid16) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
@@ -666,21 +337,6 @@ bool bluetooth::shim::BTM_HasEirService(const uint32_t* p_eir_uuid,
   return false;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_HasInquiryEirService
- *
- * Description      This function is called to know if UUID in bit map of UUID
- *                  list.
- *
- * Parameters       p_results - inquiry results
- *                  uuid16 - UUID 16-bit
- *
- * Returns          BTM_EIR_FOUND - if found
- *                  BTM_EIR_NOT_FOUND - if not found and it is complete list
- *                  BTM_EIR_UNKNOWN - if not found and it is not complete list
- *
- ******************************************************************************/
 tBTM_EIR_SEARCH_RESULT bluetooth::shim::BTM_HasInquiryEirService(
     tBTM_INQ_RESULTS* p_results, uint16_t uuid16) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
@@ -688,59 +344,17 @@ tBTM_EIR_SEARCH_RESULT bluetooth::shim::BTM_HasInquiryEirService(
   return BTM_EIR_UNKNOWN;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_AddEirService
- *
- * Description      This function is called to add a service in bit map of UUID
- *                  list.
- *
- * Parameters       p_eir_uuid - bit mask of UUID list for EIR
- *                  uuid16 - UUID 16-bit
- *
- * Returns          None
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_AddEirService(uint32_t* p_eir_uuid, uint16_t uuid16) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   CHECK(p_eir_uuid != nullptr);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_RemoveEirService
- *
- * Description      This function is called to remove a service in bit map of
- *                  UUID list.
- *
- * Parameters       p_eir_uuid - bit mask of UUID list for EIR
- *                  uuid16 - UUID 16-bit
- *
- * Returns          None
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_RemoveEirService(uint32_t* p_eir_uuid,
                                            uint16_t uuid16) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   CHECK(p_eir_uuid != nullptr);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_GetEirSupportedServices
- *
- * Description      This function is called to get UUID list from bit map of
- *                  UUID list.
- *
- * Parameters       p_eir_uuid - bit mask of UUID list for EIR
- *                  p - reference of current pointer of EIR
- *                  max_num_uuid16 - max number of UUID can be written in EIR
- *                  num_uuid16 - number of UUID have been written in EIR
- *
- * Returns          BTM_EIR_MORE_16BITS_UUID_TYPE, if it has more than max
- *                  BTM_EIR_COMPLETE_16BITS_UUID_TYPE, otherwise
- *
- ******************************************************************************/
 uint8_t bluetooth::shim::BTM_GetEirSupportedServices(uint32_t* p_eir_uuid,
                                                      uint8_t** p,
                                                      uint8_t max_num_uuid16,
@@ -753,29 +367,6 @@ uint8_t bluetooth::shim::BTM_GetEirSupportedServices(uint32_t* p_eir_uuid,
   return BTM_NO_RESOURCES;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_GetEirUuidList
- *
- * Description      This function parses EIR and returns UUID list.
- *
- * Parameters       p_eir - EIR
- *                  eir_len - EIR len
- *                  uuid_size - Uuid::kNumBytes16, Uuid::kNumBytes32,
- *                              Uuid::kNumBytes128
- *                  p_num_uuid - return number of UUID in found list
- *                  p_uuid_list - return UUID list
- *                  max_num_uuid - maximum number of UUID to be returned
- *
- * Returns          0 - if not found
- *                  BTM_EIR_COMPLETE_16BITS_UUID_TYPE
- *                  BTM_EIR_MORE_16BITS_UUID_TYPE
- *                  BTM_EIR_COMPLETE_32BITS_UUID_TYPE
- *                  BTM_EIR_MORE_32BITS_UUID_TYPE
- *                  BTM_EIR_COMPLETE_128BITS_UUID_TYPE
- *                  BTM_EIR_MORE_128BITS_UUID_TYPE
- *
- ******************************************************************************/
 uint8_t bluetooth::shim::BTM_GetEirUuidList(uint8_t* p_eir, size_t eir_len,
                                             uint8_t uuid_size,
                                             uint8_t* p_num_uuid,
@@ -788,12 +379,6 @@ uint8_t bluetooth::shim::BTM_GetEirUuidList(uint8_t* p_eir, size_t eir_len,
   return 0;
 }
 
-/**
- *
- * BLE API HERE
- *
- */
-
 bool bluetooth::shim::BTM_SecAddBleDevice(const RawAddress& bd_addr,
                                           BD_NAME bd_name,
                                           tBT_DEVICE_TYPE dev_type,
@@ -802,21 +387,6 @@ bool bluetooth::shim::BTM_SecAddBleDevice(const RawAddress& bd_addr,
   return false;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_SecAddBleKey
- *
- * Description      Add/modify LE device information.  This function will be
- *                  normally called during host startup to restore all required
- *                  information stored in the NVRAM.
- *
- * Parameters:      bd_addr          - BD address of the peer
- *                  p_le_key         - LE key values.
- *                  key_type         - LE SMP key type.
- *
- * Returns          true if added OK, else false
- *
- ******************************************************************************/
 bool bluetooth::shim::BTM_SecAddBleKey(const RawAddress& bd_addr,
                                        tBTM_LE_KEY_VALUE* p_le_key,
                                        tBTM_LE_KEY_TYPE key_type) {
@@ -825,20 +395,6 @@ bool bluetooth::shim::BTM_SecAddBleKey(const RawAddress& bd_addr,
   return false;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleLoadLocalKeys
- *
- * Description      Local local identity key, encryption root or sign counter.
- *
- * Parameters:      key_type: type of key, can be BTM_BLE_KEY_TYPE_ID,
- *                                                BTM_BLE_KEY_TYPE_ER
- *                                             or BTM_BLE_KEY_TYPE_COUNTER.
- *                  p_key: pointer to the key.
- *
- * Returns          non2.
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BleLoadLocalKeys(uint8_t key_type,
                                            tBTM_BLE_LOCAL_KEYS* p_key) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
@@ -865,16 +421,6 @@ const Octet16& bluetooth::shim::BTM_GetDeviceDHK() {
   return bogus_root;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_ReadConnectionAddr
- *
- * Description      This function is called to get the local device address
- *                  information.
- *
- * Returns          void
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_ReadConnectionAddr(const RawAddress& remote_bda,
                                              RawAddress& local_conn_addr,
                                              tBLE_ADDR_TYPE* p_addr_type) {
@@ -882,35 +428,11 @@ void bluetooth::shim::BTM_ReadConnectionAddr(const RawAddress& remote_bda,
   CHECK(p_addr_type != nullptr);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_IsBleConnection
- *
- * Description      This function is called to check if the connection handle
- *                  for an LE link
- *
- * Returns          true if connection is LE link, otherwise false.
- *
- ******************************************************************************/
 bool bluetooth::shim::BTM_IsBleConnection(uint16_t conn_handle) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   return false;
 }
 
-/*******************************************************************************
- *
- * Function       BTM_ReadRemoteConnectionAddr
- *
- * Description    This function is read the remote device address currently used
- *
- * Parameters     pseudo_addr: pseudo random address available
- *                conn_addr:connection address used
- *                p_addr_type : BD Address type, Public or Random of the address
- *                              used
- *
- * Returns        bool, true if connection to remote device exists, else false
- *
- ******************************************************************************/
 bool bluetooth::shim::BTM_ReadRemoteConnectionAddr(
     const RawAddress& pseudo_addr, RawAddress& conn_addr,
     tBLE_ADDR_TYPE* p_addr_type) {
@@ -918,78 +440,22 @@ bool bluetooth::shim::BTM_ReadRemoteConnectionAddr(
   CHECK(p_addr_type != nullptr);
   return false;
 }
-/*******************************************************************************
- *
- * Function         BTM_SecurityGrant
- *
- * Description      This function is called to grant security process.
- *
- * Parameters       bd_addr - peer device bd address.
- *                  res     - result of the operation BTM_SUCCESS if success.
- *                            Otherwise, BTM_REPEATED_ATTEMPTS if too many
- *                            attempts.
- *
- * Returns          None
- *
- ******************************************************************************/
+
 void bluetooth::shim::BTM_SecurityGrant(const RawAddress& bd_addr,
                                         uint8_t res) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BlePasskeyReply
- *
- * Description      This function is called after Security Manager submitted
- *                  passkey request to the application.
- *
- * Parameters:      bd_addr - Address of the device for which passkey was
- *                            requested
- *                  res     - result of the operation BTM_SUCCESS if success
- *                  key_len - length in bytes of the Passkey
- *                  p_passkey    - pointer to array with the passkey
- *                  trusted_mask - bitwise OR of trusted services (array of
- *                                 uint32_t)
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BlePasskeyReply(const RawAddress& bd_addr,
                                           uint8_t res, uint32_t passkey) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleConfirmReply
- *
- * Description      This function is called after Security Manager submitted
- *                  numeric comparison request to the application.
- *
- * Parameters:      bd_addr      - Address of the device with which numeric
- *                                 comparison was requested
- *                  res          - comparison result BTM_SUCCESS if success
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BleConfirmReply(const RawAddress& bd_addr,
                                           uint8_t res) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleOobDataReply
- *
- * Description      This function is called to provide the OOB data for
- *                  SMP in response to BTM_LE_OOB_REQ_EVT
- *
- * Parameters:      bd_addr     - Address of the peer device
- *                  res         - result of the operation SMP_SUCCESS if success
- *                  p_data      - oob data, depending on transport and
- *                                capabilities.
- *                                Might be "Simple Pairing Randomizer", or
- *                                "Security Manager TK Value".
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BleOobDataReply(const RawAddress& bd_addr,
                                           uint8_t res, uint8_t len,
                                           uint8_t* p_data) {
@@ -997,19 +463,6 @@ void bluetooth::shim::BTM_BleOobDataReply(const RawAddress& bd_addr,
   CHECK(p_data != nullptr);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleSecureConnectionOobDataReply
- *
- * Description      This function is called to provide the OOB data for
- *                  SMP in response to BTM_LE_OOB_REQ_EVT when secure connection
- *                  data is available
- *
- * Parameters:      bd_addr     - Address of the peer device
- *                  p_c         - pointer to Confirmation.
- *                  p_r         - pointer to Randomizer
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BleSecureConnectionOobDataReply(
     const RawAddress& bd_addr, uint8_t* p_c, uint8_t* p_r) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
@@ -1017,40 +470,11 @@ void bluetooth::shim::BTM_BleSecureConnectionOobDataReply(
   CHECK(p_r != nullptr);
 }
 
-/******************************************************************************
- *
- * Function         BTM_BleSetConnScanParams
- *
- * Description      Set scan parameter used in BLE connection request
- *
- * Parameters:      scan_interval: scan interval
- *                  scan_window: scan window
- *
- * Returns          void
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BleSetConnScanParams(uint32_t scan_interval,
                                                uint32_t scan_window) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
 }
 
-/********************************************************
- *
- * Function         BTM_BleSetPrefConnParams
- *
- * Description      Set a peripheral's preferred connection parameters
- *
- * Parameters:      bd_addr          - BD address of the peripheral
- *                  scan_interval: scan interval
- *                  scan_window: scan window
- *                  min_conn_int     - minimum preferred connection interval
- *                  max_conn_int     - maximum preferred connection interval
- *                  slave_latency    - preferred slave latency
- *                  supervision_tout - preferred supervision timeout
- *
- * Returns          void
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BleSetPrefConnParams(const RawAddress& bd_addr,
                                                uint16_t min_conn_int,
                                                uint16_t max_conn_int,
@@ -1059,18 +483,6 @@ void bluetooth::shim::BTM_BleSetPrefConnParams(const RawAddress& bd_addr,
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_ReadDevInfo
- *
- * Description      This function is called to read the device/address type
- *                  of BD address.
- *
- * Parameter        remote_bda: remote device address
- *                  p_dev_type: output parameter to read the device type.
- *                  p_addr_type: output parameter to read the address type.
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_ReadDevInfo(const RawAddress& remote_bda,
                                       tBT_DEVICE_TYPE* p_dev_type,
                                       tBLE_ADDR_TYPE* p_addr_type) {
@@ -1079,20 +491,6 @@ void bluetooth::shim::BTM_ReadDevInfo(const RawAddress& remote_bda,
   CHECK(p_addr_type != nullptr);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_ReadConnectedTransportAddress
- *
- * Description      This function is called to read the paired device/address
- *                  type of other device paired corresponding to the BD_address
- *
- * Parameter        remote_bda: remote device address, carry out the transport
- *                              address
- *                  transport: active transport
- *
- * Return           true if an active link is identified; false otherwise
- *
- ******************************************************************************/
 bool bluetooth::shim::BTM_ReadConnectedTransportAddress(
     RawAddress* remote_bda, tBT_TRANSPORT transport) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
@@ -1100,35 +498,12 @@ bool bluetooth::shim::BTM_ReadConnectedTransportAddress(
   return false;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleReceiverTest
- *
- * Description      This function is called to start the LE Receiver test
- *
- * Parameter       rx_freq - Frequency Range
- *               p_cmd_cmpl_cback - Command Complete callback
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BleReceiverTest(uint8_t rx_freq,
                                           tBTM_CMPL_CB* p_cmd_cmpl_cback) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   CHECK(p_cmd_cmpl_cback != nullptr);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleTransmitterTest
- *
- * Description      This function is called to start the LE Transmitter test
- *
- * Parameter       tx_freq - Frequency Range
- *                       test_data_len - Length in bytes of payload data in each
- *                                       packet
- *                       packet_payload - Pattern to use in the payload
- *                       p_cmd_cmpl_cback - Command Complete callback
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BleTransmitterTest(uint8_t tx_freq,
                                              uint8_t test_data_len,
                                              uint8_t packet_payload,
@@ -1137,81 +512,27 @@ void bluetooth::shim::BTM_BleTransmitterTest(uint8_t tx_freq,
   CHECK(p_cmd_cmpl_cback != nullptr);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleTestEnd
- *
- * Description      This function is called to stop the in-progress TX or RX
- *                  test
- *
- * Parameter       p_cmd_cmpl_cback - Command complete callback
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BleTestEnd(tBTM_CMPL_CB* p_cmd_cmpl_cback) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   CHECK(p_cmd_cmpl_cback != nullptr);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_UseLeLink
- *
- * Description      This function is to select the underlying physical link to
- *                  use.
- *
- * Returns          true to use LE, false use BR/EDR.
- *
- ******************************************************************************/
 bool bluetooth::shim::BTM_UseLeLink(const RawAddress& raw_address) {
   return shim_btm.IsLeAclConnected(raw_address);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_SetBleDataLength
- *
- * Description      This function is to set maximum BLE transmission packet size
- *
- * Returns          BTM_SUCCESS if success; otherwise failed.
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_SetBleDataLength(const RawAddress& bd_addr,
                                                   uint16_t tx_pdu_length) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   return BTM_NO_RESOURCES;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleReadPhy
- *
- * Description      To read the current PHYs for specified LE connection
- *
- *
- * Returns          BTM_SUCCESS if command successfully sent to controller,
- *                  BTM_MODE_UNSUPPORTED if local controller doesn't support LE
- *                  2M or LE Coded PHY,
- *                  BTM_WRONG_MODE if Device in wrong mode for request.
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BleReadPhy(
     const RawAddress& bd_addr,
     base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleSetDefaultPhy
- *
- * Description      To set preferred PHY for ensuing LE connections
- *
- *
- * Returns          BTM_SUCCESS if command successfully sent to controller,
- *                  BTM_MODE_UNSUPPORTED if local controller doesn't support LE
- *                  2M or LE Coded PHY
- *
- ******************************************************************************/
 tBTM_STATUS bluetooth::shim::BTM_BleSetDefaultPhy(uint8_t all_phys,
                                                   uint8_t tx_phys,
                                                   uint8_t rx_phys) {
@@ -1219,42 +540,11 @@ tBTM_STATUS bluetooth::shim::BTM_BleSetDefaultPhy(uint8_t all_phys,
   return BTM_NO_RESOURCES;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleSetPhy
- *
- * Description      To set PHY preferences for specified LE connection
- *
- *
- * Returns          BTM_SUCCESS if command successfully sent to controller,
- *                  BTM_MODE_UNSUPPORTED if local controller doesn't support LE
- *                  2M or LE Coded PHY,
- *                  BTM_ILLEGAL_VALUE if specified remote doesn't support LE 2M
- *                  or LE Coded PHY,
- *                  BTM_WRONG_MODE if Device in wrong mode for request.
- *
- ******************************************************************************/
 void bluetooth::shim::BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys,
                                     uint8_t rx_phys, uint16_t phy_options) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleDataSignature
- *
- * Description      This function is called to sign the data using AES128 CMAC
- *                  algorith.
- *
- * Parameter        bd_addr: target device the data to be signed for.
- *                  p_text: singing data
- *                  len: length of the data to be signed.
- *                  signature: output parameter where data signature is going to
- *                             be stored.
- *
- * Returns          true if signing sucessul, otherwise false.
- *
- ******************************************************************************/
 bool bluetooth::shim::BTM_BleDataSignature(const RawAddress& bd_addr,
                                            uint8_t* p_text, uint16_t len,
                                            BLE_SIGNATURE signature) {
@@ -1263,21 +553,6 @@ bool bluetooth::shim::BTM_BleDataSignature(const RawAddress& bd_addr,
   return false;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleVerifySignature
- *
- * Description      This function is called to verify the data signature
- *
- * Parameter        bd_addr: target device the data to be signed for.
- *                  p_orig:  original data before signature.
- *                  len: length of the signing data
- *                  counter: counter used when doing data signing
- *                  p_comp: signature to be compared against.
-
- * Returns          true if signature verified correctly; otherwise false.
- *
- ******************************************************************************/
 bool bluetooth::shim::BTM_BleVerifySignature(const RawAddress& bd_addr,
                                              uint8_t* p_orig, uint16_t len,
                                              uint32_t counter,
@@ -1288,16 +563,6 @@ bool bluetooth::shim::BTM_BleVerifySignature(const RawAddress& bd_addr,
   return false;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_GetLeSecurityState
- *
- * Description      This function is called to get security mode 1 flags and
- *                  encryption key size for LE peer.
- *
- * Returns          bool    true if LE device is found, false otherwise.
- *
- ******************************************************************************/
 bool bluetooth::shim::BTM_GetLeSecurityState(const RawAddress& bd_addr,
                                              uint8_t* p_le_dev_sec_flags,
                                              uint8_t* p_le_key_size) {
@@ -1307,34 +572,12 @@ bool bluetooth::shim::BTM_GetLeSecurityState(const RawAddress& bd_addr,
   return false;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleSecurityProcedureIsRunning
- *
- * Description      This function indicates if LE security procedure is
- *                  currently running with the peer.
- *
- * Returns          bool    true if security procedure is running, false
- *                  otherwise.
- *
- ******************************************************************************/
 bool bluetooth::shim::BTM_BleSecurityProcedureIsRunning(
     const RawAddress& bd_addr) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   return false;
 }
 
-/*******************************************************************************
- *
- * Function         BTM_BleGetSupportedKeySize
- *
- * Description      This function gets the maximum encryption key size in bytes
- *                  the local device can suport.
- *                  record.
- *
- * Returns          the key size or 0 if the size can't be retrieved.
- *
- ******************************************************************************/
 uint8_t bluetooth::shim::BTM_BleGetSupportedKeySize(const RawAddress& bd_addr) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
   return 0;
@@ -1405,7 +648,16 @@ void bluetooth::shim::BTM_BleAdvFilterParamSetup(
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
 }
 
+void bluetooth::shim::BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy) {
+  LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
+}
+
 void bluetooth::shim::BTM_BleEnableDisableFilterFeature(
     uint8_t enable, tBTM_BLE_PF_STATUS_CBACK p_stat_cback) {
   LOG_INFO(LOG_TAG, "UNIMPLEMENTED %s", __func__);
 }
+
+uint8_t bluetooth::shim::BTM_BleMaxMultiAdvInstanceCount() {
+  // TODO(cmanton) Connect this to the gd side
+  return 5;
+}
index 6cd1fc4..905fcfa 100644 (file)
@@ -24,2361 +24,2618 @@ namespace shim {
 
 /*******************************************************************************
  *
- * Function         BTM_DeviceReset
- *
- * Description      This function is called to reset the controller.  The
- *                  Callback function if provided is called when startup of the
- *                  device has completed.
- *
- * Returns          void
+ * Function         BTM_StartInquiry
  *
- ******************************************************************************/
-void BTM_DeviceReset(tBTM_CMPL_CB* p_cb);
-
-/*******************************************************************************
+ * Description      This function is called to start an inquiry.
  *
- * Function         BTM_IsDeviceUp
+ * Parameters:      p_inqparms - pointer to the inquiry information
+ *                      mode - GENERAL or LIMITED inquiry
+ *                      duration - length in 1.28 sec intervals (If '0', the
+ *                                 inquiry is CANCELLED)
+ *                      max_resps - maximum amount of devices to search for
+ *                                  before ending the inquiry
+ *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
+ *                                         BTM_FILTER_COND_DEVICE_CLASS, or
+ *                                         BTM_FILTER_COND_BD_ADDR
+ *                      filter_cond - value for the filter (based on
+ *                                                          filter_cond_type)
  *
- * Description      This function is called to check if the device is up.
+ *                  p_results_cb  - Pointer to the callback routine which gets
+ *                                called upon receipt of an inquiry result. If
+ *                                this field is NULL, the application is not
+ *                                notified.
  *
- * Returns          true if device is up, else false
+ *                  p_cmpl_cb   - Pointer to the callback routine which gets
+ *                                called upon completion.  If this field is
+ *                                NULL, the application is not notified when
+ *                                completed.
+ * Returns          tBTM_STATUS
+ *                  BTM_CMD_STARTED if successfully initiated
+ *                  BTM_BUSY if already in progress
+ *                  BTM_ILLEGAL_VALUE if parameter(s) are out of range
+ *                  BTM_NO_RESOURCES if could not allocate resources to start
+ *                                   the command
+ *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
-bool BTM_IsDeviceUp(void);
+tBTM_STATUS BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms,
+                             tBTM_INQ_RESULTS_CB* p_results_cb,
+                             tBTM_CMPL_CB* p_cmpl_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_SetLocalDeviceName
- *
- * Description      This function is called to set the local device name.
- *
- * Returns          BTM_CMD_STARTED if successful, otherwise an error
+ * Function         BTM_SetPeriodicInquiryMode
  *
- ******************************************************************************/
-tBTM_STATUS BTM_SetLocalDeviceName(char* p_name);
-
-/*******************************************************************************
+ * Description      This function is called to set the device periodic inquiry
+ *                  mode. If the duration is zero, the periodic inquiry mode is
+ *                  cancelled.
  *
- * Function         BTM_SetDeviceClass
+ * Parameters:      p_inqparms - pointer to the inquiry information
+ *                      mode - GENERAL or LIMITED inquiry
+ *                      duration - length in 1.28 sec intervals (If '0', the
+ *                                 inquiry is CANCELLED)
+ *                      max_resps - maximum amount of devices to search for
+ *                                  before ending the inquiry
+ *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
+ *                                         BTM_FILTER_COND_DEVICE_CLASS, or
+ *                                         BTM_FILTER_COND_BD_ADDR
+ *                      filter_cond - value for the filter (based on
+ *                                                          filter_cond_type)
  *
- * Description      This function is called to set the local device class
+ *                  max_delay - maximum amount of time between successive
+ *                              inquiries
+ *                  min_delay - minimum amount of time between successive
+ *                              inquiries
+ *                  p_results_cb - callback returning pointer to results
+ *                              (tBTM_INQ_RESULTS)
  *
- * Returns          BTM_SUCCESS if successful, otherwise an error
+ * Returns          BTM_CMD_STARTED if successfully started
+ *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
+ *                  BTM_NO_RESOURCES if could not allocate a message buffer
+ *                  BTM_SUCCESS - if cancelling the periodic inquiry
+ *                  BTM_BUSY - if an inquiry is already active
+ *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetDeviceClass(DEV_CLASS dev_class);
+tBTM_STATUS BTM_SetPeriodicInquiryMode(tBTM_INQ_PARMS* p_inqparms,
+                                       uint16_t max_delay, uint16_t min_delay,
+                                       tBTM_INQ_RESULTS_CB* p_results_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadLocalDeviceName
+ * Function         BTM_SetDiscoverability
  *
- * Description      This function is called to read the local device name.
+ * Description      This function is called to set the device into or out of
+ *                  discoverable mode. Discoverable mode means inquiry
+ *                  scans are enabled.  If a value of '0' is entered for window
+ *                  or interval, the default values are used.
  *
- * Returns          status of the operation
- *                  If success, BTM_SUCCESS is returned and p_name points stored
- *                              local device name
- *                  If BTM doesn't store local device name, BTM_NO_RESOURCES is
- *                              is returned and p_name is set to NULL
+ * Returns          BTM_SUCCESS if successful
+ *                  BTM_BUSY if a setting of the filter is already in progress
+ *                  BTM_NO_RESOURCES if couldn't get a memory pool buffer
+ *                  BTM_ILLEGAL_VALUE if a bad parameter was detected
+ *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadLocalDeviceName(char** p_name);
+tBTM_STATUS BTM_SetDiscoverability(uint16_t inq_mode, uint16_t window,
+                                   uint16_t interval);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadLocalDeviceNameFromController
+ * Function         BTM_SetInquiryScanType
  *
- * Description      Get local device name from controller. Do not use cached
- *                  name (used to get chip-id prior to btm reset complete).
+ * Description      This function is called to set the iquiry scan-type to
+ *                  standard or interlaced.
  *
- * Returns          BTM_CMD_STARTED if successful, otherwise an error
+ * Input Params:    BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED
+ *
+ * Returns          BTM_SUCCESS if successful
+ *                  BTM_MODE_UNSUPPORTED if not a 1.2 device
+ *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadLocalDeviceNameFromController(
-    tBTM_CMPL_CB* p_rln_cmpl_cback);
+tBTM_STATUS BTM_SetInquiryScanType(uint16_t scan_type);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadDeviceClass
+ * Function         BTM_BleObserve
  *
- * Description      This function is called to read the local device class
+ * Description      This procedure keep the device listening for advertising
+ *                  events from a broadcast device.
  *
- * Returns          pointer to the device class
+ * Parameters       start: start or stop observe.
+ *
+ * Returns          void
  *
  ******************************************************************************/
-uint8_t* BTM_ReadDeviceClass(void);
+tBTM_STATUS BTM_BleObserve(bool start, uint8_t duration,
+                           tBTM_INQ_RESULTS_CB* p_results_cb,
+                           tBTM_CMPL_CB* p_cmpl_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadLocalFeatures
+ * Function         BTM_SetPageScanType
  *
- * Description      This function is called to read the local features
+ * Description      This function is called to set the page scan-type to
+ *                  standard or interlaced.
  *
- * Returns          pointer to the local features string
+ * Input Params:    BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED
+ *
+ * Returns          BTM_SUCCESS if successful
+ *                  BTM_MODE_UNSUPPORTED if not a 1.2 device
+ *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
-uint8_t* BTM_ReadLocalFeatures(void);
+tBTM_STATUS BTM_SetPageScanType(uint16_t scan_type);
 
 /*******************************************************************************
  *
- * Function         BTM_RegisterForDeviceStatusNotif
+ * Function         BTM_SetInquiryMode
  *
- * Description      This function is called to register for device status
- *                  change notifications.
+ * Description      This function is called to set standard, with RSSI
+ *                  mode or extended of the inquiry for local device.
  *
- * Returns          pointer to previous caller's callback function or NULL if
- *                  first registration.
+ * Input Params:    BTM_INQ_RESULT_STANDARD, BTM_INQ_RESULT_WITH_RSSI or
+ *                  BTM_INQ_RESULT_EXTENDED
+ *
+ * Returns          BTM_SUCCESS if successful
+ *                  BTM_NO_RESOURCES if couldn't get a memory pool buffer
+ *                  BTM_ILLEGAL_VALUE if a bad parameter was detected
+ *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
-tBTM_DEV_STATUS_CB* BTM_RegisterForDeviceStatusNotif(tBTM_DEV_STATUS_CB* p_cb);
+tBTM_STATUS BTM_SetInquiryMode(uint8_t mode);
 
 /*******************************************************************************
  *
- * Function         BTM_RegisterForVSEvents
+ * Function         BTM_ReadDiscoverability
  *
- * Description      This function is called to register/deregister for vendor
- *                  specific HCI events.
+ * Description      This function is called to read the current discoverability
+ *                  mode of the device.
  *
- *                  If is_register=true, then the function will be registered;
- *                  otherwise the function will be deregistered.
+ * Output Params:   p_window - current inquiry scan duration
+ *                  p_interval - current inquiry scan interval
  *
- * Returns          BTM_SUCCESS if successful,
- *                  BTM_BUSY if maximum number of callbacks have already been
- *                           registered.
+ * Returns          BTM_NON_DISCOVERABLE, BTM_LIMITED_DISCOVERABLE, or
+ *                  BTM_GENERAL_DISCOVERABLE
  *
  ******************************************************************************/
-tBTM_STATUS BTM_RegisterForVSEvents(tBTM_VS_EVT_CB* p_cb, bool is_register);
+uint16_t BTM_ReadDiscoverability(uint16_t* p_window, uint16_t* p_interval);
 
 /*******************************************************************************
  *
- * Function         BTM_VendorSpecificCommand
+ * Function         BTM_CancelPeriodicInquiry
  *
- * Description      Send a vendor specific HCI command to the controller.
+ * Description      This function cancels a periodic inquiry
+ *
+ * Returns
+ *                  BTM_NO_RESOURCES if could not allocate a message buffer
+ *                  BTM_SUCCESS - if cancelling the periodic inquiry
+ *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
-void BTM_VendorSpecificCommand(uint16_t opcode, uint8_t param_len,
-                               uint8_t* p_param_buf, tBTM_VSC_CMPL_CB* p_cb);
+tBTM_STATUS BTM_CancelPeriodicInquiry(void);
 
 /*******************************************************************************
  *
- * Function         BTM_AllocateSCN
+ * Function         BTM_SetConnectability
  *
- * Description      Look through the Server Channel Numbers for a free one to be
- *                  used with an RFCOMM connection.
+ * Description      This function is called to set the device into or out of
+ *                  connectable mode. Discoverable mode means page scans are
+ *                  enabled.
  *
- * Returns          Allocated SCN number or 0 if none.
+ * Returns          BTM_SUCCESS if successful
+ *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
+ *                  BTM_NO_RESOURCES if could not allocate a message buffer
+ *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
-uint8_t BTM_AllocateSCN(void);
+tBTM_STATUS BTM_SetConnectability(uint16_t page_mode, uint16_t window,
+                                  uint16_t interval);
 
 /*******************************************************************************
  *
- * Function         BTM_TryAllocateSCN
+ * Function         BTM_ReadConnectability
  *
- * Description      Try to allocate a fixed server channel
+ * Description      This function is called to read the current discoverability
+ *                  mode of the device.
+ * Output Params    p_window - current page scan duration
+ *                  p_interval - current time between page scans
  *
- * Returns          Returns true if server channel was available
+ * Returns          BTM_NON_CONNECTABLE or BTM_CONNECTABLE
  *
  ******************************************************************************/
-bool BTM_TryAllocateSCN(uint8_t scn);
+uint16_t BTM_ReadConnectability(uint16_t* p_window, uint16_t* p_interval);
 
 /*******************************************************************************
  *
- * Function         BTM_FreeSCN
+ * Function         BTM_IsInquiryActive
  *
- * Description      Free the specified SCN.
+ * Description      Return a bit mask of the current inquiry state
  *
- * Returns          true if successful, false if SCN is not in use or invalid
+ * Returns          BTM_INQUIRY_INACTIVE if inactive (0)
+ *                  BTM_LIMITED_INQUIRY_ACTIVE if a limted inquiry is active
+ *                  BTM_GENERAL_INQUIRY_ACTIVE if a general inquiry is active
+ *                  BTM_PERIODIC_INQUIRY_ACTIVE if a periodic inquiry is active
  *
  ******************************************************************************/
-bool BTM_FreeSCN(uint8_t scn);
+uint16_t BTM_IsInquiryActive(void);
 
 /*******************************************************************************
  *
- * Function         BTM_SetTraceLevel
+ * Function         BTM_CancelInquiry
  *
- * Description      This function sets the trace level for BTM.  If called with
- *                  a value of 0xFF, it simply returns the current trace level.
+ * Description      This function cancels an inquiry if active
  *
- * Returns          The new or current trace level
+ * Returns          BTM_SUCCESS if successful
+ *                  BTM_NO_RESOURCES if could not allocate a message buffer
+ *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
-uint8_t BTM_SetTraceLevel(uint8_t new_level);
+tBTM_STATUS BTM_CancelInquiry(void);
 
 /*******************************************************************************
  *
- * Function         BTM_WritePageTimeout
- *
- * Description      Send HCI Wite Page Timeout.
+ * Function         BTM_ReadRemoteDeviceName
  *
- ******************************************************************************/
-void BTM_WritePageTimeout(uint16_t timeout);
-
-/*******************************************************************************
+ * Description      This function initiates a remote device HCI command to the
+ *                  controller and calls the callback when the process has
+ *                  completed.
  *
- * Function         BTM_WriteVoiceSettings
+ * Input Params:    remote_bda      - device address of name to retrieve
+ *                  p_cb            - callback function called when
+ *                                    BTM_CMD_STARTED is returned.
+ *                                    A pointer to tBTM_REMOTE_DEV_NAME is
+ *                                    passed to the callback.
  *
- * Description      Send HCI Write Voice Settings command.
- *                  See hcidefs.h for settings bitmask values.
+ * Returns
+ *                  BTM_CMD_STARTED is returned if the request was successfully
+ *                                  sent to HCI.
+ *                  BTM_BUSY if already in progress
+ *                  BTM_UNKNOWN_ADDR if device address is bad
+ *                  BTM_NO_RESOURCES if resources could not be allocated to
+ *                                   start the command
+ *                  BTM_WRONG_MODE if the device is not up.
  *
  ******************************************************************************/
-void BTM_WriteVoiceSettings(uint16_t settings);
+tBTM_STATUS BTM_ReadRemoteDeviceName(const RawAddress& remote_bda,
+                                     tBTM_CMPL_CB* p_cb,
+                                     tBT_TRANSPORT transport);
 
 /*******************************************************************************
  *
- * Function         BTM_EnableTestMode
+ * Function         BTM_CancelRemoteDeviceName
  *
- * Description      Send HCI the enable device under test command.
+ * Description      This function initiates the cancel request for the specified
+ *                  remote device.
  *
- *                  Note: Controller can only be taken out of this mode by
- *                      resetting the controller.
+ * Input Params:    None
  *
  * Returns
- *      BTM_SUCCESS         Command sent.
- *      BTM_NO_RESOURCES    If out of resources to send the command.
- *
+ *                  BTM_CMD_STARTED is returned if the request was successfully
+ *                                  sent to HCI.
+ *                  BTM_NO_RESOURCES if resources could not be allocated to
+ *                                   start the command
+ *                  BTM_WRONG_MODE if there is no active remote name request.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_EnableTestMode(void);
-
-/*******************************************************************************
- * DEVICE DISCOVERY FUNCTIONS - Inquiry, Remote Name, Discovery, Class of Device
- ******************************************************************************/
+tBTM_STATUS BTM_CancelRemoteDeviceName(void);
 
 /*******************************************************************************
  *
- * Function         BTM_SetDiscoverability
+ * Function         BTM_InqDbRead
  *
- * Description      This function is called to set the device into or out of
- *                  discoverable mode. Discoverable mode means inquiry
- *                  scans are enabled.  If a value of '0' is entered for window
- *                  or interval, the default values are used.
+ * Description      This function looks through the inquiry database for a match
+ *                  based on Bluetooth Device Address. This is the application's
+ *                  interface to get the inquiry details of a specific BD
+ *                  address.
  *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_BUSY if a setting of the filter is already in progress
- *                  BTM_NO_RESOURCES if couldn't get a memory pool buffer
- *                  BTM_ILLEGAL_VALUE if a bad parameter was detected
- *                  BTM_WRONG_MODE if the device is not up.
+ * Returns          pointer to entry, or NULL if not found
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetDiscoverability(uint16_t inq_mode, uint16_t window,
-                                   uint16_t interval);
+tBTM_INQ_INFO* BTM_InqDbRead(const RawAddress& p_bda);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadDiscoverability
- *
- * Description      This function is called to read the current discoverability
- *                  mode of the device.
+ * Function         BTM_InqDbFirst
  *
- * Output Params:   p_window - current inquiry scan duration
- *                  p_interval - current inquiry scan interval
+ * Description      This function looks through the inquiry database for the
+ *                  first used entry, and returns that. This is used in
+ *                  conjunction with BTM_InqDbNext by applications as a way to
+ *                  walk through the inquiry database.
  *
- * Returns          BTM_NON_DISCOVERABLE, BTM_LIMITED_DISCOVERABLE, or
- *                  BTM_GENERAL_DISCOVERABLE
+ * Returns          pointer to first in-use entry, or NULL if DB is empty
  *
  ******************************************************************************/
-uint16_t BTM_ReadDiscoverability(uint16_t* p_window, uint16_t* p_interval);
+tBTM_INQ_INFO* BTM_InqDbFirst(void);
 
 /*******************************************************************************
  *
- * Function         BTM_SetPeriodicInquiryMode
- *
- * Description      This function is called to set the device periodic inquiry
- *                  mode. If the duration is zero, the periodic inquiry mode is
- *                  cancelled.
- *
- * Parameters:      p_inqparms - pointer to the inquiry information
- *                      mode - GENERAL or LIMITED inquiry
- *                      duration - length in 1.28 sec intervals (If '0', the
- *                                 inquiry is CANCELLED)
- *                      max_resps - maximum amount of devices to search for
- *                                  before ending the inquiry
- *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
- *                                         BTM_FILTER_COND_DEVICE_CLASS, or
- *                                         BTM_FILTER_COND_BD_ADDR
- *                      filter_cond - value for the filter (based on
- *                                                          filter_cond_type)
+ * Function         BTM_InqDbNext
  *
- *                  max_delay - maximum amount of time between successive
- *                              inquiries
- *                  min_delay - minimum amount of time between successive
- *                              inquiries
- *                  p_results_cb - callback returning pointer to results
- *                              (tBTM_INQ_RESULTS)
+ * Description      This function looks through the inquiry database for the
+ *                  next used entry, and returns that.  If the input parameter
+ *                  is NULL, the first entry is returned.
  *
- * Returns          BTM_CMD_STARTED if successfully started
- *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
- *                  BTM_NO_RESOURCES if could not allocate a message buffer
- *                  BTM_SUCCESS - if cancelling the periodic inquiry
- *                  BTM_BUSY - if an inquiry is already active
- *                  BTM_WRONG_MODE if the device is not up.
+ * Returns          pointer to next in-use entry, or NULL if no more found.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetPeriodicInquiryMode(tBTM_INQ_PARMS* p_inqparms,
-                                       uint16_t max_delay, uint16_t min_delay,
-                                       tBTM_INQ_RESULTS_CB* p_results_cb);
+tBTM_INQ_INFO* BTM_InqDbNext(tBTM_INQ_INFO* p_cur);
 
 /*******************************************************************************
  *
- * Function         BTM_StartInquiry
- *
- * Description      This function is called to start an inquiry.
+ * Function         BTM_ClearInqDb
  *
- * Parameters:      p_inqparms - pointer to the inquiry information
- *                      mode - GENERAL or LIMITED inquiry
- *                      duration - length in 1.28 sec intervals (If '0', the
- *                                 inquiry is CANCELLED)
- *                      max_resps - maximum amount of devices to search for
- *                                  before ending the inquiry
- *                      filter_cond_type - BTM_CLR_INQUIRY_FILTER,
- *                                         BTM_FILTER_COND_DEVICE_CLASS, or
- *                                         BTM_FILTER_COND_BD_ADDR
- *                      filter_cond - value for the filter (based on
- *                                                          filter_cond_type)
+ * Description      This function is called to clear out a device or all devices
+ *                  from the inquiry database.
  *
- *                  p_results_cb  - Pointer to the callback routine which gets
- *                                called upon receipt of an inquiry result. If
- *                                this field is NULL, the application is not
- *                                notified.
+ * Parameter        p_bda - (input) BD_ADDR ->  Address of device to clear
+ *                                              (NULL clears all entries)
  *
- *                  p_cmpl_cb   - Pointer to the callback routine which gets
- *                                called upon completion.  If this field is
- *                                NULL, the application is not notified when
- *                                completed.
- * Returns          tBTM_STATUS
- *                  BTM_CMD_STARTED if successfully initiated
- *                  BTM_BUSY if already in progress
- *                  BTM_ILLEGAL_VALUE if parameter(s) are out of range
- *                  BTM_NO_RESOURCES if could not allocate resources to start
- *                                   the command
- *                  BTM_WRONG_MODE if the device is not up.
+ * Returns          BTM_BUSY if an inquiry, get remote name, or event filter
+ *                          is active, otherwise BTM_SUCCESS
  *
  ******************************************************************************/
-tBTM_STATUS BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms,
-                             tBTM_INQ_RESULTS_CB* p_results_cb,
-                             tBTM_CMPL_CB* p_cmpl_cb);
+tBTM_STATUS BTM_ClearInqDb(const RawAddress* p_bda);
 
 /*******************************************************************************
  *
- * Function         BTM_IsInquiryActive
+ * Function         BTM_ReadInquiryRspTxPower
  *
- * Description      Return a bit mask of the current inquiry state
+ * Description      This command will read the inquiry Transmit Power level used
+ *                  to transmit the FHS and EIR data packets.
+ *                  This can be used directly in the Tx Power Level EIR data
+ *                  type.
  *
- * Returns          BTM_INQUIRY_INACTIVE if inactive (0)
- *                  BTM_LIMITED_INQUIRY_ACTIVE if a limted inquiry is active
- *                  BTM_GENERAL_INQUIRY_ACTIVE if a general inquiry is active
- *                  BTM_PERIODIC_INQUIRY_ACTIVE if a periodic inquiry is active
+ * Returns          BTM_SUCCESS if successful
  *
  ******************************************************************************/
-uint16_t BTM_IsInquiryActive(void);
+tBTM_STATUS BTM_ReadInquiryRspTxPower(tBTM_CMPL_CB* p_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_CancelInquiry
+ * Function         BTM_WriteEIR
  *
- * Description      This function cancels an inquiry if active
+ * Description      This function is called to write EIR data to controller.
  *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_NO_RESOURCES if could not allocate a message buffer
- *                  BTM_WRONG_MODE if the device is not up.
+ * Parameters       p_buff - allocated HCI command buffer including extended
+ *                           inquriry response
+ *
+ * Returns          BTM_SUCCESS  - if successful
+ *                  BTM_MODE_UNSUPPORTED - if local device cannot support it
  *
  ******************************************************************************/
-tBTM_STATUS BTM_CancelInquiry(void);
+tBTM_STATUS BTM_WriteEIR(BT_HDR* p_buff);
 
 /*******************************************************************************
  *
- * Function         BTM_CancelPeriodicInquiry
+ * Function         BTM_HasEirService
  *
- * Description      This function cancels a periodic inquiry
+ * Description      This function is called to know if UUID in bit map of UUID.
  *
- * Returns
- *                  BTM_NO_RESOURCES if could not allocate a message buffer
- *                  BTM_SUCCESS - if cancelling the periodic inquiry
- *                  BTM_WRONG_MODE if the device is not up.
+ * Parameters       p_eir_uuid - bit map of UUID list
+ *                  uuid16 - UUID 16-bit
+ *
+ * Returns          true - if found
+ *                  false - if not found
  *
  ******************************************************************************/
-tBTM_STATUS BTM_CancelPeriodicInquiry(void);
+bool BTM_HasEirService(const uint32_t* p_eir_uuid, uint16_t uuid16);
 
 /*******************************************************************************
  *
- * Function         BTM_SetConnectability
+ * Function         BTM_HasInquiryEirService
  *
- * Description      This function is called to set the device into or out of
- *                  connectable mode. Discoverable mode means page scans are
- *                  enabled.
+ * Description      Return if a UUID is in the bit map of a UUID list.
  *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_ILLEGAL_VALUE if a bad parameter is detected
- *                  BTM_NO_RESOURCES if could not allocate a message buffer
- *                  BTM_WRONG_MODE if the device is not up.
+ * Parameters       p_results - inquiry results
+ *                  uuid16 - UUID 16-bit
+ *
+ * Returns          BTM_EIR_FOUND - if found
+ *                  BTM_EIR_NOT_FOUND - if not found and it is a complete list
+ *                  BTM_EIR_UNKNOWN - if not found and it is not complete list
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetConnectability(uint16_t page_mode, uint16_t window,
-                                  uint16_t interval);
+tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService(tBTM_INQ_RESULTS* p_results,
+                                                uint16_t uuid16);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadConnectability
+ * Function         BTM_AddEirService
  *
- * Description      This function is called to read the current discoverability
- *                  mode of the device.
- * Output Params    p_window - current page scan duration
- *                  p_interval - current time between page scans
+ * Description      This function is called to add a service in the bit map UUID
+ *                  list.
  *
- * Returns          BTM_NON_CONNECTABLE or BTM_CONNECTABLE
+ * Parameters       p_eir_uuid - bit mask of UUID list for EIR
+ *                  uuid16 - UUID 16-bit
+ *
+ * Returns          None
  *
  ******************************************************************************/
-uint16_t BTM_ReadConnectability(uint16_t* p_window, uint16_t* p_interval);
+void BTM_AddEirService(uint32_t* p_eir_uuid, uint16_t uuid16);
 
 /*******************************************************************************
  *
- * Function         BTM_SetInquiryMode
+ * Function         BTM_RemoveEirService
  *
- * Description      This function is called to set standard, with RSSI
- *                  mode or extended of the inquiry for local device.
+ * Description      This function is called to remove a service from the bit map
+ *                  UUID list.
  *
- * Input Params:    BTM_INQ_RESULT_STANDARD, BTM_INQ_RESULT_WITH_RSSI or
- *                  BTM_INQ_RESULT_EXTENDED
+ * Parameters       p_eir_uuid - bit mask of UUID list for EIR
+ *                  uuid16 - UUID 16-bit
  *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_NO_RESOURCES if couldn't get a memory pool buffer
- *                  BTM_ILLEGAL_VALUE if a bad parameter was detected
- *                  BTM_WRONG_MODE if the device is not up.
+ * Returns          None
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetInquiryMode(uint8_t mode);
+void BTM_RemoveEirService(uint32_t* p_eir_uuid, uint16_t uuid16);
 
 /*******************************************************************************
  *
- * Function         BTM_SetInquiryScanType
- *
- * Description      This function is called to set the iquiry scan-type to
- *                  standard or interlaced.
+ * Function         BTM_GetEirSupportedServices
  *
- * Input Params:    BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED
+ * Description      This function is called to get UUID list from bit map UUID
+ *                  list.
  *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_MODE_UNSUPPORTED if not a 1.2 device
- *                  BTM_WRONG_MODE if the device is not up.
+ * Parameters       p_eir_uuid - bit mask of UUID list for EIR
+ *                  p - reference of current pointer of EIR
+ *                  max_num_uuid16 - max number of UUID can be written in EIR
+ *                  num_uuid16 - number of UUID have been written in EIR
+ *
+ * Returns          BTM_EIR_MORE_16BITS_UUID_TYPE, if it has more than max
+ *                  BTM_EIR_COMPLETE_16BITS_UUID_TYPE, otherwise
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetInquiryScanType(uint16_t scan_type);
+uint8_t BTM_GetEirSupportedServices(uint32_t* p_eir_uuid, uint8_t** p,
+                                    uint8_t max_num_uuid16,
+                                    uint8_t* p_num_uuid16);
 
 /*******************************************************************************
  *
- * Function         BTM_SetPageScanType
+ * Function         BTM_GetEirUuidList
  *
- * Description      This function is called to set the page scan-type to
- *                  standard or interlaced.
+ * Description      This function parses EIR and returns UUID list.
  *
- * Input Params:    BTM_SCAN_TYPE_STANDARD or BTM_SCAN_TYPE_INTERLACED
+ * Parameters       p_eir - EIR
+ *                  eirl_len - EIR len
+ *                  uuid_size - Uuid::kNumBytes16, Uuid::kNumBytes32,
+ *                              Uuid::kNumBytes128
+ *                  p_num_uuid - return number of UUID in found list
+ *                  p_uuid_list - return UUID 16-bit list
+ *                  max_num_uuid - maximum number of UUID to be returned
  *
- * Returns          BTM_SUCCESS if successful
- *                  BTM_MODE_UNSUPPORTED if not a 1.2 device
- *                  BTM_WRONG_MODE if the device is not up.
+ * Returns          0 - if not found
+ *                  BTM_EIR_COMPLETE_16BITS_UUID_TYPE
+ *                  BTM_EIR_MORE_16BITS_UUID_TYPE
+ *                  BTM_EIR_COMPLETE_32BITS_UUID_TYPE
+ *                  BTM_EIR_MORE_32BITS_UUID_TYPE
+ *                  BTM_EIR_COMPLETE_128BITS_UUID_TYPE
+ *                  BTM_EIR_MORE_128BITS_UUID_TYPE
  *
  ******************************************************************************/
-
-tBTM_STATUS BTM_SetPageScanType(uint16_t scan_type);
+uint8_t BTM_GetEirUuidList(uint8_t* p_eir, size_t eir_len, uint8_t uuid_size,
+                           uint8_t* p_num_uuid, uint8_t* p_uuid_list,
+                           uint8_t max_num_uuid);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadRemoteDeviceName
+ * Function         BTM_SecAddBleDevice
  *
- * Description      This function initiates a remote device HCI command to the
- *                  controller and calls the callback when the process has
- *                  completed.
+ * Description      Add/modify device.  This function will be normally called
+ *                  during host startup to restore all required information
+ *                  for a LE device stored in the NVRAM.
  *
- * Input Params:    remote_bda      - device address of name to retrieve
- *                  p_cb            - callback function called when
- *                                    BTM_CMD_STARTED is returned.
- *                                    A pointer to tBTM_REMOTE_DEV_NAME is
- *                                    passed to the callback.
+ * Parameters:      bd_addr          - BD address of the peer
+ *                  bd_name          - Name of the peer device. NULL if unknown.
+ *                  dev_type         - Remote device's device type.
+ *                  addr_type        - LE device address type.
  *
- * Returns
- *                  BTM_CMD_STARTED is returned if the request was successfully
- *                                  sent to HCI.
- *                  BTM_BUSY if already in progress
- *                  BTM_UNKNOWN_ADDR if device address is bad
- *                  BTM_NO_RESOURCES if resources could not be allocated to
- *                                   start the command
- *                  BTM_WRONG_MODE if the device is not up.
+ * Returns          true if added OK, else false
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadRemoteDeviceName(const RawAddress& remote_bda,
-                                     tBTM_CMPL_CB* p_cb,
-                                     tBT_TRANSPORT transport);
+bool BTM_SecAddBleDevice(const RawAddress& bd_addr, BD_NAME bd_name,
+                         tBT_DEVICE_TYPE dev_type, tBLE_ADDR_TYPE addr_type);
 
 /*******************************************************************************
  *
- * Function         BTM_CancelRemoteDeviceName
+ * Function         BTM_SecAddBleKey
  *
- * Description      This function initiates the cancel request for the specified
- *                  remote device.
+ * Description      Add/modify LE device information.  This function will be
+ *                  normally called during host startup to restore all required
+ *                  information stored in the NVRAM.
  *
- * Input Params:    None
+ * Parameters:      bd_addr          - BD address of the peer
+ *                  p_le_key         - LE key values.
+ *                  key_type         - LE SMP key type.
  *
- * Returns
- *                  BTM_CMD_STARTED is returned if the request was successfully
- *                                  sent to HCI.
- *                  BTM_NO_RESOURCES if resources could not be allocated to
- *                                   start the command
- *                  BTM_WRONG_MODE if there is no active remote name request.
+ * Returns          true if added OK, else false
  *
  ******************************************************************************/
-tBTM_STATUS BTM_CancelRemoteDeviceName(void);
+bool BTM_SecAddBleKey(const RawAddress& bd_addr, tBTM_LE_KEY_VALUE* p_le_key,
+                      tBTM_LE_KEY_TYPE key_type);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadRemoteVersion
+ * Function         BTM_BleLoadLocalKeys
  *
- * Description      This function is called to read a remote device's version
+ * Description      Local local identity key, encryption root or sign counter.
  *
- * Returns          BTM_SUCCESS if successful, otherwise an error
+ * Parameters:      key_type: type of key, can be BTM_BLE_KEY_TYPE_ID,
+ *                            BTM_BLE_KEY_TYPE_ER
+ *                            or BTM_BLE_KEY_TYPE_COUNTER.
+ *                  p_key: pointer to the key.
+ *
+ * Returns          non2.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
-                                  uint16_t* manufacturer,
-                                  uint16_t* lmp_sub_version);
+void BTM_BleLoadLocalKeys(uint8_t key_type, tBTM_BLE_LOCAL_KEYS* p_key);
+
+/** Returns local device encryption root (ER) */
+const Octet16& BTM_GetDeviceEncRoot();
+
+/** Returns local device identity root (IR) */
+const Octet16& BTM_GetDeviceIDRoot();
+
+/** Return local device DHK. */
+const Octet16& BTM_GetDeviceDHK();
 
 /*******************************************************************************
  *
- * Function         BTM_ReadRemoteFeatures
- *
- * Description      This function is called to read a remote device's
- *                  supported features mask (features mask located at page 0)
+ * Function         BTM_ReadConnectionAddr
  *
- *                  Note: The size of device features mask page is
- *                  BTM_FEATURE_BYTES_PER_PAGE bytes.
+ * Description      Read the local device random address.
  *
- * Returns          pointer to the remote supported features mask
+ * Returns          void
  *
  ******************************************************************************/
-uint8_t* BTM_ReadRemoteFeatures(const RawAddress& addr);
+void BTM_ReadConnectionAddr(const RawAddress& remote_bda,
+                            RawAddress& local_conn_addr,
+                            tBLE_ADDR_TYPE* p_addr_type);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadRemoteExtendedFeatures
+ * Function         BTM_IsBleConnection
  *
- * Description      This function is called to read a specific extended features
- *                  page of the remote device
+ * Description      This function is called to check if the connection handle
+ *                  for an LE link
  *
- *                  Note1: The size of device features mask page is
- *                  BTM_FEATURE_BYTES_PER_PAGE bytes.
- *                  Note2: The valid device features mask page number depends on
- *                  the remote device capabilities. It is expected to be in the
- *                  range [0 - BTM_EXT_FEATURES_PAGE_MAX].
-
- * Returns          pointer to the remote extended features mask
- *                  or NULL if page_number is not valid
+ * Returns          true if connection is LE link, otherwise false.
  *
  ******************************************************************************/
-uint8_t* BTM_ReadRemoteExtendedFeatures(const RawAddress& addr,
-                                        uint8_t page_number);
+bool BTM_IsBleConnection(uint16_t conn_handle);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadNumberRemoteFeaturesPages
+ * Function         BTM_ReadRemoteConnectionAddr
  *
- * Description      This function is called to retrieve the number of feature
- *                  pages read from the remote device
+ * Description      Read the remote device address currently used.
  *
- * Returns          number of features pages read from the remote device
+ * Returns          void
  *
  ******************************************************************************/
-uint8_t BTM_ReadNumberRemoteFeaturesPages(const RawAddress& addr);
+bool BTM_ReadRemoteConnectionAddr(const RawAddress& pseudo_addr,
+                                  RawAddress& conn_addr,
+                                  tBLE_ADDR_TYPE* p_addr_type);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadAllRemoteFeatures
+ * Function         BTM_SecurityGrant
  *
- * Description      Read all the features of the remote device
+ * Description      This function is called to grant security process.
  *
- * Returns          pointer to the byte[0] of the page[0] of the remote device
- *                  feature mask.
+ * Parameters       bd_addr - peer device bd address.
+ *                  res     - result of the operation BTM_SUCCESS if success.
+ *                            Otherwise, BTM_REPEATED_ATTEMPTS is too many
+ *                            attempts.
  *
- * Note:            the function returns the pointer to the array of the size
- *                  BTM_FEATURE_BYTES_PER_PAGE * (BTM_EXT_FEATURES_PAGE_MAX + 1)
+ * Returns          None
  *
  ******************************************************************************/
-uint8_t* BTM_ReadAllRemoteFeatures(const RawAddress& addr);
+void BTM_SecurityGrant(const RawAddress& bd_addr, uint8_t res);
 
 /*******************************************************************************
  *
- * Function         BTM_InqDbRead
+ * Function         BTM_BlePasskeyReply
  *
- * Description      This function looks through the inquiry database for a match
- *                  based on Bluetooth Device Address. This is the application's
- *                  interface to get the inquiry details of a specific BD
- *                  address.
+ * Description      This function is called after Security Manager submitted
+ *                  passkey request to the application.
  *
- * Returns          pointer to entry, or NULL if not found
+ * Parameters:      bd_addr - Address of the device for which passkey was
+ *                            requested
+ *                  res     - result of the operation SMP_SUCCESS if success
+ *                  passkey - numeric value in the range of
+ *                               BTM_MIN_PASSKEY_VAL(0) -
+ *                               BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
  *
  ******************************************************************************/
-tBTM_INQ_INFO* BTM_InqDbRead(const RawAddress& p_bda);
+void BTM_BlePasskeyReply(const RawAddress& bd_addr, uint8_t res,
+                         uint32_t passkey);
 
 /*******************************************************************************
  *
- * Function         BTM_InqDbFirst
+ * Function         BTM_BleConfirmReply
  *
- * Description      This function looks through the inquiry database for the
- *                  first used entry, and returns that. This is used in
- *                  conjunction with BTM_InqDbNext by applications as a way to
- *                  walk through the inquiry database.
+ * Description      This function is called after Security Manager submitted
+ *                  numeric comparison request to the application.
  *
- * Returns          pointer to first in-use entry, or NULL if DB is empty
+ * Parameters:      bd_addr      - Address of the device with which numeric
+ *                                 comparison was requested
+ *                  res          - comparison result BTM_SUCCESS if success
  *
  ******************************************************************************/
-tBTM_INQ_INFO* BTM_InqDbFirst(void);
+void BTM_BleConfirmReply(const RawAddress& bd_addr, uint8_t res);
 
 /*******************************************************************************
  *
- * Function         BTM_InqDbNext
+ * Function         BTM_LeOobDataReply
  *
- * Description      This function looks through the inquiry database for the
- *                  next used entry, and returns that.  If the input parameter
- *                  is NULL, the first entry is returned.
+ * Description      This function is called to provide the OOB data for
+ *                  SMP in response to BTM_LE_OOB_REQ_EVT
  *
- * Returns          pointer to next in-use entry, or NULL if no more found.
+ * Parameters:      bd_addr     - Address of the peer device
+ *                  res         - result of the operation SMP_SUCCESS if success
+ *                  p_data      - simple pairing Randomizer  C.
  *
  ******************************************************************************/
-tBTM_INQ_INFO* BTM_InqDbNext(tBTM_INQ_INFO* p_cur);
+void BTM_BleOobDataReply(const RawAddress& bd_addr, uint8_t res, uint8_t len,
+                         uint8_t* p_data);
 
 /*******************************************************************************
  *
- * Function         BTM_ClearInqDb
- *
- * Description      This function is called to clear out a device or all devices
- *                  from the inquiry database.
+ * Function         BTM_BleSecureConnectionOobDataReply
  *
- * Parameter        p_bda - (input) BD_ADDR ->  Address of device to clear
- *                                              (NULL clears all entries)
+ * Description      This function is called to provide the OOB data for
+ *                  SMP in response to BTM_LE_OOB_REQ_EVT when secure connection
+ *                  data is available
  *
- * Returns          BTM_BUSY if an inquiry, get remote name, or event filter
- *                          is active, otherwise BTM_SUCCESS
+ * Parameters:      bd_addr     - Address of the peer device
+ *                  p_c         - pointer to Confirmation
+ *                  p_r         - pointer to Randomizer.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ClearInqDb(const RawAddress* p_bda);
+void BTM_BleSecureConnectionOobDataReply(const RawAddress& bd_addr,
+                                         uint8_t* p_c, uint8_t* p_r);
 
-/*******************************************************************************
+/******************************************************************************
  *
- * Function         BTM_ReadInquiryRspTxPower
+ * Function         BTM_BleSetConnScanParams
  *
- * Description      This command will read the inquiry Transmit Power level used
- *                  to transmit the FHS and EIR data packets.
- *                  This can be used directly in the Tx Power Level EIR data
- *                  type.
+ * Description      Set scan parameters used in BLE connection request
  *
- * Returns          BTM_SUCCESS if successful
+ * Parameters:      scan_interval    - scan interval
+ *                  scan_window      - scan window
+ *
+ * Returns          void
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadInquiryRspTxPower(tBTM_CMPL_CB* p_cb);
+void BTM_BleSetConnScanParams(uint32_t scan_interval, uint32_t scan_window);
 
-/*****************************************************************************
- *  ACL CHANNEL MANAGEMENT FUNCTIONS
- ****************************************************************************/
-/*******************************************************************************
- *
- * Function         BTM_SetLinkPolicy
- *
- * Description      Create and send HCI "Write Policy Set" command
- *
- * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
+/********************************************************
  *
- ******************************************************************************/
-tBTM_STATUS BTM_SetLinkPolicy(const RawAddress& remote_bda, uint16_t* settings);
-
-/*******************************************************************************
+ * Function         BTM_BleSetPrefConnParams
  *
- * Function         BTM_SetDefaultLinkPolicy
+ * Description      Set a peripheral's preferred connection parameters. When
+ *                  any of the value does not want to be updated while others
+ *                  do, use BTM_BLE_CONN_PARAM_UNDEF for the ones want to
+ *                  leave untouched.
  *
- * Description      Set the default value for HCI "Write Policy Set" command
- *                  to use when an ACL link is created.
+ * Parameters:      bd_addr          - BD address of the peripheral
+ *                  min_conn_int     - minimum preferred connection interval
+ *                  max_conn_int     - maximum preferred connection interval
+ *                  slave_latency    - preferred slave latency
+ *                  supervision_tout - preferred supervision timeout
  *
  * Returns          void
  *
  ******************************************************************************/
-void BTM_SetDefaultLinkPolicy(uint16_t settings);
+void BTM_BleSetPrefConnParams(const RawAddress& bd_addr, uint16_t min_conn_int,
+                              uint16_t max_conn_int, uint16_t slave_latency,
+                              uint16_t supervision_tout);
 
 /*******************************************************************************
  *
- * Function         BTM_SetDefaultLinkSuperTout
+ * Function         BTM_ReadDevInfo
  *
- * Description      Set the default value for HCI "Write Link Supervision
- *                  Timeout" command to use when an ACL link is created.
+ * Description      This function is called to read the device/address type
+ *                  of BD address.
  *
- * Returns          void
+ * Parameter        remote_bda: remote device address
+ *                  p_dev_type: output parameter to read the device type.
+ *                  p_addr_type: output parameter to read the address type.
  *
  ******************************************************************************/
-void BTM_SetDefaultLinkSuperTout(uint16_t timeout);
+void BTM_ReadDevInfo(const RawAddress& remote_bda, tBT_DEVICE_TYPE* p_dev_type,
+                     tBLE_ADDR_TYPE* p_addr_type);
 
 /*******************************************************************************
  *
- * Function         BTM_SetLinkSuperTout
+ * Function         BTM_ReadConnectedTransportAddress
  *
- * Description      Create and send HCI "Write Link Supervision Timeout" command
+ * Description      This function is called to read the paired device/address
+ *                  type of other device paired corresponding to the BD_address
  *
- * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
+ * Parameter        remote_bda: remote device address, carry out the transport
+ *                              address
+ *                  transport: active transport
+ *
+ * Return           true if an active link is identified; false otherwise
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetLinkSuperTout(const RawAddress& remote_bda,
-                                 uint16_t timeout);
+bool BTM_ReadConnectedTransportAddress(RawAddress* remote_bda,
+                                       tBT_TRANSPORT transport);
+
 /*******************************************************************************
  *
- * Function         BTM_GetLinkSuperTout
+ * Function         BTM_BleReceiverTest
  *
- * Description      Read the link supervision timeout value of the connection
+ * Description      This function is called to start the LE Receiver test
  *
- * Returns          status of the operation
+ * Parameter       rx_freq - Frequency Range
+ *               p_cmd_cmpl_cback - Command Complete callback
  *
  ******************************************************************************/
-tBTM_STATUS BTM_GetLinkSuperTout(const RawAddress& remote_bda,
-                                 uint16_t* p_timeout);
+void BTM_BleReceiverTest(uint8_t rx_freq, tBTM_CMPL_CB* p_cmd_cmpl_cback);
 
 /*******************************************************************************
  *
- * Function         BTM_IsAclConnectionUp
+ * Function         BTM_BleTransmitterTest
  *
- * Description      This function is called to check if an ACL connection exists
- *                  to a specific remote BD Address.
+ * Description      This function is called to start the LE Transmitter test
  *
- * Returns          true if connection is up, else false.
+ * Parameter       tx_freq - Frequency Range
+ *                       test_data_len - Length in bytes of payload data in each
+ *                                       packet
+ *                       packet_payload - Pattern to use in the payload
+ *                       p_cmd_cmpl_cback - Command Complete callback
  *
  ******************************************************************************/
-bool BTM_IsAclConnectionUp(const RawAddress& remote_bda,
-                           tBT_TRANSPORT transport);
+void BTM_BleTransmitterTest(uint8_t tx_freq, uint8_t test_data_len,
+                            uint8_t packet_payload,
+                            tBTM_CMPL_CB* p_cmd_cmpl_cback);
 
 /*******************************************************************************
  *
- * Function         BTM_GetRole
+ * Function         BTM_BleTestEnd
  *
- * Description      This function is called to get the role of the local device
- *                  for the ACL connection with the specified remote device
+ * Description     This function is called to stop the in-progress TX or RX test
  *
- * Returns          BTM_SUCCESS if connection exists.
- *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
+ * Parameter       p_cmd_cmpl_cback - Command complete callback
  *
  ******************************************************************************/
-tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, uint8_t* p_role);
+void BTM_BleTestEnd(tBTM_CMPL_CB* p_cmd_cmpl_cback);
 
 /*******************************************************************************
  *
- * Function         BTM_SwitchRole
+ * Function         BTM_UseLeLink
  *
- * Description      This function is called to switch role between master and
- *                  slave.  If role is already set it will do nothing.  If the
- *                  command was initiated, the callback function is called upon
- *                  completion.
+ * Description      Select the underlying physical link to use.
  *
- * Returns          BTM_SUCCESS if already in specified role.
- *                  BTM_CMD_STARTED if command issued to controller.
- *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
- *                                   the command
- *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
- *                  BTM_MODE_UNSUPPORTED if the local device does not support
- *                                       role switching
+ * Returns          true to use LE, false use BR/EDR.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role,
-                           tBTM_CMPL_CB* p_cb);
+bool BTM_UseLeLink(const RawAddress& bd_addr);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadRSSI
+ * Function         BTM_SetBleDataLength
  *
- * Description      This function is called to read the link policy settings.
- *                  The address of link policy results are returned in the
- *                  callback. (tBTM_RSSI_RESULT)
+ * Description      Set the maximum BLE transmission packet size
  *
- * Returns          BTM_CMD_STARTED if command issued to controller.
- *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
- *                                   the command
- *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
- *                  BTM_BUSY if command is already in progress
+ * Returns          BTM_SUCCESS if success; otherwise failed.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadRSSI(const RawAddress& remote_bda, tBTM_CMPL_CB* p_cb);
+tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr,
+                                 uint16_t tx_pdu_length);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadFailedContactCounter
+ * Function         BTM_BleReadPhy
  *
- * Description      This function is called to read the failed contact counter.
- *                  The result is returned in the callback.
- *                  (tBTM_FAILED_CONTACT_COUNTER_RESULT)
+ * Description      To read the current PHYs for specified LE connection
  *
- * Returns          BTM_CMD_STARTED if command issued to controller.
- *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
- *                                   the command
- *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
- *                  BTM_BUSY if command is already in progress
+ *
+ * Returns          BTM_SUCCESS if success; otherwise failed.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadFailedContactCounter(const RawAddress& remote_bda,
-                                         tBTM_CMPL_CB* p_cb);
+void BTM_BleReadPhy(
+    const RawAddress& bd_addr,
+    base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadAutomaticFlushTimeout
+ * Function         BTM_BleSetDefaultPhy
  *
- * Description      This function is called to read the automatic flush timeout.
- *                  The result is returned in the callback.
- *                  (tBTM_AUTOMATIC_FLUSH_TIMEOUT_RESULT)
+ * Description      To set preferred PHY for ensuing LE connections
  *
- * Returns          BTM_CMD_STARTED if command issued to controller.
- *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
- *                                   the command
- *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
- *                  BTM_BUSY if command is already in progress
+ *
+ * Returns          BTM_SUCCESS if success; otherwise failed.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadAutomaticFlushTimeout(const RawAddress& remote_bda,
-                                          tBTM_CMPL_CB* p_cb);
+tBTM_STATUS BTM_BleSetDefaultPhy(uint8_t all_phys, uint8_t tx_phys,
+                                 uint8_t rx_phys);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadTxPower
+ * Function         BTM_BleSetPhy
  *
- * Description      This function is called to read the current connection
- *                  TX power of the connection. The TX power level results
- *                  are returned in the callback.
- *                  (tBTM_RSSI_RESULT)
+ * Description      To set PHY preferences for specified LE connection
  *
- * Returns          BTM_CMD_STARTED if command issued to controller.
- *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
- *                                   the command
- *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
- *                  BTM_BUSY if command is already in progress
+ *
+ * Returns          BTM_SUCCESS if success; otherwise failed.
+ *                  BTM_MODE_UNSUPPORTED if local controller doesn't support LE
+ *                  2M or LE Coded PHY,
+ *                  BTM_ILLEGAL_VALUE if specified remote doesn't support LE 2M
+ *                  or LE Coded PHY,
+ *                  BTM_WRONG_MODE if Device in wrong mode for request.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadTxPower(const RawAddress& remote_bda,
-                            tBT_TRANSPORT transport, tBTM_CMPL_CB* p_cb);
+void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys,
+                   uint16_t phy_options);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadLinkQuality
+ * Function         BTM_BleDataSignature
  *
- * Description      This function is called to read the link quality.
- *                  The value of the link quality is returned in the callback.
- *                  (tBTM_LINK_QUALITY_RESULT)
+ * Description      This function is called to sign the data using AES128 CMAC
+ *                  algorith.
  *
- * Returns          BTM_CMD_STARTED if command issued to controller.
- *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
- *                                   the command
- *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
- *                  BTM_BUSY if command is already in progress
+ * Parameter        bd_addr: target device the data to be signed for.
+ *                  p_text: singing data
+ *                  len: length of the signing data
+ *                  signature: output parameter where data signature is going to
+ *                             be stored.
+ *
+ * Returns          true if signing sucessul, otherwise false.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadLinkQuality(const RawAddress& remote_bda,
-                                tBTM_CMPL_CB* p_cb);
+bool BTM_BleDataSignature(const RawAddress& bd_addr, uint8_t* p_text,
+                          uint16_t len, BLE_SIGNATURE signature);
 
 /*******************************************************************************
  *
- * Function         BTM_RegBusyLevelNotif
+ * Function         BTM_BleVerifySignature
  *
- * Description      This function is called to register a callback to receive
- *                  busy level change events.
+ * Description      This function is called to verify the data signature
  *
- * Returns          BTM_SUCCESS if successfully registered, otherwise error
+ * Parameter        bd_addr: target device the data to be signed for.
+ *                  p_orig:  original data before signature.
+ *                  len: length of the signing data
+ *                  counter: counter used when doing data signing
+ *                  p_comp: signature to be compared against.
+
+ * Returns          true if signature verified correctly; otherwise false.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_RegBusyLevelNotif(tBTM_BL_CHANGE_CB* p_cb, uint8_t* p_level,
-                                  tBTM_BL_EVENT_MASK evt_mask);
+bool BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig,
+                            uint16_t len, uint32_t counter, uint8_t* p_comp);
 
 /*******************************************************************************
  *
- * Function         BTM_AclRegisterForChanges
+ * Function         BTM_GetLeSecurityState
  *
- * Description      This function is called to register a callback to receive
- *                  ACL database change events, i.e. new connection or removed.
+ * Description      This function is called to get security mode 1 flags and
+ *                  encryption key size for LE peer.
  *
- * Returns          BTM_SUCCESS if successfully initiated, otherwise error
+ * Returns          bool    true if LE device is found, false otherwise.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_AclRegisterForChanges(tBTM_ACL_DB_CHANGE_CB* p_cb);
+bool BTM_GetLeSecurityState(const RawAddress& bd_addr,
+                            uint8_t* p_le_dev_sec_flags,
+                            uint8_t* p_le_key_size);
 
 /*******************************************************************************
  *
- * Function         BTM_GetNumAclLinks
+ * Function         BTM_BleSecurityProcedureIsRunning
  *
- * Description      This function is called to count the number of
- *                  ACL links that are active.
+ * Description      This function indicates if LE security procedure is
+ *                  currently running with the peer.
  *
- * Returns          uint16_t Number of active ACL links
+ * Returns          bool true if security procedure is running, false otherwise.
  *
  ******************************************************************************/
-uint16_t BTM_GetNumAclLinks(void);
+bool BTM_BleSecurityProcedureIsRunning(const RawAddress& bd_addr);
 
 /*******************************************************************************
  *
- * Function         BTM_SetQoS
+ * Function         BTM_BleGetSupportedKeySize
  *
- * Description      This function is called to setup QoS
+ * Description      This function gets the maximum encryption key size in bytes
+ *                  the local device can suport.
+ *                  record.
  *
- * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
+ * Returns          the key size or 0 if the size can't be retrieved.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetQoS(const RawAddress& bd, FLOW_SPEC* p_flow,
-                       tBTM_CMPL_CB* p_cb);
+uint8_t BTM_BleGetSupportedKeySize(const RawAddress& bd_addr);
+
+void BTM_LE_PF_local_name(tBTM_BLE_SCAN_COND_OP action,
+                          tBTM_BLE_PF_FILT_INDEX filt_index,
+                          std::vector<uint8_t> name, tBTM_BLE_PF_CFG_CBACK cb);
+
+void BTM_LE_PF_srvc_data(tBTM_BLE_SCAN_COND_OP action,
+                         tBTM_BLE_PF_FILT_INDEX filt_index);
+
+void BTM_LE_PF_manu_data(tBTM_BLE_SCAN_COND_OP action,
+                         tBTM_BLE_PF_FILT_INDEX filt_index, uint16_t company_id,
+                         uint16_t company_id_mask, std::vector<uint8_t> data,
+                         std::vector<uint8_t> data_mask,
+                         tBTM_BLE_PF_CFG_CBACK cb);
+
+void BTM_LE_PF_srvc_data_pattern(tBTM_BLE_SCAN_COND_OP action,
+                                 tBTM_BLE_PF_FILT_INDEX filt_index,
+                                 std::vector<uint8_t> data,
+                                 std::vector<uint8_t> data_mask,
+                                 tBTM_BLE_PF_CFG_CBACK cb);
+
+void BTM_LE_PF_addr_filter(tBTM_BLE_SCAN_COND_OP action,
+                           tBTM_BLE_PF_FILT_INDEX filt_index, tBLE_BD_ADDR addr,
+                           tBTM_BLE_PF_CFG_CBACK cb);
+
+void BTM_LE_PF_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
+                           tBTM_BLE_PF_FILT_INDEX filt_index,
+                           tBTM_BLE_PF_COND_TYPE filter_type,
+                           const bluetooth::Uuid& uuid,
+                           tBTM_BLE_PF_LOGIC_TYPE cond_logic,
+                           const bluetooth::Uuid& uuid_mask,
+                           tBTM_BLE_PF_CFG_CBACK cb);
+
+void BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index,
+                   std::vector<ApcfCommand> commands, tBTM_BLE_PF_CFG_CBACK cb);
+void BTM_LE_PF_clear(tBTM_BLE_PF_FILT_INDEX filt_index,
+                     tBTM_BLE_PF_CFG_CBACK cb);
 
-/*****************************************************************************
- *  (e)SCO CHANNEL MANAGEMENT FUNCTIONS
- ****************************************************************************/
 /*******************************************************************************
  *
- * Function         BTM_CreateSco
- *
- * Description      This function is called to create an SCO connection. If the
- *                  "is_orig" flag is true, the connection will be originated,
- *                  otherwise BTM will wait for the other side to connect.
+ * Function         BTM_BleAdvFilterParamSetup
  *
- * Returns          BTM_UNKNOWN_ADDR if the ACL connection is not up
- *                  BTM_BUSY         if another SCO being set up to
- *                                   the same BD address
- *                  BTM_NO_RESOURCES if the max SCO limit has been reached
- *                  BTM_CMD_STARTED  if the connection establishment is started.
- *                                   In this case, "*p_sco_inx" is filled in
- *                                   with the sco index used for the connection.
+ * Description      This function is called to setup the adv data payload filter
+ *                  condition.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_CreateSco(const RawAddress* remote_bda, bool is_orig,
-                          uint16_t pkt_types, uint16_t* p_sco_inx,
-                          tBTM_SCO_CB* p_conn_cb, tBTM_SCO_CB* p_disc_cb);
+void BTM_BleAdvFilterParamSetup(
+    int action, tBTM_BLE_PF_FILT_INDEX filt_index,
+    std::unique_ptr<btgatt_filt_param_setup_t> p_filt_params,
+    tBTM_BLE_PF_PARAM_CB cb);
 
 /*******************************************************************************
  *
- * Function         BTM_RemoveSco
+ * Function         BTM_BleUpdateAdvFilterPolicy
  *
- * Description      This function is called to remove a specific SCO connection.
+ * Description      This function update the filter policy of advertiser.
  *
- * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
+ * Parameter        adv_policy: advertising filter policy
  *
+ * Return           void
  ******************************************************************************/
-tBTM_STATUS BTM_RemoveSco(uint16_t sco_inx);
+void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy);
 
 /*******************************************************************************
  *
- * Function         BTM_SetScoPacketTypes
- *
- * Description      This function is called to set the packet types used for
- *                  a specific SCO connection,
- *
- * Parameters       pkt_types - One or more of the following
- *                  BTM_SCO_PKT_TYPES_MASK_HV1
- *                  BTM_SCO_PKT_TYPES_MASK_HV2
- *                  BTM_SCO_PKT_TYPES_MASK_HV3
- *                  BTM_SCO_PKT_TYPES_MASK_EV3
- *                  BTM_SCO_PKT_TYPES_MASK_EV4
- *                  BTM_SCO_PKT_TYPES_MASK_EV5
+ * Function         BTM_BleEnableDisableFilterFeature
  *
- *                  BTM_SCO_LINK_ALL_MASK   - enables all supported types
+ * Description      Enable or disable the APCF feature
  *
- * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
+ * Parameters       enable - true - enables APCF, false - disables APCF
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetScoPacketTypes(uint16_t sco_inx, uint16_t pkt_types);
+void BTM_BleEnableDisableFilterFeature(uint8_t enable,
+                                       tBTM_BLE_PF_STATUS_CBACK p_stat_cback);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadScoPacketTypes
- *
- * Description      This function is read the packet types used for a specific
- *                  SCO connection.
+ * Function          BTM_BleMaxMultiAdvInstanceCount
  *
- * Returns       One or more of the following (bitmask)
- *                  BTM_SCO_PKT_TYPES_MASK_HV1
- *                  BTM_SCO_PKT_TYPES_MASK_HV2
- *                  BTM_SCO_PKT_TYPES_MASK_HV3
- *                  BTM_SCO_PKT_TYPES_MASK_EV3
- *                  BTM_SCO_PKT_TYPES_MASK_EV4
- *                  BTM_SCO_PKT_TYPES_MASK_EV5
+ * Description      Returns the maximum number of multi adv instances supported
+ *                  by the controller.
  *
- * Returns          packet types supported for the connection
+ * Returns          Max multi adv instance count
  *
  ******************************************************************************/
-uint16_t BTM_ReadScoPacketTypes(uint16_t sco_inx);
+uint8_t BTM_BleMaxMultiAdvInstanceCount();
 
 /*******************************************************************************
  *
- * Function         BTM_ReadDeviceScoPacketTypes
+ * Function         BTM_DeviceReset
  *
- * Description      This function is read the SCO packet types that
- *                  the device supports.
+ * Description      This function is called to reset the controller.  The
+ *                  Callback function if provided is called when startup of the
+ *                  device has completed.
  *
- * Returns          packet types supported by the device.
+ * Returns          void
  *
  ******************************************************************************/
-uint16_t BTM_ReadDeviceScoPacketTypes(void);
+void BTM_DeviceReset(tBTM_CMPL_CB* p_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadScoHandle
+ * Function         BTM_IsDeviceUp
  *
- * Description      Reead the HCI handle used for a specific SCO connection,
+ * Description      This function is called to check if the device is up.
  *
- * Returns          handle for the connection, or 0xFFFF if invalid SCO index.
+ * Returns          true if device is up, else false
  *
  ******************************************************************************/
-uint16_t BTM_ReadScoHandle(uint16_t sco_inx);
+bool BTM_IsDeviceUp(void);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadScoBdAddr
+ * Function         BTM_SetLocalDeviceName
  *
- * Description      This function is read the remote BD Address for a specific
- *                  SCO connection,
+ * Description      This function is called to set the local device name.
  *
- * Returns          pointer to BD address or NULL if not known
+ * Returns          BTM_CMD_STARTED if successful, otherwise an error
  *
  ******************************************************************************/
-const RawAddress* BTM_ReadScoBdAddr(uint16_t sco_inx);
+tBTM_STATUS BTM_SetLocalDeviceName(char* p_name);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadScoDiscReason
+ * Function         BTM_SetDeviceClass
  *
- * Description      This function is returns the reason why an (e)SCO connection
- *                  has been removed. It contains the value until read, or until
- *                  another (e)SCO connection has disconnected.
+ * Description      This function is called to set the local device class
  *
- * Returns          HCI reason or BTM_INVALID_SCO_DISC_REASON if not set.
+ * Returns          BTM_SUCCESS if successful, otherwise an error
  *
  ******************************************************************************/
-uint16_t BTM_ReadScoDiscReason(void);
+tBTM_STATUS BTM_SetDeviceClass(DEV_CLASS dev_class);
 
 /*******************************************************************************
  *
- * Function         BTM_SetEScoMode
+ * Function         BTM_ReadLocalDeviceName
  *
- * Description      This function sets up the negotiated parameters for SCO or
- *                  eSCO, and sets as the default mode used for calls to
- *                  BTM_CreateSco.  It can be called only when there are no
- *                  active (e)SCO links.
+ * Description      This function is called to read the local device name.
  *
- * Returns          BTM_SUCCESS if the successful.
- *                  BTM_BUSY if there are one or more active (e)SCO links.
+ * Returns          status of the operation
+ *                  If success, BTM_SUCCESS is returned and p_name points stored
+ *                              local device name
+ *                  If BTM doesn't store local device name, BTM_NO_RESOURCES is
+ *                              is returned and p_name is set to NULL
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetEScoMode(enh_esco_params_t* p_parms);
+tBTM_STATUS BTM_ReadLocalDeviceName(char** p_name);
 
 /*******************************************************************************
  *
- * Function         BTM_SetWBSCodec
- *
- * Description      This function sends command to the controller to setup
- *                  WBS codec for the upcoming eSCO connection.
+ * Function         BTM_ReadLocalDeviceNameFromController
  *
- * Returns          BTM_SUCCESS.
+ * Description      Get local device name from controller. Do not use cached
+ *                  name (used to get chip-id prior to btm reset complete).
  *
+ * Returns          BTM_CMD_STARTED if successful, otherwise an error
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetWBSCodec(tBTM_SCO_CODEC_TYPE codec_type);
+tBTM_STATUS BTM_ReadLocalDeviceNameFromController(
+    tBTM_CMPL_CB* p_rln_cmpl_cback);
 
 /*******************************************************************************
  *
- * Function         BTM_RegForEScoEvts
+ * Function         BTM_ReadDeviceClass
  *
- * Description      This function registers a SCO event callback with the
- *                  specified instance.  It should be used to received
- *                  connection indication events and change of link parameter
- *                  events.
+ * Description      This function is called to read the local device class
  *
- * Returns          BTM_SUCCESS if the successful.
- *                  BTM_ILLEGAL_VALUE if there is an illegal sco_inx
+ * Returns          pointer to the device class
  *
  ******************************************************************************/
-tBTM_STATUS BTM_RegForEScoEvts(uint16_t sco_inx, tBTM_ESCO_CBACK* p_esco_cback);
+uint8_t* BTM_ReadDeviceClass(void);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadEScoLinkParms
- *
- * Description      This function returns the current eSCO link parameters for
- *                  the specified handle.  This can be called anytime a
- *                  connection is active, but is typically called after
- *                  receiving the SCO opened callback.
+ * Function         BTM_ReadLocalFeatures
  *
- *                  Note: If called over a 1.1 controller, only the packet types
- *                        field has meaning.
- *                  Note: If the upper layer doesn't know the current sco index,
- *                  BTM_FIRST_ACTIVE_SCO_INDEX can be used as the first
- *                  parameter to find the first active SCO index
+ * Description      This function is called to read the local features
  *
- * Returns          BTM_SUCCESS if returned data is valid connection.
- *                  BTM_ILLEGAL_VALUE if no connection for specified sco_inx.
- *                  BTM_MODE_UNSUPPORTED if local controller does not support
- *                      1.2 specification.
+ * Returns          pointer to the local features string
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadEScoLinkParms(uint16_t sco_inx, tBTM_ESCO_DATA* p_parms);
+uint8_t* BTM_ReadLocalFeatures(void);
 
 /*******************************************************************************
  *
- * Function         BTM_ChangeEScoLinkParms
- *
- * Description      This function requests renegotiation of the parameters on
- *                  the current eSCO Link.  If any of the changes are accepted
- *                  by the controllers, the BTM_ESCO_CHG_EVT event is sent in
- *                  the tBTM_ESCO_CBACK function with the current settings of
- *                  the link. The callback is registered through the call to
- *                  BTM_SetEScoMode.
+ * Function         BTM_RegisterForDeviceStatusNotif
  *
+ * Description      This function is called to register for device status
+ *                  change notifications.
  *
- * Returns          BTM_CMD_STARTED if command is successfully initiated.
- *                  BTM_ILLEGAL_VALUE if no connection for specified sco_inx.
- *                  BTM_NO_RESOURCES - not enough resources to initiate command.
- *                  BTM_MODE_UNSUPPORTED if local controller does not support
- *                      1.2 specification.
+ * Returns          pointer to previous caller's callback function or NULL if
+ *                  first registration.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ChangeEScoLinkParms(uint16_t sco_inx,
-                                    tBTM_CHG_ESCO_PARAMS* p_parms);
+tBTM_DEV_STATUS_CB* BTM_RegisterForDeviceStatusNotif(tBTM_DEV_STATUS_CB* p_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_EScoConnRsp
+ * Function         BTM_RegisterForVSEvents
  *
- * Description      This function is called upon receipt of an (e)SCO connection
- *                  request event (BTM_ESCO_CONN_REQ_EVT) to accept or reject
- *                  the request. Parameters used to negotiate eSCO links.
- *                  If p_parms is NULL, then values set through BTM_SetEScoMode
- *                  are used.
- *                  If the link type of the incoming request is SCO, then only
- *                  the tx_bw, max_latency, content format, and packet_types are
- *                  valid.  The hci_status parameter should be
- *                  ([0x0] to accept, [0x0d..0x0f] to reject)
+ * Description      This function is called to register/deregister for vendor
+ *                  specific HCI events.
  *
+ *                  If is_register=true, then the function will be registered;
+ *                  otherwise the function will be deregistered.
  *
- * Returns          void
+ * Returns          BTM_SUCCESS if successful,
+ *                  BTM_BUSY if maximum number of callbacks have already been
+ *                           registered.
  *
  ******************************************************************************/
-void BTM_EScoConnRsp(uint16_t sco_inx, uint8_t hci_status,
-                     enh_esco_params_t* p_parms);
+tBTM_STATUS BTM_RegisterForVSEvents(tBTM_VS_EVT_CB* p_cb, bool is_register);
 
 /*******************************************************************************
  *
- * Function         BTM_GetNumScoLinks
- *
- * Description      This function returns the number of active SCO links.
+ * Function         BTM_VendorSpecificCommand
  *
- * Returns          uint8_t
+ * Description      Send a vendor specific HCI command to the controller.
  *
  ******************************************************************************/
-uint8_t BTM_GetNumScoLinks(void);
+void BTM_VendorSpecificCommand(uint16_t opcode, uint8_t param_len,
+                               uint8_t* p_param_buf, tBTM_VSC_CMPL_CB* p_cb);
 
-/*****************************************************************************
- *  SECURITY MANAGEMENT FUNCTIONS
- ****************************************************************************/
 /*******************************************************************************
  *
- * Function         BTM_SecRegister
+ * Function         BTM_AllocateSCN
  *
- * Description      Application manager calls this function to register for
- *                  security services.  There can be one and only one
- *                  application saving link keys.  BTM allows only first
- *                  registration.
+ * Description      Look through the Server Channel Numbers for a free one to be
+ *                  used with an RFCOMM connection.
  *
- * Returns          true if registered OK, else false
+ * Returns          Allocated SCN number or 0 if none.
  *
  ******************************************************************************/
-bool BTM_SecRegister(const tBTM_APPL_INFO* p_cb_info);
+uint8_t BTM_AllocateSCN(void);
 
 /*******************************************************************************
  *
- * Function         BTM_SecRegisterLinkKeyNotificationCallback
+ * Function         BTM_TryAllocateSCN
  *
- * Description      Profiles can register to be notified when a new Link Key
- *                  is generated per connection.
+ * Description      Try to allocate a fixed server channel
  *
- * Returns          true if registered OK, else false
+ * Returns          Returns true if server channel was available
  *
  ******************************************************************************/
-bool BTM_SecRegisterLinkKeyNotificationCallback(
-    tBTM_LINK_KEY_CALLBACK* p_callback);
+bool BTM_TryAllocateSCN(uint8_t scn);
 
 /*******************************************************************************
  *
- * Function         BTM_SecAddRmtNameNotifyCallback
+ * Function         BTM_FreeSCN
  *
- * Description      Profiles can register to be notified when name of the
- *                  remote device is resolved (up to
- *                  BTM_SEC_MAX_RMT_NAME_CALLBACKS).
+ * Description      Free the specified SCN.
  *
- * Returns          true if registered OK, else false
+ * Returns          true if successful, false if SCN is not in use or invalid
  *
  ******************************************************************************/
-bool BTM_SecAddRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback);
+bool BTM_FreeSCN(uint8_t scn);
 
 /*******************************************************************************
  *
- * Function         BTM_SecDeleteRmtNameNotifyCallback
+ * Function         BTM_SetTraceLevel
  *
- * Description      A profile can deregister notification when a new Link Key
- *                  is generated per connection.
+ * Description      This function sets the trace level for BTM.  If called with
+ *                  a value of 0xFF, it simply returns the current trace level.
  *
- * Returns          true if OK, else false
+ * Returns          The new or current trace level
  *
  ******************************************************************************/
-bool BTM_SecDeleteRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback);
+uint8_t BTM_SetTraceLevel(uint8_t new_level);
 
 /*******************************************************************************
  *
- * Function         BTM_GetSecurityFlags
- *
- * Description      Get security flags for the device
+ * Function         BTM_WritePageTimeout
  *
- * Returns          bool    true or false is device found
+ * Description      Send HCI Wite Page Timeout.
  *
  ******************************************************************************/
-bool BTM_GetSecurityFlags(const RawAddress& bd_addr, uint8_t* p_sec_flags);
+void BTM_WritePageTimeout(uint16_t timeout);
 
 /*******************************************************************************
  *
- * Function         BTM_GetSecurityFlagsByTransport
- *
- * Description      Get security flags for the device on a particular transport
- *
- * Parameters      bd_addr: BD address of remote device
- *                  p_sec_flags : Out parameter to be filled with security
- *                                flags for the connection
- *                  transport :  Physical transport of the connection
- *                               (BR/EDR or LE)
+ * Function         BTM_WriteVoiceSettings
  *
- * Returns          bool    true or false is device found
+ * Description      Send HCI Write Voice Settings command.
+ *                  See hcidefs.h for settings bitmask values.
  *
  ******************************************************************************/
-bool BTM_GetSecurityFlagsByTransport(const RawAddress& bd_addr,
-                                     uint8_t* p_sec_flags,
-                                     tBT_TRANSPORT transport);
+void BTM_WriteVoiceSettings(uint16_t settings);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadTrustedMask
+ * Function         BTM_EnableTestMode
  *
- * Description      Get trusted mask for the device
+ * Description      Send HCI the enable device under test command.
+ *
+ *                  Note: Controller can only be taken out of this mode by
+ *                      resetting the controller.
+ *
+ * Returns
+ *      BTM_SUCCESS         Command sent.
+ *      BTM_NO_RESOURCES    If out of resources to send the command.
  *
- * Returns          NULL, if the device record is not found.
- *                  otherwise, the trusted mask
  *
  ******************************************************************************/
-uint32_t* BTM_ReadTrustedMask(const RawAddress& bd_addr);
+tBTM_STATUS BTM_EnableTestMode(void);
 
 /*******************************************************************************
  *
- * Function         BTM_SetPinType
+ * Function         BTM_ReadRemoteVersion
  *
- * Description      Set PIN type for the device.
+ * Description      This function is called to read a remote device's version
  *
- * Returns          void
+ * Returns          BTM_SUCCESS if successful, otherwise an error
  *
  ******************************************************************************/
-void BTM_SetPinType(uint8_t pin_type, PIN_CODE pin_code, uint8_t pin_code_len);
+tBTM_STATUS BTM_ReadRemoteVersion(const RawAddress& addr, uint8_t* lmp_version,
+                                  uint16_t* manufacturer,
+                                  uint16_t* lmp_sub_version);
 
 /*******************************************************************************
  *
- * Function         BTM_SetPairableMode
+ * Function         BTM_ReadRemoteFeatures
  *
- * Description      Enable or disable pairing
+ * Description      This function is called to read a remote device's
+ *                  supported features mask (features mask located at page 0)
  *
- * Parameters       allow_pairing - (true or false) whether or not the device
- *                      allows pairing.
- *                  connect_only_paired - (true or false) whether or not to
- *                      only allow paired devices to connect.
+ *                  Note: The size of device features mask page is
+ *                  BTM_FEATURE_BYTES_PER_PAGE bytes.
  *
- * Returns          void
+ * Returns          pointer to the remote supported features mask
  *
  ******************************************************************************/
-void BTM_SetPairableMode(bool allow_pairing, bool connect_only_paired);
+uint8_t* BTM_ReadRemoteFeatures(const RawAddress& addr);
 
 /*******************************************************************************
  *
- * Function         BTM_SetSecureConnectionsOnly
- *
- * Description      Enable or disable default treatment for Mode 4 Level 0
- *                  services
+ * Function         BTM_ReadRemoteExtendedFeatures
  *
- * Parameter        secure_connections_only_mode - (true or false)
- *                  true means that the device should treat Mode 4 Level 0
- *                  services as services of other levels.
- *                  false means that the device should provide default
- *                  treatment for Mode 4 Level 0 services.
+ * Description      This function is called to read a specific extended features
+ *                  page of the remote device
  *
- * Returns          void
+ *                  Note1: The size of device features mask page is
+ *                  BTM_FEATURE_BYTES_PER_PAGE bytes.
+ *                  Note2: The valid device features mask page number depends on
+ *                  the remote device capabilities. It is expected to be in the
+ *                  range [0 - BTM_EXT_FEATURES_PAGE_MAX].
+
+ * Returns          pointer to the remote extended features mask
+ *                  or NULL if page_number is not valid
  *
  ******************************************************************************/
-void BTM_SetSecureConnectionsOnly(bool secure_connections_only_mode);
+uint8_t* BTM_ReadRemoteExtendedFeatures(const RawAddress& addr,
+                                        uint8_t page_number);
 
 /*******************************************************************************
  *
- * Function         BTM_SetSecurityLevel
+ * Function         BTM_ReadNumberRemoteFeaturesPages
  *
- * Description      Register service security level with Security Manager.  Each
- *                  service must register its requirements regardless of the
- *                  security level that is used.  This API is called once for
- *                  originators and again for acceptors of connections.
+ * Description      This function is called to retrieve the number of feature
+ *                  pages read from the remote device
  *
- * Returns          true if registered OK, else false
+ * Returns          number of features pages read from the remote device
  *
  ******************************************************************************/
-bool BTM_SetSecurityLevel(bool is_originator, const char* p_name,
-                          uint8_t service_id, uint16_t sec_level, uint16_t psm,
-                          uint32_t mx_proto_id, uint32_t mx_chan_id);
+uint8_t BTM_ReadNumberRemoteFeaturesPages(const RawAddress& addr);
 
 /*******************************************************************************
  *
- * Function         BTM_SetOutService
+ * Function         BTM_ReadAllRemoteFeatures
  *
- * Description      This function is called to set the service for
- *                  outgoing connection.
+ * Description      Read all the features of the remote device
  *
- * Returns          void
+ * Returns          pointer to the byte[0] of the page[0] of the remote device
+ *                  feature mask.
+ *
+ * Note:            the function returns the pointer to the array of the size
+ *                  BTM_FEATURE_BYTES_PER_PAGE * (BTM_EXT_FEATURES_PAGE_MAX + 1)
  *
  ******************************************************************************/
-void BTM_SetOutService(const RawAddress& bd_addr, uint8_t service_id,
-                       uint32_t mx_chan_id);
+uint8_t* BTM_ReadAllRemoteFeatures(const RawAddress& addr);
 
+/*****************************************************************************
+ *  ACL CHANNEL MANAGEMENT FUNCTIONS
+ ****************************************************************************/
 /*******************************************************************************
  *
- * Function         BTM_SecClrService
+ * Function         BTM_SetLinkPolicy
  *
- * Description      Removes specified service record(s) from the security
- *                  database. All service records with the specified name are
- *                  removed. Typically used only by devices with limited RAM
- *                  so that it can reuse an old security service record.
+ * Description      Create and send HCI "Write Policy Set" command
  *
- * Returns          Number of records that were freed.
+ * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
  *
  ******************************************************************************/
-uint8_t BTM_SecClrService(uint8_t service_id);
+tBTM_STATUS BTM_SetLinkPolicy(const RawAddress& remote_bda, uint16_t* settings);
 
 /*******************************************************************************
  *
- * Function         BTM_SecAddDevice
+ * Function         BTM_SetDefaultLinkPolicy
  *
- * Description      Add/modify device.  This function will be normally called
- *                  during host startup to restore all required information
- *                  stored in the NVRAM.
- *                  dev_class, bd_name, link_key, and features are NULL if
- *                  unknown
+ * Description      Set the default value for HCI "Write Policy Set" command
+ *                  to use when an ACL link is created.
  *
- * Returns          true if added OK, else false
+ * Returns          void
  *
  ******************************************************************************/
-bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
-                      BD_NAME bd_name, uint8_t* features,
-                      uint32_t trusted_mask[], LinkKey* link_key,
-                      uint8_t key_type, tBTM_IO_CAP io_cap, uint8_t pin_length);
+void BTM_SetDefaultLinkPolicy(uint16_t settings);
 
-/** Free resources associated with the device associated with |bd_addr| address.
+/*******************************************************************************
  *
- * *** WARNING ***
- * tBTM_SEC_DEV_REC associated with bd_addr becomes invalid after this function
- * is called, also any of it's fields. i.e. if you use p_dev_rec->bd_addr, it is
- * no longer valid!
- * *** WARNING ***
+ * Function         BTM_SetDefaultLinkSuperTout
  *
- * Returns true if removed OK, false if not found or ACL link is active.
- */
-bool BTM_SecDeleteDevice(const RawAddress& bd_addr);
+ * Description      Set the default value for HCI "Write Link Supervision
+ *                  Timeout" command to use when an ACL link is created.
+ *
+ * Returns          void
+ *
+ ******************************************************************************/
+void BTM_SetDefaultLinkSuperTout(uint16_t timeout);
 
 /*******************************************************************************
  *
- * Function         BTM_SecClearSecurityFlags
+ * Function         BTM_SetLinkSuperTout
  *
- * Description      Reset the security flags (mark as not-paired) for a given
- *                  remove device.
+ * Description      Create and send HCI "Write Link Supervision Timeout" command
+ *
+ * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
  *
  ******************************************************************************/
-void BTM_SecClearSecurityFlags(const RawAddress& bd_addr);
-
+tBTM_STATUS BTM_SetLinkSuperTout(const RawAddress& remote_bda,
+                                 uint16_t timeout);
 /*******************************************************************************
  *
- * Function         BTM_SecGetDeviceLinkKey
+ * Function         BTM_GetLinkSuperTout
  *
- * Description      This function is called to obtain link key for the device
- *                  it returns BTM_SUCCESS if link key is available, or
- *                  BTM_UNKNOWN_ADDR if Security Manager does not know about
- *                  the device or device record does not contain link key info
+ * Description      Read the link supervision timeout value of the connection
  *
- * Returns          BTM_SUCCESS if successful, otherwise error code
+ * Returns          status of the operation
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SecGetDeviceLinkKey(const RawAddress& bd_addr,
-                                    LinkKey* link_key);
+tBTM_STATUS BTM_GetLinkSuperTout(const RawAddress& remote_bda,
+                                 uint16_t* p_timeout);
 
 /*******************************************************************************
  *
- * Function         BTM_SecGetDeviceLinkKeyType
+ * Function         BTM_IsAclConnectionUp
  *
- * Description      This function is called to obtain link key type for the
- *                  device.
- *                  it returns BTM_SUCCESS if link key is available, or
- *                  BTM_UNKNOWN_ADDR if Security Manager does not know about
- *                  the device or device record does not contain link key info
+ * Description      This function is called to check if an ACL connection exists
+ *                  to a specific remote BD Address.
  *
- * Returns          BTM_LKEY_TYPE_IGNORE if link key is unknown, link type
- *                  otherwise.
+ * Returns          true if connection is up, else false.
  *
  ******************************************************************************/
-tBTM_LINK_KEY_TYPE BTM_SecGetDeviceLinkKeyType(const RawAddress& bd_addr);
+bool BTM_IsAclConnectionUp(const RawAddress& remote_bda,
+                           tBT_TRANSPORT transport);
 
 /*******************************************************************************
  *
- * Function         BTM_PINCodeReply
- *
- * Description      This function is called after Security Manager submitted
- *                  PIN code request to the UI.
+ * Function         BTM_GetRole
  *
- * Parameters:      bd_addr      - Address of the device for which PIN was
- *                                 requested
- *                  res          - result of the operation BTM_SUCCESS if
- *                                 success
- *                  pin_len      - length in bytes of the PIN Code
- *                  p_pin        - pointer to array with the PIN Code
- *                  trusted_mask - bitwise OR of trusted services
- *                                 (array of uint32_t)
+ * Description      This function is called to get the role of the local device
+ *                  for the ACL connection with the specified remote device
  *
- * Returns          void
+ * Returns          BTM_SUCCESS if connection exists.
+ *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
  *
  ******************************************************************************/
-void BTM_PINCodeReply(const RawAddress& bd_addr, uint8_t res, uint8_t pin_len,
-                      uint8_t* p_pin, uint32_t trusted_mask[]);
+tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, uint8_t* p_role);
 
 /*******************************************************************************
  *
- * Function         BTM_SecBond
+ * Function         BTM_SwitchRole
  *
- * Description      This function is called to perform bonding with peer device.
+ * Description      This function is called to switch role between master and
+ *                  slave.  If role is already set it will do nothing.  If the
+ *                  command was initiated, the callback function is called upon
+ *                  completion.
  *
- * Parameters:      bd_addr      - Address of the device to bond
- *                  pin_len      - length in bytes of the PIN Code
- *                  p_pin        - pointer to array with the PIN Code
- *                  trusted_mask - bitwise OR of trusted services
- *                                 (array of uint32_t)
- * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
+ * Returns          BTM_SUCCESS if already in specified role.
+ *                  BTM_CMD_STARTED if command issued to controller.
+ *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
+ *                                   the command
+ *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
+ *                  BTM_MODE_UNSUPPORTED if the local device does not support
+ *                                       role switching
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, uint8_t pin_len,
-                        uint8_t* p_pin, uint32_t trusted_mask[]);
+tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role,
+                           tBTM_CMPL_CB* p_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_SecBondByTransport
- *
- * Description      Perform bonding by designated transport
+ * Function         BTM_ReadRSSI
  *
- * Parameters:      bd_addr      - Address of the device to bond
- *                  pin_len      - length in bytes of the PIN Code
- *                  p_pin        - pointer to array with the PIN Code
- *                  trusted_mask - bitwise OR of trusted services
- *                                 (array of uint32_t)
- *                  transport :  Physical transport to use for bonding
- *                               (BR/EDR or LE)
+ * Description      This function is called to read the link policy settings.
+ *                  The address of link policy results are returned in the
+ *                  callback. (tBTM_RSSI_RESULT)
  *
- * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
+ * Returns          BTM_CMD_STARTED if command issued to controller.
+ *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
+ *                                   the command
+ *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
+ *                  BTM_BUSY if command is already in progress
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SecBondByTransport(const RawAddress& bd_addr,
-                                   tBT_TRANSPORT transport, uint8_t pin_len,
-                                   uint8_t* p_pin, uint32_t trusted_mask[]);
+tBTM_STATUS BTM_ReadRSSI(const RawAddress& remote_bda, tBTM_CMPL_CB* p_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_SecBondCancel
+ * Function         BTM_ReadFailedContactCounter
  *
- * Description      This function is called to cancel ongoing bonding process
- *                  with peer device.
+ * Description      This function is called to read the failed contact counter.
+ *                  The result is returned in the callback.
+ *                  (tBTM_FAILED_CONTACT_COUNTER_RESULT)
  *
- * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
+ * Returns          BTM_CMD_STARTED if command issued to controller.
+ *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
+ *                                   the command
+ *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
+ *                  BTM_BUSY if command is already in progress
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SecBondCancel(const RawAddress& bd_addr);
+tBTM_STATUS BTM_ReadFailedContactCounter(const RawAddress& remote_bda,
+                                         tBTM_CMPL_CB* p_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_SetEncryption
- *
- * Description      This function is called to ensure that connection is
- *                  encrypted.  Should be called only on an open connection.
- *                  Typically only needed for connections that first want to
- *                  bring up unencrypted links, then later encrypt them.
+ * Function         BTM_ReadAutomaticFlushTimeout
  *
- * Parameters:      bd_addr       - Address of the peer device
- *                  transport     - Link transport
- *                  p_callback    - Pointer to callback function called if
- *                                  this function returns PENDING after required
- *                                  procedures are completed.  Can be set to
- *                                  NULL if status is not desired.
- *                  p_ref_data    - pointer to any data the caller wishes to
- *                                  receive in the callback function upon
- *                                  completion.
- *                                  can be set to NULL if not used.
- *                  sec_act       - LE security action, unused for BR/EDR
+ * Description      This function is called to read the automatic flush timeout.
+ *                  The result is returned in the callback.
+ *                  (tBTM_AUTOMATIC_FLUSH_TIMEOUT_RESULT)
  *
- * Returns          BTM_SUCCESS   - already encrypted
- *                  BTM_PENDING   - command will be returned in the callback
- *                  BTM_WRONG_MODE- connection not up.
- *                  BTM_BUSY      - security procedures are currently active
- *                  BTM_MODE_UNSUPPORTED - if security manager not linked in.
+ * Returns          BTM_CMD_STARTED if command issued to controller.
+ *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
+ *                                   the command
+ *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
+ *                  BTM_BUSY if command is already in progress
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr,
-                              tBT_TRANSPORT transport,
-                              tBTM_SEC_CBACK* p_callback, void* p_ref_data,
-                              tBTM_BLE_SEC_ACT sec_act);
+tBTM_STATUS BTM_ReadAutomaticFlushTimeout(const RawAddress& remote_bda,
+                                          tBTM_CMPL_CB* p_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_ConfirmReqReply
+ * Function         BTM_ReadTxPower
  *
- * Description      This function is called to confirm the numeric value for
- *                  Simple Pairing in response to BTM_SP_CFM_REQ_EVT
+ * Description      This function is called to read the current connection
+ *                  TX power of the connection. The TX power level results
+ *                  are returned in the callback.
+ *                  (tBTM_RSSI_RESULT)
  *
- * Parameters:      res           - result of the operation BTM_SUCCESS if
- *                                  success
- *                  bd_addr       - Address of the peer device
+ * Returns          BTM_CMD_STARTED if command issued to controller.
+ *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
+ *                                   the command
+ *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
+ *                  BTM_BUSY if command is already in progress
  *
  ******************************************************************************/
-void BTM_ConfirmReqReply(tBTM_STATUS res, const RawAddress& bd_addr);
+tBTM_STATUS BTM_ReadTxPower(const RawAddress& remote_bda,
+                            tBT_TRANSPORT transport, tBTM_CMPL_CB* p_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_PasskeyReqReply
+ * Function         BTM_ReadLinkQuality
  *
- * Description      This function is called to provide the passkey for
- *                  Simple Pairing in response to BTM_SP_KEY_REQ_EVT
+ * Description      This function is called to read the link quality.
+ *                  The value of the link quality is returned in the callback.
+ *                  (tBTM_LINK_QUALITY_RESULT)
  *
- * Parameters:      res           - result of the operation BTM_SUCCESS if
- *                                  success
- *                  bd_addr       - Address of the peer device
- *                  passkey       - numeric value in the range of
- *                                  0 - 999999(0xF423F).
+ * Returns          BTM_CMD_STARTED if command issued to controller.
+ *                  BTM_NO_RESOURCES if memory couldn't be allocated to issue
+ *                                   the command
+ *                  BTM_UNKNOWN_ADDR if no active link with bd addr specified
+ *                  BTM_BUSY if command is already in progress
  *
  ******************************************************************************/
-void BTM_PasskeyReqReply(tBTM_STATUS res, const RawAddress& bd_addr,
-                         uint32_t passkey);
+tBTM_STATUS BTM_ReadLinkQuality(const RawAddress& remote_bda,
+                                tBTM_CMPL_CB* p_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_SendKeypressNotif
+ * Function         BTM_RegBusyLevelNotif
  *
- * Description      This function is used during the passkey entry model
- *                  by a device with KeyboardOnly IO capabilities
- *                  (very likely to be a HID Device).
- *                  It is called by a HID Device to inform the remote device
- *                  when a key has been entered or erased.
+ * Description      This function is called to register a callback to receive
+ *                  busy level change events.
  *
- * Parameters:      bd_addr - Address of the peer device
- *                  type - notification type
+ * Returns          BTM_SUCCESS if successfully registered, otherwise error
  *
  ******************************************************************************/
-void BTM_SendKeypressNotif(const RawAddress& bd_addr, tBTM_SP_KEY_TYPE type);
+tBTM_STATUS BTM_RegBusyLevelNotif(tBTM_BL_CHANGE_CB* p_cb, uint8_t* p_level,
+                                  tBTM_BL_EVENT_MASK evt_mask);
 
 /*******************************************************************************
  *
- * Function         BTM_IoCapRsp
+ * Function         BTM_AclRegisterForChanges
  *
- * Description      This function is called in response to BTM_SP_IO_REQ_EVT
- *                  When the event data io_req.oob_data is set to
- *                  BTM_OOB_UNKNOWN by the tBTM_SP_CALLBACK implementation, this
- *                  function is called to provide the actual response
+ * Description      This function is called to register a callback to receive
+ *                  ACL database change events, i.e. new connection or removed.
  *
- * Parameters:      bd_addr - Address of the peer device
- *                  io_cap  - The IO capability of local device.
- *                  oob     - BTM_OOB_NONE or BTM_OOB_PRESENT.
- *                  auth_req- MITM protection required or not.
+ * Returns          BTM_SUCCESS if successfully initiated, otherwise error
  *
  ******************************************************************************/
-void BTM_IoCapRsp(const RawAddress& bd_addr, tBTM_IO_CAP io_cap,
-                  tBTM_OOB_DATA oob, tBTM_AUTH_REQ auth_req);
+tBTM_STATUS BTM_AclRegisterForChanges(tBTM_ACL_DB_CHANGE_CB* p_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadLocalOobData
+ * Function         BTM_GetNumAclLinks
  *
- * Description      This function is called to read the local OOB data from
- *                  LM
+ * Description      This function is called to count the number of
+ *                  ACL links that are active.
+ *
+ * Returns          uint16_t Number of active ACL links
  *
  ******************************************************************************/
-void BTM_ReadLocalOobData(void);
+uint16_t BTM_GetNumAclLinks(void);
 
 /*******************************************************************************
  *
- * Function         BTM_RemoteOobDataReply
+ * Function         BTM_SetQoS
  *
- * Description      This function is called to provide the remote OOB data for
- *                  Simple Pairing in response to BTM_SP_RMT_OOB_EVT
+ * Description      This function is called to setup QoS
  *
- * Parameters:      bd_addr     - Address of the peer device
- *                  c           - simple pairing Hash C.
- *                  r           - simple pairing Randomizer  C.
+ * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
  *
  ******************************************************************************/
-void BTM_RemoteOobDataReply(tBTM_STATUS res, const RawAddress& bd_addr,
-                            const Octet16& c, const Octet16& r);
+tBTM_STATUS BTM_SetQoS(const RawAddress& bd, FLOW_SPEC* p_flow,
+                       tBTM_CMPL_CB* p_cb);
 
+/*****************************************************************************
+ *  (e)SCO CHANNEL MANAGEMENT FUNCTIONS
+ ****************************************************************************/
 /*******************************************************************************
  *
- * Function         BTM_BuildOobData
- *
- * Description      This function is called to build the OOB data payload to
- *                  be sent over OOB (non-Bluetooth) link
+ * Function         BTM_CreateSco
  *
- * Parameters:      p_data  - the location for OOB data
- *                  max_len - p_data size.
- *                  c       - simple pairing Hash C.
- *                  r       - simple pairing Randomizer  C.
- *                  name_len- 0, local device name would not be included.
- *                            otherwise, the local device name is included for
- *                            up to this specified length
+ * Description      This function is called to create an SCO connection. If the
+ *                  "is_orig" flag is true, the connection will be originated,
+ *                  otherwise BTM will wait for the other side to connect.
  *
- * Returns          Number of bytes in p_data.
+ * Returns          BTM_UNKNOWN_ADDR if the ACL connection is not up
+ *                  BTM_BUSY         if another SCO being set up to
+ *                                   the same BD address
+ *                  BTM_NO_RESOURCES if the max SCO limit has been reached
+ *                  BTM_CMD_STARTED  if the connection establishment is started.
+ *                                   In this case, "*p_sco_inx" is filled in
+ *                                   with the sco index used for the connection.
  *
  ******************************************************************************/
-uint16_t BTM_BuildOobData(uint8_t* p_data, uint16_t max_len, const Octet16& c,
-                          const Octet16& r, uint8_t name_len);
+tBTM_STATUS BTM_CreateSco(const RawAddress* remote_bda, bool is_orig,
+                          uint16_t pkt_types, uint16_t* p_sco_inx,
+                          tBTM_SCO_CB* p_conn_cb, tBTM_SCO_CB* p_disc_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_BothEndsSupportSecureConnections
- *
- * Description      This function is called to check if both the local device
- *                  and the peer device specified by bd_addr support BR/EDR
- *                  Secure Connections.
+ * Function         BTM_RemoveSco
  *
- * Parameters:      bd_addr - address of the peer
+ * Description      This function is called to remove a specific SCO connection.
  *
- * Returns          true if BR/EDR Secure Connections are supported by both
- *                  local and the remote device.
- *                  else false.
+ * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
  *
  ******************************************************************************/
-bool BTM_BothEndsSupportSecureConnections(const RawAddress& bd_addr);
+tBTM_STATUS BTM_RemoveSco(uint16_t sco_inx);
 
 /*******************************************************************************
  *
- * Function         BTM_PeerSupportsSecureConnections
+ * Function         BTM_SetScoPacketTypes
  *
- * Description      This function is called to check if the peer supports
- *                  BR/EDR Secure Connections.
+ * Description      This function is called to set the packet types used for
+ *                  a specific SCO connection,
  *
- * Parameters:      bd_addr - address of the peer
+ * Parameters       pkt_types - One or more of the following
+ *                  BTM_SCO_PKT_TYPES_MASK_HV1
+ *                  BTM_SCO_PKT_TYPES_MASK_HV2
+ *                  BTM_SCO_PKT_TYPES_MASK_HV3
+ *                  BTM_SCO_PKT_TYPES_MASK_EV3
+ *                  BTM_SCO_PKT_TYPES_MASK_EV4
+ *                  BTM_SCO_PKT_TYPES_MASK_EV5
  *
- * Returns          true if BR/EDR Secure Connections are supported by the peer,
- *                  else false.
+ *                  BTM_SCO_LINK_ALL_MASK   - enables all supported types
+ *
+ * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
  *
  ******************************************************************************/
-bool BTM_PeerSupportsSecureConnections(const RawAddress& bd_addr);
+tBTM_STATUS BTM_SetScoPacketTypes(uint16_t sco_inx, uint16_t pkt_types);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadOobData
+ * Function         BTM_ReadScoPacketTypes
  *
- * Description      This function is called to parse the OOB data payload
- *                  received over OOB (non-Bluetooth) link
+ * Description      This function is read the packet types used for a specific
+ *                  SCO connection.
  *
- * Parameters:      p_data  - the location for OOB data
- *                  eir_tag - The associated EIR tag to read the data.
- *                  *p_len(output) - the length of the data with the given tag.
+ * Returns       One or more of the following (bitmask)
+ *                  BTM_SCO_PKT_TYPES_MASK_HV1
+ *                  BTM_SCO_PKT_TYPES_MASK_HV2
+ *                  BTM_SCO_PKT_TYPES_MASK_HV3
+ *                  BTM_SCO_PKT_TYPES_MASK_EV3
+ *                  BTM_SCO_PKT_TYPES_MASK_EV4
+ *                  BTM_SCO_PKT_TYPES_MASK_EV5
  *
- * Returns          the beginning of the data with the given tag.
- *                  NULL, if the tag is not found.
+ * Returns          packet types supported for the connection
  *
  ******************************************************************************/
-uint8_t* BTM_ReadOobData(uint8_t* p_data, uint8_t eir_tag, uint8_t* p_len);
+uint16_t BTM_ReadScoPacketTypes(uint16_t sco_inx);
 
 /*******************************************************************************
  *
- * Function         BTM_SecReadDevName
+ * Function         BTM_ReadDeviceScoPacketTypes
  *
- * Description      Looks for the device name in the security database for the
- *                  specified BD address.
+ * Description      This function is read the SCO packet types that
+ *                  the device supports.
  *
- * Returns          Pointer to the name or NULL
+ * Returns          packet types supported by the device.
  *
  ******************************************************************************/
-char* BTM_SecReadDevName(const RawAddress& bd_addr);
+uint16_t BTM_ReadDeviceScoPacketTypes(void);
 
-/*****************************************************************************
- *  POWER MANAGEMENT FUNCTIONS
- ****************************************************************************/
 /*******************************************************************************
  *
- * Function         BTM_PmRegister
+ * Function         BTM_ReadScoHandle
  *
- * Description      register or deregister with power manager
+ * Description      Reead the HCI handle used for a specific SCO connection,
  *
- * Returns          BTM_SUCCESS if successful,
- *                  BTM_NO_RESOURCES if no room to hold registration
- *                  BTM_ILLEGAL_VALUE
+ * Returns          handle for the connection, or 0xFFFF if invalid SCO index.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_PmRegister(uint8_t mask, uint8_t* p_pm_id,
-                           tBTM_PM_STATUS_CBACK* p_cb);
+uint16_t BTM_ReadScoHandle(uint16_t sco_inx);
 
 /*******************************************************************************
  *
- * Function         BTM_SetPowerMode
+ * Function         BTM_ReadScoBdAddr
  *
- * Description      store the mode in control block or
- *                  alter ACL connection behavior.
+ * Description      This function is read the remote BD Address for a specific
+ *                  SCO connection,
  *
- * Returns          BTM_SUCCESS if successful,
- *                  BTM_UNKNOWN_ADDR if bd addr is not active or bad
+ * Returns          pointer to BD address or NULL if not known
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetPowerMode(uint8_t pm_id, const RawAddress& remote_bda,
-                             const tBTM_PM_PWR_MD* p_mode);
+const RawAddress* BTM_ReadScoBdAddr(uint16_t sco_inx);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadPowerMode
- *
- * Description      This returns the current mode for a specific
- *                  ACL connection.
- *
- * Input Param      remote_bda - device address of desired ACL connection
+ * Function         BTM_ReadScoDiscReason
  *
- * Output Param     p_mode - address where the current mode is copied into.
- *                          BTM_ACL_MODE_NORMAL
- *                          BTM_ACL_MODE_HOLD
- *                          BTM_ACL_MODE_SNIFF
- *                          BTM_ACL_MODE_PARK
- *                          (valid only if return code is BTM_SUCCESS)
+ * Description      This function is returns the reason why an (e)SCO connection
+ *                  has been removed. It contains the value until read, or until
+ *                  another (e)SCO connection has disconnected.
  *
- * Returns          BTM_SUCCESS if successful,
- *                  BTM_UNKNOWN_ADDR if bd addr is not active or bad
+ * Returns          HCI reason or BTM_INVALID_SCO_DISC_REASON if not set.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ReadPowerMode(const RawAddress& remote_bda,
-                              tBTM_PM_MODE* p_mode);
+uint16_t BTM_ReadScoDiscReason(void);
 
 /*******************************************************************************
  *
- * Function         BTM_SetSsrParams
- *
- * Description      This sends the given SSR parameters for the given ACL
- *                  connection if it is in ACTIVE mode.
- *
- * Input Param      remote_bda - device address of desired ACL connection
- *                  max_lat    - maximum latency (in 0.625ms)(0-0xFFFE)
- *                  min_rmt_to - minimum remote timeout
- *                  min_loc_to - minimum local timeout
+ * Function         BTM_SetEScoMode
  *
+ * Description      This function sets up the negotiated parameters for SCO or
+ *                  eSCO, and sets as the default mode used for calls to
+ *                  BTM_CreateSco.  It can be called only when there are no
+ *                  active (e)SCO links.
  *
- * Returns          BTM_SUCCESS if the HCI command is issued successful,
- *                  BTM_UNKNOWN_ADDR if bd addr is not active or bad
- *                  BTM_CMD_STORED if the command is stored
+ * Returns          BTM_SUCCESS if the successful.
+ *                  BTM_BUSY if there are one or more active (e)SCO links.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_SetSsrParams(const RawAddress& remote_bda, uint16_t max_lat,
-                             uint16_t min_rmt_to, uint16_t min_loc_to);
+tBTM_STATUS BTM_SetEScoMode(enh_esco_params_t* p_parms);
 
 /*******************************************************************************
  *
- * Function         BTM_GetHCIConnHandle
+ * Function         BTM_SetWBSCodec
  *
- * Description      This function is called to get the handle for an ACL
- *                  connection to a specific remote BD Address.
+ * Description      This function sends command to the controller to setup
+ *                  WBS codec for the upcoming eSCO connection.
+ *
+ * Returns          BTM_SUCCESS.
  *
- * Returns          the handle of the connection, or 0xFFFF if none.
  *
  ******************************************************************************/
-uint16_t BTM_GetHCIConnHandle(const RawAddress& remote_bda,
-                              tBT_TRANSPORT transport);
+tBTM_STATUS BTM_SetWBSCodec(tBTM_SCO_CODEC_TYPE codec_type);
 
 /*******************************************************************************
  *
- * Function         BTM_DeleteStoredLinkKey
+ * Function         BTM_RegForEScoEvts
  *
- * Description      This function is called to delete link key for the specified
- *                  device addresses from the NVRAM storage attached to the
- *                  Bluetooth controller.
+ * Description      This function registers a SCO event callback with the
+ *                  specified instance.  It should be used to received
+ *                  connection indication events and change of link parameter
+ *                  events.
  *
- * Parameters:      bd_addr      - Addresses of the devices
- *                  p_cb         - Call back function to be called to return
- *                                 the results
+ * Returns          BTM_SUCCESS if the successful.
+ *                  BTM_ILLEGAL_VALUE if there is an illegal sco_inx
  *
  ******************************************************************************/
-tBTM_STATUS BTM_DeleteStoredLinkKey(const RawAddress* bd_addr,
-                                    tBTM_CMPL_CB* p_cb);
+tBTM_STATUS BTM_RegForEScoEvts(uint16_t sco_inx, tBTM_ESCO_CBACK* p_esco_cback);
 
 /*******************************************************************************
  *
- * Function         BTM_WriteEIR
+ * Function         BTM_ReadEScoLinkParms
  *
- * Description      This function is called to write EIR data to controller.
+ * Description      This function returns the current eSCO link parameters for
+ *                  the specified handle.  This can be called anytime a
+ *                  connection is active, but is typically called after
+ *                  receiving the SCO opened callback.
  *
- * Parameters       p_buff - allocated HCI command buffer including extended
- *                           inquriry response
+ *                  Note: If called over a 1.1 controller, only the packet types
+ *                        field has meaning.
+ *                  Note: If the upper layer doesn't know the current sco index,
+ *                  BTM_FIRST_ACTIVE_SCO_INDEX can be used as the first
+ *                  parameter to find the first active SCO index
  *
- * Returns          BTM_SUCCESS  - if successful
- *                  BTM_MODE_UNSUPPORTED - if local device cannot support it
+ * Returns          BTM_SUCCESS if returned data is valid connection.
+ *                  BTM_ILLEGAL_VALUE if no connection for specified sco_inx.
+ *                  BTM_MODE_UNSUPPORTED if local controller does not support
+ *                      1.2 specification.
  *
  ******************************************************************************/
-tBTM_STATUS BTM_WriteEIR(BT_HDR* p_buff);
+tBTM_STATUS BTM_ReadEScoLinkParms(uint16_t sco_inx, tBTM_ESCO_DATA* p_parms);
 
 /*******************************************************************************
  *
- * Function         BTM_HasEirService
+ * Function         BTM_ChangeEScoLinkParms
  *
- * Description      This function is called to know if UUID in bit map of UUID.
+ * Description      This function requests renegotiation of the parameters on
+ *                  the current eSCO Link.  If any of the changes are accepted
+ *                  by the controllers, the BTM_ESCO_CHG_EVT event is sent in
+ *                  the tBTM_ESCO_CBACK function with the current settings of
+ *                  the link. The callback is registered through the call to
+ *                  BTM_SetEScoMode.
  *
- * Parameters       p_eir_uuid - bit map of UUID list
- *                  uuid16 - UUID 16-bit
  *
- * Returns          true - if found
- *                  false - if not found
+ * Returns          BTM_CMD_STARTED if command is successfully initiated.
+ *                  BTM_ILLEGAL_VALUE if no connection for specified sco_inx.
+ *                  BTM_NO_RESOURCES - not enough resources to initiate command.
+ *                  BTM_MODE_UNSUPPORTED if local controller does not support
+ *                      1.2 specification.
  *
  ******************************************************************************/
-bool BTM_HasEirService(const uint32_t* p_eir_uuid, uint16_t uuid16);
+tBTM_STATUS BTM_ChangeEScoLinkParms(uint16_t sco_inx,
+                                    tBTM_CHG_ESCO_PARAMS* p_parms);
 
 /*******************************************************************************
  *
- * Function         BTM_HasInquiryEirService
+ * Function         BTM_EScoConnRsp
  *
- * Description      Return if a UUID is in the bit map of a UUID list.
+ * Description      This function is called upon receipt of an (e)SCO connection
+ *                  request event (BTM_ESCO_CONN_REQ_EVT) to accept or reject
+ *                  the request. Parameters used to negotiate eSCO links.
+ *                  If p_parms is NULL, then values set through BTM_SetEScoMode
+ *                  are used.
+ *                  If the link type of the incoming request is SCO, then only
+ *                  the tx_bw, max_latency, content format, and packet_types are
+ *                  valid.  The hci_status parameter should be
+ *                  ([0x0] to accept, [0x0d..0x0f] to reject)
  *
- * Parameters       p_results - inquiry results
- *                  uuid16 - UUID 16-bit
  *
- * Returns          BTM_EIR_FOUND - if found
- *                  BTM_EIR_NOT_FOUND - if not found and it is a complete list
- *                  BTM_EIR_UNKNOWN - if not found and it is not complete list
+ * Returns          void
  *
  ******************************************************************************/
-tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService(tBTM_INQ_RESULTS* p_results,
-                                                uint16_t uuid16);
+void BTM_EScoConnRsp(uint16_t sco_inx, uint8_t hci_status,
+                     enh_esco_params_t* p_parms);
 
 /*******************************************************************************
  *
- * Function         BTM_AddEirService
- *
- * Description      This function is called to add a service in the bit map UUID
- *                  list.
+ * Function         BTM_GetNumScoLinks
  *
- * Parameters       p_eir_uuid - bit mask of UUID list for EIR
- *                  uuid16 - UUID 16-bit
+ * Description      This function returns the number of active SCO links.
  *
- * Returns          None
+ * Returns          uint8_t
  *
  ******************************************************************************/
-void BTM_AddEirService(uint32_t* p_eir_uuid, uint16_t uuid16);
+uint8_t BTM_GetNumScoLinks(void);
 
+/*****************************************************************************
+ *  SECURITY MANAGEMENT FUNCTIONS
+ ****************************************************************************/
 /*******************************************************************************
  *
- * Function         BTM_RemoveEirService
- *
- * Description      This function is called to remove a service from the bit map
- *                  UUID list.
+ * Function         BTM_SecRegister
  *
- * Parameters       p_eir_uuid - bit mask of UUID list for EIR
- *                  uuid16 - UUID 16-bit
+ * Description      Application manager calls this function to register for
+ *                  security services.  There can be one and only one
+ *                  application saving link keys.  BTM allows only first
+ *                  registration.
  *
- * Returns          None
+ * Returns          true if registered OK, else false
  *
  ******************************************************************************/
-void BTM_RemoveEirService(uint32_t* p_eir_uuid, uint16_t uuid16);
+bool BTM_SecRegister(const tBTM_APPL_INFO* p_cb_info);
 
 /*******************************************************************************
  *
- * Function         BTM_GetEirSupportedServices
+ * Function         BTM_SecRegisterLinkKeyNotificationCallback
  *
- * Description      This function is called to get UUID list from bit map UUID
- *                  list.
+ * Description      Profiles can register to be notified when a new Link Key
+ *                  is generated per connection.
  *
- * Parameters       p_eir_uuid - bit mask of UUID list for EIR
- *                  p - reference of current pointer of EIR
- *                  max_num_uuid16 - max number of UUID can be written in EIR
- *                  num_uuid16 - number of UUID have been written in EIR
+ * Returns          true if registered OK, else false
  *
- * Returns          BTM_EIR_MORE_16BITS_UUID_TYPE, if it has more than max
- *                  BTM_EIR_COMPLETE_16BITS_UUID_TYPE, otherwise
+ ******************************************************************************/
+bool BTM_SecRegisterLinkKeyNotificationCallback(
+    tBTM_LINK_KEY_CALLBACK* p_callback);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SecAddRmtNameNotifyCallback
+ *
+ * Description      Profiles can register to be notified when name of the
+ *                  remote device is resolved (up to
+ *                  BTM_SEC_MAX_RMT_NAME_CALLBACKS).
+ *
+ * Returns          true if registered OK, else false
  *
  ******************************************************************************/
-uint8_t BTM_GetEirSupportedServices(uint32_t* p_eir_uuid, uint8_t** p,
-                                    uint8_t max_num_uuid16,
-                                    uint8_t* p_num_uuid16);
+bool BTM_SecAddRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback);
 
 /*******************************************************************************
  *
- * Function         BTM_GetEirUuidList
+ * Function         BTM_SecDeleteRmtNameNotifyCallback
  *
- * Description      This function parses EIR and returns UUID list.
+ * Description      A profile can deregister notification when a new Link Key
+ *                  is generated per connection.
  *
- * Parameters       p_eir - EIR
- *                  eirl_len - EIR len
- *                  uuid_size - Uuid::kNumBytes16, Uuid::kNumBytes32,
- *                              Uuid::kNumBytes128
- *                  p_num_uuid - return number of UUID in found list
- *                  p_uuid_list - return UUID 16-bit list
- *                  max_num_uuid - maximum number of UUID to be returned
+ * Returns          true if OK, else false
  *
- * Returns          0 - if not found
- *                  BTM_EIR_COMPLETE_16BITS_UUID_TYPE
- *                  BTM_EIR_MORE_16BITS_UUID_TYPE
- *                  BTM_EIR_COMPLETE_32BITS_UUID_TYPE
- *                  BTM_EIR_MORE_32BITS_UUID_TYPE
- *                  BTM_EIR_COMPLETE_128BITS_UUID_TYPE
- *                  BTM_EIR_MORE_128BITS_UUID_TYPE
+ ******************************************************************************/
+bool BTM_SecDeleteRmtNameNotifyCallback(tBTM_RMT_NAME_CALLBACK* p_callback);
+
+/*******************************************************************************
+ *
+ * Function         BTM_GetSecurityFlags
+ *
+ * Description      Get security flags for the device
+ *
+ * Returns          bool    true or false is device found
  *
  ******************************************************************************/
-uint8_t BTM_GetEirUuidList(uint8_t* p_eir, size_t eir_len, uint8_t uuid_size,
-                           uint8_t* p_num_uuid, uint8_t* p_uuid_list,
-                           uint8_t max_num_uuid);
+bool BTM_GetSecurityFlags(const RawAddress& bd_addr, uint8_t* p_sec_flags);
 
-/*****************************************************************************
- *  SCO OVER HCI
- ****************************************************************************/
 /*******************************************************************************
  *
- * Function         BTM_ConfigScoPath
+ * Function         BTM_GetSecurityFlagsByTransport
  *
- * Description      This function enable/disable SCO over HCI and registers SCO
- *                  data callback if SCO over HCI is enabled.
+ * Description      Get security flags for the device on a particular transport
  *
- * Parameter        path: SCO or HCI
- *                  p_sco_data_cb: callback function or SCO data if path is set
- *                                 to transport.
- *                  p_pcm_param: pointer to the PCM interface parameter. If a
- *                               NULL pointer is used, the PCM parameter
- *                               maintained in the control block will be used;
- *                               otherwise update the control block value.
- *                  err_data_rpt: Lisbon feature to enable the erronous data
- *                                report or not.
+ * Parameters      bd_addr: BD address of remote device
+ *                  p_sec_flags : Out parameter to be filled with security
+ *                                flags for the connection
+ *                  transport :  Physical transport of the connection
+ *                               (BR/EDR or LE)
  *
- * Returns          BTM_SUCCESS if the successful.
- *                  BTM_NO_RESOURCES: no rsource to start the command.
- *                  BTM_ILLEGAL_VALUE: invalid callback function pointer.
- *                  BTM_CMD_STARTED : Command sent. Waiting for command
- *                                    complete event.
+ * Returns          bool    true or false is device found
+ *
+ ******************************************************************************/
+bool BTM_GetSecurityFlagsByTransport(const RawAddress& bd_addr,
+                                     uint8_t* p_sec_flags,
+                                     tBT_TRANSPORT transport);
+
+/*******************************************************************************
+ *
+ * Function         BTM_ReadTrustedMask
+ *
+ * Description      Get trusted mask for the device
  *
+ * Returns          NULL, if the device record is not found.
+ *                  otherwise, the trusted mask
  *
  ******************************************************************************/
-tBTM_STATUS BTM_ConfigScoPath(esco_data_path_t path,
-                              tBTM_SCO_DATA_CB* p_sco_data_cb,
-                              tBTM_SCO_PCM_PARAM* p_pcm_param,
-                              bool err_data_rpt);
+uint32_t* BTM_ReadTrustedMask(const RawAddress& bd_addr);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SetPinType
+ *
+ * Description      Set PIN type for the device.
+ *
+ * Returns          void
+ *
+ ******************************************************************************/
+void BTM_SetPinType(uint8_t pin_type, PIN_CODE pin_code, uint8_t pin_code_len);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SetPairableMode
+ *
+ * Description      Enable or disable pairing
+ *
+ * Parameters       allow_pairing - (true or false) whether or not the device
+ *                      allows pairing.
+ *                  connect_only_paired - (true or false) whether or not to
+ *                      only allow paired devices to connect.
+ *
+ * Returns          void
+ *
+ ******************************************************************************/
+void BTM_SetPairableMode(bool allow_pairing, bool connect_only_paired);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SetSecureConnectionsOnly
+ *
+ * Description      Enable or disable default treatment for Mode 4 Level 0
+ *                  services
+ *
+ * Parameter        secure_connections_only_mode - (true or false)
+ *                  true means that the device should treat Mode 4 Level 0
+ *                  services as services of other levels.
+ *                  false means that the device should provide default
+ *                  treatment for Mode 4 Level 0 services.
+ *
+ * Returns          void
+ *
+ ******************************************************************************/
+void BTM_SetSecureConnectionsOnly(bool secure_connections_only_mode);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SetSecurityLevel
+ *
+ * Description      Register service security level with Security Manager.  Each
+ *                  service must register its requirements regardless of the
+ *                  security level that is used.  This API is called once for
+ *                  originators and again for acceptors of connections.
+ *
+ * Returns          true if registered OK, else false
+ *
+ ******************************************************************************/
+bool BTM_SetSecurityLevel(bool is_originator, const char* p_name,
+                          uint8_t service_id, uint16_t sec_level, uint16_t psm,
+                          uint32_t mx_proto_id, uint32_t mx_chan_id);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SetOutService
+ *
+ * Description      This function is called to set the service for
+ *                  outgoing connection.
+ *
+ * Returns          void
+ *
+ ******************************************************************************/
+void BTM_SetOutService(const RawAddress& bd_addr, uint8_t service_id,
+                       uint32_t mx_chan_id);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SecClrService
+ *
+ * Description      Removes specified service record(s) from the security
+ *                  database. All service records with the specified name are
+ *                  removed. Typically used only by devices with limited RAM
+ *                  so that it can reuse an old security service record.
+ *
+ * Returns          Number of records that were freed.
+ *
+ ******************************************************************************/
+uint8_t BTM_SecClrService(uint8_t service_id);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SecAddDevice
+ *
+ * Description      Add/modify device.  This function will be normally called
+ *                  during host startup to restore all required information
+ *                  stored in the NVRAM.
+ *                  dev_class, bd_name, link_key, and features are NULL if
+ *                  unknown
+ *
+ * Returns          true if added OK, else false
+ *
+ ******************************************************************************/
+bool BTM_SecAddDevice(const RawAddress& bd_addr, DEV_CLASS dev_class,
+                      BD_NAME bd_name, uint8_t* features,
+                      uint32_t trusted_mask[], LinkKey* link_key,
+                      uint8_t key_type, tBTM_IO_CAP io_cap, uint8_t pin_length);
+
+/** Free resources associated with the device associated with |bd_addr| address.
+ *
+ * *** WARNING ***
+ * tBTM_SEC_DEV_REC associated with bd_addr becomes invalid after this function
+ * is called, also any of it's fields. i.e. if you use p_dev_rec->bd_addr, it is
+ * no longer valid!
+ * *** WARNING ***
+ *
+ * Returns true if removed OK, false if not found or ACL link is active.
+ */
+bool BTM_SecDeleteDevice(const RawAddress& bd_addr);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SecClearSecurityFlags
+ *
+ * Description      Reset the security flags (mark as not-paired) for a given
+ *                  remove device.
+ *
+ ******************************************************************************/
+void BTM_SecClearSecurityFlags(const RawAddress& bd_addr);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SecGetDeviceLinkKey
+ *
+ * Description      This function is called to obtain link key for the device
+ *                  it returns BTM_SUCCESS if link key is available, or
+ *                  BTM_UNKNOWN_ADDR if Security Manager does not know about
+ *                  the device or device record does not contain link key info
+ *
+ * Returns          BTM_SUCCESS if successful, otherwise error code
+ *
+ ******************************************************************************/
+tBTM_STATUS BTM_SecGetDeviceLinkKey(const RawAddress& bd_addr,
+                                    LinkKey* link_key);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SecGetDeviceLinkKeyType
+ *
+ * Description      This function is called to obtain link key type for the
+ *                  device.
+ *                  it returns BTM_SUCCESS if link key is available, or
+ *                  BTM_UNKNOWN_ADDR if Security Manager does not know about
+ *                  the device or device record does not contain link key info
+ *
+ * Returns          BTM_LKEY_TYPE_IGNORE if link key is unknown, link type
+ *                  otherwise.
+ *
+ ******************************************************************************/
+tBTM_LINK_KEY_TYPE BTM_SecGetDeviceLinkKeyType(const RawAddress& bd_addr);
+
+/*******************************************************************************
+ *
+ * Function         BTM_PINCodeReply
+ *
+ * Description      This function is called after Security Manager submitted
+ *                  PIN code request to the UI.
+ *
+ * Parameters:      bd_addr      - Address of the device for which PIN was
+ *                                 requested
+ *                  res          - result of the operation BTM_SUCCESS if
+ *                                 success
+ *                  pin_len      - length in bytes of the PIN Code
+ *                  p_pin        - pointer to array with the PIN Code
+ *                  trusted_mask - bitwise OR of trusted services
+ *                                 (array of uint32_t)
+ *
+ * Returns          void
+ *
+ ******************************************************************************/
+void BTM_PINCodeReply(const RawAddress& bd_addr, uint8_t res, uint8_t pin_len,
+                      uint8_t* p_pin, uint32_t trusted_mask[]);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SecBond
+ *
+ * Description      This function is called to perform bonding with peer device.
+ *
+ * Parameters:      bd_addr      - Address of the device to bond
+ *                  pin_len      - length in bytes of the PIN Code
+ *                  p_pin        - pointer to array with the PIN Code
+ *                  trusted_mask - bitwise OR of trusted services
+ *                                 (array of uint32_t)
+ * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
+ *
+ ******************************************************************************/
+tBTM_STATUS BTM_SecBond(const RawAddress& bd_addr, uint8_t pin_len,
+                        uint8_t* p_pin, uint32_t trusted_mask[]);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SecBondByTransport
+ *
+ * Description      Perform bonding by designated transport
+ *
+ * Parameters:      bd_addr      - Address of the device to bond
+ *                  pin_len      - length in bytes of the PIN Code
+ *                  p_pin        - pointer to array with the PIN Code
+ *                  trusted_mask - bitwise OR of trusted services
+ *                                 (array of uint32_t)
+ *                  transport :  Physical transport to use for bonding
+ *                               (BR/EDR or LE)
+ *
+ * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
+ *
+ ******************************************************************************/
+tBTM_STATUS BTM_SecBondByTransport(const RawAddress& bd_addr,
+                                   tBT_TRANSPORT transport, uint8_t pin_len,
+                                   uint8_t* p_pin, uint32_t trusted_mask[]);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SecBondCancel
+ *
+ * Description      This function is called to cancel ongoing bonding process
+ *                  with peer device.
+ *
+ * Returns          BTM_CMD_STARTED if successfully initiated, otherwise error
+ *
+ ******************************************************************************/
+tBTM_STATUS BTM_SecBondCancel(const RawAddress& bd_addr);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SetEncryption
+ *
+ * Description      This function is called to ensure that connection is
+ *                  encrypted.  Should be called only on an open connection.
+ *                  Typically only needed for connections that first want to
+ *                  bring up unencrypted links, then later encrypt them.
+ *
+ * Parameters:      bd_addr       - Address of the peer device
+ *                  transport     - Link transport
+ *                  p_callback    - Pointer to callback function called if
+ *                                  this function returns PENDING after required
+ *                                  procedures are completed.  Can be set to
+ *                                  NULL if status is not desired.
+ *                  p_ref_data    - pointer to any data the caller wishes to
+ *                                  receive in the callback function upon
+ *                                  completion.
+ *                                  can be set to NULL if not used.
+ *                  sec_act       - LE security action, unused for BR/EDR
+ *
+ * Returns          BTM_SUCCESS   - already encrypted
+ *                  BTM_PENDING   - command will be returned in the callback
+ *                  BTM_WRONG_MODE- connection not up.
+ *                  BTM_BUSY      - security procedures are currently active
+ *                  BTM_MODE_UNSUPPORTED - if security manager not linked in.
+ *
+ ******************************************************************************/
+tBTM_STATUS BTM_SetEncryption(const RawAddress& bd_addr,
+                              tBT_TRANSPORT transport,
+                              tBTM_SEC_CBACK* p_callback, void* p_ref_data,
+                              tBTM_BLE_SEC_ACT sec_act);
+
+/*******************************************************************************
+ *
+ * Function         BTM_ConfirmReqReply
+ *
+ * Description      This function is called to confirm the numeric value for
+ *                  Simple Pairing in response to BTM_SP_CFM_REQ_EVT
+ *
+ * Parameters:      res           - result of the operation BTM_SUCCESS if
+ *                                  success
+ *                  bd_addr       - Address of the peer device
+ *
+ ******************************************************************************/
+void BTM_ConfirmReqReply(tBTM_STATUS res, const RawAddress& bd_addr);
+
+/*******************************************************************************
+ *
+ * Function         BTM_PasskeyReqReply
+ *
+ * Description      This function is called to provide the passkey for
+ *                  Simple Pairing in response to BTM_SP_KEY_REQ_EVT
+ *
+ * Parameters:      res           - result of the operation BTM_SUCCESS if
+ *                                  success
+ *                  bd_addr       - Address of the peer device
+ *                  passkey       - numeric value in the range of
+ *                                  0 - 999999(0xF423F).
+ *
+ ******************************************************************************/
+void BTM_PasskeyReqReply(tBTM_STATUS res, const RawAddress& bd_addr,
+                         uint32_t passkey);
 
 /*******************************************************************************
  *
- * Function         BTM_WriteScoData
- *
- * Description      This function write SCO data to a specified instance. The
- *                  data to be written p_buf needs to carry an offset of
- *                  HCI_SCO_PREAMBLE_SIZE bytes, and the data length can not
- *                  exceed BTM_SCO_DATA_SIZE_MAX bytes, whose default value is
- *                  set to 60 and is configurable. Data longer than the maximum
- *                  bytes will be truncated.
+ * Function         BTM_SendKeypressNotif
  *
- * Returns          BTM_SUCCESS: data write is successful
- *                  BTM_ILLEGAL_VALUE: SCO data contains illegal offset value.
- *                  BTM_SCO_BAD_LENGTH: SCO data length exceeds the max SCO
- *                                      packet size.
- *                  BTM_NO_RESOURCES: no resources.
- *                  BTM_UNKNOWN_ADDR: unknown SCO connection handle, or SCO is
- *                                    not routed via HCI.
+ * Description      This function is used during the passkey entry model
+ *                  by a device with KeyboardOnly IO capabilities
+ *                  (very likely to be a HID Device).
+ *                  It is called by a HID Device to inform the remote device
+ *                  when a key has been entered or erased.
  *
+ * Parameters:      bd_addr - Address of the peer device
+ *                  type - notification type
  *
  ******************************************************************************/
-tBTM_STATUS BTM_WriteScoData(uint16_t sco_inx, BT_HDR* p_buf);
+void BTM_SendKeypressNotif(const RawAddress& bd_addr, tBTM_SP_KEY_TYPE type);
 
 /*******************************************************************************
  *
- * Function         BTM_SetARCMode
+ * Function         BTM_IoCapRsp
  *
- * Description      Send Audio Routing Control command.
+ * Description      This function is called in response to BTM_SP_IO_REQ_EVT
+ *                  When the event data io_req.oob_data is set to
+ *                  BTM_OOB_UNKNOWN by the tBTM_SP_CALLBACK implementation, this
+ *                  function is called to provide the actual response
  *
- * Returns          void
+ * Parameters:      bd_addr - Address of the peer device
+ *                  io_cap  - The IO capability of local device.
+ *                  oob     - BTM_OOB_NONE or BTM_OOB_PRESENT.
+ *                  auth_req- MITM protection required or not.
  *
  ******************************************************************************/
-void BTM_SetARCMode(uint8_t iface, uint8_t arc_mode,
-                    tBTM_VSC_CMPL_CB* p_arc_cb);
+void BTM_IoCapRsp(const RawAddress& bd_addr, tBTM_IO_CAP io_cap,
+                  tBTM_OOB_DATA oob, tBTM_AUTH_REQ auth_req);
 
 /*******************************************************************************
  *
- * Function         BTM_PCM2Setup_Write
- *
- * Description      Send PCM2_Setup write command.
+ * Function         BTM_ReadLocalOobData
  *
- * Returns          void
+ * Description      This function is called to read the local OOB data from
+ *                  LM
  *
  ******************************************************************************/
-void BTM_PCM2Setup_Write(bool clk_master, tBTM_VSC_CMPL_CB* p_arc_cb);
+void BTM_ReadLocalOobData(void);
 
 /*******************************************************************************
  *
- * Function         BTM_PM_ReadControllerState
+ * Function         BTM_RemoteOobDataReply
  *
- * Description      This function is called to obtain the controller state
+ * Description      This function is called to provide the remote OOB data for
+ *                  Simple Pairing in response to BTM_SP_RMT_OOB_EVT
  *
- * Returns          Controller state (BTM_CONTRL_ACTIVE, BTM_CONTRL_SCAN, and
- *                                    BTM_CONTRL_IDLE)
+ * Parameters:      bd_addr     - Address of the peer device
+ *                  c           - simple pairing Hash C.
+ *                  r           - simple pairing Randomizer  C.
  *
  ******************************************************************************/
-tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void);
+void BTM_RemoteOobDataReply(tBTM_STATUS res, const RawAddress& bd_addr,
+                            const Octet16& c, const Octet16& r);
 
-/**
- *
- * BLE API
- */
 /*******************************************************************************
  *
- * Function         BTM_SecAddBleDevice
+ * Function         BTM_BuildOobData
  *
- * Description      Add/modify device.  This function will be normally called
- *                  during host startup to restore all required information
- *                  for a LE device stored in the NVRAM.
+ * Description      This function is called to build the OOB data payload to
+ *                  be sent over OOB (non-Bluetooth) link
  *
- * Parameters:      bd_addr          - BD address of the peer
- *                  bd_name          - Name of the peer device. NULL if unknown.
- *                  dev_type         - Remote device's device type.
- *                  addr_type        - LE device address type.
+ * Parameters:      p_data  - the location for OOB data
+ *                  max_len - p_data size.
+ *                  c       - simple pairing Hash C.
+ *                  r       - simple pairing Randomizer  C.
+ *                  name_len- 0, local device name would not be included.
+ *                            otherwise, the local device name is included for
+ *                            up to this specified length
  *
- * Returns          true if added OK, else false
+ * Returns          Number of bytes in p_data.
  *
  ******************************************************************************/
-bool BTM_SecAddBleDevice(const RawAddress& bd_addr, BD_NAME bd_name,
-                         tBT_DEVICE_TYPE dev_type, tBLE_ADDR_TYPE addr_type);
+uint16_t BTM_BuildOobData(uint8_t* p_data, uint16_t max_len, const Octet16& c,
+                          const Octet16& r, uint8_t name_len);
 
 /*******************************************************************************
  *
- * Function         BTM_SecAddBleKey
+ * Function         BTM_BothEndsSupportSecureConnections
  *
- * Description      Add/modify LE device information.  This function will be
- *                  normally called during host startup to restore all required
- *                  information stored in the NVRAM.
+ * Description      This function is called to check if both the local device
+ *                  and the peer device specified by bd_addr support BR/EDR
+ *                  Secure Connections.
  *
- * Parameters:      bd_addr          - BD address of the peer
- *                  p_le_key         - LE key values.
- *                  key_type         - LE SMP key type.
+ * Parameters:      bd_addr - address of the peer
  *
- * Returns          true if added OK, else false
+ * Returns          true if BR/EDR Secure Connections are supported by both
+ *                  local and the remote device.
+ *                  else false.
  *
  ******************************************************************************/
-bool BTM_SecAddBleKey(const RawAddress& bd_addr, tBTM_LE_KEY_VALUE* p_le_key,
-                      tBTM_LE_KEY_TYPE key_type);
+bool BTM_BothEndsSupportSecureConnections(const RawAddress& bd_addr);
 
 /*******************************************************************************
  *
- * Function         BTM_BleObtainVendorCapabilities
+ * Function         BTM_PeerSupportsSecureConnections
  *
- * Description      This function is called to obatin vendor capabilties
+ * Description      This function is called to check if the peer supports
+ *                  BR/EDR Secure Connections.
  *
- * Parameters       p_cmn_vsc_cb - Returns the vednor capabilities
+ * Parameters:      bd_addr - address of the peer
  *
- * Returns          void
+ * Returns          true if BR/EDR Secure Connections are supported by the peer,
+ *                  else false.
  *
  ******************************************************************************/
-void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb);
-
-/**
- * This function is called to set scan parameters. |cb| is called with operation
- * status
- **/
-void BTM_BleSetScanParams(uint32_t scan_interval, uint32_t scan_window,
-                          tBLE_SCAN_MODE scan_type,
-                          base::Callback<void(uint8_t)> cb);
+bool BTM_PeerSupportsSecureConnections(const RawAddress& bd_addr);
 
 /*******************************************************************************
  *
- * Function         BTM_BleGetVendorCapabilities
+ * Function         BTM_ReadOobData
  *
- * Description      This function reads local LE features
+ * Description      This function is called to parse the OOB data payload
+ *                  received over OOB (non-Bluetooth) link
  *
- * Parameters       p_cmn_vsc_cb : Locala LE capability structure
+ * Parameters:      p_data  - the location for OOB data
+ *                  eir_tag - The associated EIR tag to read the data.
+ *                  *p_len(output) - the length of the data with the given tag.
  *
- * Returns          void
+ * Returns          the beginning of the data with the given tag.
+ *                  NULL, if the tag is not found.
  *
  ******************************************************************************/
-void BTM_BleGetVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb);
+uint8_t* BTM_ReadOobData(uint8_t* p_data, uint8_t eir_tag, uint8_t* p_len);
+
 /*******************************************************************************
  *
- * Function         BTM_BleSetStorageConfig
- *
- * Description      This function is called to setup storage configuration and
- *                  setup callbacks.
+ * Function         BTM_SecReadDevName
  *
- * Parameters       uint8_t batch_scan_full_max -Batch scan full maximum
-                    uint8_t batch_scan_trunc_max - Batch scan truncated value
- maximum
-                    uint8_t batch_scan_notify_threshold - Threshold value
-                    cb - Setup callback
-                    tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback -Threshold
- callback
-                    void *p_ref - Reference value
+ * Description      Looks for the device name in the security database for the
+ *                  specified BD address.
  *
+ * Returns          Pointer to the name or NULL
  *
  ******************************************************************************/
-void BTM_BleSetStorageConfig(uint8_t batch_scan_full_max,
-                             uint8_t batch_scan_trunc_max,
-                             uint8_t batch_scan_notify_threshold,
-                             base::Callback<void(uint8_t /* status */)> cb,
-                             tBTM_BLE_SCAN_THRESHOLD_CBACK* p_thres_cback,
-                             tBTM_BLE_REF_VALUE ref_value);
-
-/* This function is called to enable batch scan */
-void BTM_BleEnableBatchScan(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
-                            uint32_t scan_interval, uint32_t scan_window,
-                            tBTM_BLE_DISCARD_RULE discard_rule,
-                            tBLE_ADDR_TYPE addr_type,
-                            base::Callback<void(uint8_t /* status */)> cb);
-
-/* This function is called to disable batch scanning */
-void BTM_BleDisableBatchScan(base::Callback<void(uint8_t /* status */)> cb);
-
-/* This function is called to read batch scan reports */
-void BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode,
-                            tBTM_BLE_SCAN_REP_CBACK cb);
-
-/* This function is called to setup the callback for tracking */
-void BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK* p_track_cback,
-                            tBTM_BLE_REF_VALUE ref_value);
+char* BTM_SecReadDevName(const RawAddress& bd_addr);
 
+/*****************************************************************************
+ *  POWER MANAGEMENT FUNCTIONS
+ ****************************************************************************/
 /*******************************************************************************
  *
- * Function         BTM_BleWriteScanRsp
- *
- * Description      This function is called to write LE scan response.
+ * Function         BTM_PmRegister
  *
- * Parameters:      p_scan_rsp: scan response.
+ * Description      register or deregister with power manager
  *
- * Returns          status
+ * Returns          BTM_SUCCESS if successful,
+ *                  BTM_NO_RESOURCES if no room to hold registration
+ *                  BTM_ILLEGAL_VALUE
  *
  ******************************************************************************/
-void BTM_BleWriteScanRsp(uint8_t* data, uint8_t length,
-                         tBTM_BLE_ADV_DATA_CMPL_CBACK* p_adv_data_cback);
+tBTM_STATUS BTM_PmRegister(uint8_t mask, uint8_t* p_pm_id,
+                           tBTM_PM_STATUS_CBACK* p_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_BleObserve
- *
- * Description      This procedure keep the device listening for advertising
- *                  events from a broadcast device.
+ * Function         BTM_SetPowerMode
  *
- * Parameters       start: start or stop observe.
+ * Description      store the mode in control block or
+ *                  alter ACL connection behavior.
  *
- * Returns          void
+ * Returns          BTM_SUCCESS if successful,
+ *                  BTM_UNKNOWN_ADDR if bd addr is not active or bad
  *
  ******************************************************************************/
-tBTM_STATUS BTM_BleObserve(bool start, uint8_t duration,
-                           tBTM_INQ_RESULTS_CB* p_results_cb,
-                           tBTM_CMPL_CB* p_cmpl_cb);
-
-/** Returns local device encryption root (ER) */
-const Octet16& BTM_GetDeviceEncRoot();
-
-/** Returns local device identity root (IR) */
-const Octet16& BTM_GetDeviceIDRoot();
-
-/** Return local device DHK. */
-const Octet16& BTM_GetDeviceDHK();
+tBTM_STATUS BTM_SetPowerMode(uint8_t pm_id, const RawAddress& remote_bda,
+                             const tBTM_PM_PWR_MD* p_mode);
 
 /*******************************************************************************
  *
- * Function         BTM_SecurityGrant
+ * Function         BTM_ReadPowerMode
  *
- * Description      This function is called to grant security process.
+ * Description      This returns the current mode for a specific
+ *                  ACL connection.
  *
- * Parameters       bd_addr - peer device bd address.
- *                  res     - result of the operation BTM_SUCCESS if success.
- *                            Otherwise, BTM_REPEATED_ATTEMPTS is too many
- *                            attempts.
+ * Input Param      remote_bda - device address of desired ACL connection
  *
- * Returns          None
+ * Output Param     p_mode - address where the current mode is copied into.
+ *                          BTM_ACL_MODE_NORMAL
+ *                          BTM_ACL_MODE_HOLD
+ *                          BTM_ACL_MODE_SNIFF
+ *                          BTM_ACL_MODE_PARK
+ *                          (valid only if return code is BTM_SUCCESS)
+ *
+ * Returns          BTM_SUCCESS if successful,
+ *                  BTM_UNKNOWN_ADDR if bd addr is not active or bad
  *
  ******************************************************************************/
-void BTM_SecurityGrant(const RawAddress& bd_addr, uint8_t res);
+tBTM_STATUS BTM_ReadPowerMode(const RawAddress& remote_bda,
+                              tBTM_PM_MODE* p_mode);
 
 /*******************************************************************************
  *
- * Function         BTM_BlePasskeyReply
+ * Function         BTM_SetSsrParams
+ *
+ * Description      This sends the given SSR parameters for the given ACL
+ *                  connection if it is in ACTIVE mode.
+ *
+ * Input Param      remote_bda - device address of desired ACL connection
+ *                  max_lat    - maximum latency (in 0.625ms)(0-0xFFFE)
+ *                  min_rmt_to - minimum remote timeout
+ *                  min_loc_to - minimum local timeout
  *
- * Description      This function is called after Security Manager submitted
- *                  passkey request to the application.
  *
- * Parameters:      bd_addr - Address of the device for which passkey was
- *                            requested
- *                  res     - result of the operation SMP_SUCCESS if success
- *                  passkey - numeric value in the range of
- *                               BTM_MIN_PASSKEY_VAL(0) -
- *                               BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
+ * Returns          BTM_SUCCESS if the HCI command is issued successful,
+ *                  BTM_UNKNOWN_ADDR if bd addr is not active or bad
+ *                  BTM_CMD_STORED if the command is stored
  *
  ******************************************************************************/
-void BTM_BlePasskeyReply(const RawAddress& bd_addr, uint8_t res,
-                         uint32_t passkey);
+tBTM_STATUS BTM_SetSsrParams(const RawAddress& remote_bda, uint16_t max_lat,
+                             uint16_t min_rmt_to, uint16_t min_loc_to);
 
 /*******************************************************************************
  *
- * Function         BTM_BleConfirmReply
+ * Function         BTM_GetHCIConnHandle
  *
- * Description      This function is called after Security Manager submitted
- *                  numeric comparison request to the application.
+ * Description      This function is called to get the handle for an ACL
+ *                  connection to a specific remote BD Address.
  *
- * Parameters:      bd_addr      - Address of the device with which numeric
- *                                 comparison was requested
- *                  res          - comparison result BTM_SUCCESS if success
+ * Returns          the handle of the connection, or 0xFFFF if none.
  *
  ******************************************************************************/
-void BTM_BleConfirmReply(const RawAddress& bd_addr, uint8_t res);
+uint16_t BTM_GetHCIConnHandle(const RawAddress& remote_bda,
+                              tBT_TRANSPORT transport);
 
 /*******************************************************************************
  *
- * Function         BTM_LeOobDataReply
+ * Function         BTM_DeleteStoredLinkKey
  *
- * Description      This function is called to provide the OOB data for
- *                  SMP in response to BTM_LE_OOB_REQ_EVT
+ * Description      This function is called to delete link key for the specified
+ *                  device addresses from the NVRAM storage attached to the
+ *                  Bluetooth controller.
  *
- * Parameters:      bd_addr     - Address of the peer device
- *                  res         - result of the operation SMP_SUCCESS if success
- *                  p_data      - simple pairing Randomizer  C.
+ * Parameters:      bd_addr      - Addresses of the devices
+ *                  p_cb         - Call back function to be called to return
+ *                                 the results
  *
  ******************************************************************************/
-void BTM_BleOobDataReply(const RawAddress& bd_addr, uint8_t res, uint8_t len,
-                         uint8_t* p_data);
+tBTM_STATUS BTM_DeleteStoredLinkKey(const RawAddress* bd_addr,
+                                    tBTM_CMPL_CB* p_cb);
 
+/*****************************************************************************
+ *  SCO OVER HCI
+ ****************************************************************************/
 /*******************************************************************************
  *
- * Function         BTM_BleSecureConnectionOobDataReply
+ * Function         BTM_ConfigScoPath
  *
- * Description      This function is called to provide the OOB data for
- *                  SMP in response to BTM_LE_OOB_REQ_EVT when secure connection
- *                  data is available
+ * Description      This function enable/disable SCO over HCI and registers SCO
+ *                  data callback if SCO over HCI is enabled.
+ *
+ * Parameter        path: SCO or HCI
+ *                  p_sco_data_cb: callback function or SCO data if path is set
+ *                                 to transport.
+ *                  p_pcm_param: pointer to the PCM interface parameter. If a
+ *                               NULL pointer is used, the PCM parameter
+ *                               maintained in the control block will be used;
+ *                               otherwise update the control block value.
+ *                  err_data_rpt: Lisbon feature to enable the erronous data
+ *                                report or not.
+ *
+ * Returns          BTM_SUCCESS if the successful.
+ *                  BTM_NO_RESOURCES: no rsource to start the command.
+ *                  BTM_ILLEGAL_VALUE: invalid callback function pointer.
+ *                  BTM_CMD_STARTED : Command sent. Waiting for command
+ *                                    complete event.
  *
- * Parameters:      bd_addr     - Address of the peer device
- *                  p_c         - pointer to Confirmation
- *                  p_r         - pointer to Randomizer.
  *
  ******************************************************************************/
-void BTM_BleSecureConnectionOobDataReply(const RawAddress& bd_addr,
-                                         uint8_t* p_c, uint8_t* p_r);
+tBTM_STATUS BTM_ConfigScoPath(esco_data_path_t path,
+                              tBTM_SCO_DATA_CB* p_sco_data_cb,
+                              tBTM_SCO_PCM_PARAM* p_pcm_param,
+                              bool err_data_rpt);
 
 /*******************************************************************************
  *
- * Function         BTM_BleDataSignature
+ * Function         BTM_WriteScoData
  *
- * Description      This function is called to sign the data using AES128 CMAC
- *                  algorith.
+ * Description      This function write SCO data to a specified instance. The
+ *                  data to be written p_buf needs to carry an offset of
+ *                  HCI_SCO_PREAMBLE_SIZE bytes, and the data length can not
+ *                  exceed BTM_SCO_DATA_SIZE_MAX bytes, whose default value is
+ *                  set to 60 and is configurable. Data longer than the maximum
+ *                  bytes will be truncated.
  *
- * Parameter        bd_addr: target device the data to be signed for.
- *                  p_text: singing data
- *                  len: length of the signing data
- *                  signature: output parameter where data signature is going to
- *                             be stored.
+ * Returns          BTM_SUCCESS: data write is successful
+ *                  BTM_ILLEGAL_VALUE: SCO data contains illegal offset value.
+ *                  BTM_SCO_BAD_LENGTH: SCO data length exceeds the max SCO
+ *                                      packet size.
+ *                  BTM_NO_RESOURCES: no resources.
+ *                  BTM_UNKNOWN_ADDR: unknown SCO connection handle, or SCO is
+ *                                    not routed via HCI.
  *
- * Returns          true if signing sucessul, otherwise false.
  *
  ******************************************************************************/
-bool BTM_BleDataSignature(const RawAddress& bd_addr, uint8_t* p_text,
-                          uint16_t len, BLE_SIGNATURE signature);
+tBTM_STATUS BTM_WriteScoData(uint16_t sco_inx, BT_HDR* p_buf);
 
 /*******************************************************************************
  *
- * Function         BTM_BleVerifySignature
+ * Function         BTM_SetARCMode
  *
- * Description      This function is called to verify the data signature
+ * Description      Send Audio Routing Control command.
  *
- * Parameter        bd_addr: target device the data to be signed for.
- *                  p_orig:  original data before signature.
- *                  len: length of the signing data
- *                  counter: counter used when doing data signing
- *                  p_comp: signature to be compared against.
-
- * Returns          true if signature verified correctly; otherwise false.
+ * Returns          void
  *
  ******************************************************************************/
-bool BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig,
-                            uint16_t len, uint32_t counter, uint8_t* p_comp);
+void BTM_SetARCMode(uint8_t iface, uint8_t arc_mode,
+                    tBTM_VSC_CMPL_CB* p_arc_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_ReadConnectionAddr
+ * Function         BTM_PCM2Setup_Write
  *
- * Description      Read the local device random address.
+ * Description      Send PCM2_Setup write command.
  *
  * Returns          void
  *
  ******************************************************************************/
-void BTM_ReadConnectionAddr(const RawAddress& remote_bda,
-                            RawAddress& local_conn_addr,
-                            tBLE_ADDR_TYPE* p_addr_type);
+void BTM_PCM2Setup_Write(bool clk_master, tBTM_VSC_CMPL_CB* p_arc_cb);
 
 /*******************************************************************************
  *
- * Function         BTM_IsBleConnection
+ * Function         BTM_PM_ReadControllerState
  *
- * Description      This function is called to check if the connection handle
- *                  for an LE link
+ * Description      This function is called to obtain the controller state
  *
- * Returns          true if connection is LE link, otherwise false.
+ * Returns          Controller state (BTM_CONTRL_ACTIVE, BTM_CONTRL_SCAN, and
+ *                                    BTM_CONTRL_IDLE)
  *
  ******************************************************************************/
-bool BTM_IsBleConnection(uint16_t conn_handle);
+tBTM_CONTRL_STATE BTM_PM_ReadControllerState(void);
 
+/**
+ *
+ * BLE API
+ */
 /*******************************************************************************
  *
- * Function         BTM_ReadRemoteConnectionAddr
+ * Function         BTM_BleObtainVendorCapabilities
  *
- * Description      Read the remote device address currently used.
+ * Description      This function is called to obatin vendor capabilties
+ *
+ * Parameters       p_cmn_vsc_cb - Returns the vednor capabilities
  *
  * Returns          void
  *
  ******************************************************************************/
-bool BTM_ReadRemoteConnectionAddr(const RawAddress& pseudo_addr,
-                                  RawAddress& conn_addr,
-                                  tBLE_ADDR_TYPE* p_addr_type);
+void BTM_BleObtainVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb);
+
+/**
+ * This function is called to set scan parameters. |cb| is called with operation
+ * status
+ **/
+void BTM_BleSetScanParams(uint32_t scan_interval, uint32_t scan_window,
+                          tBLE_SCAN_MODE scan_type,
+                          base::Callback<void(uint8_t)> cb);
 
 /*******************************************************************************
  *
- * Function         BTM_BleLoadLocalKeys
+ * Function         BTM_BleGetVendorCapabilities
  *
- * Description      Local local identity key, encryption root or sign counter.
+ * Description      This function reads local LE features
  *
- * Parameters:      key_type: type of key, can be BTM_BLE_KEY_TYPE_ID,
- *                            BTM_BLE_KEY_TYPE_ER
- *                            or BTM_BLE_KEY_TYPE_COUNTER.
- *                  p_key: pointer to the key.
+ * Parameters       p_cmn_vsc_cb : Locala LE capability structure
  *
- * Returns          non2.
+ * Returns          void
  *
  ******************************************************************************/
-void BTM_BleLoadLocalKeys(uint8_t key_type, tBTM_BLE_LOCAL_KEYS* p_key);
+void BTM_BleGetVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb);
 
-/********************************************************
+/*******************************************************************************
  *
- * Function         BTM_BleSetPrefConnParams
+ * Function         BTM_BleSetStorageConfig
  *
- * Description      Set a peripheral's preferred connection parameters. When
- *                  any of the value does not want to be updated while others
- *                  do, use BTM_BLE_CONN_PARAM_UNDEF for the ones want to
- *                  leave untouched.
+ * Description      This function is called to setup storage configuration and
+ *                  setup callbacks.
  *
- * Parameters:      bd_addr          - BD address of the peripheral
- *                  min_conn_int     - minimum preferred connection interval
- *                  max_conn_int     - maximum preferred connection interval
- *                  slave_latency    - preferred slave latency
- *                  supervision_tout - preferred supervision timeout
+ * Parameters       uint8_t batch_scan_full_max -Batch scan full maximum
+ *                  uint8_t batch_scan_trunc_max - Batch scan truncated value
+ *maximum uint8_t batch_scan_notify_threshold - Threshold value cb - Setup
+ *callback tBTM_BLE_SCAN_THRESHOLD_CBACK *p_thres_cback -Threshold callback void
+ **p_ref - Reference value
  *
- * Returns          void
  *
  ******************************************************************************/
-void BTM_BleSetPrefConnParams(const RawAddress& bd_addr, uint16_t min_conn_int,
-                              uint16_t max_conn_int, uint16_t slave_latency,
-                              uint16_t supervision_tout);
+void BTM_BleSetStorageConfig(uint8_t batch_scan_full_max,
+                             uint8_t batch_scan_trunc_max,
+                             uint8_t batch_scan_notify_threshold,
+                             base::Callback<void(uint8_t /* status */)> cb,
+                             tBTM_BLE_SCAN_THRESHOLD_CBACK* p_thres_cback,
+                             tBTM_BLE_REF_VALUE ref_value);
 
-/******************************************************************************
+/* This function is called to enable batch scan */
+void BTM_BleEnableBatchScan(tBTM_BLE_BATCH_SCAN_MODE scan_mode,
+                            uint32_t scan_interval, uint32_t scan_window,
+                            tBTM_BLE_DISCARD_RULE discard_rule,
+                            tBLE_ADDR_TYPE addr_type,
+                            base::Callback<void(uint8_t /* status */)> cb);
+
+/* This function is called to disable batch scanning */
+void BTM_BleDisableBatchScan(base::Callback<void(uint8_t /* status */)> cb);
+
+/* This function is called to read batch scan reports */
+void BTM_BleReadScanReports(tBLE_SCAN_MODE scan_mode,
+                            tBTM_BLE_SCAN_REP_CBACK cb);
+
+/* This function is called to setup the callback for tracking */
+void BTM_BleTrackAdvertiser(tBTM_BLE_TRACK_ADV_CBACK* p_track_cback,
+                            tBTM_BLE_REF_VALUE ref_value);
+
+/*******************************************************************************
  *
- * Function         BTM_BleSetConnScanParams
+ * Function         BTM_BleWriteScanRsp
  *
- * Description      Set scan parameters used in BLE connection request
+ * Description      This function is called to write LE scan response.
  *
- * Parameters:      scan_interval    - scan interval
- *                  scan_window      - scan window
+ * Parameters:      p_scan_rsp: scan response.
  *
- * Returns          void
+ * Returns          status
  *
  ******************************************************************************/
-void BTM_BleSetConnScanParams(uint32_t scan_interval, uint32_t scan_window);
+void BTM_BleWriteScanRsp(uint8_t* data, uint8_t length,
+                         tBTM_BLE_ADV_DATA_CMPL_CBACK* p_adv_data_cback);
 
 /******************************************************************************
  *
@@ -2396,60 +2653,28 @@ void BTM_BleReadControllerFeatures(tBTM_BLE_CTRL_FEATURES_CBACK* p_vsc_cback);
 
 /*******************************************************************************
  *
- * Function         BTM__BLEReadDiscoverability
- *
- * Description      This function is called to read the current LE
- *                  discoverability mode of the device.
- *
- * Returns          BTM_BLE_NON_DISCOVERABLE ,BTM_BLE_LIMITED_DISCOVERABLE or
- *                     BTM_BLE_GENRAL_DISCOVERABLE
- *
- ******************************************************************************/
-uint16_t BTM_BleReadDiscoverability();
-
-/*******************************************************************************
- *
- * Function         BTM__BLEReadConnectability
- *
- * Description      This function is called to read the current LE
- *                  connectibility mode of the device.
- *
- * Returns          BTM_BLE_NON_CONNECTABLE or BTM_BLE_CONNECTABLE
- *
- ******************************************************************************/
-uint16_t BTM_BleReadConnectability();
-
-/*******************************************************************************
- *
- * Function         BTM_ReadDevInfo
+ * Function         BTM__BLEReadDiscoverability
  *
- * Description      This function is called to read the device/address type
- *                  of BD address.
+ * Description      This function is called to read the current LE
+ *                  discoverability mode of the device.
  *
- * Parameter        remote_bda: remote device address
- *                  p_dev_type: output parameter to read the device type.
- *                  p_addr_type: output parameter to read the address type.
+ * Returns          BTM_BLE_NON_DISCOVERABLE ,BTM_BLE_LIMITED_DISCOVERABLE or
+ *                     BTM_BLE_GENRAL_DISCOVERABLE
  *
  ******************************************************************************/
-void BTM_ReadDevInfo(const RawAddress& remote_bda, tBT_DEVICE_TYPE* p_dev_type,
-                     tBLE_ADDR_TYPE* p_addr_type);
+uint16_t BTM_BleReadDiscoverability();
 
 /*******************************************************************************
  *
- * Function         BTM_ReadConnectedTransportAddress
- *
- * Description      This function is called to read the paired device/address
- *                  type of other device paired corresponding to the BD_address
+ * Function         BTM__BLEReadConnectability
  *
- * Parameter        remote_bda: remote device address, carry out the transport
- *                              address
- *                  transport: active transport
+ * Description      This function is called to read the current LE
+ *                  connectibility mode of the device.
  *
- * Return           true if an active link is identified; false otherwise
+ * Returns          BTM_BLE_NON_CONNECTABLE or BTM_BLE_CONNECTABLE
  *
  ******************************************************************************/
-bool BTM_ReadConnectedTransportAddress(RawAddress* remote_bda,
-                                       tBT_TRANSPORT transport);
+uint16_t BTM_BleReadConnectability();
 
 /*******************************************************************************
  *
@@ -2492,18 +2717,6 @@ void BTM_BleEnableMixedPrivacyMode(bool mixed_on);
 
 /*******************************************************************************
  *
- * Function          BTM_BleMaxMultiAdvInstanceCount
- *
- * Description      Returns the maximum number of multi adv instances supported
- *                  by the controller.
- *
- * Returns          Max multi adv instance count
- *
- ******************************************************************************/
-uint8_t BTM_BleMaxMultiAdvInstanceCount();
-
-/*******************************************************************************
- *
  * Function         BTM_BleSetConnectableMode
  *
  * Description      This function is called to set BLE connectable mode for a
@@ -2538,69 +2751,6 @@ void BTM_BleTurnOnPrivacyOnRemote(const RawAddress& bd_addr, bool privacy_on);
 
 /*******************************************************************************
  *
- * Function         BTM_BleUpdateAdvFilterPolicy
- *
- * Description      This function update the filter policy of advertiser.
- *
- * Parameter        adv_policy: advertising filter policy
- *
- * Return           void
- ******************************************************************************/
-void BTM_BleUpdateAdvFilterPolicy(tBTM_BLE_AFP adv_policy);
-
-/*******************************************************************************
- *
- * Function         BTM_BleReceiverTest
- *
- * Description      This function is called to start the LE Receiver test
- *
- * Parameter       rx_freq - Frequency Range
- *               p_cmd_cmpl_cback - Command Complete callback
- *
- ******************************************************************************/
-void BTM_BleReceiverTest(uint8_t rx_freq, tBTM_CMPL_CB* p_cmd_cmpl_cback);
-
-/*******************************************************************************
- *
- * Function         BTM_BleTransmitterTest
- *
- * Description      This function is called to start the LE Transmitter test
- *
- * Parameter       tx_freq - Frequency Range
- *                       test_data_len - Length in bytes of payload data in each
- *                                       packet
- *                       packet_payload - Pattern to use in the payload
- *                       p_cmd_cmpl_cback - Command Complete callback
- *
- ******************************************************************************/
-void BTM_BleTransmitterTest(uint8_t tx_freq, uint8_t test_data_len,
-                            uint8_t packet_payload,
-                            tBTM_CMPL_CB* p_cmd_cmpl_cback);
-
-/*******************************************************************************
- *
- * Function         BTM_BleTestEnd
- *
- * Description     This function is called to stop the in-progress TX or RX test
- *
- * Parameter       p_cmd_cmpl_cback - Command complete callback
- *
- ******************************************************************************/
-void BTM_BleTestEnd(tBTM_CMPL_CB* p_cmd_cmpl_cback);
-
-/*******************************************************************************
- *
- * Function         BTM_UseLeLink
- *
- * Description      Select the underlying physical link to use.
- *
- * Returns          true to use LE, false use BR/EDR.
- *
- ******************************************************************************/
-bool BTM_UseLeLink(const RawAddress& bd_addr);
-
-/*******************************************************************************
- *
  * Function         BTM_BleStackEnable
  *
  * Description      Enable/Disable BLE functionality on stack regardless of
@@ -2613,78 +2763,9 @@ bool BTM_UseLeLink(const RawAddress& bd_addr);
  ******************************************************************************/
 tBTM_STATUS BTM_BleStackEnable(bool enable);
 
-/*******************************************************************************
- *
- * Function         BTM_GetLeSecurityState
- *
- * Description      This function is called to get security mode 1 flags and
- *                  encryption key size for LE peer.
- *
- * Returns          bool    true if LE device is found, false otherwise.
- *
- ******************************************************************************/
-bool BTM_GetLeSecurityState(const RawAddress& bd_addr,
-                            uint8_t* p_le_dev_sec_flags,
-                            uint8_t* p_le_key_size);
-
-/*******************************************************************************
- *
- * Function         BTM_BleSecurityProcedureIsRunning
- *
- * Description      This function indicates if LE security procedure is
- *                  currently running with the peer.
- *
- * Returns          bool true if security procedure is running, false otherwise.
- *
- ******************************************************************************/
-bool BTM_BleSecurityProcedureIsRunning(const RawAddress& bd_addr);
-
-/*******************************************************************************
- *
- * Function         BTM_BleGetSupportedKeySize
- *
- * Description      This function gets the maximum encryption key size in bytes
- *                  the local device can suport.
- *                  record.
- *
- * Returns          the key size or 0 if the size can't be retrieved.
- *
- ******************************************************************************/
-uint8_t BTM_BleGetSupportedKeySize(const RawAddress& bd_addr);
-
-/*******************************************************************************
- *
- * Function         BTM_BleAdvFilterParamSetup
- *
- * Description      This function is called to setup the adv data payload filter
- *                  condition.
- *
- ******************************************************************************/
-void BTM_BleAdvFilterParamSetup(
-    int action, tBTM_BLE_PF_FILT_INDEX filt_index,
-    std::unique_ptr<btgatt_filt_param_setup_t> p_filt_params,
-    tBTM_BLE_PF_PARAM_CB cb);
-
 /**
  * This functions are called to configure the adv data payload filter condition
  */
-void BTM_LE_PF_set(tBTM_BLE_PF_FILT_INDEX filt_index,
-                   std::vector<ApcfCommand> commands, tBTM_BLE_PF_CFG_CBACK cb);
-void BTM_LE_PF_clear(tBTM_BLE_PF_FILT_INDEX filt_index,
-                     tBTM_BLE_PF_CFG_CBACK cb);
-
-/*******************************************************************************
- *
- * Function         BTM_BleEnableDisableFilterFeature
- *
- * Description      Enable or disable the APCF feature
- *
- * Parameters       enable - true - enables APCF, false - disables APCF
- *
- ******************************************************************************/
-void BTM_BleEnableDisableFilterFeature(uint8_t enable,
-                                       tBTM_BLE_PF_STATUS_CBACK p_stat_cback);
-
 /*******************************************************************************
  *
  * Function         BTM_BleGetEnergyInfo
@@ -2698,88 +2779,5 @@ void BTM_BleEnableDisableFilterFeature(uint8_t enable,
  ******************************************************************************/
 tBTM_STATUS BTM_BleGetEnergyInfo(tBTM_BLE_ENERGY_INFO_CBACK* p_ener_cback);
 
-/*******************************************************************************
- *
- * Function         BTM_SetBleDataLength
- *
- * Description      Set the maximum BLE transmission packet size
- *
- * Returns          BTM_SUCCESS if success; otherwise failed.
- *
- ******************************************************************************/
-tBTM_STATUS BTM_SetBleDataLength(const RawAddress& bd_addr,
-                                 uint16_t tx_pdu_length);
-
-/*******************************************************************************
- *
- * Function         BTM_BleReadPhy
- *
- * Description      To read the current PHYs for specified LE connection
- *
- *
- * Returns          BTM_SUCCESS if success; otherwise failed.
- *
- ******************************************************************************/
-void BTM_BleReadPhy(
-    const RawAddress& bd_addr,
-    base::Callback<void(uint8_t tx_phy, uint8_t rx_phy, uint8_t status)> cb);
-
-/*******************************************************************************
- *
- * Function         BTM_BleSetDefaultPhy
- *
- * Description      To set preferred PHY for ensuing LE connections
- *
- *
- * Returns          BTM_SUCCESS if success; otherwise failed.
- *
- ******************************************************************************/
-tBTM_STATUS BTM_BleSetDefaultPhy(uint8_t all_phys, uint8_t tx_phys,
-                                 uint8_t rx_phys);
-
-/*******************************************************************************
- *
- * Function         BTM_BleSetPhy
- *
- * Description      To set PHY preferences for specified LE connection
- *
- *
- * Returns          BTM_SUCCESS if success; otherwise failed.
- *
- ******************************************************************************/
-void BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys,
-                   uint16_t phy_options);
-
-void BTM_LE_PF_local_name(tBTM_BLE_SCAN_COND_OP action,
-                          tBTM_BLE_PF_FILT_INDEX filt_index,
-                          std::vector<uint8_t> name, tBTM_BLE_PF_CFG_CBACK cb);
-
-void BTM_LE_PF_srvc_data(tBTM_BLE_SCAN_COND_OP action,
-                         tBTM_BLE_PF_FILT_INDEX filt_index);
-
-void BTM_LE_PF_manu_data(tBTM_BLE_SCAN_COND_OP action,
-                         tBTM_BLE_PF_FILT_INDEX filt_index, uint16_t company_id,
-                         uint16_t company_id_mask, std::vector<uint8_t> data,
-                         std::vector<uint8_t> data_mask,
-                         tBTM_BLE_PF_CFG_CBACK cb);
-
-void BTM_LE_PF_srvc_data_pattern(tBTM_BLE_SCAN_COND_OP action,
-                                 tBTM_BLE_PF_FILT_INDEX filt_index,
-                                 std::vector<uint8_t> data,
-                                 std::vector<uint8_t> data_mask,
-                                 tBTM_BLE_PF_CFG_CBACK cb);
-
-void BTM_LE_PF_addr_filter(tBTM_BLE_SCAN_COND_OP action,
-                           tBTM_BLE_PF_FILT_INDEX filt_index, tBLE_BD_ADDR addr,
-                           tBTM_BLE_PF_CFG_CBACK cb);
-
-void BTM_LE_PF_uuid_filter(tBTM_BLE_SCAN_COND_OP action,
-                           tBTM_BLE_PF_FILT_INDEX filt_index,
-                           tBTM_BLE_PF_COND_TYPE filter_type,
-                           const bluetooth::Uuid& uuid,
-                           tBTM_BLE_PF_LOGIC_TYPE cond_logic,
-                           const bluetooth::Uuid& uuid_mask,
-                           tBTM_BLE_PF_CFG_CBACK cb);
-
 }  // namespace shim
 }  // namespace bluetooth