Merge changes I1abcf94d,I720b8a16

* changes:
  Simplify security level parameter for SDP
  L2CAP: Remove never used API Ping and Echo
diff --git a/btif/src/btif_rc.cc b/btif/src/btif_rc.cc
index d8ea94c..b61bf4f 100644
--- a/btif/src/btif_rc.cc
+++ b/btif/src/btif_rc.cc
@@ -2939,11 +2939,12 @@
     return;
   }
   // interval is only valid for AVRC_EVT_PLAY_POS_CHANGED
-  uint32_t interval = 0;
+  uint32_t interval_in_seconds = 0;
   if (p_event->event_id == AVRC_EVT_PLAY_POS_CHANGED) {
-    interval = 2000;
+    interval_in_seconds = 2;
   }
-  status = register_notification_cmd(p_transaction->lbl, p_event->event_id, interval, p_dev);
+  status = register_notification_cmd(p_transaction->lbl, p_event->event_id,
+                                     interval_in_seconds, p_dev);
   if (status != BT_STATUS_SUCCESS) {
     BTIF_TRACE_ERROR("%s: Error in Notification registration: %d", __func__,
                      status);
diff --git a/gd/cert/gd_device.py b/gd/cert/gd_device.py
index 8f84dbc..fa9d24f 100644
--- a/gd/cert/gd_device.py
+++ b/gd/cert/gd_device.py
@@ -85,3 +85,4 @@
         self.hci_classic_security.command_complete_stream = EventStream(self.hci_classic_security.FetchCommandCompleteEvent)
         self.l2cap.packet_stream = EventStream(self.l2cap.FetchL2capData)
         self.l2cap.connection_complete_stream = EventStream(self.l2cap.FetchConnectionComplete)
+        self.l2cap.connection_close_stream = EventStream(self.l2cap.FetchConnectionClose)
diff --git a/gd/cert/pts_base_test.py b/gd/cert/pts_base_test.py
new file mode 100644
index 0000000..07154ea
--- /dev/null
+++ b/gd/cert/pts_base_test.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python3
+#
+#   Copyright 2019 - The Android Open Source Project
+#
+#   Licensed under the Apache License, Version 2.0 (the "License");
+#   you may not use this file except in compliance with the License.
+#   You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#   Unless required by applicable law or agreed to in writing, software
+#   distributed under the License is distributed on an "AS IS" BASIS,
+#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#   See the License for the specific language governing permissions and
+#   limitations under the License.
+
+from acts.base_test import BaseTestClass
+
+import importlib
+import logging
+import os
+import signal
+import sys
+import subprocess
+
+ANDROID_BUILD_TOP = os.environ.get('ANDROID_BUILD_TOP')
+
+sys.path.append(ANDROID_BUILD_TOP + '/out/soong/.intermediates/system/bt/gd/BluetoothFacadeAndCertGeneratedStub_py/gen')
+
+
+class PTSBaseTestClass(BaseTestClass):
+    def __init__(self, configs):
+        BaseTestClass.__init__(self, configs)
+
+        gd_devices = self.controller_configs.get("GdDevice")
+
+        self.register_controller(
+            importlib.import_module('cert.gd_device'),
+            builtin=True)
diff --git a/gd/cert/run_pts_l2cap.sh b/gd/cert/run_pts_l2cap.sh
new file mode 100755
index 0000000..4539c65
--- /dev/null
+++ b/gd/cert/run_pts_l2cap.sh
@@ -0,0 +1,5 @@
+#! /bin/bash
+
+# For bluetooth_packets_python3
+export PYTHONPATH=$PYTHONPATH:$ANDROID_BUILD_TOP/out/host/linux-x86/lib64
+python3.8 `which act.py` -c $ANDROID_BUILD_TOP/system/bt/gd/l2cap/pts/pts.json -tf $ANDROID_BUILD_TOP/system/bt/gd/l2cap/pts/pts_l2cap_testcase -tp $ANDROID_BUILD_TOP/system/bt/gd
diff --git a/gd/hci/hci_packets.pdl b/gd/hci/hci_packets.pdl
index 18838d4..5a24468 100644
--- a/gd/hci/hci_packets.pdl
+++ b/gd/hci/hci_packets.pdl
@@ -22,6 +22,11 @@
   COMPLETE_LOCAL_NAME = 0x09,
   TX_POWER_LEVEL = 0x0A,
   CLASS_OF_DEVICE = 0x0D,
+  SERVICE_DATA_16_BIT_UUIDS = 0x16,
+  APPEARANCE = 0x19,
+  SERVICE_DATA_32_BIT_UUIDS = 0x20,
+  SERVICE_DATA_128_BIT_UUIDS = 0x21,
+  MANUFACTURER_SPECIFIC_DATA = 0xFF,
 }
 
 struct GapData {
diff --git a/gd/l2cap/classic/cert/pts_l2cap_test.py b/gd/l2cap/classic/cert/pts_l2cap_test.py
new file mode 100644
index 0000000..57ccb36
--- /dev/null
+++ b/gd/l2cap/classic/cert/pts_l2cap_test.py
@@ -0,0 +1,190 @@
+from cert.pts_base_test import PTSBaseTestClass
+from facade import common_pb2
+from facade import rootservice_pb2 as facade_rootservice_pb2
+from l2cap.classic import facade_pb2 as l2cap_facade_pb2
+from google.protobuf import empty_pb2
+
+from datetime import timedelta
+import time
+class PTSL2capTest(PTSBaseTestClass):
+    def setup_test(self):
+        self.device_under_test = self.gd_devices[0]
+
+        self.device_under_test.rootservice.StartStack(
+            facade_rootservice_pb2.StartStackRequest(
+                module_under_test=facade_rootservice_pb2.BluetoothModule.Value('L2CAP'),
+            )
+        )
+
+        self.device_under_test.wait_channel_ready()
+
+        dut_address = self.device_under_test.controller_read_only_property.ReadLocalAddress(empty_pb2.Empty()).address
+        pts_address = self.controller_configs.get('pts_address').lower()
+        self.device_under_test.address = dut_address
+
+        self.dut_address = common_pb2.BluetoothAddress(
+            address=self.device_under_test.address)
+        self.pts_address = common_pb2.BluetoothAddress(
+            address=str.encode(pts_address))
+
+    def teardown_test(self):
+        self.device_under_test.rootservice.StopStack(
+            facade_rootservice_pb2.StopStackRequest()
+        )
+
+    def _pending_connection_complete(self, timeout=30):
+        dut_connection_stream = self.device_under_test.l2cap.connection_complete_stream
+        dut_connection_stream.subscribe()
+        dut_connection_stream.assert_event_occurs(
+          lambda device : device.remote.address == self.pts_address.address,
+          timeout=timedelta(seconds=timeout)
+        )
+        dut_connection_stream.unsubscribe()
+
+    def _pending_connection_close(self, timeout=30):
+        dut_connection_close_stream = self.device_under_test.l2cap.connection_close_stream
+        dut_connection_close_stream.subscribe()
+        dut_connection_close_stream.assert_event_occurs(
+          lambda device : device.remote.address == self.pts_address.address,
+          timeout=timedelta(seconds=timeout)
+        )
+        dut_connection_close_stream.unsubscribe()
+
+    def test_L2CAP_COS_CED_BV_01_C(self):
+        """
+        L2CAP/COS/CED/BV-01-C [Request Connection]
+        Verify that the IUT is able to request the connection establishment for an L2CAP data channel and
+        initiate the configuration procedure.
+        """
+        psm = 1
+        self.device_under_test.l2cap.OpenChannel(l2cap_facade_pb2.OpenChannelRequest(remote=self.pts_address, psm=psm))
+        self._pending_connection_complete()
+        self.device_under_test.l2cap.CloseChannel(l2cap_facade_pb2.CloseChannelRequest(psm=psm))
+        self._pending_connection_close()
+
+    def test_L2CAP_COS_CED_BV_03_C(self):
+        """
+        L2CAP/COS/CED/BV-03-C [Send Data]
+        Verify that the IUT is able to send DATA.
+        """
+        psm = 1
+        self.device_under_test.l2cap.SetDynamicChannel(l2cap_facade_pb2.SetEnableDynamicChannelRequest(
+            psm=psm, retransmission_mode=l2cap_facade_pb2.RetransmissionFlowControlMode.BASIC))
+        self._pending_connection_complete()
+        self.device_under_test.l2cap.SendDynamicChannelPacket(l2cap_facade_pb2.DynamicChannelPacket(psm=psm, payload=b'abc'*34))
+        self._pending_connection_close()
+
+    def test_L2CAP_COS_CED_BV_04_C(self):
+        """
+        L2CAP/COS/CED/BV-04-C [Disconnect]
+        Verify that the IUT is able to disconnect the data channel.
+        """
+        psm = 1
+        self.device_under_test.l2cap.SetDynamicChannel(l2cap_facade_pb2.SetEnableDynamicChannelRequest(
+            psm=psm, retransmission_mode=l2cap_facade_pb2.RetransmissionFlowControlMode.BASIC))
+        self._pending_connection_complete()
+        time.sleep(2)
+        self.device_under_test.l2cap.CloseChannel(l2cap_facade_pb2.CloseChannelRequest(psm=psm))
+        self._pending_connection_close()
+
+    def test_L2CAP_COS_CED_BV_05_C(self):
+        """
+        L2CAP/COS/CED/BV-05-C [Accept Connection]
+        Verify that the IUT is able to disconnect the data channel.
+        """
+        psm = 1
+        self.device_under_test.l2cap.SetDynamicChannel(l2cap_facade_pb2.SetEnableDynamicChannelRequest(
+            psm=psm, retransmission_mode=l2cap_facade_pb2.RetransmissionFlowControlMode.BASIC))
+        self._pending_connection_complete()
+        self._pending_connection_close()
+
+    def test_L2CAP_COS_CED_BV_07_C(self):
+        """
+        L2CAP/COS/CED/BV-07-C [Accept Disconnect]
+        Verify that the IUT is able to respond to the request to disconnect the data channel.
+        """
+        psm = 1
+        self.device_under_test.l2cap.SetDynamicChannel(l2cap_facade_pb2.SetEnableDynamicChannelRequest(
+            psm=psm, retransmission_mode=l2cap_facade_pb2.RetransmissionFlowControlMode.BASIC))
+        self._pending_connection_complete()
+        self._pending_connection_close()
+
+    def test_L2CAP_COS_CED_BV_08_C(self):
+        """
+        L2CAP/COS/CED/BV-08-C [Disconnect on Timeout]
+        Verify that the IUT disconnects the data channel and shuts down this channel if no response occurs
+        """
+        psm = 1
+        self.device_under_test.l2cap.SetDynamicChannel(l2cap_facade_pb2.SetEnableDynamicChannelRequest(
+            psm=psm, retransmission_mode=l2cap_facade_pb2.RetransmissionFlowControlMode.BASIC))
+
+        time.sleep(120)
+
+    def test_L2CAP_COS_CED_BV_09_C(self):
+        """
+        L2CAP/COS/CED/BV-09-C [Receive Multi-Command Packet]
+        Verify that the IUT is able to receive more than one signaling command in one L2CAP packet.
+        """
+        psm = 1
+        self.device_under_test.l2cap.SetDynamicChannel(l2cap_facade_pb2.SetEnableDynamicChannelRequest(
+            psm=psm, retransmission_mode=l2cap_facade_pb2.RetransmissionFlowControlMode.BASIC))
+        self._pending_connection_complete()
+        self._pending_connection_close()
+
+    def test_L2CAP_COS_CED_BV_11_C(self):
+        """
+        L2CAP/COS/CED/BV-11-C [Configure MTU Size]
+        Verify that the IUT is able to configure the supported MTU size
+        """
+        psm = 1
+        self.device_under_test.l2cap.SetDynamicChannel(l2cap_facade_pb2.SetEnableDynamicChannelRequest(
+            psm=psm, retransmission_mode=l2cap_facade_pb2.RetransmissionFlowControlMode.BASIC))
+        self._pending_connection_complete()
+        self._pending_connection_close()
+
+    def test_L2CAP_COS_CED_BI_01_C(self):
+        """
+        L2CAP/COS/CED/BI-01-C [Reject Unknown Command]
+        Verify that the IUT rejects an unknown signaling command.
+        """
+        psm = 1
+        self.device_under_test.l2cap.SetDynamicChannel(l2cap_facade_pb2.SetEnableDynamicChannelRequest(
+            psm=psm, retransmission_mode=l2cap_facade_pb2.RetransmissionFlowControlMode.BASIC))
+        self._pending_connection_complete()
+        time.sleep(5)
+
+    def test_L2CAP_COS_CFD_BV_03_C(self):
+        """
+        L2CAP/COS/CFD/BV-03-C [Send Requested Options]
+        Verify that the IUT can receive a configuration request with no options and send the requested
+        options to the Lower Tester
+        """
+        psm = 1
+        self.device_under_test.l2cap.SetDynamicChannel(l2cap_facade_pb2.SetEnableDynamicChannelRequest(
+            psm=psm, retransmission_mode=l2cap_facade_pb2.RetransmissionFlowControlMode.BASIC))
+        self._pending_connection_close()
+
+    def test_L2CAP_COS_CFD_BV_08_C(self):
+        """
+        L2CAP/COS/CFD/BV-08-C [Non-blocking Config Response]
+        Verify that the IUT does not block transmitting L2CAP_ConfigRsp while waiting for L2CAP_ConfigRsp
+        from the Lower Tester.
+        """
+        psm = 1
+        self.device_under_test.l2cap.OpenChannel(l2cap_facade_pb2.OpenChannelRequest(remote=self.pts_address, psm=psm))
+        self._pending_connection_complete()
+        self.device_under_test.l2cap.CloseChannel(l2cap_facade_pb2.CloseChannelRequest(psm=psm))
+        self._pending_connection_close()
+
+
+    def test_L2CAP_ERM_BI_01_C(self):
+        """
+        L2CAP/ERM/BI-01-C [S-Frame [REJ] Lost or Corrupted]
+        Verify the IUT can handle receipt of an S-=frame [RR] Poll = 1 if the S-frame [REJ] sent from the IUT
+        is lost.
+        """
+        psm = 1
+        self.device_under_test.l2cap.SetDynamicChannel(l2cap_facade_pb2.SetEnableDynamicChannelRequest(
+            psm=psm, retransmission_mode=l2cap_facade_pb2.RetransmissionFlowControlMode.ERTM))
+        self._pending_connection_complete()
+        self._pending_connection_close(timeout=60)
diff --git a/gd/l2cap/classic/facade.cc b/gd/l2cap/classic/facade.cc
index 64f3810..83073f7 100644
--- a/gd/l2cap/classic/facade.cc
+++ b/gd/l2cap/classic/facade.cc
@@ -64,6 +64,22 @@
     return connection_complete_stream_.HandleRequest(context, request, writer);
   }
 
