4#include <spdlog/spdlog.h>
15 spdlog::set_pattern(
"[%H:%M:%S] [%^%=7l%$] [thread %t] %v");
16 spdlog::info(
"Welcome to SRS Application");
24 spdlog::trace(
"Application: Resetting io context workguard ... ");
26 if (not
status_.is_acq_off.load())
29 "Failed to close srs system! Please manually close the system with\n\nsrs_control --acq-off\n");
35 spdlog::debug(
"Application: Wait until working thread finishes ...");
38 spdlog::debug(
"io context is stoped");
40 spdlog::debug(
"Application: working thread is finished");
41 spdlog::debug(
"Application has exited.");
46 spdlog::debug(
"Calling the destructor of App ... ");
54 spdlog::debug(
"Turning srs system off ...");
67 [
this](
const boost::system::error_code& error,
auto)
69 if (error == asio::error::operation_aborted)
74 spdlog::info(
"calling SIGINT from monitoring thread");
76 auto monitoring_action = [
this]()
82 catch (
const std::exception& ex)
84 spdlog::critical(
"Exception on working thread occured: {}", ex.what());
93 auto res =
status_.wait_for_status(
94 [](
const auto& status)
96 spdlog::debug(
"Waiting for reading status false");
97 return not status.is_reading.load();
102 spdlog::critical(
"TIMEOUT during waiting for status is_reading false.");
109 spdlog::debug(
"App::exit is called");
110 status_.is_on_exit.store(
true);
124 spdlog::debug(
"Set the remote socket with ip: {} and port: {}", remote_ip, port_number);
125 auto udp_endpoints = resolver.resolve(udp::v4(), remote_ip, fmt::format(
"{}", port_number));
133 auto connection = std::make_shared<connection::Starter>(connection_info);
142 auto connection = std::make_shared<connection::Stopper>(connection_info);
~AppExitHelper() noexcept
asio::executor_work_guard< io_context_type::executor_type > io_work_guard_
void read_data(bool is_non_stop=true)
void set_remote_endpoint(std::string_view remote_ip, int port_number)
void set_status_acq_on(bool val=true)
std::shared_ptr< connection::DataReader > data_reader_
asio::signal_set signal_set_
std::jthread working_thread_
void set_print_mode(common::DataPrintMode mode)
void set_output_filenames(const std::vector< std::string > &filenames)
std::unique_ptr< workflow::Handler > workflow_handler_
void start_workflow(bool is_blocking=true)
udp::endpoint remote_endpoint_
io_context_type io_context_
void wait_for_reading_finish()
void set_status_acq_off(bool val=true)