Loading system/main/shim/acl.cc +45 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,8 @@ class ShimAclConnection { TRY_POSTING_ON_MAIN(send_data_upwards_, p_buf); } virtual void InitiateDisconnect(hci::DisconnectReason reason) = 0; protected: const uint16_t handle_{kInvalidHciHandle}; os::Handler* handler_; Loading Loading @@ -340,6 +342,10 @@ class ClassicShimAclConnection hci::Address GetRemoteAddress() const { return connection_->GetAddress(); } void InitiateDisconnect(hci::DisconnectReason reason) override { connection_->Disconnect(reason); } private: OnDisconnect on_disconnect_; const shim::legacy::acl_classic_link_interface_t interface_; Loading Loading @@ -400,6 +406,10 @@ class LeShimAclConnection return connection_->GetRemoteAddress(); } void InitiateDisconnect(hci::DisconnectReason reason) override { connection_->Disconnect(reason); } private: OnDisconnect on_disconnect_; const shim::legacy::acl_le_link_interface_t interface_; Loading Loading @@ -761,3 +771,38 @@ void bluetooth::shim::legacy::Acl::ConfigureLePrivacy( address_policy, empty_address_with_type, rotation_irk, minimum_rotation_time, maximum_rotation_time); } void bluetooth::shim::legacy::Acl::DisconnectClassic(uint16_t handle, tHCI_STATUS reason) { auto connection = pimpl_->handle_to_classic_connection_map_.find(handle); if (connection != pimpl_->handle_to_classic_connection_map_.end()) { auto remote_address = connection->second->GetRemoteAddress(); connection->second->InitiateDisconnect( ToDisconnectReasonFromLegacy(reason)); LOG_DEBUG("Disconnection initiated classic remote:%s handle:%hu", PRIVATE_ADDRESS(remote_address), handle); btm_cb.history_->Push("%-32s: %s classic", "Disconnection initiated", PRIVATE_ADDRESS(remote_address)); } else { LOG_WARN("Unable to disconnect unknown classic connection handle:0x%04x", handle); } } void bluetooth::shim::legacy::Acl::DisconnectLe(uint16_t handle, tHCI_STATUS reason) { auto connection = pimpl_->handle_to_le_connection_map_.find(handle); if (connection != pimpl_->handle_to_le_connection_map_.end()) { auto remote_address_with_type = connection->second->GetRemoteAddressWithType(); connection->second->InitiateDisconnect( ToDisconnectReasonFromLegacy(reason)); LOG_DEBUG("Disconnection initiated le remote:%s handle:%hu", PRIVATE_ADDRESS(remote_address_with_type), handle); btm_cb.history_->Push("%-32s: %s le", "Disconnection initiated", PRIVATE_ADDRESS(remote_address_with_type)); } else { LOG_WARN("Unable to disconnect unknown le connection handle:0x%04x", handle); } } system/main/shim/acl.h +3 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,9 @@ class Acl : public hci::acl_manager::ConnectionCallbacks, void ConfigureLePrivacy(bool is_le_privacy_enabled); void DisconnectClassic(uint16_t handle, tHCI_STATUS reason); void DisconnectLe(uint16_t handle, tHCI_STATUS reason); void Dump(int fd) const; protected: Loading system/main/shim/acl_api.cc +7 −0 Original line number Diff line number Diff line Loading @@ -51,3 +51,10 @@ void bluetooth::shim::ACL_WriteData(uint16_t handle, const BT_HDR* p_buf) { void bluetooth::shim::ACL_ConfigureLePrivacy(bool is_le_privacy_enabled) { Stack::GetInstance()->GetAcl()->ConfigureLePrivacy(is_le_privacy_enabled); } void bluetooth::shim::ACL_Disconnect(uint16_t handle, bool is_classic, tHCI_STATUS reason) { (is_classic) ? Stack::GetInstance()->GetAcl()->DisconnectClassic(handle, reason) : Stack::GetInstance()->GetAcl()->DisconnectLe(handle, reason); } system/main/shim/acl_api.h +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #pragma once #include "stack/include/bt_types.h" #include "stack/include/hci_error_code.h" #include "types/ble_address_with_type.h" #include "types/raw_address.h" Loading @@ -27,6 +28,7 @@ void ACL_CancelClassicConnection(const RawAddress& raw_address); void ACL_CancelLeConnection(const tBLE_BD_ADDR& legacy_address_with_type); void ACL_CreateClassicConnection(const RawAddress& raw_address); void ACL_CreateLeConnection(const tBLE_BD_ADDR& legacy_address_with_type); void ACL_Disconnect(uint16_t handle, bool is_classic, tHCI_STATUS reason); void ACL_WriteData(uint16_t handle, const BT_HDR* p_buf); void ACL_ConfigureLePrivacy(bool is_le_privacy_enabled); Loading Loading
system/main/shim/acl.cc +45 −0 Original line number Diff line number Diff line Loading @@ -150,6 +150,8 @@ class ShimAclConnection { TRY_POSTING_ON_MAIN(send_data_upwards_, p_buf); } virtual void InitiateDisconnect(hci::DisconnectReason reason) = 0; protected: const uint16_t handle_{kInvalidHciHandle}; os::Handler* handler_; Loading Loading @@ -340,6 +342,10 @@ class ClassicShimAclConnection hci::Address GetRemoteAddress() const { return connection_->GetAddress(); } void InitiateDisconnect(hci::DisconnectReason reason) override { connection_->Disconnect(reason); } private: OnDisconnect on_disconnect_; const shim::legacy::acl_classic_link_interface_t interface_; Loading Loading @@ -400,6 +406,10 @@ class LeShimAclConnection return connection_->GetRemoteAddress(); } void InitiateDisconnect(hci::DisconnectReason reason) override { connection_->Disconnect(reason); } private: OnDisconnect on_disconnect_; const shim::legacy::acl_le_link_interface_t interface_; Loading Loading @@ -761,3 +771,38 @@ void bluetooth::shim::legacy::Acl::ConfigureLePrivacy( address_policy, empty_address_with_type, rotation_irk, minimum_rotation_time, maximum_rotation_time); } void bluetooth::shim::legacy::Acl::DisconnectClassic(uint16_t handle, tHCI_STATUS reason) { auto connection = pimpl_->handle_to_classic_connection_map_.find(handle); if (connection != pimpl_->handle_to_classic_connection_map_.end()) { auto remote_address = connection->second->GetRemoteAddress(); connection->second->InitiateDisconnect( ToDisconnectReasonFromLegacy(reason)); LOG_DEBUG("Disconnection initiated classic remote:%s handle:%hu", PRIVATE_ADDRESS(remote_address), handle); btm_cb.history_->Push("%-32s: %s classic", "Disconnection initiated", PRIVATE_ADDRESS(remote_address)); } else { LOG_WARN("Unable to disconnect unknown classic connection handle:0x%04x", handle); } } void bluetooth::shim::legacy::Acl::DisconnectLe(uint16_t handle, tHCI_STATUS reason) { auto connection = pimpl_->handle_to_le_connection_map_.find(handle); if (connection != pimpl_->handle_to_le_connection_map_.end()) { auto remote_address_with_type = connection->second->GetRemoteAddressWithType(); connection->second->InitiateDisconnect( ToDisconnectReasonFromLegacy(reason)); LOG_DEBUG("Disconnection initiated le remote:%s handle:%hu", PRIVATE_ADDRESS(remote_address_with_type), handle); btm_cb.history_->Push("%-32s: %s le", "Disconnection initiated", PRIVATE_ADDRESS(remote_address_with_type)); } else { LOG_WARN("Unable to disconnect unknown le connection handle:0x%04x", handle); } }
system/main/shim/acl.h +3 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,9 @@ class Acl : public hci::acl_manager::ConnectionCallbacks, void ConfigureLePrivacy(bool is_le_privacy_enabled); void DisconnectClassic(uint16_t handle, tHCI_STATUS reason); void DisconnectLe(uint16_t handle, tHCI_STATUS reason); void Dump(int fd) const; protected: Loading
system/main/shim/acl_api.cc +7 −0 Original line number Diff line number Diff line Loading @@ -51,3 +51,10 @@ void bluetooth::shim::ACL_WriteData(uint16_t handle, const BT_HDR* p_buf) { void bluetooth::shim::ACL_ConfigureLePrivacy(bool is_le_privacy_enabled) { Stack::GetInstance()->GetAcl()->ConfigureLePrivacy(is_le_privacy_enabled); } void bluetooth::shim::ACL_Disconnect(uint16_t handle, bool is_classic, tHCI_STATUS reason) { (is_classic) ? Stack::GetInstance()->GetAcl()->DisconnectClassic(handle, reason) : Stack::GetInstance()->GetAcl()->DisconnectLe(handle, reason); }
system/main/shim/acl_api.h +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ #pragma once #include "stack/include/bt_types.h" #include "stack/include/hci_error_code.h" #include "types/ble_address_with_type.h" #include "types/raw_address.h" Loading @@ -27,6 +28,7 @@ void ACL_CancelClassicConnection(const RawAddress& raw_address); void ACL_CancelLeConnection(const tBLE_BD_ADDR& legacy_address_with_type); void ACL_CreateClassicConnection(const RawAddress& raw_address); void ACL_CreateLeConnection(const tBLE_BD_ADDR& legacy_address_with_type); void ACL_Disconnect(uint16_t handle, bool is_classic, tHCI_STATUS reason); void ACL_WriteData(uint16_t handle, const BT_HDR* p_buf); void ACL_ConfigureLePrivacy(bool is_le_privacy_enabled); Loading