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

Commit 093f8c81 authored by Myles Watson's avatar Myles Watson
Browse files

RootCanal: AddressResolutionEnable

Bug: 202018502
Test: cert/run
Tag: #feature
Change-Id: I46f5745efabe8edfdbdf4cbcf05447283a3a225c
parent 99cab193
Loading
Loading
Loading
Loading
+10 −6
Original line number Diff line number Diff line
@@ -1611,12 +1611,16 @@ void DualModeController::LeReadBufferSizeV2(CommandView command) {
}

void DualModeController::LeSetAddressResolutionEnable(CommandView command) {
    // NOP
    auto payload =
      std::make_unique<bluetooth::packet::RawBuilder>(std::vector<uint8_t>(
          {static_cast<uint8_t>(bluetooth::hci::ErrorCode::SUCCESS)}));
  send_event_(bluetooth::hci::CommandCompleteBuilder::Create(
      kNumCommandPackets, command.GetOpCode(), std::move(payload)));
  auto command_view = gd_hci::LeSetAddressResolutionEnableView::Create(
      gd_hci::LeSecurityCommandView::Create(
          gd_hci::SecurityCommandView::Create(command)));
  ASSERT(command_view.IsValid());
  auto status = link_layer_controller_.LeSetAddressResolutionEnable(
      command_view.GetAddressResolutionEnable() ==
      bluetooth::hci::Enable::ENABLED);
  send_event_(
      bluetooth::hci::LeSetAddressResolutionEnableCompleteBuilder::Create(
          kNumCommandPackets, status));
}

void DualModeController::LeSetResovalablePrivateAddressTimeout(CommandView command) {
+9 −0
Original line number Diff line number Diff line
@@ -2878,6 +2878,15 @@ ErrorCode LinkLayerController::LeConnectListClear() {
  return ErrorCode::SUCCESS;
}

ErrorCode LinkLayerController::LeSetAddressResolutionEnable(bool enable) {
  if (ResolvingListBusy()) {
    return ErrorCode::COMMAND_DISALLOWED;
  }

  le_resolving_list_enabled_ = enable;
  return ErrorCode::SUCCESS;
}

ErrorCode LinkLayerController::LeResolvingListClear() {
  if (ResolvingListBusy()) {
    return ErrorCode::COMMAND_DISALLOWED;
+2 −0
Original line number Diff line number Diff line
@@ -181,6 +181,7 @@ class LinkLayerController {
  bool LeConnectListContainsDevice(Address addr, uint8_t addr_type);
  bool LeConnectListFull();
  bool ResolvingListBusy();
  ErrorCode LeSetAddressResolutionEnable(bool enable);
  ErrorCode LeResolvingListClear();
  ErrorCode LeResolvingListAddDevice(Address addr, uint8_t addr_type,
                                     std::array<uint8_t, kIrkSize> peerIrk,
@@ -463,6 +464,7 @@ class LinkLayerController {
    std::array<uint8_t, kIrkSize> local_irk;
  };
  std::vector<ResolvingListEntry> le_resolving_list_;
  bool le_resolving_list_enabled_{false};

  std::array<LeAdvertiser, 7> advertisers_;