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

Commit 6651ee1c authored by Henri Chataing's avatar Henri Chataing
Browse files

RootCanal: Pass the configuration by value to HciDevice

The controller properties are loaded from file each time
a connection is created at the moment, this change makes sure
that the properties are read only once at boot time.

Test: m root-canal && ./root-canal
Bug: 253525123
Change-Id: Icc6b7deb03d7afbedef0c5e43861f16cd7561798
parent 5e1e95ef
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -199,7 +199,8 @@ Return<void> BluetoothHci::initialize_impl(
    SetUpHciServer([this](std::shared_ptr<AsyncDataChannel> socket,
                          AsyncDataChannelServer* srv) {
      auto transport = HciSocketTransport::Create(socket);
      test_model_.AddHciConnection(HciDevice::Create(transport, ""));
      test_model_.AddHciConnection(
          HciDevice::Create(transport, rootcanal::ControllerProperties()));
      srv->StartListening();
    });
    SetUpLinkLayerServer([this](std::shared_ptr<AsyncDataChannel> socket,
+1 −1
Original line number Diff line number Diff line
@@ -67,7 +67,7 @@ void TestEnvironment::initialize(std::promise<void> barrier) {
    if (enable_hci_sniffer_) {
      transport = HciSniffer::Create(transport);
    }
    auto device = HciDevice::Create(transport, controller_properties_file_);
    auto device = HciDevice::Create(transport, controller_properties_);
    async_manager_.ExecAsync(user_id, std::chrono::milliseconds(0), [=]() {
      test_model_.AddHciConnection(device);
    });
+2 −2
Original line number Diff line number Diff line
@@ -64,7 +64,7 @@ class TestEnvironment {
        link_socket_server_(link_server_port),
        link_ble_socket_server_(link_ble_server_port),
        connector_(connector),
        controller_properties_file_(controller_properties_file),
        controller_properties_(controller_properties_file),
        default_commands_file_(default_commands_file),
        enable_hci_sniffer_(enable_hci_sniffer),
        enable_baseband_sniffer_(enable_baseband_sniffer),
@@ -84,7 +84,7 @@ class TestEnvironment {
  std::shared_ptr<AsyncDataChannelServer> link_socket_server_;
  std::shared_ptr<AsyncDataChannelServer> link_ble_socket_server_;
  std::shared_ptr<AsyncDataChannelConnector> connector_;
  std::string controller_properties_file_;
  rootcanal::ControllerProperties controller_properties_;
  std::string default_commands_file_;
  bool enable_hci_sniffer_;
  bool enable_baseband_sniffer_;
+2 −2
Original line number Diff line number Diff line
@@ -60,8 +60,8 @@ void DualModeController::SendCommandCompleteUnknownOpCodeEvent(
          static_cast<uint8_t>(ErrorCode::UNKNOWN_HCI_COMMAND)})));
}

DualModeController::DualModeController(const std::string& properties_filename)
    : properties_(properties_filename) {
DualModeController::DualModeController(ControllerProperties properties)
    : properties_(std::move(properties)) {
  Address public_address{};
  ASSERT(Address::FromString("3C:5A:B4:04:05:06", public_address));
  SetAddress(public_address);
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ using ::bluetooth::hci::CommandView;
// "Hci" to distinguish it as a controller command.
class DualModeController : public Device {
 public:
  DualModeController(const std::string& properties_filename = "");
  DualModeController(ControllerProperties properties = ControllerProperties());
  DualModeController(DualModeController&&) = delete;
  DualModeController(const DualModeController&) = delete;
  ~DualModeController() = default;
Loading