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

Commit 0c5ff263 authored by Myles Watson's avatar Myles Watson
Browse files

Controller: Remove dependency on int flags

The dependency shouldn't be in the header file.  Otherwise
it forces mocks to find it, as well.

Bug: 283254594
Test: mma -j32
Change-Id: I5d82bf128aaab9f07f4ee2e8e1a53cf01e61272b
parent 803d1097
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1348,6 +1348,25 @@ bool Controller::IsSupported(bluetooth::hci::OpCode op_code) const {
  return impl_->is_supported(op_code);
}

uint64_t Controller::MaskLeEventMask(HciVersion version, uint64_t mask) {
  if (!common::init_flags::subrating_is_enabled()) {
    mask = mask & ~(static_cast<uint64_t>(LLFeaturesBits::CONNECTION_SUBRATING_HOST_SUPPORT));
  }
  if (version >= HciVersion::V_5_3) {
    return mask;
  } else if (version >= HciVersion::V_5_2) {
    return mask & kLeEventMask52;
  } else if (version >= HciVersion::V_5_1) {
    return mask & kLeEventMask51;
  } else if (version >= HciVersion::V_5_0) {
    return mask & kLeEventMask50;
  } else if (version >= HciVersion::V_4_2) {
    return mask & kLeEventMask42;
  } else {
    return mask & kLeEventMask41;
  }
}

const ModuleFactory Controller::Factory = ModuleFactory([]() { return new Controller(); });

void Controller::ListDependencies(ModuleList* list) const {
+1 −19
Original line number Diff line number Diff line
@@ -16,7 +16,6 @@

#pragma once

#include "common/init_flags.h"
#include "hci/address.h"
#include "hci/hci_packets.h"
#include "hci/le_rand_callback.h"
@@ -219,24 +218,7 @@ class Controller : public Module {
  static constexpr uint64_t kLeEventMask42 = 0x00000000000003ff;
  static constexpr uint64_t kLeEventMask41 = 0x000000000000003f;

  static uint64_t MaskLeEventMask(HciVersion version, uint64_t mask) {
    if (!common::init_flags::subrating_is_enabled()) {
      mask = mask & ~(static_cast<uint64_t>(LLFeaturesBits::CONNECTION_SUBRATING_HOST_SUPPORT));
    }
    if (version >= HciVersion::V_5_3) {
      return mask;
    } else if (version >= HciVersion::V_5_2) {
      return mask & kLeEventMask52;
    } else if (version >= HciVersion::V_5_1) {
      return mask & kLeEventMask51;
    } else if (version >= HciVersion::V_5_0) {
      return mask & kLeEventMask50;
    } else if (version >= HciVersion::V_4_2) {
      return mask & kLeEventMask42;
    } else {
      return mask & kLeEventMask41;
    }
  }
  static uint64_t MaskLeEventMask(HciVersion version, uint64_t mask);

 protected:
  void ListDependencies(ModuleList* list) const override;