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

Commit 39c7b56b authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "GD: Set LE Event Mask"

parents a35c2773 56019551
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -84,6 +84,9 @@ struct le_impl : public bluetooth::hci::LeAddressManagerCallback {
      case SubeventCode::CONNECTION_UPDATE_COMPLETE:
        on_le_connection_update_complete(event_packet);
        break;
      case SubeventCode::PHY_UPDATE_COMPLETE:
        LOG_INFO("PHY_UPDATE_COMPLETE");
        break;
      default:
        LOG_ALWAYS_FATAL("Unhandled event code %s", SubeventCodeText(code).c_str());
    }
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ struct Controller::impl {
          EventCode::NUMBER_OF_COMPLETED_PACKETS, handler->BindOn(this, &Controller::impl::NumberOfCompletedPackets));
    }

    le_set_event_mask(kDefaultLeEventMask);
    set_event_mask(kDefaultEventMask);
    write_simple_pairing_mode(Enable::ENABLED);
    // TODO(b/159927452): Legacy stack set SimultaneousLeHost = 1. Revisit if this causes problem.
+1 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ class Controller : public Module {
  static const ModuleFactory Factory;

  static constexpr uint64_t kDefaultEventMask = 0x3dbfffffffffffff;
  static constexpr uint64_t kDefaultLeEventMask = 0x0000000000021e7f;

 protected:
  void ListDependencies(ModuleList* list) override;
+14 −6
Original line number Diff line number Diff line
@@ -174,10 +174,16 @@ class TestHciLayer : public HciLayer {
        event_mask = view.GetEventMask();
        event_builder = SetEventMaskCompleteBuilder::Create(num_packets, ErrorCode::SUCCESS);
      } break;
      case (OpCode::LE_SET_EVENT_MASK): {
        auto view = LeSetEventMaskView::Create(command);
        ASSERT_TRUE(view.IsValid());
        le_event_mask = view.GetLeEventMask();
        event_builder = LeSetEventMaskCompleteBuilder::Create(num_packets, ErrorCode::SUCCESS);
      } break;

      case (OpCode::RESET):
      case (OpCode::SET_EVENT_FILTER):
      case (OpCode::HOST_BUFFER_SIZE):
      case (OpCode::LE_SET_EVENT_MASK):
        command_queue_.push(command);
        not_empty_.notify_all();
        return;
@@ -249,6 +255,7 @@ class TestHciLayer : public HciLayer {
  constexpr static uint16_t total_num_acl_data_packets = 10;
  constexpr static uint16_t total_num_synchronous_data_packets = 12;
  uint64_t event_mask = 0;
  uint64_t le_event_mask = 0;

 private:
  common::ContextualCallback<void(EventPacketView)> number_of_completed_packets_callback_;
@@ -363,11 +370,12 @@ TEST_F(ControllerTest, send_host_buffer_size_command) {
}

TEST_F(ControllerTest, send_le_set_event_mask_command) {
  controller_->LeSetEventMask(0x000000000000001F);
  auto packet = test_hci_layer_->GetCommand(OpCode::LE_SET_EVENT_MASK);
  auto command = LeSetEventMaskView::Create(packet);
  ASSERT_TRUE(command.IsValid());
  ASSERT_EQ(command.GetLeEventMask(), 0x000000000000001F);
  uint64_t new_le_event_mask = test_hci_layer_->event_mask - 1;
  controller_->LeSetEventMask(new_le_event_mask);
  // Send another command to make sure it was applied
  controller_->Reset();
  auto packet = test_hci_layer_->GetCommand(OpCode::RESET);
  ASSERT_EQ(new_le_event_mask, test_hci_layer_->le_event_mask);
}

TEST_F(ControllerTest, is_supported_test) {
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ constexpr SubeventCode LeConnectionManagementEvents[] = {
    SubeventCode::CONNECTION_COMPLETE,
    SubeventCode::ENHANCED_CONNECTION_COMPLETE,
    SubeventCode::CONNECTION_UPDATE_COMPLETE,
    SubeventCode::PHY_UPDATE_COMPLETE,
};

typedef CommandInterface<LeConnectionManagementCommandBuilder> LeAclConnectionInterface;