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

Commit a8012172 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "RootCanal: Separate the tcp server port from the controller configuration"

parents c0e43e44 0db53f73
Loading
Loading
Loading
Loading
+12 −7
Original line number Diff line number Diff line
@@ -30,20 +30,25 @@ message ControllerQuirks {
}

message Controller {
  // Configure the TCP port on which the controller with this defined
  // configuration will be served.
  required int32 tcp_port = 1;
  // Configure the controller preset. Presets come with a pre-selection
  // of features and quirks, but these can be overridden with the next fields.
  optional ControllerPreset preset = 2;
  optional ControllerPreset preset = 1;
  // Configure support for controller features.
  optional ControllerFeatures features = 3;
  optional ControllerFeatures features = 2;
  // Enable controller quirks.
  // Quirks are behaviors observed in real controllers that are not valid
  // according to the specification.
  optional ControllerQuirks quirks = 4;
  optional ControllerQuirks quirks = 3;
}

message TcpServer {
  // Configure the TCP port on which the controller with this defined
  // configuration will be served.
  required int32 tcp_port = 1;
  // Controller configuration for this port.
  optional Controller configuration = 2;
}

message Configuration {
  repeated Controller controllers = 1;
  repeated TcpServer tcp_server = 1;
}
+6 −6
Original line number Diff line number Diff line
@@ -67,19 +67,19 @@ TestEnvironment::TestEnvironment(
  rootcanal::configuration::Configuration* config =
      new rootcanal::configuration::Configuration();
  if (!google::protobuf::TextFormat::ParseFromString(config_str, config) ||
      config->controllers_size() == 0) {
      config->tcp_server_size() == 0) {
    // Default configuration with default hci port if the input
    // configuration cannot be used.
    SetUpHciServer(open_server, hci_port, rootcanal::ControllerProperties());
  } else {
    // Open an HCI server for all configurations requested by
    // the caller.
    int num_controllers = config->controllers_size();
    int num_controllers = config->tcp_server_size();
    for (int index = 0; index < num_controllers; index++) {
      rootcanal::configuration::Controller const& controller =
          config->controllers(index);
      SetUpHciServer(open_server, controller.tcp_port(),
                     rootcanal::ControllerProperties(controller));
      rootcanal::configuration::TcpServer const& tcp_server =
          config->tcp_server(index);
      SetUpHciServer(open_server, tcp_server.tcp_port(),
                     rootcanal::ControllerProperties(tcp_server.configuration()));
    }
  }
}