SRS-control
0.1.4
Loading...
Searching...
No Matches
Connections.cpp
Go to the documentation of this file.
1
#include <
srs/utils/Connections.hpp
>
2
#include <
srs/workflow/Handler.hpp
>
3
4
namespace
srs::connection
5
{
6
void
Starter::close
()
7
{
8
close_socket
();
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
15
void
Stopper::acq_off
()
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 };
31
communicate
(data,
common::NULL_ADDRESS
);
32
}
33
34
void
DataReader::close
()
35
{
36
spdlog::debug(
"Stopping UDP data reading ..."
);
37
close_socket
();
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
Connections.hpp
Handler.hpp
srs::connection::Base::communicate
void communicate(this auto &&self, const std::vector< CommunicateEntryType > &data, uint16_t address)
Definition
ConnectionBase.hpp:248
srs::connection::Base::get_app
auto get_app() -> App &
Definition
ConnectionBase.hpp:56
srs::connection::Base::close_socket
void close_socket()
Definition
ConnectionBase.hpp:259
srs::connection::DataReader::close
void close()
Definition
Connections.cpp:34
srs::connection::DataReader::workflow_handler_
gsl::not_null< workflow::Handler * > workflow_handler_
Definition
Connections.hpp:132
srs::connection::DataReader::read_data_handle
void read_data_handle(std::span< BufferElementType > read_data)
Definition
Connections.cpp:45
srs::connection::Starter::close
void close()
Definition
Connections.cpp:6
srs::connection::Stopper::acq_off
void acq_off()
Turn off the data acquisition from SRS system.
Definition
Connections.cpp:15
srs::common::NULL_ADDRESS
constexpr auto NULL_ADDRESS
Definition
CommonDefitions.hpp:31
srs::connection
Definition
Application.hpp:22
srs::Status
Definition
AppStatus.hpp:9
srs::Status::is_acq_on
std::atomic< bool > is_acq_on
Definition
AppStatus.hpp:11
backend
srs
utils
Connections.cpp
Impressum
Datenschutzerklärung
Generated by
1.13.2