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

Commit fb17a214 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Controller: enable simple pairing and LE host

Tell the controller that we support simple pairing and LE host

Test: cert/run --host
Tag: #gd-refactor
Bug: 158861440
Change-Id: I9d1da611c4f01154536e20e1e592d9229063a08f
parent 8932ab7f
Loading
Loading
Loading
Loading
+17 −0
Original line number Diff line number Diff line
@@ -37,6 +37,9 @@ struct Controller::impl {
                               handler->BindOn(this, &Controller::impl::NumberOfCompletedPackets));

    set_event_mask(kDefaultEventMask);
    write_simple_pairing_mode(Enable::ENABLED);
    // TODO(b/159927452): Legacy stack set SimultaneousLeHost = 1. Revisit if this causes problem.
    write_le_host_support(Enable::ENABLED, SimultaneousLeHost::DISABLED);
    hci_->EnqueueCommand(ReadLocalNameBuilder::Create(),
                         handler->BindOnceOn(this, &Controller::impl::read_local_name_complete_handler));
    hci_->EnqueueCommand(ReadLocalVersionInformationBuilder::Create(),
@@ -361,6 +364,20 @@ struct Controller::impl {
                                                this, &Controller::impl::check_status<SetEventMaskCompleteView>));
  }

  void write_simple_pairing_mode(Enable enable) {
    std::unique_ptr<WriteSimplePairingModeBuilder> packet = WriteSimplePairingModeBuilder::Create(enable);
    hci_->EnqueueCommand(
        std::move(packet),
        module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<WriteSimplePairingModeCompleteView>));
  }

  void write_le_host_support(Enable enable, SimultaneousLeHost simultaneous_le_host) {
    std::unique_ptr<WriteLeHostSupportBuilder> packet = WriteLeHostSupportBuilder::Create(enable, simultaneous_le_host);
    hci_->EnqueueCommand(
        std::move(packet),
        module_.GetHandler()->BindOnceOn(this, &Controller::impl::check_status<WriteLeHostSupportCompleteView>));
  }

  void reset() {
    std::unique_ptr<ResetBuilder> packet = ResetBuilder::Create();
    hci_->EnqueueCommand(std::move(packet),