+  class ConnectionCloseCallback : public grpc::GrpcEventStreamCallback<ConnectionCloseEvent, ConnectionCloseEvent> {
+   public:
+    void OnWriteResponse(ConnectionCloseEvent* response, const ConnectionCloseEvent& event) override {
+      response->CopyFrom(event);
+    }
+
+  } connection_close_callback_;
+  ::bluetooth::grpc::GrpcEventStream<ConnectionCloseEvent, ConnectionCloseEvent> connection_close_stream_{
+      &connection_close_callback_};
+
+  ::grpc::Status FetchConnectionClose(::grpc::ServerContext* context,
+                                      const ::bluetooth::facade::EventStreamRequest* request,
+                                      ::grpc::ServerWriter<classic::ConnectionCloseEvent>* writer) override {
+    return connection_close_stream_.HandleRequest(context, request, writer);
+  }
+
   ::grpc::Status Connect(::grpc::ServerContext* context, const facade::BluetoothAddress* request,
                          ::google::protobuf::Empty* response) override {
     auto fixed_channel_manager = l2cap_layer_->GetFixedChannelManager();
@@ -108,6 +124,17 @@
     return ::grpc::Status::OK;
   }
 
+  ::grpc::Status CloseChannel(::grpc::ServerContext* context,
+                              const ::bluetooth::l2cap::classic::CloseChannelRequest* request,
+                              ::google::protobuf::Empty* response) override {
+    auto psm = request->psm();
+    if (dynamic_channel_helper_map_.find(request->psm()) == dynamic_channel_helper_map_.end()) {
+      return ::grpc::Status(::grpc::StatusCode::FAILED_PRECONDITION, "Psm not registered");
+    }
+    dynamic_channel_helper_map_[psm]->disconnect();
+    return ::grpc::Status::OK;
+  }
+
   ::grpc::Status FetchL2capData(::grpc::ServerContext* context, const ::bluetooth::facade::EventStreamRequest* request,
                                 ::grpc::ServerWriter<classic::L2capPacket>* writer) override {
     return l2cap_stream_.HandleRequest(context, request, writer);
@@ -218,6 +245,10 @@
           common::Bind(&L2capDynamicChannelHelper::on_connect_fail, common::Unretained(this)), handler_);
     }
 
