13#ifndef RTCTK_COMPONENTFRAMEWORK_STDCMDSIMPL_HPP
14#define RTCTK_COMPONENTFRAMEWORK_STDCMDSIMPL_HPP
18#include <rtctk/componentFramework/events.rad.hpp>
38 std::shared_ptr<elt::mal::rr::RrEntity> rr_service = std::make_shared<StdCmdsImpl>(engine);
43 : m_logger(
GetLogger(
"rtctk")), m_engine(engine) {
46 ::elt::mal::future<std::string>
Init()
override {
47 LOG4CPLUS_TRACE(m_logger,
"Received command 'Init'");
48 return InjectReqRepEvent<events::Init>(m_engine);
51 ::elt::mal::future<std::string>
Stop()
override {
52 LOG4CPLUS_TRACE(m_logger,
"Received command 'Stop'");
53 return InjectReqRepEvent<events::Stop>(m_engine);
56 ::elt::mal::future<std::string>
Reset()
override {
57 LOG4CPLUS_TRACE(m_logger,
"Received command 'Reset'");
58 return InjectReqRepEvent<events::Reset>(m_engine);
61 ::elt::mal::future<std::string>
Enable()
override {
62 LOG4CPLUS_TRACE(m_logger,
"Received command 'Enable'");
63 return InjectReqRepEvent<events::Enable>(m_engine);
66 ::elt::mal::future<std::string>
Disable()
override {
67 LOG4CPLUS_TRACE(m_logger,
"Received command 'Disable'");
68 return InjectReqRepEvent<events::Disable>(m_engine);
71 ::elt::mal::future<std::string>
GetState()
override {
72 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetState'");
73 return InjectReqRepEvent<events::GetState>(m_engine);
76 ::elt::mal::future<std::string>
GetStatus()
override {
77 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetStatus'");
78 return InjectReqRepEvent<events::GetStatus>(m_engine);
82 LOG4CPLUS_TRACE(m_logger,
"Received command 'GetVersion'");
83 return InjectReqRepEvent<events::GetVersion>(m_engine);
86 ::elt::mal::future<std::string>
Exit()
override {
87 LOG4CPLUS_TRACE(m_logger,
"Received command 'Exit'");
88 return InjectReqRepEvent<events::Exit>(m_engine);
91 ::elt::mal::future<std::string>
92 SetLogLevel(std::shared_ptr<stdif::LogInfo>
const& info)
override {
93 LOG4CPLUS_TRACE(m_logger,
94 "Received command 'SetLogLevel' with logger '" + info->getLogger() +
95 "' and level '" + info->getLevel() +
"'");
96 auto ev = std::make_shared<events::SetLogLevel>(info->clone());
97 auto f = ev->GetPayload().GetReplyFuture();
103 log4cplus::Logger& m_logger;
Class that handles reception of commands using MAL.
Definition: commandReplier.hpp:29
void RegisterService(std::string const &name, std::shared_ptr< elt::mal::rr::RrEntity > &service)
Definition: commandReplier.hpp:36
Definition: stateMachineEngine.hpp:35
void PostEvent(rad::SharedEvent s)
Injects a new event into the state machine engine.
Definition: stateMachineEngine.cpp:148
Class that handles reception of stdif commands.
Definition: stdCmdsImpl.hpp:35
::elt::mal::future< std::string > Stop() override
Definition: stdCmdsImpl.hpp:51
StdCmdsImpl(StateMachineEngine &engine)
Definition: stdCmdsImpl.hpp:42
static void Register(CommandReplier &replier, StateMachineEngine &engine)
Definition: stdCmdsImpl.hpp:37
::elt::mal::future< std::string > Reset() override
Definition: stdCmdsImpl.hpp:56
::elt::mal::future< std::string > Init() override
Definition: stdCmdsImpl.hpp:46
::elt::mal::future< std::string > Exit() override
Definition: stdCmdsImpl.hpp:86
::elt::mal::future< std::string > GetStatus() override
Definition: stdCmdsImpl.hpp:76
::elt::mal::future< std::string > GetState() override
Definition: stdCmdsImpl.hpp:71
::elt::mal::future< std::string > SetLogLevel(std::shared_ptr< stdif::LogInfo > const &info) override
Definition: stdCmdsImpl.hpp:92
::elt::mal::future< std::string > Disable() override
Definition: stdCmdsImpl.hpp:66
::elt::mal::future< std::string > GetVersion() override
Definition: stdCmdsImpl.hpp:81
::elt::mal::future< std::string > Enable() override
Definition: stdCmdsImpl.hpp:61
Receive commands via MAL.
log4cplus::Logger & GetLogger(const std::string &name="app")
Get handle to a specific logger.
Definition: logger.cpp:180
Logging Support Library based on log4cplus.
Provides core functionality of an RTC Component.
Definition: commandReplier.cpp:22
Wrapper around the SCXML State Machine Engine.