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

Commit 78a2f3ce authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "le_impl: Co-locate add/remove_device_from_resolving_list"

parents 16664dfe bc9399d4
Loading
Loading
Loading
Loading
+21 −21
Original line number Diff line number Diff line
@@ -450,6 +450,27 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback {
    }
  }

  void remove_device_from_resolving_list(AddressWithType address_with_type) {
    AddressType address_type = address_with_type.GetAddressType();
    if (!address_manager_registered) {
      le_address_manager_->Register(this);
      address_manager_registered = true;
    }
    pause_connection = true;
    switch (address_type) {
      case AddressType::PUBLIC_DEVICE_ADDRESS:
      case AddressType::PUBLIC_IDENTITY_ADDRESS: {
        le_address_manager_->RemoveDeviceFromResolvingList(
            PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS, address_with_type.GetAddress());
      } break;
      case AddressType::RANDOM_DEVICE_ADDRESS:
      case AddressType::RANDOM_IDENTITY_ADDRESS: {
        le_address_manager_->RemoveDeviceFromResolvingList(
            PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS, address_with_type.GetAddress());
      }
    }
  }

  void create_le_connection(AddressWithType address_with_type, bool add_to_connect_list, bool is_direct) {
    if (le_client_callbacks_ == nullptr) {
      LOG_ERROR("No callbacks to call");
@@ -614,27 +635,6 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback {
        std::move(packet), handler_->BindOnce([](CommandCompleteView complete) {}));
  }

  void remove_device_from_resolving_list(AddressWithType address_with_type) {
    AddressType address_type = address_with_type.GetAddressType();
    if (!address_manager_registered) {
      le_address_manager_->Register(this);
      address_manager_registered = true;
    }
    pause_connection = true;
    switch (address_type) {
      case AddressType::PUBLIC_DEVICE_ADDRESS:
      case AddressType::PUBLIC_IDENTITY_ADDRESS: {
        le_address_manager_->RemoveDeviceFromResolvingList(
            PeerAddressType::PUBLIC_DEVICE_OR_IDENTITY_ADDRESS, address_with_type.GetAddress());
      } break;
      case AddressType::RANDOM_DEVICE_ADDRESS:
      case AddressType::RANDOM_IDENTITY_ADDRESS: {
        le_address_manager_->RemoveDeviceFromResolvingList(
            PeerAddressType::RANDOM_DEVICE_OR_IDENTITY_ADDRESS, address_with_type.GetAddress());
      }
    }
  }

  void clear_resolving_list() {
    le_address_manager_->ClearResolvingList();
  }