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

Commit f7b03148 authored by Zach Johnson's avatar Zach Johnson Committed by Jack He
Browse files

Integrate GD controller

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: Ie9676a9127bb3bdacd54c9f65afc15802aa46f2a
parent 8711123c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -828,7 +828,7 @@ static const controller_t* controller_get_interface_legacy() {
}

const controller_t* controller_get_interface() {
  if (bluetooth::shim::is_gd_shim_enabled()) {
  if (bluetooth::shim::is_gd_controller_enabled()) {
    return bluetooth::shim::controller_get_interface();
  } else {
    return controller_get_interface_legacy();
+8 −3
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <string>
#include <utility>

#include "common/init_flags.h"
#include "hci/hci_layer.h"

namespace bluetooth {
@@ -34,8 +35,10 @@ struct Controller::impl {
  void Start(hci::HciLayer* hci) {
    hci_ = hci;
    Handler* handler = module_.GetHandler();
    hci_->RegisterEventHandler(EventCode::NUMBER_OF_COMPLETED_PACKETS,
                               handler->BindOn(this, &Controller::impl::NumberOfCompletedPackets));
    if (bluetooth::common::InitFlags::GdCoreEnabled()) {
      hci_->RegisterEventHandler(
          EventCode::NUMBER_OF_COMPLETED_PACKETS, handler->BindOn(this, &Controller::impl::NumberOfCompletedPackets));
    }

    set_event_mask(kDefaultEventMask);
    write_simple_pairing_mode(Enable::ENABLED);
@@ -130,7 +133,9 @@ struct Controller::impl {
  }

  void Stop() {
    if (bluetooth::common::InitFlags::GdCoreEnabled()) {
      hci_->UnregisterEventHandler(EventCode::NUMBER_OF_COMPLETED_PACKETS);
    }
    hci_ = nullptr;
  }

+4 −0
Original line number Diff line number Diff line
@@ -58,6 +58,10 @@ bool bluetooth::shim::is_gd_hci_enabled() {
  return bluetooth::common::InitFlags::GdHciEnabled();
}

bool bluetooth::shim::is_gd_controller_enabled() {
  return bluetooth::common::InitFlags::GdControllerEnabled();
}

bool bluetooth::shim::is_gd_shim_enabled() {
  return bluetooth::common::InitFlags::GdCoreEnabled();
}
+1 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ namespace shim {
 * @return true if using gd shim core, false if using legacy.
 */
bool is_gd_hci_enabled();
bool is_gd_controller_enabled();
bool is_gd_shim_enabled();
bool is_any_gd_enabled();

+3 −0
Original line number Diff line number Diff line
@@ -73,6 +73,9 @@ void Stack::StartEverything() {
    modules.add<storage::StorageModule>();
    modules.add<shim::Dumpsys>();
  }
  if (common::InitFlags::GdControllerEnabled()) {
    modules.add<hci::Controller>();
  }
  if (common::InitFlags::GdCoreEnabled()) {
    modules.add<att::AttModule>();
    modules.add<hci::AclManager>();
Loading