SRS-control 0.1.4
 
Loading...
Searching...
No Matches
Connections.cpp
Go to the documentation of this file.
3
4namespace srs::connection
5{
7 {
9 auto& control = get_app();
10 control.set_status_acq_on();
11 control.notify_status_change();
12 spdlog::info("SRS system is turned on");
13 }
14
16 {
17 const auto waiting_time = std::chrono::seconds{ 4 };
18 auto is_ok = get_app().wait_for_status(
19 [](const Status& status)
20 {
21 spdlog::debug("Waiting for acq_on status true ...");
22 return status.is_acq_on.load();
23 },
24 waiting_time);
25
26 if (not is_ok)
27 {
28 throw std::runtime_error("TIMEOUT during waiting for status is_acq_on true.");
29 }
30 const auto data = std::vector<CommunicateEntryType>{ 0, 15, 0 };
32 }
33
35 {
36 spdlog::debug("Stopping UDP data reading ...");
38 auto& control = get_app();
39 control.set_status_is_reading(false);
40 spdlog::trace("reading status is not false");
41 control.notify_status_change();
42 spdlog::info("UDP Data reading is stopped.");
43 }
44
45 void DataReader::read_data_handle(std::span<BufferElementType> read_data)
46 {
47
48 workflow_handler_->read_data_once(read_data);
49 }
50} // namespace srs::connection
void communicate(this auto &&self, const std::vector< CommunicateEntryType > &data, uint16_t address)
auto get_app() -> App &
gsl::not_null< workflow::Handler * > workflow_handler_
void read_data_handle(std::span< BufferElementType > read_data)
void acq_off()
Turn off the data acquisition from SRS system.
constexpr auto NULL_ADDRESS
std::atomic< bool > is_acq_on
Definition AppStatus.hpp:11