13#ifndef RTCTK_COMPONENTFRAMEWORK_RTCCOMPONENT_HPP
14#define RTCTK_COMPONENTFRAMEWORK_RTCCOMPONENT_HPP
102 Super::InputStage::Start();
144 if (req ==
nullptr) {
152 engine.RegisterAction(
"ActionUpdatingEntry", [
this](
auto c) {
156 engine.RegisterAction(
"ActionUpdatingDone", [
this](
auto c) {
163 engine.RegisterAction(
"ActionUpdatingFailed", [
this](
auto c) {
175 engine.RegisterGuard(
"GuardUpdatingAllowed", [
this](
auto c) {
177 if (req ==
nullptr) {
189 std::string
string_arg = req->GetRequestPayload();
194 engine.RegisterGuard(
"GuardDisablingAllowed", [
this](
auto c) {
232 this->
mm.
AddTrans(
"On::Operational" ,
"" ,
"events.ClearAlerts",
"",
"ActionClearAlerts");
238 this->
mm.
AddState(
Simple,
"On:Update:Busy", update_region ,
"ActivityUpdating" ,
"ActionUpdatingEntry");
240 this->
mm.
AddTrans(
"On:Update:Initial" ,
"On:Update:Idle" );
241 this->
mm.
AddTrans(
"On:Update:Idle" ,
"On:Update:Busy" ,
"events.Update",
"GuardUpdatingAllowed");
242 this->
mm.
AddTrans(
"On:Update:Busy" ,
"On:Update:Idle" ,
"events.UpdateDone",
"" ,
"ActionUpdatingDone" );
243 this->
mm.
AddTrans(
"On:Update:Busy" ,
"On:Update:Idle" ,
"events.UpdateError",
"" ,
"ActionUpdatingFailed" );
245 this->
mm.
ModTransGuard(
"On::Operational",
"On::NotOperational::Disabling",
"events.Disable",
"",
"GuardDisablingAllowed");
static void Register(CommandReplier &replier, StateMachineEngine &engine)
Definition rtcCmdsImpl.hpp:95
ModelManipulator mm
Definition modelBuilderBase.hpp:79
void AddState(StateType type, const std::string &id, const std::string &parent_id="", const std::string &activity_id="", const std::string &entry_action_id="", const std::string &exit_action_id="")
Adds a new state.
Definition modelManipulator.cpp:30
void ModTransGuard(const std::string &source_id, const std::string &target_id, const std::string &event_id, const std::string &guard_id, const std::string &new_guard_id)
Modifies the guard of a transition.
Definition modelManipulator.cpp:297
void AddTrans(const std::string &source_id, const std::string &target_id, const std::string &event_id="", const std::string &guard_id="", const std::string &action_id="")
Adds a new transition.
Definition modelManipulator.cpp:229
Adapter object intended to be used in contexts without direct access to the output-stream object.
Definition exceptions.hpp:159
std::string Str() const
Convenience function for constructing a std::string from the exception.
Definition exceptions.hpp:177
Thrown if somebody sent a stop or abort command.
Definition rtcComponent.hpp:29
RequestAborted()
Definition rtcComponent.hpp:32
static constexpr int32_t ERROR_CODE
Definition rtcComponent.hpp:31
Thrown if the command was accepted but the task to run failed.
Definition rtcComponent.hpp:53
RequestFailed(const std::string &message)
Definition rtcComponent.hpp:59
static constexpr int32_t ERROR_CODE
Definition rtcComponent.hpp:58
Thrown if a command is not allowed in current state or guard.
Definition rtcComponent.hpp:40
RequestRejected(const std::string &request_id, const std::string &state_id)
Definition rtcComponent.hpp:43
static constexpr int32_t ERROR_CODE
Definition rtcComponent.hpp:42
Definition rtcComponent.hpp:80
virtual bool GuardUpdatingAllowed(const JsonPayload &args)
Definition rtcComponent.hpp:86
virtual void ActionClearAlerts()
Definition rtcComponent.hpp:90
virtual void ActivityUpdating(StopToken st, const JsonPayload &args)
Definition rtcComponent.hpp:83
Definition rtcComponent.hpp:228
ModelBuilder(StateMachineEngine &engine)
Definition rtcComponent.hpp:230
Definition rtcComponent.hpp:112
std::function< void(std::exception_ptr)> m_update_error_handler
Definition rtcComponent.hpp:220
std::list< std::string > m_no_disable_in_states
Definition rtcComponent.hpp:222
std::list< std::string > m_no_update_in_states
Definition rtcComponent.hpp:221
OutputStage(StateMachineEngine &engine, BizLogicIf &bl)
Definition rtcComponent.hpp:114
std::function< void()> m_update_success_handler
Definition rtcComponent.hpp:219
std::shared_ptr< rad::cii::Request< std::string, std::string > > m_tmp_update_request
Definition rtcComponent.hpp:218
Definition stateMachineEngine.hpp:35
void RegisterAction(const std::string &id, ActionMethod action)
Register action.
Definition stateMachineEngine.cpp:86
std::string GetState()
Queries the current state.
Definition stateMachineEngine.cpp:153
void PostEvent(rad::SharedEvent s)
Injects a new event into the state machine engine.
Definition stateMachineEngine.cpp:148
Definition stdComponent.hpp:148
Definition stdComponent.hpp:420
Definition stdComponent.hpp:183
StateMachineEngine & m_engine
Definition stdComponent.hpp:410
BizLogicIf & m_logic
Definition stdComponent.hpp:411
static void Register(CommandReplier &replier, StateMachineEngine &engine)
Definition rtcCmdsImpl.hpp:122
Defines the JSON payload type JsonPayload.
Definition commandReplier.cpp:22
StdComponent RtcComponentSuper
Definition rtcComponent.hpp:66
@ Simple
Definition model.hpp:23
@ Composite
Definition model.hpp:23
@ Initial
Definition model.hpp:23
rad::StopToken StopToken
Definition stopToken.hpp:20
const std::string STD_OK_REPLY
Definition stdComponent.hpp:86
nlohmann::json JsonPayload
Type requirements:
Definition jsonPayload.hpp:25
elt::mal::future< std::string > InjectReqRepEvent(StateMachineEngine &engine)
Definition malEventInjector.hpp:23
Implementation of MAL commands for layer 'RtcComponent'.
Lifecycle of the 'Standard Component'.
Basic life cycle for RtcComponent.
Definition rtcComponent.hpp:74
Basic life cycle for StdComponent.
Definition stdComponent.hpp:144