RTC Toolkit  0.1.0-alpha
telRepubBusinessLogic.hpp
Go to the documentation of this file.
1 
8 #ifndef RTCTK_REUSABLECOMPONENT_TELREPUB_TELREPUBBUSINESSLOGIC_HPP_
9 #define RTCTK_REUSABLECOMPONENT_TELREPUB_TELREPUBBUSINESSLOGIC_HPP_
10 
11 #include "udpReceiver.hpp"
12 #include "ddsPub.hpp"
13 #include "ddsPubThread.hpp"
14 
20 
22 
23 #include <rad/mal/utils.hpp>
24 #include <rad/logger.hpp>
25 
26 #include <chrono>
27 #include <iostream>
28 
29 using namespace rtctk::componentFramework;
30 using namespace std::chrono_literals;
31 using namespace std;
32 
33 using std::this_thread::sleep_for;
34 
35 namespace rtctk::telRepub {
36 
42 {
43 public:
44  TelRepubBusinessLogic(const std::string& name, rtctk::componentFramework::ServiceContainer& services);
45 
46  virtual ~TelRepubBusinessLogic();
47 
48  // activities
49  void Starting(StopToken st) override;
50 
51  void Recovering(StopToken st) override;
52 
53  void Initialising(StopToken st) override;
54 
55  void Enabling(StopToken st) override;
56 
57  void Disabling(StopToken st) override;
58 
59  void GoingRunning(StopToken st) override;
60 
61  void GoingIdle(StopToken st) override;
62 
63  void Running(StopToken st) override;
64 
65  void Updating(StopToken st, Payload args) override;
66  // guards
67  bool IsUpdatingAllowed(Payload args) override;
68 
69 protected:
70 
74  void CreateMudpiReceivers();
75 
79  void DeleteMudpiReceivers();
80 
84  void CreateDdsPubs();
88  void DeleteDdsPubs();
89 
90 
94  const std::string m_name;
95 
100 
102 
106  std::vector<std::unique_ptr<UdpReceiver>> udp_receivers;
107 
111  std::list<PubThread<rtctk::AgnosticTopic>> m_pubThreads;
112 };
113 
114 } // closing namespace
115 
116 #endif //RTCTK_REUSABLECOMPONENT_TELREPUB_TELREPUBBUSINESSLOGIC_HPP_
serviceContainer.hpp
A container that can hold any type of service.
udpReceiver.hpp
UDP receiver: receiving MUDPI and send to MUDPI processor.
commandReplier.hpp
Receive commands via MAL.
ddsPubThread.hpp
DDS agnostic topic publioshing thread.
statePublisher.hpp
Publishes the stdif state topic via MAL.
rtctk::componentFramework
Definition: rtcComponent.hpp:17
rtctk::componentFramework::RunnableStateMachineLogicIf
Definition: runnableStateMachineLogicIf.hpp:26
rtctk::telRepub
Definition: ddsPub.cpp:12
rtctk::telRepub::TelRepubBusinessLogic::udp_receivers
std::vector< std::unique_ptr< UdpReceiver > > udp_receivers
Definition: telRepubBusinessLogic.hpp:106
rtctk::telRepub::DdsPub
Definition: ddsPub.hpp:36
rtctk::componentFramework::StopToken
rad::StopToken StopToken
Definition: stopToken.hpp:16
commandHandler.hpp
Receive commands via MAL and inject events to state machine.
rtctk::telRepub::TelRepubBusinessLogic::m_name
const std::string m_name
Definition: telRepubBusinessLogic.hpp:94
rtctk::componentFramework::Payload
std::string Payload
Definition: runnableStateMachineLogicIf.hpp:17
rtctk::componentFramework::ServiceContainer
Definition: serviceContainer.hpp:31
ddsPub.hpp
DDS Publisher.
rtctk::telRepub::TelRepubBusinessLogic::m_serviceContainer
rtctk::componentFramework::ServiceContainer & m_serviceContainer
Definition: telRepubBusinessLogic.hpp:99
std
Definition: mudpiProcessingError.hpp:109
rtctk::telRepub::TelRepubBusinessLogic::m_pubThreads
std::list< PubThread< rtctk::AgnosticTopic > > m_pubThreads
Definition: telRepubBusinessLogic.hpp:111
runnableStateMachineLogicIf.hpp
Life-Cycle Interface of the Runnable State Machine.
rtctk::telRepub::TelRepubBusinessLogic::m_ddsPub
DdsPub m_ddsPub
Definition: telRepubBusinessLogic.hpp:101
runnableStateMachine.hpp
The Runnable Statemachine.
rtctk::telRepub::TelRepubBusinessLogic
Definition: telRepubBusinessLogic.hpp:42