+    void disconnect() {
+      channel_->Close();
+    }
+
     void on_l2cap_service_registration_complete(DynamicChannelManager::RegistrationResult registration_result,
                                                 std::unique_ptr<DynamicChannelService> service) {}
 
@@ -226,6 +257,15 @@
       event.mutable_remote()->set_address(channel->GetDevice().ToString());
       facade_service_->connection_complete_stream_.OnIncomingEvent(event);
       channel_ = std::move(channel);
+      channel_->RegisterOnCloseCallback(
+          handler_, common::Bind(&L2capDynamicChannelHelper::on_close_callback, common::Unretained(this)));
+    }
+
+    void on_close_callback(hci::ErrorCode errorCode) {
+      ConnectionCloseEvent event;
+      event.mutable_remote()->set_address(channel_->GetDevice().ToString());
+      event.set_reason(static_cast<uint32_t>(errorCode));
+      facade_service_->connection_close_stream_.OnIncomingEvent(event);
     }
 
     void on_connect_fail(DynamicChannelManager::ConnectionResult result) {}
diff --git a/gd/l2cap/classic/facade.proto b/gd/l2cap/classic/facade.proto
index ab2a911..535dca9 100644
--- a/gd/l2cap/classic/facade.proto
+++ b/gd/l2cap/classic/facade.proto
@@ -12,12 +12,15 @@
   rpc FetchConnectionComplete(facade.EventStreamRequest) returns (stream ConnectionCompleteEvent) {
     // Testing Android Bluetooth stack only. Optional for other stack.
   }
+  rpc FetchConnectionClose(facade.EventStreamRequest) returns (stream ConnectionCloseEvent) {
+    // Testing Android Bluetooth stack only. Optional for other stack.
+  }
   rpc Connect(facade.BluetoothAddress) returns (google.protobuf.Empty) {}
   rpc OpenChannel(OpenChannelRequest) returns (google.protobuf.Empty) {}
+  rpc CloseChannel(CloseChannelRequest) returns (google.protobuf.Empty) {}
   rpc ConfigureChannel(ConfigureChannelRequest) returns (google.protobuf.Empty) {}
   rpc SendL2capPacket(L2capPacket) returns (SendL2capPacketResult) {}
   rpc FetchL2capData(facade.EventStreamRequest) returns (stream L2capPacket) {}
-  rpc RegisterDynamicChannel(RegisterDynamicChannelRequest) returns (google.protobuf.Empty) {}
   rpc SetDynamicChannel(SetEnableDynamicChannelRequest) returns (google.protobuf.Empty) {}
   rpc SendDynamicChannelPacket(DynamicChannelPacket) returns (google.protobuf.Empty) {}
 }
