RTC Toolkit  2.0.0
suspCmdsImpl.hpp
Go to the documentation of this file.
1 
12 #ifndef RTCTK_COMPONENTFRAMEWORK_SUSPCMDSIMPL_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_SUSPCMDSIMPL_HPP
14 
15 #include <Rtctkif.hpp>
17 #include <rtctk/componentFramework/events.rad.hpp>
21 
22 #include <mal/Cii.hpp>
23 
24 #include <memory>
25 #include <string>
26 
27 namespace rtctk::componentFramework {
28 
32 class SuspCmdsImpl : public rtctkif::AsyncSuspCmds {
33 public:
34  static void Register(CommandReplier& replier, StateMachineEngine& engine) {
35  std::shared_ptr<elt::mal::rr::RrEntity> rr_service = std::make_shared<SuspCmdsImpl>(engine);
36  replier.RegisterService<rtctkif::AsyncSuspCmds>("SuspCmds", rr_service);
37  }
38 
39  SuspCmdsImpl(StateMachineEngine& engine) : m_engine(engine) {
40  }
41 
42  ::elt::mal::future<std::string> Suspend() override {
43  LOG4CPLUS_TRACE(GetLogger(), "Received command 'Suspend'");
44  return InjectReqRepEvent<events::Suspend>(m_engine);
45  }
46 
47  ::elt::mal::future<std::string> Resume() override {
48  LOG4CPLUS_TRACE(GetLogger(), "Received command 'Resume'");
49  return InjectReqRepEvent<events::Resume>(m_engine);
50  }
51 
52 private:
53  StateMachineEngine& m_engine;
54 };
55 
56 } // namespace rtctk::componentFramework
57 
58 #endif // RTCTK_COMPONENTFRAMEWORK_SUSPCMDSIMPL_HPP
commandReplier.hpp
Receive commands via MAL.
stateMachineEngine.hpp
Wrapper around the SCXML State Machine Engine.
rtctk::componentFramework
Definition: commandReplier.cpp:20
rtctk::componentFramework::SuspCmdsImpl::Resume
::elt::mal::future< std::string > Resume() override
Definition: suspCmdsImpl.hpp:47
rtctk::componentFramework::SuspCmdsImpl
Class that handles reception of commands Suspend and Resume using MAL.
Definition: suspCmdsImpl.hpp:32
rtctk::componentFramework::SuspCmdsImpl::Suspend
::elt::mal::future< std::string > Suspend() override
Definition: suspCmdsImpl.hpp:42
rtctk::componentFramework::StateMachineEngine
Definition: stateMachineEngine.hpp:31
rtctk::componentFramework::GetLogger
log4cplus::Logger & GetLogger(const std::string &name="")
Get handle to a specific logger (used with logging macros)
rtctk::componentFramework::SuspCmdsImpl::Register
static void Register(CommandReplier &replier, StateMachineEngine &engine)
Definition: suspCmdsImpl.hpp:34
rtctk::componentFramework::CommandReplier
Class that handles reception of commands using MAL.
Definition: commandReplier.hpp:26
rtctk::componentFramework::SuspCmdsImpl::SuspCmdsImpl
SuspCmdsImpl(StateMachineEngine &engine)
Definition: suspCmdsImpl.hpp:39
logger.hpp
Logging Support Library based on log4cplus.
rtctk::componentFramework::CommandReplier::RegisterService
void RegisterService(std::string const &name, std::shared_ptr< elt::mal::rr::RrEntity > &service)
Definition: commandReplier.hpp:33
malEventInjector.hpp
Provides core functionality of an RTC Component.