Loading system/gd/rust/topshim/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -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", Loading @@ -71,8 +72,10 @@ cc_library_static { ], host_supported: true, static_libs: [ "libbluetooth_hci_pdl", "libbluetooth_log", "libchrome", "libflatbuffers-cpp", ], } Loading system/gd/rust/topshim/controller/controller_shim.cc +3 −4 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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 Loading system/gd/rust/topshim/controller/controller_shim.h +4 −4 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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 Loading Loading
system/gd/rust/topshim/Android.bp +3 −0 Original line number Diff line number Diff line Loading @@ -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", Loading @@ -71,8 +72,10 @@ cc_library_static { ], host_supported: true, static_libs: [ "libbluetooth_hci_pdl", "libbluetooth_log", "libchrome", "libflatbuffers-cpp", ], } Loading
system/gd/rust/topshim/controller/controller_shim.cc +3 −4 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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 Loading
system/gd/rust/topshim/controller/controller_shim.h +4 −4 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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 Loading