@@ -30,6 +33,11 @@
   facade.BluetoothAddress remote = 1;
 }
 
+message ConnectionCloseEvent {
+  facade.BluetoothAddress remote = 1;
+  uint32 reason = 2;
+}
+
 enum RetransmissionFlowControlMode {
   BASIC = 0;
   ERTM = 3;
@@ -47,8 +55,7 @@
 }
 
 message CloseChannelRequest {
-  facade.BluetoothAddress remote = 1;
-  uint32 cid = 2;
+  uint32 psm = 1;
 }
 
 enum ChannelSignalEventType {
@@ -77,10 +84,6 @@
   bytes payload = 3;
 }
 
-message RegisterDynamicChannelRequest {
-  uint32 psm = 1;
-}
-
 message SetEnableDynamicChannelRequest {
   uint32 psm = 1;
   bool enable = 2;
diff --git a/gd/l2cap/le/l2cap_le_module.cc b/gd/l2cap/le/l2cap_le_module.cc
index 781843d..4959547 100644
--- a/gd/l2cap/le/l2cap_le_module.cc
+++ b/gd/l2cap/le/l2cap_le_module.cc
@@ -48,6 +48,9 @@
                                       &parameter_provider_};
 };
 
+L2capLeModule::L2capLeModule() {}
+L2capLeModule::~L2capLeModule() {}
+
 void L2capLeModule::ListDependencies(ModuleList* list) {
   list->add<hci::AclManager>();
 }
@@ -71,4 +74,4 @@
 
 }  // namespace le
 }  // namespace l2cap
-}  // namespace bluetooth
\ No newline at end of file
+}  // namespace bluetooth
diff --git a/gd/l2cap/le/l2cap_le_module.h b/gd/l2cap/le/l2cap_le_module.h
index 3ee6acf..4ed3d9f 100644
--- a/gd/l2cap/le/l2cap_le_module.h
+++ b/gd/l2cap/le/l2cap_le_module.h
@@ -26,13 +26,13 @@
 
 class L2capLeModule : public bluetooth::Module {
  public:
-  L2capLeModule() = default;
-  ~L2capLeModule() = default;
+  L2capLeModule();
+  virtual ~L2capLeModule();
 
   /**
    * Get the api to the LE fixed channel l2cap module
    */
-  std::unique_ptr<FixedChannelManager> GetFixedChannelManager();
+  virtual std::unique_ptr<FixedChannelManager> GetFixedChannelManager();
 
   static const ModuleFactory Factory;
 
@@ -53,4 +53,4 @@
 
 }  // namespace le
 }  // namespace l2cap
-}  // namespace bluetooth
\ No newline at end of file
+}  // namespace bluetooth
diff --git a/gd/l2cap/le/l2cap_le_module_mock.h b/gd/l2cap/le/l2cap_le_module_mock.h
new file mode 100644
index 0000000..897ddb0
--- /dev/null
+++ b/gd/l2cap/le/l2cap_le_module_mock.h
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#pragma once
+
+#include "l2cap/le/l2cap_le_module.h"
+
+#include <gmock/gmock.h>
+
+// Unit test interfaces
+namespace bluetooth {
+namespace l2cap {
+namespace le {
+namespace testing {
+
+class MockL2capLeModule : public L2capLeModule {
+ public:
+  MOCK_METHOD(std::unique_ptr<FixedChannelManager>, GetFixedChannelManager, (), (override));
+};
+
+}  // namespace testing
+}  // namespace le
+}  // namespace l2cap
+}  // namespace bluetooth
diff --git a/gd/l2cap/pts/pts.json b/gd/l2cap/pts/pts.json
new file mode 100644
index 0000000..76a27be
--- /dev/null
+++ b/gd/l2cap/pts/pts.json
@@ -0,0 +1,34 @@
+
+{   "_description": "Bluetooth cert testing",
+    "testbed":
+    [
+        {
+            "_description": "PTS l2cap layer test",
+            "name": "PTSL2CAP",
+            "GdDevice":
+            [
+                {
+                    "grpc_port": "8899",
+                    "grpc_root_server_port": "8897",
+                    "signal_port": "8895",
+                    "label": "stack_under_test",
+                    "serial_number": "DUT",
+                    "cmd":
+                    [
+                        "adb",
+                        "-s",
+                        "$(serial_number)",
+                        "shell",
+                        "/system/bin/bluetooth_stack_with_facade",
+                        "--grpc-port=$(grpc_port)",
+                        "--root-server-port=$(grpc_root_server_port)",
+                        "--btsnoop=data/misc/bluetooth/logs/btsnoop_hci.log",
+                        "--signal-port=$(signal_port)"
+                    ]
+                }
+            ],
+            "pts_address": "PTS"
+        }
+    ],
+    "logpath": "/tmp/logs"
+}
diff --git a/gd/l2cap/pts/pts_l2cap_testcase b/gd/l2cap/pts/pts_l2cap_testcase
new file mode 100644
index 0000000..a0ae40e
--- /dev/null
+++ b/gd/l2cap/pts/pts_l2cap_testcase
@@ -0,0 +1 @@
+PTSL2capTest
diff --git a/gd/l2cap/pts/run_pts_l2cap.sh b/gd/l2cap/pts/run_pts_l2cap.sh
new file mode 100755
index 0000000..9165f58
--- /dev/null
+++ b/gd/l2cap/pts/run_pts_l2cap.sh
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+act.py -c $ANDROID_BUILD_TOP/system/bt/gd/l2cap/pts/pts.json -tf $ANDROID_BUILD_TOP/system/bt/gd/l2cap/pts/pts_l2cap_testcase -tp $ANDROID_BUILD_TOP/system/bt/gd
diff --git a/gd/security/initial_informations.h b/gd/security/initial_informations.h
index db560bd..4e5efa4 100644
--- a/gd/security/initial_informations.h
+++ b/gd/security/initial_informations.h
@@ -19,6 +19,7 @@
 #pragma once
 
 #include <optional>
+#include <variant>
 
 #include "common/bidi_queue.h"
 #include "common/callback.h"
@@ -28,6 +29,7 @@
 #include "os/handler.h"
 #include "packet/base_packet_builder.h"
 #include "packet/packet_view.h"
+#include "security/ecdh_keys.h"
 #include "security/pairing_failure.h"
 #include "security/smp_packets.h"
 #include "security/ui.h"
diff --git a/gd/shim/discoverability.cc b/gd/shim/discoverability.cc
index 5754882..f793404 100644
--- a/gd/shim/discoverability.cc
+++ b/gd/shim/discoverability.cc
@@ -36,26 +36,44 @@
   impl(neighbor::DiscoverabilityModule* module) : module_(module) {}
 
   neighbor::DiscoverabilityModule* module_{nullptr};
