OSDN Git Service

Add Api stack/acl/::btm_pm_is_le_link
authorChris Manton <cmanton@google.com>
Wed, 23 Sep 2020 17:10:31 +0000 (10:10 -0700)
committerChris Manton <cmanton@google.com>
Thu, 8 Oct 2020 06:08:50 +0000 (06:08 +0000)
Towards loggable code

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Test: act.py -tc BleCocTest
Change-Id: Ie94f7b5a91e75aff552c1686fdd9f143c4337ea2

stack/acl/acl.h
stack/acl/btm_acl.cc
stack/include/acl_api.h

index d6a5649..5c31315 100644 (file)
@@ -174,6 +174,7 @@ typedef struct {
   friend bool BTM_ReadPowerMode(const RawAddress& remote_bda,
                                 tBTM_PM_MODE* p_mode);
   friend bool acl_is_role_switch_allowed();
+  friend bool btm_pm_is_le_link(const RawAddress& remote_bda);
   friend const RawAddress acl_address_from_handle(uint16_t hci_handle);
   friend int btm_pm_find_acl_ind(const RawAddress& remote_bda);
   friend tACL_CONN* btm_bda_to_acl(const RawAddress& bda,
index 5992f2d..f19ee26 100644 (file)
@@ -2549,6 +2549,17 @@ int btm_pm_find_acl_ind(const RawAddress& remote_bda) {
   return xx;
 }
 
+bool btm_pm_is_le_link(const RawAddress& remote_bda) {
+  const tACL_CONN* p_acl = &btm_cb.acl_cb_.acl_db[0];
+  for (uint8_t xx = 0; xx < MAX_L2CAP_LINKS; xx++, p_acl++) {
+    if (p_acl->in_use && p_acl->remote_addr == remote_bda &&
+        p_acl->transport == BT_TRANSPORT_LE) {
+      return true;
+    }
+  }
+  return false;
+}
+
 /*******************************************************************************
  *
  * Function         btm_ble_refresh_local_resolvable_private_addr
index cda4d59..dd75f35 100644 (file)
@@ -273,6 +273,7 @@ bool BTM_IsBleConnection(uint16_t hci_handle);
 const RawAddress acl_address_from_handle(uint16_t hci_handle);
 tBTM_PM_MCB* acl_power_mode_from_handle(uint16_t hci_handle);
 int btm_pm_find_acl_ind(const RawAddress& remote_bda);
+bool btm_pm_is_le_link(const RawAddress& remote_bda);
 
 void btm_ble_refresh_local_resolvable_private_addr(
     const RawAddress& pseudo_addr, const RawAddress& local_rpa);