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

Commit af08f8f2 authored by Myles Watson's avatar Myles Watson Committed by Gerrit Code Review
Browse files

Merge "Use GD Controller interface in Rust" into main

parents 748d1dd3 5c4fb635
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -57,6 +57,7 @@ cc_library_static {
        "hfp/hfp_shim.cc",
    ],
    generated_headers: [
        "BluetoothGeneratedDumpsysDataSchema_h",
        "cxx-bridge-header",
        "libbt_init_flags_bridge_header",
        "libbt_topshim_bridge_header",
@@ -71,8 +72,10 @@ cc_library_static {
    ],
    host_supported: true,
    static_libs: [
        "libbluetooth_hci_pdl",
        "libbluetooth_log",
        "libchrome",
        "libflatbuffers-cpp",
    ],
}

+3 −4
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@

#include <memory>

#include "main/shim/helpers.h"
#include "rust/cxx.h"
#include "src/controller.rs.h"
#include "types/raw_address.h"
@@ -40,14 +41,12 @@ std::unique_ptr<ControllerIntf> GetControllerInterface() {

RawAddress ControllerIntf::read_local_addr() const {
  if (!controller_) std::abort();
  return *controller_->get_address();
  return ToRawAddress(controller_->GetMacAddress());
}

uint64_t ControllerIntf::get_ble_supported_states() const {
  if (!controller_) std::abort();
  uint64_t states;
  memcpy(&states, controller_->get_ble_supported_states(), sizeof(uint64_t));
  return states;
  return controller_->GetLeSupportedStates();
}

}  // namespace rust
+4 −4
Original line number Diff line number Diff line
@@ -18,7 +18,8 @@

#include <memory>

#include "main/shim/controller.h"
#include "hci/controller_interface.h"
#include "main/shim/entry.h"
#include "rust/cxx.h"
#include "types/raw_address.h"

@@ -28,17 +29,16 @@ namespace rust {

class ControllerIntf {
 public:
  ControllerIntf() : controller_(controller_get_interface()) {}
  ControllerIntf() : controller_(shim::GetController()) {}
  ~ControllerIntf();

  RawAddress read_local_addr() const;
  uint64_t get_ble_supported_states() const;

 private:
  const controller_t* controller_;
  const hci::ControllerInterface* controller_;
};

// ControllerIntf* GetControllerInterface();
std::unique_ptr<ControllerIntf> GetControllerInterface();

}  // namespace rust