Classes
srs::App
-
class App
The primary interface class of SRS-Control.
Application class should be instantiated only once during the whole program. Public setter methods should be called before calling the init() method.
Public Functions
-
App()
Constructor of the App class.
The constructor contains following actions:
Instantiation of the work guard, which make sure the io_context_ keep accepting new tasks.
Instantiation of strand from the io_context_, which synchronizes the communications among the FECs.
Set the logging format.
Instantiation (memory allocation) of workflow_handler_.
-
~App() noexcept
Destructor of the App class.
This destructor is called before the destruction of each members. The destructor contains following actions:
Cancel the signal_set_.
Wait for the Status::is_reading to be false, which will be unset from connection::DataReader::close(). The waiting time is set to be common::DEFAULT_STATUS_WAITING_TIME_SECONDS.
Requesting acquisition off to all FEC devices.
Set the Status::is_acq_on to be true.
The exit process of App class also contains the destruction of its member variables. The following order must be kept:
Destruction of connection::DataReader member.
Destruction of workflow::Handler member.
Destruction of internal::AppExitHelper member, which calls end_of_work method.
Destruction of working_thread_ (std::jthread) by waiting for the thread to finish.
Destruction other members. Orders are not important.
Destruction of io_context member. This must be done in the very end.
See also
-
void init()
Initialization of internal members.
-
void switch_on()
Establish the communications to the available FECs to start the data acquisition.
-
void switch_off()
Establish the communications to the available FECs to stop the data acquisition.
-
void read_data(bool is_non_stop = true)
Start reading the input data stream from the port specified by srs::Config::fec_data_receive_port. If is_non_stop is true, the reading process will not be stopped until an interrupt happens, such as pressing “Ctrl-C” from users. If is_non_stop is false, the reading process will be stopped after one frame of data is read.
- Parameters:
is_non_stop – Flag to set non-stop mode.
-
void start_workflow()
Start data analysis workflow, triggering data conversions.
This function call is executed in the main thread.
-
void wait_for_finish()
Manually wait for the working thread to finish.
This method is called automatically in the destructor and shouldn’t be called if not necessary. It blocks the program until the working thread exits.
-
inline void set_fec_data_receiv_port(int port_num)
Set the local listen port number for the communications to FEC devices.
-
void set_print_mode(common::DataPrintMode mode)
Set the print mode.
-
void set_output_filenames(const std::vector<std::string> &filenames, std::size_t n_lines = 1)
Set the output filenames.
Private Members
-
io_context_type io_context_ = {4}
Asio io_context that manages the task scheduling and network IO.
-
asio::executor_work_guard<io_context_type::executor_type> io_work_guard_
Asio io_context work guard.
-
std::vector<udp::endpoint> remote_fec_endpoints_
Remote endpoints of FEC devices.
-
asio::signal_set signal_set_ = {io_context_, SIGINT, SIGTERM}
User signal handler for interrupts.
-
asio::strand<io_context_type::executor_type> fec_strand_
FEC communication strand for synchronous communications.
-
std::jthread working_thread_
Main working thread.
-
std::jthread workflow_thread_
Main thread to run workflow.
-
internal::AppExitHelper exit_helper_ = {this}
Exit helper for App class. This is called after calling the destructor.
-
std::unique_ptr<workflow::Handler> workflow_handler_
The handler to the analysis working flow.
-
std::shared_ptr<connection::DataSocket> data_socket_
Communication to the main input data stream.
-
App()
srs::Config
-
class Config
Main configuration struct.
Public Members
-
int fec_control_local_port = common::FEC_CONTROL_LOCAL_PORT
The port number of the local network that is used for the communication to FECs.
-
int fec_control_remote_port = common::DEFAULT_SRS_CONTROL_PORT
The port number of the remote network that is used for the communication to FECs.
-
int fec_data_receive_port = common::FEC_DAQ_RECEIVE_PORT
The port number of the local network that is used for reading the data stream from FECs.
-
std::size_t data_buffer_size = common::LARGE_READ_MSG_BUFFER_SIZE
The size of data buffer to store the incoming UDP frames.
-
std::vector<std::string> remote_fec_ips = {std::string{common::DEFAULT_SRS_IP}}
Remote IP addresses of FECs.
-
int fec_control_local_port = common::FEC_CONTROL_LOCAL_PORT
srs::connection::DataReader
Warning
doxygenclass: Cannot find class “srs::connection::DataReader” in doxygen xml output for project “srs” from directory: /Users/runner/work/srs-control/srs-control/build/doc/xml