// SPDX-License-Identifier: MIT // SPDX-FileCopyrightText: 2026 Martino Ferrari #include "acquisition.hpp" #include "config.hpp" #include "model.hpp" #include "plot_host.hpp" #include "source_dialog.hpp" #include "ui.hpp" #include #include int main(int argc, char** argv) { udpscope::Config cfg; try { cfg = udpscope::parse_args(argc, argv); } catch (const std::exception& e) { std::fprintf(stderr, "udpscope: %s\n", e.what()); return 2; } // No `--server` means the user has not said which source to open, so ask. Before the model: // declining must cost no buffer and no socket, and nothing below has to cope with "no source". if (!cfg.server_specified && !udpscope::choose_source(cfg)) return 0; udpscope::ScopeModel model(cfg); udpscope::RowSet rows; rows.set_row_count(cfg.plots); udpscope::Acquisition acquisition(model, cfg); try { acquisition.start(); } catch (const std::exception& e) { std::fprintf(stderr, "udpscope: %s\n", e.what()); return 1; } const int result = udpscope::run_ui(argc, argv, cfg, model, acquisition, rows); acquisition.stop(); return result; }