#include <DaphneV3Interface.hpp>
Definition at line 88 of file DaphneV3Interface.hpp.
◆ DaphneV3Interface() [1/3]
| DaphneV3Interface::DaphneV3Interface |
( |
std::string | address, |
|
|
std::string | routing, |
|
|
std::chrono::milliseconds | timeout = std::chrono::milliseconds(500) ) |
Definition at line 24 of file DaphneV3Interface.cpp.
30
31
32 m_socket.set(zmq::sockopt::routing_id, routing);
34 TLOG() << routing <<
" timeout set to " << value <<
" ms";
35 m_socket.set(zmq::sockopt::rcvtimeo, value);
36 m_socket.set(zmq::sockopt::sndtimeo, value);
37 m_socket.set(zmq::sockopt::immediate, 1);
38
39
40 static const std::regex ip_with_port(R"(^([^\/\s:]+)(?::(\d{1,5}))?$)");
41 std::smatch string_values;
42 if (! std::regex_match(
address, string_values, ip_with_port ) ) {
44 }
45
47 fmt::format(
"tcp://{}",
address) :
50
52
53 auto add = string_values[1];
55
56 try {
58 auto add = string_values[1];
61 }
64 }
65
66}
static const size_t s_default_control_port
std::chrono::milliseconds m_timeout
bool validate_connection()
Base class for any user define issue.
void add(QString const &db, QString const &fn)
◆ ~DaphneV3Interface()
| dunedaq::daphnemodules::DaphneV3Interface::~DaphneV3Interface |
( |
| ) |
|
|
inline |
◆ DaphneV3Interface() [2/3]
| dunedaq::daphnemodules::DaphneV3Interface::DaphneV3Interface |
( |
const DaphneV3Interface & | | ) |
|
|
delete |
◆ DaphneV3Interface() [3/3]
| dunedaq::daphnemodules::DaphneV3Interface::DaphneV3Interface |
( |
DaphneV3Interface && | | ) |
|
|
delete |
◆ _receive()
Definition at line 109 of file DaphneV3Interface.cpp.
109 {
110
111 zmq::message_t reply;
112 if (!
m_socket.recv(reply, zmq::recv_flags::none)) {
113
115 }
116 if (reply.size() <= 0) {
118 }
119
121 if (!rep.ParseFromArray(reply.data(), static_cast<int>(reply.size()) )) {
122 throw FailedDecoding(
ERS_HERE, rep.GetTypeName(), reply.to_string());
123 }
124
127 }
128
129 return rep;
130}
::uint32_t version() const
::daphne::Direction dir() const
const std::string & Direction_Name(T value)
void warning(const Issue &issue)
◆ _send()
Definition at line 88 of file DaphneV3Interface.cpp.
88 {
89
93
96
97
99 env.
set_timestamp_ns(std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now().time_since_epoch()).count());
100
101
102 std::string bytes = env.SerializeAsString();
103
104 if (!
m_socket.send(zmq::buffer(bytes), zmq::send_flags::none)) {
106 }
107}
void set_timestamp_ns(::uint64_t value)
void set_payload(Arg_ &&arg, Args_... args)
void set_type(::daphne::MessageTypeV2 value)
void set_dir(::daphne::Direction value)
void set_version(::uint32_t value)
void set_msg_id(::uint64_t value)
uint64_t m_message_counter
const std::string & MessageTypeV2_Name(T value)
◆ close()
| void DaphneV3Interface::close |
( |
| ) |
|
|
protected |
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ send() [1/2]
Implementations of DaphneV3Interface's functions
This is part of the DUNE DAQ Software Suite, copyright 2020.
Licensing/copyright details are in the COPYING file that you should have
Definition at line 11 of file DaphneV3Interface.hxx.
11 {
12
14
15 _send(std::move(message), sent_type);
16
18
19 lock.unlock();
20
21 const auto ty =
ret.type();
23 if ( ty != received_type ) {
26 }
27
28 if (!
out.ParseFromString(
ret.payload())) {
30 }
31
33}
void _send(std::string &&message, daphne::MessageTypeV2)
daphne::ControlEnvelopeV2 _receive()
FELIX Initialization std::string initerror FELIX queue timed out
◆ send() [2/2]
◆ validate_connection()
| bool DaphneV3Interface::validate_connection |
( |
| ) |
|
Definition at line 133 of file DaphneV3Interface.cpp.
134{
135 static const uint64_t good_value = 0xdeadbeef;
136
139 MessageTypeV2::MT2_READ_TEST_REG_REQ,
140 MessageTypeV2::MT2_READ_TEST_REG_RESP );
141
142 return reply.value() == good_value;
143}
daphne::ControlEnvelopeV2 send(std::string &&message, daphne::MessageTypeV2)
◆ m_access_mutex
| std::mutex dunedaq::daphnemodules::DaphneV3Interface::m_access_mutex |
|
mutableprivate |
◆ m_connection
| std::string dunedaq::daphnemodules::DaphneV3Interface::m_connection |
|
private |
◆ m_context
| zmq::context_t dunedaq::daphnemodules::DaphneV3Interface::m_context |
|
private |
◆ m_message_counter
| uint64_t dunedaq::daphnemodules::DaphneV3Interface::m_message_counter = 0 |
|
private |
◆ m_socket
| zmq::socket_t dunedaq::daphnemodules::DaphneV3Interface::m_socket |
|
private |
◆ m_timeout
| std::chrono::milliseconds dunedaq::daphnemodules::DaphneV3Interface::m_timeout {1000} |
|
private |
◆ s_default_control_port
| const size_t dunedaq::daphnemodules::DaphneV3Interface::s_default_control_port = 40001 |
|
inlinestaticprivate |
The documentation for this class was generated from the following files: