Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b620b2c authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "gd: Get local address from acl module for legacy SMP"

parents 8cd0e542 6df424cd
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -570,6 +570,10 @@ class LeShimAclConnection
    // TODO Issue LeReadRemoteFeatures Command
  }

  bluetooth::hci::AddressWithType GetLocalAddressWithType() {
    return connection_->GetLocalAddress();
  }

  void OnConnectionUpdate(hci::ErrorCode hci_status,
                          uint16_t connection_interval,
                          uint16_t connection_latency,
@@ -1041,6 +1045,19 @@ void shim::legacy::Acl::OnClassicLinkDisconnected(HciHandle handle,
          is_locally_initiated, reason)));
}

bluetooth::hci::AddressWithType shim::legacy::Acl::GetConnectionLocalAddress(
    const RawAddress& remote_bda) {
  bluetooth::hci::AddressWithType address_with_type;
  auto remote_address = ToGdAddress(remote_bda);
  for (auto& [handle, connection] : pimpl_->handle_to_le_connection_map_) {
    if (connection->GetRemoteAddressWithType().GetAddress() == remote_address) {
      return connection->GetLocalAddressWithType();
    }
  }
  LOG_WARN("address not found!");
  return address_with_type;
}

void shim::legacy::Acl::OnLeLinkDisconnected(HciHandle handle,
                                             hci::ErrorCode reason) {
  hci::AddressWithType remote_address_with_type =
+2 −0
Original line number Diff line number Diff line
@@ -55,6 +55,8 @@ class Acl : public hci::acl_manager::ConnectionCallbacks,
      std::unique_ptr<hci::acl_manager::LeAclConnection>) override;
  void OnLeConnectFail(hci::AddressWithType, hci::ErrorCode reason) override;
  void OnLeLinkDisconnected(uint16_t handle, hci::ErrorCode reason);
  bluetooth::hci::AddressWithType GetConnectionLocalAddress(
      const RawAddress& remote_bda);

  // LinkConnectionInterface
  void CreateClassicConnection(const hci::Address& address) override;
+9 −0
Original line number Diff line number Diff line
@@ -94,3 +94,12 @@ void bluetooth::shim::ACL_Shutdown() {
void bluetooth::shim::ACL_IgnoreAllLeConnections() {
  return Stack::GetInstance()->GetAcl()->ClearAcceptList();
}

void bluetooth::shim::ACL_ReadConnectionAddress(const RawAddress& pseudo_addr,
                                                RawAddress& conn_addr,
                                                uint8_t* p_addr_type) {
  auto local_address =
      Stack::GetInstance()->GetAcl()->GetConnectionLocalAddress(pseudo_addr);
  conn_addr = ToRawAddress(local_address.GetAddress());
  *p_addr_type = static_cast<uint8_t>(local_address.GetAddressType());
}
 No newline at end of file
+3 −0
Original line number Diff line number Diff line
@@ -35,5 +35,8 @@ void ACL_ConfigureLePrivacy(bool is_le_privacy_enabled);
void ACL_Shutdown();
void ACL_IgnoreAllLeConnections();

void ACL_ReadConnectionAddress(const RawAddress& pseudo_addr,
                               RawAddress& conn_addr, uint8_t* p_addr_type);

}  // namespace shim
}  // namespace bluetooth
+4 −0
Original line number Diff line number Diff line
@@ -2319,6 +2319,10 @@ void BTM_ReadConnectionAddr(const RawAddress& remote_bda,
    bluetooth::shim::L2CA_ReadConnectionAddr(remote_bda, local_conn_addr,
                                             p_addr_type);
    return;
  } else if (bluetooth::shim::is_gd_scanning_enabled()) {
    bluetooth::shim::ACL_ReadConnectionAddress(remote_bda, local_conn_addr,
                                               p_addr_type);
    return;
  }

  tACL_CONN* p_acl = internal_.btm_bda_to_acl(remote_bda, BT_TRANSPORT_LE);
Loading