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

Commit b5233896 authored by Myles Watson's avatar Myles Watson
Browse files

HCI: Make Controller getters virtual and const

Getters that are virtual and const make testing easier for
modules that depend on the controller.

Bug: 139080884
Test: bluetooth_test_gd
Change-Id: Icde03e69f1ebd19c819a6b443665a6de0721505e
parent 74a8db53
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -73,11 +73,11 @@ class TestController : public Controller {
    acl_cb_handler_ = handler;
  }

  uint16_t GetControllerAclPacketLength() override {
  uint16_t GetControllerAclPacketLength() const override {
    return acl_buffer_length_;
  }

  uint16_t GetControllerNumAclPacketBuffers() override {
  uint16_t GetControllerNumAclPacketBuffers() const override {
    return total_acl_buffers_;
  }

+19 −19
Original line number Diff line number Diff line
@@ -696,50 +696,50 @@ void Controller::RegisterCompletedAclPacketsCallback(Callback<void(uint16_t /* h
  impl_->RegisterCompletedAclPacketsCallback(cb, handler);  // TODO hsz: why here?
}

std::string Controller::GetControllerLocalName() {
std::string Controller::GetControllerLocalName() const {
  return impl_->local_name_;
}

LocalVersionInformation Controller::GetControllerLocalVersionInformation() {
LocalVersionInformation Controller::GetControllerLocalVersionInformation() const {
  return impl_->local_version_information_;
}

std::array<uint8_t, 64> Controller::GetControllerLocalSupportedCommands() {
std::array<uint8_t, 64> Controller::GetControllerLocalSupportedCommands() const {
  return impl_->local_supported_commands_;
}

uint8_t Controller::GetControllerLocalExtendedFeaturesMaxPageNumber() {
uint8_t Controller::GetControllerLocalExtendedFeaturesMaxPageNumber() const {
  return impl_->maximum_page_number_;
}

uint64_t Controller::GetControllerLocalSupportedFeatures() {
uint64_t Controller::GetControllerLocalSupportedFeatures() const {
  return impl_->local_supported_features_;
}

uint64_t Controller::GetControllerLocalExtendedFeatures(uint8_t page_number) {
uint64_t Controller::GetControllerLocalExtendedFeatures(uint8_t page_number) const {
  if (page_number <= impl_->maximum_page_number_) {
    return impl_->extended_lmp_features_array_[page_number];
  }
  return 0x00;
}

uint16_t Controller::GetControllerAclPacketLength() {
uint16_t Controller::GetControllerAclPacketLength() const {
  return impl_->acl_buffer_length_;
}

uint16_t Controller::GetControllerNumAclPacketBuffers() {
uint16_t Controller::GetControllerNumAclPacketBuffers() const {
  return impl_->acl_buffers_;
}

uint8_t Controller::GetControllerScoPacketLength() {
uint8_t Controller::GetControllerScoPacketLength() const {
  return impl_->sco_buffer_length_;
}

uint16_t Controller::GetControllerNumScoPacketBuffers() {
uint16_t Controller::GetControllerNumScoPacketBuffers() const {
  return impl_->sco_buffers_;
}

Address Controller::GetControllerMacAddress() {
Address Controller::GetControllerMacAddress() const {
  return impl_->mac_address_;
}

@@ -813,35 +813,35 @@ void Controller::LeSetEventMask(uint64_t le_event_mask) {
  GetHandler()->Post(common::BindOnce(&impl::le_set_event_mask, common::Unretained(impl_.get()), le_event_mask));
}

LeBufferSize Controller::GetControllerLeBufferSize() {
LeBufferSize Controller::GetControllerLeBufferSize() const {
  return impl_->le_buffer_size_;
}

uint64_t Controller::GetControllerLeLocalSupportedFeatures() {
uint64_t Controller::GetControllerLeLocalSupportedFeatures() const {
  return impl_->le_local_supported_features_;
}

uint64_t Controller::GetControllerLeSupportedStates() {
uint64_t Controller::GetControllerLeSupportedStates() const {
  return impl_->le_supported_states_;
}

LeMaximumDataLength Controller::GetControllerLeMaximumDataLength() {
LeMaximumDataLength Controller::GetControllerLeMaximumDataLength() const {
  return impl_->le_maximum_data_length_;
}

uint16_t Controller::GetControllerLeMaximumAdvertisingDataLength() {
uint16_t Controller::GetControllerLeMaximumAdvertisingDataLength() const {
  return impl_->le_maximum_advertising_data_length_;
}

uint16_t Controller::GetControllerLeNumberOfSupportedAdverisingSets() {
uint16_t Controller::GetControllerLeNumberOfSupportedAdverisingSets() const {
  return impl_->le_number_supported_advertising_sets_;
}

VendorCapabilities Controller::GetControllerVendorCapabilities() {
VendorCapabilities Controller::GetControllerVendorCapabilities() const {
  return impl_->vendor_capabilities_;
}

bool Controller::IsSupported(bluetooth::hci::OpCode op_code) {
bool Controller::IsSupported(bluetooth::hci::OpCode op_code) const {
  return impl_->is_supported(op_code);
}

+19 −19
Original line number Diff line number Diff line
@@ -34,27 +34,27 @@ class Controller : public Module {
  virtual void RegisterCompletedAclPacketsCallback(
      common::Callback<void(uint16_t /* handle */, uint16_t /* num_packets */)> cb, os::Handler* handler);

  virtual std::string GetControllerLocalName();
  virtual std::string GetControllerLocalName() const;

  virtual LocalVersionInformation GetControllerLocalVersionInformation();
  virtual LocalVersionInformation GetControllerLocalVersionInformation() const;

  virtual std::array<uint8_t, 64> GetControllerLocalSupportedCommands();
  virtual std::array<uint8_t, 64> GetControllerLocalSupportedCommands() const;

  virtual uint64_t GetControllerLocalSupportedFeatures();
  virtual uint64_t GetControllerLocalSupportedFeatures() const;

  virtual uint8_t GetControllerLocalExtendedFeaturesMaxPageNumber();
  virtual uint8_t GetControllerLocalExtendedFeaturesMaxPageNumber() const;

  virtual uint64_t GetControllerLocalExtendedFeatures(uint8_t page_number);
  virtual uint64_t GetControllerLocalExtendedFeatures(uint8_t page_number) const;

  virtual uint16_t GetControllerAclPacketLength();
  virtual uint16_t GetControllerAclPacketLength() const;

  virtual uint16_t GetControllerNumAclPacketBuffers();
  virtual uint16_t GetControllerNumAclPacketBuffers() const;

  virtual uint8_t GetControllerScoPacketLength();
  virtual uint8_t GetControllerScoPacketLength() const;

  virtual uint16_t GetControllerNumScoPacketBuffers();
  virtual uint16_t GetControllerNumScoPacketBuffers() const;

  virtual Address GetControllerMacAddress();
  virtual Address GetControllerMacAddress() const;

  virtual void SetEventMask(uint64_t event_mask);

@@ -86,21 +86,21 @@ class Controller : public Module {
  // LE controller commands
  virtual void LeSetEventMask(uint64_t le_event_mask);

  LeBufferSize GetControllerLeBufferSize();
  virtual LeBufferSize GetControllerLeBufferSize() const;

  uint64_t GetControllerLeLocalSupportedFeatures();
  virtual uint64_t GetControllerLeLocalSupportedFeatures() const;

  uint64_t GetControllerLeSupportedStates();
  virtual uint64_t GetControllerLeSupportedStates() const;

  LeMaximumDataLength GetControllerLeMaximumDataLength();
  virtual LeMaximumDataLength GetControllerLeMaximumDataLength() const;

  uint16_t GetControllerLeMaximumAdvertisingDataLength();
  virtual uint16_t GetControllerLeMaximumAdvertisingDataLength() const;

  uint16_t GetControllerLeNumberOfSupportedAdverisingSets();
  virtual uint16_t GetControllerLeNumberOfSupportedAdverisingSets() const;

  VendorCapabilities GetControllerVendorCapabilities();
  virtual VendorCapabilities GetControllerVendorCapabilities() const;

  bool IsSupported(OpCode op_code);
  virtual bool IsSupported(OpCode op_code) const;

  static const ModuleFactory Factory;