OSDN Git Service

Remove bta knowledge of hci handle
authorChris Manton <cmanton@google.com>
Tue, 25 Aug 2020 20:55:25 +0000 (13:55 -0700)
committerChris Manton <cmanton@google.com>
Tue, 25 Aug 2020 21:19:20 +0000 (14:19 -0700)
Want all the handles back

Towards proper interfaces

Bug: 163134718
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ic28ba99fc9f7371a6858009228c8ebeba28b5e10

bta/dm/bta_dm_act.cc
bta/dm/bta_dm_int.h
bta/include/bta_dm_acl.h
stack/acl/btm_acl.cc

index f8cab5a..6fb6882 100644 (file)
@@ -2155,11 +2155,10 @@ void BTA_dm_report_role_change(const RawAddress bd_addr, uint8_t new_role,
 }
 
 static tBTA_DM_PEER_DEVICE* allocate_device_for(const RawAddress& bd_addr,
-                                                tBT_TRANSPORT transport,
-                                                uint16_t handle) {
+                                                tBT_TRANSPORT transport) {
   for (uint8_t i = 0; i < bta_dm_cb.device_list.count; i++) {
     auto device = &bta_dm_cb.device_list.peer_device[i];
-    if (device->peer_bdaddr == bd_addr && device->conn_handle == handle) {
+    if (device->peer_bdaddr == bd_addr && device->transport == transport) {
       return device;
     }
   }
@@ -2169,7 +2168,6 @@ static tBTA_DM_PEER_DEVICE* allocate_device_for(const RawAddress& bd_addr,
         &bta_dm_cb.device_list.peer_device[bta_dm_cb.device_list.count];
     device->peer_bdaddr = bd_addr;
     bta_dm_cb.device_list.count++;
-    device->conn_handle = handle;
     if (transport == BT_TRANSPORT_LE) {
       bta_dm_cb.device_list.le_count++;
     }
@@ -2178,9 +2176,8 @@ static tBTA_DM_PEER_DEVICE* allocate_device_for(const RawAddress& bd_addr,
   return nullptr;
 }
 
-static void bta_dm_acl_up(const RawAddress& bd_addr, tBT_TRANSPORT transport,
-                          uint16_t handle) {
-  auto device = allocate_device_for(bd_addr, transport, handle);
+static void bta_dm_acl_up(const RawAddress& bd_addr, tBT_TRANSPORT transport) {
+  auto device = allocate_device_for(bd_addr, transport);
   if (device == nullptr) {
     APPL_TRACE_ERROR("%s max active connection reached, no resources",
                      __func__);
@@ -2206,10 +2203,8 @@ static void bta_dm_acl_up(const RawAddress& bd_addr, tBT_TRANSPORT transport,
   bta_dm_adjust_roles(true);
 }
 
-void BTA_dm_acl_up(const RawAddress bd_addr, tBT_TRANSPORT transport,
-                   uint16_t handle) {
-  do_in_main_thread(FROM_HERE,
-                    base::Bind(bta_dm_acl_up, bd_addr, transport, handle));
+void BTA_dm_acl_up(const RawAddress bd_addr, tBT_TRANSPORT transport) {
+  do_in_main_thread(FROM_HERE, base::Bind(bta_dm_acl_up, bd_addr, transport));
 }
 
 static void bta_dm_acl_down(const RawAddress& bd_addr,
index 626d9a8..65545f6 100644 (file)
@@ -192,7 +192,6 @@ typedef struct {
   tBTA_DM_PM_ACTION pm_mode_attempted;
   tBTA_DM_PM_ACTION pm_mode_failed;
   bool remove_dev_pending;
-  uint16_t conn_handle;
   tBT_TRANSPORT transport;
 } tBTA_DM_PEER_DEVICE;
 
index 102fa59..e844920 100644 (file)
@@ -22,8 +22,7 @@
 #include "types/bt_transport.h"
 #include "types/raw_address.h"
 
-void BTA_dm_acl_up(const RawAddress bd_addr, tBT_TRANSPORT transport,
-                   uint16_t handle);
+void BTA_dm_acl_up(const RawAddress bd_addr, tBT_TRANSPORT transport);
 void BTA_dm_acl_down(const RawAddress bd_addr, tBT_TRANSPORT transport);
 void BTA_dm_report_role_change(const RawAddress bd_addr, uint8_t new_role,
                                uint8_t hci_status);
index bd7dee1..0444f7c 100644 (file)
@@ -1173,8 +1173,7 @@ void StackAclBtmAcl::btm_establish_continue(tACL_CONN* p_acl_cb) {
   }
   p_acl_cb->link_up_issued = true;
 
-  BTA_dm_acl_up(p_acl_cb->remote_addr, p_acl_cb->transport,
-                p_acl_cb->hci_handle);
+  BTA_dm_acl_up(p_acl_cb->remote_addr, p_acl_cb->transport);
 }
 
 void btm_establish_continue_from_address(const RawAddress& bda,