#pragma once #include "fgc/Config.h" #include #include #include namespace fgc { // Command-line / runtime options that override config at launch. struct RuntimeOptions { bool init = false; // run the endstop-finding init sequence bool start = false; // begin capture automatically bool demo = false; // demo mode (copy placeholder image instead of encoding) // Start anyway when hardware.ini declares something this rig does not have. // Field triage only: it overrides [Features] strict_presence, and the log // says so in those words so it cannot become the normal way to run a tower. bool degraded = false; // Tri-state feature overrides (unset => use the config value). std::optional use_mqtt; std::optional mock_camera; std::optional mock_serial; std::optional mock_env; // implies [Features] enable_env std::optional use_tui; // --tui / --no-tui; unset => [UI] enable_tui std::string log_level; // empty => default std::string trace_categories; // comma list (serial,mqtt,camera,control,all); empty => unset std::string config_path; // resolved config.ini path (to save calibration back); empty => none // --test: run this one self-test selection (the words after `test` at the // console, e.g. "hardware" or "hardware motor") once the motor link is up, // then exit with its verdict. Empty => normal operation. For scripts - the // installer above all - which need an answer, not a dashboard. std::string run_test; }; // Exit codes of a --test run, beside main()'s 1 (config), 2 (lock) and // Application's 3 (declared hardware missing). constexpr int kExitTestFail = 4; // the test ran and failed constexpr int kExitTestNotRun = 5; // the test could not start; the log says why // Owns the component lifecycle and the control loop. Builds the concrete // motor controller, control channel and camera source from config + options // (real or mock), wires them to the ImagePipeline and CaptureScheduler, and // runs until "exit" / SIGINT. class Application { public: Application(AppConfig config, RuntimeOptions options); ~Application(); int run(); private: struct Impl; std::unique_ptr impl_; }; } // namespace fgc