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

Commit b90f492a authored by Chienyuan's avatar Chienyuan
Browse files

Pass connection parameter to OnLeConnectSuccess

Bug: 231095722
Tag: #refactor
Test: gd/cert/run
Change-Id: I6322c99ce880fb68966c4f1a25e5602ed8f36f84
parent 3e801aa8
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -78,6 +78,9 @@ class LeAclConnection : public AclConnection {
  // Time Range: 100 ms to 32 s
  // Time Range: 100 ms to 32 s
  uint16_t supervision_timeout_;
  uint16_t supervision_timeout_;


  Address local_resolvable_private_address_ = Address::kEmpty;
  Address peer_resolvable_private_address_ = Address::kEmpty;

  virtual void RegisterCallbacks(LeConnectionManagementCallbacks* callbacks, os::Handler* handler);
  virtual void RegisterCallbacks(LeConnectionManagementCallbacks* callbacks, os::Handler* handler);
  virtual void Disconnect(DisconnectReason reason);
  virtual void Disconnect(DisconnectReason reason);


+9 −0
Original line number Original line Diff line number Diff line
@@ -341,6 +341,9 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback {
    std::unique_ptr<LeAclConnection> connection(new LeAclConnection(
    std::unique_ptr<LeAclConnection> connection(new LeAclConnection(
        std::move(queue), le_acl_connection_interface_, handle, local_address, remote_address, role));
        std::move(queue), le_acl_connection_interface_, handle, local_address, remote_address, role));
    connection->peer_address_with_type_ = AddressWithType(address, peer_address_type);
    connection->peer_address_with_type_ = AddressWithType(address, peer_address_type);
    connection->interval_ = conn_interval;
    connection->latency_ = conn_latency;
    connection->supervision_timeout_ = supervision_timeout;
    connections.add(
    connections.add(
        handle, remote_address, queue_down_end, handler_, connection->GetEventCallbacks([this](uint16_t handle) {
        handle, remote_address, queue_down_end, handler_, connection->GetEventCallbacks([this](uint16_t handle) {
          this->connections.invalidate(handle);
          this->connections.invalidate(handle);
@@ -426,6 +429,12 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback {
    std::unique_ptr<LeAclConnection> connection(new LeAclConnection(
    std::unique_ptr<LeAclConnection> connection(new LeAclConnection(
        std::move(queue), le_acl_connection_interface_, handle, local_address, remote_address, role));
        std::move(queue), le_acl_connection_interface_, handle, local_address, remote_address, role));
    connection->peer_address_with_type_ = AddressWithType(address, peer_address_type);
    connection->peer_address_with_type_ = AddressWithType(address, peer_address_type);
    connection->interval_ = conn_interval;
    connection->latency_ = conn_latency;
    connection->supervision_timeout_ = supervision_timeout;
    connection->local_resolvable_private_address_ = connection_complete.GetLocalResolvablePrivateAddress();
    connection->peer_resolvable_private_address_ = connection_complete.GetPeerResolvablePrivateAddress();
    connection_complete.GetLocalResolvablePrivateAddress();
    connections.add(
    connections.add(
        handle, remote_address, queue_down_end, handler_, connection->GetEventCallbacks([this](uint16_t handle) {
        handle, remote_address, queue_down_end, handler_, connection->GetEventCallbacks([this](uint16_t handle) {
          this->connections.invalidate(handle);
          this->connections.invalidate(handle);
+11 −8
Original line number Original line Diff line number Diff line
@@ -1497,6 +1497,17 @@ void shim::legacy::Acl::OnLeConnectSuccess(
  hci::Role connection_role = connection->GetRole();
  hci::Role connection_role = connection->GetRole();
  bool locally_initiated = connection->locally_initiated_;
  bool locally_initiated = connection->locally_initiated_;


  uint16_t conn_interval = connection->interval_;
  uint16_t conn_latency = connection->latency_;
  uint16_t conn_timeout = connection->supervision_timeout_;

  RawAddress local_rpa =
      ToRawAddress(connection->local_resolvable_private_address_);
  RawAddress peer_rpa =
      ToRawAddress(connection->peer_resolvable_private_address_);
  tBLE_ADDR_TYPE peer_addr_type =
      (tBLE_ADDR_TYPE)connection->peer_address_with_type_.GetAddressType();

  pimpl_->handle_to_le_connection_map_.emplace(
  pimpl_->handle_to_le_connection_map_.emplace(
      handle, std::make_unique<LeShimAclConnection>(
      handle, std::make_unique<LeShimAclConnection>(
                  acl_interface_.on_send_data_upwards,
                  acl_interface_.on_send_data_upwards,
@@ -1512,14 +1523,6 @@ void shim::legacy::Acl::OnLeConnectSuccess(
  tBLE_BD_ADDR legacy_address_with_type =
  tBLE_BD_ADDR legacy_address_with_type =
      ToLegacyAddressWithType(address_with_type);
      ToLegacyAddressWithType(address_with_type);


  uint16_t conn_interval = 36; /* TODO Default to 45 msec*/
  uint16_t conn_latency = 0;   /* TODO Default to zero events */
  uint16_t conn_timeout = 500; /* TODO Default to 5s */

  RawAddress local_rpa = RawAddress::kEmpty; /* TODO enhanced */
  RawAddress peer_rpa = RawAddress::kEmpty;  /* TODO enhanced */
  tBLE_ADDR_TYPE peer_addr_type = BLE_ADDR_PUBLIC; /* TODO public */

  // Once an le connection has successfully been established
  // Once an le connection has successfully been established
  // the device address is removed from the controller accept list.
  // the device address is removed from the controller accept list.