added timing
This commit is contained in:
@@ -194,6 +194,33 @@ using Json = nlohmann::json;
|
||||
return notch;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto parse_locator_server(const Json& object) -> radar::locator::LocatorServerConfig {
|
||||
radar::locator::LocatorServerConfig locator{};
|
||||
locator.enabled = optional_bool(object, "enabled", locator.enabled);
|
||||
locator.host = optional_string(object, "host", locator.host);
|
||||
locator.device_id = optional_u32(object, "device_id", locator.device_id);
|
||||
locator.protocol_version = optional_u32(object, "protocol_version", locator.protocol_version);
|
||||
locator.max_payload_bytes = optional_u32(object, "max_payload_bytes", locator.max_payload_bytes);
|
||||
locator.client_queue_size = optional_u32(object, "client_queue_size", locator.client_queue_size);
|
||||
|
||||
if (const auto* port_value = optional_field(object, "port"); port_value != nullptr) {
|
||||
const auto port_u32 = number_to_u32(as_number(*port_value, "run.locator_server.port"),
|
||||
"run.locator_server.port");
|
||||
if (port_u32 == 0U || port_u32 > 0xFFFFU) {
|
||||
throw std::runtime_error("run.locator_server.port must be in [1, 65535]");
|
||||
}
|
||||
locator.port = static_cast<std::uint16_t>(port_u32);
|
||||
}
|
||||
|
||||
if (locator.client_queue_size == 0U) {
|
||||
throw std::runtime_error("run.locator_server.client_queue_size must be > 0");
|
||||
}
|
||||
if (locator.max_payload_bytes == 0U) {
|
||||
throw std::runtime_error("run.locator_server.max_payload_bytes must be > 0");
|
||||
}
|
||||
return locator;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto parse_driver_mode(const std::string& value) -> DriverMode {
|
||||
if (value == "mock") {
|
||||
return DriverMode::Mock;
|
||||
@@ -479,6 +506,12 @@ auto load_run_config(const std::string& path) -> RunConfig {
|
||||
"python_app/runtime/processing_live.json"
|
||||
);
|
||||
|
||||
if (const auto* locator_value = optional_field(*run_obj, "locator_server");
|
||||
locator_value != nullptr) {
|
||||
config.locator_server =
|
||||
parse_locator_server(*as_object(*locator_value, "run.locator_server"));
|
||||
}
|
||||
|
||||
const auto* combos = as_array(required_field(*run_obj, "combos"), "run.combos");
|
||||
if (combos->empty()) {
|
||||
throw std::runtime_error("run.combos must not be empty");
|
||||
|
||||
Reference in New Issue
Block a user