+
+  bool general_discoverability_enabled_{false};
+  bool limited_discoverability_enabled_{false};
 };
 
 void Discoverability::StopDiscoverability() {
-  return pimpl_->module_->StopDiscoverability();
+  if (pimpl_->general_discoverability_enabled_ || pimpl_->limited_discoverability_enabled_) {
+    pimpl_->module_->StopDiscoverability();
+    LOG_DEBUG("%s Stopped discoverability", __func__);
+  } else {
+    LOG_WARN("%s Discoverability not enabled", __func__);
+  }
 }
 
 void Discoverability::StartLimitedDiscoverability() {
-  return pimpl_->module_->StartLimitedDiscoverability();
+  if (pimpl_->general_discoverability_enabled_ || pimpl_->limited_discoverability_enabled_) {
+    LOG_WARN("%s Please stop discoverability before re-enabling", __func__);
+    return;
+  }
+  pimpl_->module_->StartLimitedDiscoverability();
+  LOG_DEBUG("%s Started limited discoverability", __func__);
 }
 
 void Discoverability::StartGeneralDiscoverability() {
-  return pimpl_->module_->StartGeneralDiscoverability();
+  if (pimpl_->general_discoverability_enabled_ || pimpl_->limited_discoverability_enabled_) {
+    LOG_WARN("%s Please stop discoverability before re-enabling", __func__);
+    return;
+  }
+  pimpl_->module_->StartGeneralDiscoverability();
+  LOG_DEBUG("%s Started general discoverability", __func__);
 }
 
 bool Discoverability::IsGeneralDiscoverabilityEnabled() const {
-  return pimpl_->module_->IsGeneralDiscoverabilityEnabled();
+  return pimpl_->general_discoverability_enabled_;
 }
 
 bool Discoverability::IsLimitedDiscoverabilityEnabled() const {
-  return pimpl_->module_->IsLimitedDiscoverabilityEnabled();
+  return pimpl_->limited_discoverability_enabled_;
 }
 
 /**
diff --git a/main/shim/btm_api.cc b/main/shim/btm_api.cc
index a8adee8..6b9fce7 100644
--- a/main/shim/btm_api.cc
+++ b/main/shim/btm_api.cc
@@ -25,43 +25,13 @@
 
 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 @@
   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 @@
   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 @@
       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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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 @@
   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;
+}
diff --git a/main/shim/btm_api.h b/main/shim/btm_api.h
index 6cd1fc4..905fcfa 100644
--- a/main/shim/btm_api.h
+++ b/main/shim/btm_api.h
@@ -24,6 +24,1016 @@
 
 /*******************************************************************************
  *
+ * 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
+ *                      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.
+ *
+ ******************************************************************************/
+tBTM_STATUS BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms,
+                             tBTM_INQ_RESULTS_CB* p_results_cb,
+                             tBTM_CMPL_CB* p_cmpl_cb);
+
+/*******************************************************************************
+ *
+ * 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)
+ *
+ *                  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 BTM_SetPeriodicInquiryMode(tBTM_INQ_PARMS* p_inqparms,
+                                       uint16_t max_delay, uint16_t min_delay,
+                                       tBTM_INQ_RESULTS_CB* p_results_cb);
+
+/*******************************************************************************
+ *
+ * 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 BTM_SetDiscoverability(uint16_t inq_mode, uint16_t window,
+                                   uint16_t interval);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SetInquiryScanType
+ *
+ * Description      This function is called to set the iquiry scan-type to
+ *                  standard or interlaced.
+ *
+ * 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_SetInquiryScanType(uint16_t scan_type);
+
+/*******************************************************************************
+ *
+ * Function         BTM_BleObserve
+ *
+ * Description      This procedure keep the device listening for advertising
+ *                  events from a broadcast device.
+ *
+ * Parameters       start: start or stop observe.
+ *
+ * Returns          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_SetPageScanType
+ *
+ * Description      This function is called to set the page scan-type to
+ *                  standard or interlaced.
+ *
+ * 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_SetPageScanType(uint16_t scan_type);
+
+/*******************************************************************************
+ *
+ * Function         BTM_SetInquiryMode
+ *
+ * Description      This function is called to set standard, with RSSI
+ *                  mode or extended of the inquiry for local device.
+ *
+ * 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_STATUS BTM_SetInquiryMode(uint8_t mode);
+
+/*******************************************************************************
+ *
+ * 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 BTM_ReadDiscoverability(uint16_t* p_window, uint16_t* p_interval);
+
+/*******************************************************************************
+ *
+ * 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 BTM_CancelPeriodicInquiry(void);
+
+/*******************************************************************************
+ *
+ * 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 BTM_SetConnectability(uint16_t page_mode, uint16_t window,
+                                  uint16_t interval);
+
+/*******************************************************************************
+ *
+ * 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 BTM_ReadConnectability(uint16_t* p_window, uint16_t* p_interval);
+
+/*******************************************************************************
+ *
+ * Function         BTM_IsInquiryActive
+ *
+ * Description      Return 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 BTM_IsInquiryActive(void);
+
+/*******************************************************************************
+ *
+ * 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 BTM_CancelInquiry(void);
+
+/*******************************************************************************
+ *
+ * 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 resources could not be allocated to
+ *                                   start the command
+ *                  BTM_WRONG_MODE if the device is not up.
+ *
+ ******************************************************************************/
+tBTM_STATUS BTM_ReadRemoteDeviceName(const RawAddress& remote_bda,
+                                     tBTM_CMPL_CB* p_cb,
+                                     tBT_TRANSPORT transport);
+
+/*******************************************************************************
+ *
+ * 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 resources could not be allocated to
+ *                                   start the command
+ *                  BTM_WRONG_MODE if there is no active remote name request.
+ *
+ ******************************************************************************/
+tBTM_STATUS BTM_CancelRemoteDeviceName(void);
+
+/*******************************************************************************
+ *
+ * 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* BTM_InqDbRead(const RawAddress& p_bda);
+
+/*******************************************************************************
+ *
+ * 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* BTM_InqDbFirst(void);
+
+/*******************************************************************************
+ *
+ * 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* BTM_InqDbNext(tBTM_INQ_INFO* p_cur);
+
+/*******************************************************************************
+ *
+ * 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 BTM_ClearInqDb(const RawAddress* p_bda);
+
+/*******************************************************************************
+ *
+ * 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 BTM_ReadInquiryRspTxPower(tBTM_CMPL_CB* p_cb);
+
+/*******************************************************************************
+ *
+ * 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 BTM_WriteEIR(BT_HDR* p_buff);
+
+/*******************************************************************************
+ *
+ * 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 BTM_HasEirService(const uint32_t* p_eir_uuid, uint16_t uuid16);
+
+/*******************************************************************************
+ *
+ * Function         BTM_HasInquiryEirService
+ *
+ * Description      Return if a UUID is in the bit map of a 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 a complete list
+ *                  BTM_EIR_UNKNOWN - if not found and it is not complete list
+ *
+ ******************************************************************************/
+tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService(tBTM_INQ_RESULTS* p_results,
+                                                uint16_t uuid16);
+
+/*******************************************************************************
+ *
+ * Function         BTM_AddEirService
+ *
+ * Description      This function is called to add a service in the bit map UUID
+ *                  list.
+ *
+ * Parameters       p_eir_uuid - bit mask of UUID list for EIR
+ *                  uuid16 - UUID 16-bit
+ *
+ * Returns          None
+ *
+ ******************************************************************************/
+void BTM_AddEirService(uint32_t* p_eir_uuid, uint16_t uuid16);
+
+/*******************************************************************************
+ *
+ * Function         BTM_RemoveEirService
+ *
+ * Description      This function is called to remove a service from the bit map
+ *                  UUID list.
+ *
+ * Parameters       p_eir_uuid - bit mask of UUID list for EIR
+ *                  uuid16 - UUID 16-bit
+ *
+ * Returns          None
+ *
+ ******************************************************************************/
+void BTM_RemoveEirService(uint32_t* p_eir_uuid, uint16_t uuid16);
+
+/*******************************************************************************
+ *
+ * Function         BTM_GetEirSupportedServices
+ *
+ * Description      This function is called to get UUID list from bit map 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 BTM_GetEirSupportedServices(uint32_t* p_eir_uuid, uint8_t** p,
+                                    uint8_t max_num_uuid16,
+                                    uint8_t* p_num_uuid16);
+
+/*******************************************************************************
+ *
+ * Function         BTM_GetEirUuidList
+ *
+ * Description      This function parses EIR and returns UUID list.
+ *
+ * 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          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 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_SecAddBleDevice
+ *
+ * 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.
+ *
+ * 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          true if added OK, else false
+ *
+ ******************************************************************************/
+bool BTM_SecAddBleDevice(const RawAddress& bd_addr, BD_NAME bd_name,
+                         tBT_DEVICE_TYPE dev_type, tBLE_ADDR_TYPE addr_type);
+
+/*******************************************************************************
+ *
+ * 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 BTM_SecAddBleKey(const RawAddress& bd_addr, tBTM_LE_KEY_VALUE* p_le_key,
+                      tBTM_LE_KEY_TYPE key_type);
+
+/*******************************************************************************
+ *
+ * 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 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_ReadConnectionAddr
+ *
+ * Description      Read the local device random address.
+ *
+ * Returns          void
+ *
+ ******************************************************************************/
+void BTM_ReadConnectionAddr(const RawAddress& remote_bda,
+                            RawAddress& local_conn_addr,
+                            tBLE_ADDR_TYPE* p_addr_type);
+
+/*******************************************************************************
+ *
+ * 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 BTM_IsBleConnection(uint16_t conn_handle);
+
+/*******************************************************************************
+ *
+ * Function         BTM_ReadRemoteConnectionAddr
+ *
+ * Description      Read the remote device address currently used.
+ *
+ * Returns          void
+ *
+ ******************************************************************************/
+bool BTM_ReadRemoteConnectionAddr(const RawAddress& pseudo_addr,
+                                  RawAddress& conn_addr,
+                                  tBLE_ADDR_TYPE* p_addr_type);
+
+/*******************************************************************************
+ *
+ * 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 is too many
+ *                            attempts.
+ *
+ * Returns          None
+ *
+ ******************************************************************************/
+void BTM_SecurityGrant(const RawAddress& bd_addr, uint8_t res);
+
+/*******************************************************************************
+ *
+ * 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 SMP_SUCCESS if success
+ *                  passkey - numeric value in the range of
+ *                               BTM_MIN_PASSKEY_VAL(0) -
+ *                               BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
+ *
+ ******************************************************************************/
+void BTM_BlePasskeyReply(const RawAddress& bd_addr, uint8_t res,
+                         uint32_t passkey);
+
+/*******************************************************************************
+ *
+ * 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 BTM_BleConfirmReply(const RawAddress& bd_addr, uint8_t res);
+
+/*******************************************************************************
+ *
+ * Function         BTM_LeOobDataReply
+ *
+ * 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      - simple pairing Randomizer  C.
+ *
+ ******************************************************************************/
+void BTM_BleOobDataReply(const RawAddress& bd_addr, uint8_t res, uint8_t len,
+                         uint8_t* p_data);
+
+/*******************************************************************************
+ *
+ * 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 BTM_BleSecureConnectionOobDataReply(const RawAddress& bd_addr,
+                                         uint8_t* p_c, uint8_t* p_r);
+
+/******************************************************************************
+ *
+ * Function         BTM_BleSetConnScanParams
+ *
+ * Description      Set scan parameters used in BLE connection request
+ *
+ * Parameters:      scan_interval    - scan interval
+ *                  scan_window      - scan window
+ *
+ * Returns          void
+ *
+ ******************************************************************************/
+void BTM_BleSetConnScanParams(uint32_t scan_interval, uint32_t scan_window);
+
+/********************************************************
+ *
+ * Function         BTM_BleSetPrefConnParams
+ *
+ * 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.
+ *
+ * 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_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_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 BTM_ReadDevInfo(const RawAddress& remote_bda, tBT_DEVICE_TYPE* p_dev_type,
+                     tBLE_ADDR_TYPE* p_addr_type);
+
+/*******************************************************************************
+ *
+ * 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 BTM_ReadConnectedTransportAddress(RawAddress* remote_bda,
+                                       tBT_TRANSPORT transport);
+
+/*******************************************************************************
+ *
+ * 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_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.
+ *                  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 BTM_BleSetPhy(const RawAddress& bd_addr, uint8_t tx_phys, uint8_t rx_phys,
+                   uint16_t phy_options);
+
+/*******************************************************************************
+ *
+ * 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 signing data
+ *                  signature: output parameter where data signature is going to
+ *                             be stored.
+ *
+ * Returns          true if signing sucessul, otherwise false.
+ *
+ ******************************************************************************/
+bool BTM_BleDataSignature(const RawAddress& bd_addr, uint8_t* p_text,
+                          uint16_t len, BLE_SIGNATURE signature);
+
+/*******************************************************************************
+ *
+ * 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 BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig,
+                            uint16_t len, uint32_t counter, uint8_t* p_comp);
+
+/*******************************************************************************
+ *
+ * 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);
+
+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);
+
+/*******************************************************************************
+ *
+ * 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);
+
+/*******************************************************************************
+ *
+ * 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_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_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_DeviceReset
  *
  * Description      This function is called to reset the controller.  The
@@ -241,294 +1251,6 @@
 tBTM_STATUS BTM_EnableTestMode(void);
 
 /*******************************************************************************
- * DEVICE DISCOVERY FUNCTIONS - Inquiry, Remote Name, Discovery, Class of Device
- ******************************************************************************/
-
-/*******************************************************************************
- *
- * 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 BTM_SetDiscoverability(uint16_t inq_mode, uint16_t window,
-                                   uint16_t interval);
-
-/*******************************************************************************
- *
- * 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 BTM_ReadDiscoverability(uint16_t* p_window, uint16_t* p_interval);
-
-/*******************************************************************************
- *
- * 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)
- *
- *                  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 BTM_SetPeriodicInquiryMode(tBTM_INQ_PARMS* p_inqparms,
-                                       uint16_t max_delay, uint16_t min_delay,
-                                       tBTM_INQ_RESULTS_CB* p_results_cb);
-
-/*******************************************************************************
- *
- * 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
- *                      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.
- *
- ******************************************************************************/
-tBTM_STATUS BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms,
-                             tBTM_INQ_RESULTS_CB* p_results_cb,
-                             tBTM_CMPL_CB* p_cmpl_cb);
-
-/*******************************************************************************
- *
- * Function         BTM_IsInquiryActive
- *
- * Description      Return 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 BTM_IsInquiryActive(void);
-
-/*******************************************************************************
- *
- * 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 BTM_CancelInquiry(void);
-
-/*******************************************************************************
- *
- * 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 BTM_CancelPeriodicInquiry(void);
-
-/*******************************************************************************
- *
- * 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 BTM_SetConnectability(uint16_t page_mode, uint16_t window,
-                                  uint16_t interval);
-
-/*******************************************************************************
- *
- * 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 BTM_ReadConnectability(uint16_t* p_window, uint16_t* p_interval);
-
-/*******************************************************************************
- *
- * Function         BTM_SetInquiryMode
- *
- * Description      This function is called to set standard, with RSSI
- *                  mode or extended of the inquiry for local device.
- *
- * 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_STATUS BTM_SetInquiryMode(uint8_t mode);
-
-/*******************************************************************************
- *
- * Function         BTM_SetInquiryScanType
- *
- * Description      This function is called to set the iquiry scan-type to
- *                  standard or interlaced.
- *
- * 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_SetInquiryScanType(uint16_t scan_type);
-
-/*******************************************************************************
- *
- * Function         BTM_SetPageScanType
- *
- * Description      This function is called to set the page scan-type to
- *                  standard or interlaced.
- *
- * 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_SetPageScanType(uint16_t scan_type);
-
-/*******************************************************************************
- *
- * 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 resources could not be allocated to
- *                                   start the command
- *                  BTM_WRONG_MODE if the device is not up.
- *
- ******************************************************************************/
-tBTM_STATUS BTM_ReadRemoteDeviceName(const RawAddress& remote_bda,
-                                     tBTM_CMPL_CB* p_cb,
-                                     tBT_TRANSPORT transport);
-
-/*******************************************************************************
- *
- * 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 resources could not be allocated to
- *                                   start the command
- *                  BTM_WRONG_MODE if there is no active remote name request.
- *
- ******************************************************************************/
-tBTM_STATUS BTM_CancelRemoteDeviceName(void);
-
-/*******************************************************************************
  *
  * Function         BTM_ReadRemoteVersion
  *
@@ -603,77 +1325,6 @@
  ******************************************************************************/
 uint8_t* BTM_ReadAllRemoteFeatures(const RawAddress& addr);
 
