RTC Toolkit 5.0.0
Loading...
Searching...
No Matches
telRepubBusinessLogic.hpp
Go to the documentation of this file.
1
13#ifndef RTCTK_REUSABLECOMPONENT_TELREPUB_TELREPUBBUSINESSLOGIC_HPP
14#define RTCTK_REUSABLECOMPONENT_TELREPUB_TELREPUBBUSINESSLOGIC_HPP
15
16#include <fastdds/dds/publisher/DataWriter.hpp>
19
20#include "numapp/numapolicies.hpp"
27
28#include <rad/logger.hpp>
29#include <rad/mal/utils.hpp>
30
31#include <cstdint>
32
33namespace rtctk::telRepub {
34
35using namespace rtctk::componentFramework;
36
38
40
41class PubThread;
42
43class PubThreadMudpi;
44
45class MudpiProcessor;
46
47class UdpReceiver;
48
55public:
58 std::string name, ServiceContainer& service, RepubWranglerFactory&& factory = [](auto x) {
59 return nullptr;
60 });
61
62 virtual ~TelRepubBusinessLogic();
63
64 void ActivityStarting(StopToken st) override;
65
66 void ActionClearAlerts() override;
67
68 void ActivityRecovering(StopToken st) override;
69
70 void ActivityInitialising(StopToken st) override;
71
72 void ActivityEnabling(StopToken st) override;
73
74 void ActivityDisabling(StopToken st) override;
75
76 void ActivityGoingRunning(StopToken st) override;
77
78 void ActivityGoingIdle(StopToken st) override;
79
80 void ActivityRunning(StopToken st) override;
81
82 void ActivityUpdating(StopToken st, const JsonPayload& args) override;
83
84 bool GuardUpdatingAllowed(const JsonPayload& args) override;
85
86protected:
91 void ReadGlobalCfg();
92
98
103
110
115 void CreateSimPubThreads();
116
120 void DeletePubThreads();
121
126 void CreateDdsPubs();
127
131 void DeleteDdsPubs();
132
137 void Monitor();
138
142 log4cplus::Logger& m_logger;
143
147 const std::string m_name;
148
149 std::unique_ptr<DdsPub> m_dds_pub;
150
155
160
166
172
176 std::vector<std::unique_ptr<UdpReceiver>> m_udp_receivers;
177
181 std::vector<std::unique_ptr<PubThread>> m_pub_threads;
182
187
191 std::chrono::milliseconds m_monitor_report_interval_ms = std::chrono::milliseconds(1000);
192
196 std::optional<numapp::NumaPolicies> monitoring_thread_policies = std::nullopt;
197};
198
199} // namespace rtctk::telRepub
200
201#endif // RTCTK_REUSABLECOMPONENT_TELREPUB_TELREPUBBUSINESSLOGIC_HPP
Declares AlertService.
Alert Service interface.
Definition alertServiceIf.hpp:128
Component metrics interface.
Definition componentMetricsIf.hpp:85
Base interface for all Runtime Configuration Repository adapters.
Definition runtimeRepoIf.hpp:27
Container class that holds services of any type.
Definition serviceContainer.hpp:39
Processing MUDPI data received by UDP receiver: rtctk::telRepub::UdpReceiver.
Definition mudpiProcessor.hpp:56
DDS publisher thread class that supports (re)publishing of MUDPI samples.
Definition ddsPubThread.hpp:142
DDS publisher thread class that supports production and simulation mode.
Definition ddsPubThread.hpp:60
Telemetry Republisher business logic.
Definition telRepubBusinessLogic.hpp:54
void CreateMudpiReceivers()
Creates MUDPI receivers (rtctk::telRepub::UdpReceiver) incl corresponding Publisher threads,...
Definition telRepubBusinessLogic.cpp:95
std::unique_ptr< DdsPub > m_dds_pub
Definition telRepubBusinessLogic.hpp:149
void ActivityEnabling(StopToken st) override
Definition telRepubBusinessLogic.cpp:488
void ActivityStarting(StopToken st) override
Definition telRepubBusinessLogic.cpp:477
void ActivityInitialising(StopToken st) override
Definition telRepubBusinessLogic.cpp:459
const std::string m_name
Component name.
Definition telRepubBusinessLogic.hpp:147
void ActivityUpdating(StopToken st, const JsonPayload &args) override
Definition telRepubBusinessLogic.cpp:538
void ActivityGoingIdle(StopToken st) override
Definition telRepubBusinessLogic.cpp:497
PubThreadMudpi & CreatePubThread(const std::string &dds_topic_path_static)
Creates Publisher Thread (rtctk::telRepub::PubThread), reading configuration from the Runtime Configu...
Definition telRepubBusinessLogic.cpp:292
void Monitor()
Monitoring alerts etc that is executed in a loop.
Definition telRepubBusinessLogic.cpp:550
void DeleteMudpiReceivers()
Deletes UDPI receivers (rtctk::telRepub::UdpReceiver).
Definition telRepubBusinessLogic.cpp:220
AlertServiceIf & m_alerts
references to component alert service
Definition telRepubBusinessLogic.hpp:171
TelRepubBusinessLogic(std::string name, ServiceContainer &service, RepubWranglerFactory &&factory=[](auto x) { return nullptr;})
Definition telRepubBusinessLogic.cpp:47
std::chrono::milliseconds m_monitor_report_interval_ms
Monitoring report interval in msecs.
Definition telRepubBusinessLogic.hpp:191
componentFramework::ComponentMetricsIf & m_metrics
references to component metrices service
Definition telRepubBusinessLogic.hpp:165
rtctk::componentFramework::ServiceContainer & m_service
Reference to container service.
Definition telRepubBusinessLogic.hpp:154
std::optional< numapp::NumaPolicies > monitoring_thread_policies
Monitoring thread policies.
Definition telRepubBusinessLogic.hpp:196
void ActivityRunning(StopToken st) override
Definition telRepubBusinessLogic.cpp:500
void ActivityRecovering(StopToken st) override
Definition telRepubBusinessLogic.cpp:485
RepubWranglerFactory m_wrangler_factory
Factory for wrangler functions, depending on the topic id.
Definition telRepubBusinessLogic.hpp:186
void ActionClearAlerts() override
Definition telRepubBusinessLogic.cpp:563
log4cplus::Logger & m_logger
Logger object reference of this class.
Definition telRepubBusinessLogic.hpp:142
virtual ~TelRepubBusinessLogic()
Definition telRepubBusinessLogic.cpp:60
std::vector< std::unique_ptr< UdpReceiver > > m_udp_receivers
vector of UDP receivers
Definition telRepubBusinessLogic.hpp:176
bool GuardUpdatingAllowed(const JsonPayload &args) override
Definition telRepubBusinessLogic.cpp:543
std::vector< std::unique_ptr< PubThread > > m_pub_threads
DDS publishers.
Definition telRepubBusinessLogic.hpp:181
void CreateSimPubThreads()
Creates all Simulated Publisher Threads (rtctk::telRepub::PubThread), reading configuration from the ...
Definition telRepubBusinessLogic.cpp:390
void ActivityGoingRunning(StopToken st) override
Definition telRepubBusinessLogic.cpp:494
componentFramework::RuntimeRepoIf & m_rtr
Reference to run-time repository needed to access the configuration.
Definition telRepubBusinessLogic.hpp:159
void ActivityDisabling(StopToken st) override
Definition telRepubBusinessLogic.cpp:491
void ReadGlobalCfg()
Reads Global configuration.
Definition telRepubBusinessLogic.cpp:66
void DeletePubThreads()
Deletes all (incl.
Definition telRepubBusinessLogic.cpp:455
void CreateDdsPubs()
Creates DDS publishers (rtctk::componentFramework::DdsPub), reading configuration from the Runtime Co...
Definition telRepubBusinessLogic.cpp:227
void DeleteDdsPubs()
Deletes DDS publishers (rtctk::componentFramework::DdsPub).
Definition telRepubBusinessLogic.cpp:279
Receiving UDP data asynchronously and forwards received packets to provided packet processors.
Definition udpReceiver.hpp:60
Header file for ComponentMetricsIf.
DDS Publisher.
Logging Support Library based on log4cplus.
Definition commandReplier.cpp:22
rad::StopToken StopToken
Definition stopToken.hpp:20
nlohmann::json JsonPayload
Type requirements:
Definition jsonPayload.hpp:25
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
Definition ddsPubThread.cpp:17
Runnable< RtcComponent > LifeCycle
Definition telRepubBusinessLogic.hpp:37
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:28
std::function< WranglerFunction(int32_t)> RepubWranglerFactory
Definition telRepubBusinessLogic.hpp:39
Wrangler: User extension point.
Lifecycle of a basic 'RtcComponent'.
Lifecycle Extension that makes an RTC Component 'Runnable'.
Header file for RuntimeRepoIf, which defines the API for RuntimeRepoAdapters.
Life cycle extension to make RtcComponent Runnable.
Definition runnable.hpp:31