12#ifndef RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSOR_HPP
13#define RTCTK_REUSABLECOMPONENT_TELREPUB_MUDPIPROCESSOR_HPP
15#include <boost/asio.hpp>
17#include <fmt/format.h>
19#include "agnostictopicif.hpp"
20#include "llnetio/mudpi/mudpi.hpp"
31#include <taiclock/taiClock.hpp>
44 std::chrono::milliseconds(20000);
56 using AgnosticTopic = rtctk::componentFramework::AgnosticTopic;
63 std::vector<QueueElement> queue_elements{};
64 std::vector<gsl::span<const uint8_t>> payloads{};
65 taiclock::TaiClock::time_point time_stamp{};
66 llnetio::mudpi::SampleId sample_id{0};
69 queue_elements.clear();
77 PacketData m_packet_data{};
79 ComponentMetricsIf& m_metrics;
80 AlertServiceIf& m_alerts;
82 llnetio::mudpi::NumFrames m_num_frames = std::numeric_limits<llnetio::mudpi::NumFrames>::max();
83 llnetio::mudpi::TopicId m_topic_id = 0;
85 std::string m_topic_name;
86 std::string m_metric_path_prefix;
88 llnetio::mudpi::SampleId m_expected_sample_id = 0;
89 llnetio::mudpi::FrameId m_expected_frame_id = 0;
91 llnetio::mudpi::SampleId m_expected_sample_id_increment;
93 bool m_sample_finished =
false;
95 enum ProcessorState : uint8_t { Synchronising, Processing };
97 ProcessorState m_state = Synchronising;
103 log4cplus::Logger m_logger;
112 perfc::CounterI64 m_pc_frames_recvd;
113 perfc::ScopedRegistration m_pc_frames_recvd_reg;
114 perfc::CounterI64 m_pc_samples_recvd;
115 perfc::ScopedRegistration m_pc_samples_recvd_reg;
116 perfc::CounterI64 m_pc_frame_errors;
117 perfc::ScopedRegistration m_pc_frame_errors_reg;
118 perfc::CounterI64 m_pc_sample_errors;
119 perfc::ScopedRegistration m_pc_sample_errors_reg;
120 perfc::CounterI64 m_pc_last_sample_id_recvd;
121 perfc::ScopedRegistration m_pc_last_sample_id_recvd_reg;
126 std::atomic<std::chrono::steady_clock::time_point> m_last_sample_received;
130 std::chrono::milliseconds m_receive_sample_timeout_ms =
131 std::chrono::milliseconds(0);
176DefaultWrangler(gsl::span<
const gsl::span<const uint8_t>> input, std::vector<uint8_t>& output);
Alert Service interface.
Definition alertServiceIf.hpp:138
Models a single alert source that can be set or cleared.
Definition alertServiceIf.hpp:47
Component metrics interface.
Definition componentMetricsIf.hpp:163
Monitors min, mean and max duration and publishes them to OLDB.
Definition durationMonitor.hpp:36
Estimates the frequency in which Tick is called and publishes result to OLDB.
Definition frequencyEstimator.hpp:30
Container class that holds services of any type.
Definition serviceContainer.hpp:38
void ResetCounters()
Reset the counters.
Definition mudpiProcessor.cpp:313
bool Monitor()
Monitoring MUDPI processor for different problems (alerts): like timeouts ....
Definition mudpiProcessor.cpp:325
ErrorCode< MudpiProcessorError > ProcessMudpi(AgnosticTopic &topic, const WranglerFunction &wrangler)
Here the actual processing is done (frame by frame (MUDPI datagram)).
Definition mudpiProcessor.cpp:138
uint16_t GetTopicId() const
To query the topic id of the current mudpi processor object.
Definition mudpiProcessor.cpp:133
MudpiProcessor(QueuePtr queue, CfgMudpiProc &cfg, componentFramework::ServiceContainer &service)
MUDPI Processor constructor.
Definition mudpiProcessor.cpp:44
Header file for ComponentMetricsIf.
Header file for Duration Monitor.
Header file for Frequency Estimator.
MUDPI processor error codes.
Definition ddsPubThread.cpp:16
std::shared_ptr< Queue > QueuePtr
Definition queue.hpp:35
std::error_code DefaultWrangler(const gsl::span< const gsl::span< const uint8_t > > input, std::vector< uint8_t > &output)
Definition mudpiProcessor.cpp:337
std::function< std::error_code( const gsl::span< const gsl::span< const uint8_t > >, std::vector< uint8_t > &)> WranglerFunction
The wrangler function that is called with a span of spans containing the payload and an vector where ...
Definition wrangler.hpp:27
Wrangler: User extension point.
A container that can hold any type of service.
Structure to hold MudpiProcessor's configuration.
Definition mudpiProcessor.hpp:39
std::uint32_t expected_sample_id_increment
Definition mudpiProcessor.hpp:42
llnetio::mudpi::TopicId mudpi_topic_id
Definition mudpiProcessor.hpp:41
std::string dds_topic_name
Definition mudpiProcessor.hpp:40
std::chrono::milliseconds receive_sample_timeout_ms
Definition mudpiProcessor.hpp:43
Definition mudpiProcessingError.hpp:27