ifw-rtmstools 3.0.0
Loading...
Searching...
No Matches
rtmsSender.hpp
Go to the documentation of this file.
1
8#ifndef RTMSTOOLS2_RTMS_SENDER_LLNETIO_HPP_
9#define RTMSTOOLS2_RTMS_SENDER_LLNETIO_HPP_
10
11#include <csignal>
12#include <cerrno>
13#include <thread>
14
15#include <boost/endian/arithmetic.hpp>
16
17#include <fmt/format.h>
18
19#include <llnetio/ipv4.hpp>
20#include <llnetio/mudpi/io.hpp>
21#include <llnetio/rtms/io.hpp>
22#include <llnetio/rtms/rtms.hpp>
23#include <llnetio/udpSocket.hpp>
24#include <llnetio/mockSocket.hpp>
25
29
31
32 constexpr auto RTMS_HEADER_SIZE = 96;
33 constexpr auto LEADER_TRAILER_PACKET_NB = 2;
34 constexpr auto EXT_INFO_SIZE = sizeof(SampleExtInfo);
35
37 public:
39
40 uint16_t mtu_size{1500};
41 int32_t topic_id{10};
42 uint16_t component_id{12345};
43 bool simulation{false};
45 };
46
47
59 class RtmsSender {
60 public:
61
69 RtmsSender(const std::string& src_ip,
70 const std::string& dest_ip,
71 const int dest_port,
72 const ifw::fnd::datatype::DataType data_type,
73 const int pixels_per_sample,
74 const SenderConfig& sndr_cfg = SenderConfig());
75
76 virtual ~RtmsSender();
77
81 void SendSample(const SampleExtInfo& ext_info,
82 const std::vector<uint8_t>& sample_payload);
83
84 int GetPixelsPerSample() const;
85
86 private:
87 void Initialise(const SampleExtInfo& ext_info);
88
89 std::string m_src_ip;
90 std::string m_dest_ip;
91 int m_dest_port;
92 ifw::fnd::datatype::DataType m_data_type;
93 int32_t m_pixels_per_sample;
94 SenderConfig m_sndr_cfg;
95
96 int32_t m_current_pixels_per_sample;
97 int32_t m_nb_of_udp_packets;
98 int8_t m_bpp;
99
100 std::unique_ptr<llnetio::UdpTxSocket> m_udp_socket;
101 std::unique_ptr<llnetio::mudpi::Sender> m_mudpi_sender;
102 std::unique_ptr<llnetio::rtms::Sender> m_rtms_sender;
103
104 };
105}
106
107#endif // RTMSTOOLS2_RTMS_SENDER_HPP_
RtmsSender class.
Definition rtmsSender.hpp:59
int GetPixelsPerSample() const
Definition rtmsSender.cpp:230
virtual ~RtmsSender()
Definition rtmsSender.cpp:44
void SendSample(const SampleExtInfo &ext_info, const std::vector< uint8_t > &sample_payload)
User provided method to send an image as an RTMS Sample.
Definition rtmsSender.cpp:128
RtmsSender(const std::string &src_ip, const std::string &dest_ip, const int dest_port, const ifw::fnd::datatype::DataType data_type, const int pixels_per_sample, const SenderConfig &sndr_cfg=SenderConfig())
Simple RTMS Sender class.
Definition rtmsSender.cpp:19
Definition sampleExtInfo.hpp:27
bool simulation
Definition rtmsSender.hpp:43
uint16_t component_id
Definition rtmsSender.hpp:42
uint16_t mtu_size
Definition rtmsSender.hpp:40
SenderConfig()
Definition rtmsSender.hpp:38
uint16_t ext_info_size
Definition rtmsSender.hpp:44
int32_t topic_id
Definition rtmsSender.hpp:41
Logger source file.
Definition common.cpp:16
constexpr auto RTMS_HEADER_SIZE
Definition rtmsReceiver.hpp:35
constexpr auto LEADER_TRAILER_PACKET_NB
Definition rtmsReceiver.hpp:36
constexpr auto EXT_INFO_SIZE
Definition rtmsSender.hpp:34