-/*******************************************************************************
- *
- * 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* BTM_InqDbRead(const RawAddress& p_bda);
-
-/*******************************************************************************
- *
- * 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* BTM_InqDbFirst(void);
-
-/*******************************************************************************
- *
- * 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* BTM_InqDbNext(tBTM_INQ_INFO* p_cur);
-
-/*******************************************************************************
- *
- * 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 BTM_ClearInqDb(const RawAddress* p_bda);
-
-/*******************************************************************************
- *
- * 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 BTM_ReadInquiryRspTxPower(tBTM_CMPL_CB* p_cb);
-
 /*****************************************************************************
  *  ACL CHANNEL MANAGEMENT FUNCTIONS
  ****************************************************************************/
@@ -1803,130 +2454,6 @@
 tBTM_STATUS BTM_DeleteStoredLinkKey(const RawAddress* bd_addr,
                                     tBTM_CMPL_CB* p_cb);
 
-/*******************************************************************************
- *
- * 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 BTM_WriteEIR(BT_HDR* p_buff);
-
-/*******************************************************************************
- *
- * 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 BTM_HasEirService(const uint32_t* p_eir_uuid, uint16_t uuid16);
-
-/*******************************************************************************
- *
- * Function         BTM_HasInquiryEirService
- *
- * Description      Return if a UUID is in the bit map of a 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 a complete list
- *                  BTM_EIR_UNKNOWN - if not found and it is not complete list
- *
- ******************************************************************************/
-tBTM_EIR_SEARCH_RESULT BTM_HasInquiryEirService(tBTM_INQ_RESULTS* p_results,
-                                                uint16_t uuid16);
-
-/*******************************************************************************
- *
- * Function         BTM_AddEirService
- *
- * Description      This function is called to add a service in the bit map UUID
- *                  list.
- *
- * Parameters       p_eir_uuid - bit mask of UUID list for EIR
- *                  uuid16 - UUID 16-bit
- *
- * Returns          None
- *
- ******************************************************************************/
-void BTM_AddEirService(uint32_t* p_eir_uuid, uint16_t uuid16);
-
-/*******************************************************************************
- *
- * Function         BTM_RemoveEirService
- *
- * Description      This function is called to remove a service from the bit map
- *                  UUID list.
- *
- * Parameters       p_eir_uuid - bit mask of UUID list for EIR
- *                  uuid16 - UUID 16-bit
- *
- * Returns          None
- *
- ******************************************************************************/
-void BTM_RemoveEirService(uint32_t* p_eir_uuid, uint16_t uuid16);
-
-/*******************************************************************************
- *
- * Function         BTM_GetEirSupportedServices
- *
- * Description      This function is called to get UUID list from bit map 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 BTM_GetEirSupportedServices(uint32_t* p_eir_uuid, uint8_t** p,
-                                    uint8_t max_num_uuid16,
-                                    uint8_t* p_num_uuid16);
-
-/*******************************************************************************
- *
- * Function         BTM_GetEirUuidList
- *
- * Description      This function parses EIR and returns UUID list.
- *
- * 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          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 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);
-
 /*****************************************************************************
  *  SCO OVER HCI
  ****************************************************************************/
@@ -2024,43 +2551,6 @@
  */
 /*******************************************************************************
  *
- * Function         BTM_SecAddBleDevice
- *
- * 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.
- *
- * 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          true if added OK, else false
- *
- ******************************************************************************/
-bool BTM_SecAddBleDevice(const RawAddress& bd_addr, BD_NAME bd_name,
-                         tBT_DEVICE_TYPE dev_type, tBLE_ADDR_TYPE addr_type);
-
-/*******************************************************************************
- *
- * 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 BTM_SecAddBleKey(const RawAddress& bd_addr, tBTM_LE_KEY_VALUE* p_le_key,
-                      tBTM_LE_KEY_TYPE key_type);
-
-/*******************************************************************************
- *
  * Function         BTM_BleObtainVendorCapabilities
  *
  * Description      This function is called to obatin vendor capabilties
@@ -2092,6 +2582,7 @@
  *
  ******************************************************************************/
 void BTM_BleGetVendorCapabilities(tBTM_BLE_VSC_CB* p_cmn_vsc_cb);
+
 /*******************************************************************************
  *
  * Function         BTM_BleSetStorageConfig
@@ -2100,13 +2591,10 @@
  *                  setup callbacks.
  *
  * 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
+ *                  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
  *
  *
  ******************************************************************************/
