From 56fc48389a2fcc20c95a91eabd2c3ad1ff5e8cef Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Sun, 10 Jan 2021 15:31:15 -0800 Subject: [PATCH] gd_shim_acl: Plumb stack/acl/btm_acl::on_acl_br_edr_{success,failed} Try not to re-converge divergent code paths Bug: 163134718 Tag: #refactor Test: compile & verify basic functions working Change-Id: Ie78d6b8c8d4eca1a24175a07f4e775e92439ce1b --- main/shim/acl.cc | 4 ++-- main/shim/acl_legacy_interface.cc | 4 ++-- main/shim/acl_legacy_interface.h | 5 ++--- stack/include/acl_hci_link_interface.h | 3 +++ 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/main/shim/acl.cc b/main/shim/acl.cc index 48e9369bb..382c1876f 100644 --- a/main/shim/acl.cc +++ b/main/shim/acl.cc @@ -957,7 +957,7 @@ void bluetooth::shim::legacy::Acl::OnConnectSuccess( ->ReadRemoteControllerInformation(); TRY_POSTING_ON_MAIN(acl_interface_.connection.classic.on_connected, bd_addr, - handle, HCI_SUCCESS, false); + handle, false); LOG_DEBUG("Connection successful classic remote:%s handle:%hu initiator:%s", PRIVATE_ADDRESS(remote_address), handle, (locally_initiated) ? "local" : "remote"); @@ -970,7 +970,7 @@ void bluetooth::shim::legacy::Acl::OnConnectFail(hci::Address address, hci::ErrorCode reason) { const RawAddress bd_addr = ToRawAddress(address); TRY_POSTING_ON_MAIN(acl_interface_.connection.classic.on_failed, bd_addr, - kInvalidHciHandle, ToLegacyHciErrorCode(reason), false); + ToLegacyHciErrorCode(reason)); LOG_WARN("Connection failed classic remote:%s reason:%s", PRIVATE_ADDRESS(address), hci::ErrorCodeText(reason).c_str()); BTM_LogHistory(kBtmLogTag, ToRawAddress(address), "Connection failed", diff --git a/main/shim/acl_legacy_interface.cc b/main/shim/acl_legacy_interface.cc index 68533cef1..02c637171 100644 --- a/main/shim/acl_legacy_interface.cc +++ b/main/shim/acl_legacy_interface.cc @@ -28,8 +28,8 @@ const acl_interface_t GetAclInterface() { .on_send_data_upwards = acl_rcv_acl_data, .on_packets_completed = acl_packets_completed, - .connection.classic.on_connected = btm_acl_connected, - .connection.classic.on_failed = btm_acl_connected, + .connection.classic.on_connected = on_acl_br_edr_connected, + .connection.classic.on_failed = on_acl_br_edr_failed, .connection.classic.on_disconnected = btm_acl_disconnected, .connection.le.on_connected = diff --git a/main/shim/acl_legacy_interface.h b/main/shim/acl_legacy_interface.h index 197a8d3f8..9747162f9 100644 --- a/main/shim/acl_legacy_interface.h +++ b/main/shim/acl_legacy_interface.h @@ -29,9 +29,8 @@ namespace legacy { typedef struct { void (*on_connected)(const RawAddress& bda, uint16_t handle, - tHCI_STATUS status, uint8_t enc_mode); - void (*on_failed)(const RawAddress& bda, uint16_t handle, tHCI_STATUS status, - uint8_t enc_mode); + uint8_t enc_mode); + void (*on_failed)(const RawAddress& bda, tHCI_STATUS status); void (*on_disconnected)(tHCI_STATUS status, uint16_t handle, tHCI_STATUS reason); } acl_classic_connection_interface_t; diff --git a/stack/include/acl_hci_link_interface.h b/stack/include/acl_hci_link_interface.h index 9bfbfb431..5b38d1315 100644 --- a/stack/include/acl_hci_link_interface.h +++ b/stack/include/acl_hci_link_interface.h @@ -28,6 +28,9 @@ void btm_acl_connection_request(const RawAddress& bda, uint8_t* dc); void btm_acl_connected(const RawAddress& bda, uint16_t handle, tHCI_STATUS status, uint8_t enc_mode); +void on_acl_br_edr_connected(const RawAddress& bda, uint16_t handle, + uint8_t enc_mode); +void on_acl_br_edr_failed(const RawAddress& bda, tHCI_STATUS status); void btm_acl_disconnected(tHCI_STATUS status, uint16_t handle, tHCI_STATUS reason); void btm_acl_encrypt_change(uint16_t handle, uint8_t status, -- 2.11.0