@@ -2149,237 +2637,6 @@
 void BTM_BleWriteScanRsp(uint8_t* data, uint8_t length,
                          tBTM_BLE_ADV_DATA_CMPL_CBACK* p_adv_data_cback);
 
-/*******************************************************************************
- *
- * Function         BTM_BleObserve
- *
- * Description      This procedure keep the device listening for advertising
- *                  events from a broadcast device.
- *
- * Parameters       start: start or stop observe.
- *
- * Returns          void
- *
- ******************************************************************************/
-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();
-
-/*******************************************************************************
- *
- * 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 is too many
- *                            attempts.
- *
- * Returns          None
- *
- ******************************************************************************/
-void BTM_SecurityGrant(const RawAddress& bd_addr, uint8_t res);
-
-/*******************************************************************************
- *
- * 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 SMP_SUCCESS if success
- *                  passkey - numeric value in the range of
- *                               BTM_MIN_PASSKEY_VAL(0) -
- *                               BTM_MAX_PASSKEY_VAL(999999(0xF423F)).
- *
- ******************************************************************************/
-void BTM_BlePasskeyReply(const RawAddress& bd_addr, uint8_t res,
-                         uint32_t passkey);
-
-/*******************************************************************************
- *
- * 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 BTM_BleConfirmReply(const RawAddress& bd_addr, uint8_t res);
-
-/*******************************************************************************
- *
- * Function         BTM_LeOobDataReply
- *
- * 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      - simple pairing Randomizer  C.
- *
- ******************************************************************************/
-void BTM_BleOobDataReply(const RawAddress& bd_addr, uint8_t res, uint8_t len,
-                         uint8_t* p_data);
-
-/*******************************************************************************
- *
- * 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 BTM_BleSecureConnectionOobDataReply(const RawAddress& bd_addr,
-                                         uint8_t* p_c, uint8_t* p_r);
-
-/*******************************************************************************
- *
- * 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 signing data
- *                  signature: output parameter where data signature is going to
- *                             be stored.
- *
- * Returns          true if signing sucessul, otherwise false.
- *
- ******************************************************************************/
-bool BTM_BleDataSignature(const RawAddress& bd_addr, uint8_t* p_text,
-                          uint16_t len, BLE_SIGNATURE signature);
-
-/*******************************************************************************
- *
- * 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 BTM_BleVerifySignature(const RawAddress& bd_addr, uint8_t* p_orig,
-                            uint16_t len, uint32_t counter, uint8_t* p_comp);
-
-/*******************************************************************************
- *
- * Function         BTM_ReadConnectionAddr
- *
- * Description      Read the local device random address.
- *
- * Returns          void
- *
- ******************************************************************************/
-void BTM_ReadConnectionAddr(const RawAddress& remote_bda,
-                            RawAddress& local_conn_addr,
-                            tBLE_ADDR_TYPE* p_addr_type);
-
-/*******************************************************************************
- *
- * 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 BTM_IsBleConnection(uint16_t conn_handle);
-
-/*******************************************************************************
- *
- * Function         BTM_ReadRemoteConnectionAddr
- *
- * Description      Read the remote device address currently used.
- *
- * Returns          void
- *
- ******************************************************************************/
-bool BTM_ReadRemoteConnectionAddr(const RawAddress& pseudo_addr,
-                                  RawAddress& conn_addr,
-                                  tBLE_ADDR_TYPE* p_addr_type);
-
-/*******************************************************************************
- *
- * 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 BTM_BleLoadLocalKeys(uint8_t key_type, tBTM_BLE_LOCAL_KEYS* p_key);
-
-/********************************************************
- *
- * Function         BTM_BleSetPrefConnParams
- *
- * 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.
- *
- * 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_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_BleSetConnScanParams
- *
- * Description      Set scan parameters used in BLE connection request
- *
- * Parameters:      scan_interval    - scan interval
- *                  scan_window      - scan window
- *
- * Returns          void
- *
- ******************************************************************************/
-void BTM_BleSetConnScanParams(uint32_t scan_interval, uint32_t scan_window);
-
 /******************************************************************************
  *
  * Function         BTM_BleReadControllerFeatures
@@ -2421,38 +2678,6 @@
 
 /*******************************************************************************
  *
- * 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 BTM_ReadDevInfo(const RawAddress& remote_bda, tBT_DEVICE_TYPE* p_dev_type,
-                     tBLE_ADDR_TYPE* p_addr_type);
-
-/*******************************************************************************
- *
- * 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 BTM_ReadConnectedTransportAddress(RawAddress* remote_bda,
-                                       tBT_TRANSPORT transport);
-
-/*******************************************************************************
- *
  * Function         BTM_BleConfigPrivacy
  *
  * Description      This function is called to enable or disable the privacy in
@@ -2492,18 +2717,6 @@
 
 /*******************************************************************************
  *
- * 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 @@
 
 /*******************************************************************************
  *
- * 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 @@
  ******************************************************************************/
 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 @@
  ******************************************************************************/
 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