Implementation of an instGraph node interface for a MagAO-X Finite State Machine (FSM) More...
#include <fsmNode.hpp>


Public Member Functions | |
| fsmNode (const std::string &name, ingr::instGraphXML *parentGraph) | |
| Constructor. | |
| virtual void | device (const std::string &dev) |
| Set the device name. | |
| const std::string & | device () const |
| Get the device name. | |
| virtual void | fsmPropName (const std::string &pn) |
| Set the fsm property name. | |
| const std::string & | fsmPropName () const |
| Get the fsm property name. | |
| virtual void | fsmElName (const std::string &en) |
| Set the fsm element name. | |
| const std::string & | fsmElName () const |
| Get the fsm element name. | |
| const std::string & | fsmKey () const |
| Get the FSM unique key. | |
| fsmNodeActionT | fsmAction () const |
| Get the action. | |
| void | fsmAction (fsmNodeActionT act) |
| Set the action. | |
| const std::vector< stateCodeT > & | targetStates () const |
| Get the target states. | |
| void | loadConfig (mx::app::appConfigurator &config) |
| Load this specific node's settings from an application configuration. | |
| virtual int | handleSetProperty (const pcf::IndiProperty &ipRecv) |
| INDI SetProperty callback. | |
| virtual int | handleSetProperty (bool &actionTaken, const pcf::IndiProperty &ipRecv) |
| INDI SetProperty callback with indication if action was taken. | |
| virtual void | updateGUI () |
| std::string | name () |
| Get the name of this node. | |
| const std::set< std::string > & | keys () |
| Get the set holding the INDI keys for this node. | |
| void | key (const std::string &nkey) |
| Add a key to the set. | |
| ingr::instNode * | node () |
| Get the pointer to the underlying node. | |
| virtual void | togglePutsOn () |
| Change the state of all inputs and all outputs to on. | |
| virtual void | togglePutsOff () |
| Change the state of all inputs and all outputs to off. | |
Protected Member Functions | |
| void | loadConfigDerived (mx::app::appConfigurator &config) |
| Load this specific node's settings from an application configuration of a derived class. | |
Protected Attributes | |
| std::string | m_device |
| The INDI device name. Defaults to the node name set on construction. | |
| std::string | m_fsmPropName { "fsm" } |
| The INDI property name for the FSM, normally "fsm". | |
| std::string | m_fsmElName { "state" } |
| The INDI property element name for the FSM, normally "state". | |
| std::string | m_fsmKey |
The unique INDI key, <device>.<fsmPropName>, for the FSM state INDI property. | |
| fsmNodeActionT | m_fsmAction { fsmNodeActionT::passive } |
| std::vector< stateCodeT > | m_targetStates |
| stateCodeT | m_state { -999 } |
| The numerical code of the current state. | |
| std::string | m_stateStr |
| The string name of the current state. | |
| bool | m_stateOnTarget { false } |
| Flag indicating if the current state matches any of the target states. | |
| std::set< std::string > | m_keys |
| The INDI keys (device.property) which this node subscribes to. | |
| ingr::instGraphXML * | m_parentGraph { nullptr } |
| The parent instGraph that this node is a part of. | |
| ingr::instNode * | m_node { nullptr } |
| The underlying instGraph node. | |
| int | m_changes { 0 } |
| Counter that can be incremented when changes are detected. Set to 0 when graph is updated. | |
Private Types | |
| typedef MagAOX::app::stateCodes::stateCodeT | stateCodeT |
Implementation of an instGraph node interface for a MagAO-X Finite State Machine (FSM)
This class is interraces to a standard FSM. It tracks the FSM state INDI property and keeps its internal state updated.
Whether it impacts ioput status depends on the action specified.
Definition at line 68 of file fsmNode.hpp.
|
private |
Definition at line 71 of file fsmNode.hpp.
|
inline |
Constructor.
Default c'tor is deleted in base classs. Must supply both node name and a parentGraph with a node with the same name in it.
| [in] | name | the name of the node |
| [in] | parentGraph | the parent instGraph |
Definition at line 197 of file fsmNode.hpp.
|
inline |
Get the device name.
Definition at line 228 of file fsmNode.hpp.
References m_device.
Referenced by stdMotionNode::device(), and loadConfigDerived().
|
inlinevirtual |
Set the device name.
Derived classes may implement this to add extra logic. The device name defaults to the node name on construction.
| [in] | dev | the new device name |
Reimplemented in stdMotionNode, and stdMotionNode.
Definition at line 201 of file fsmNode.hpp.
References xigNode::key(), m_device, m_fsmKey, m_fsmPropName, and xigNode::name().
Referenced by SCENARIO().
| fsmNodeActionT fsmNode::fsmAction | ( | ) | const |
Get the action.
Definition at line 295 of file fsmNode.hpp.
References m_fsmAction.
Referenced by SCENARIO().
| void fsmNode::fsmAction | ( | fsmNodeActionT | act | ) |
|
inline |
Get the fsm element name.
Definition at line 285 of file fsmNode.hpp.
References m_fsmElName.
Referenced by loadConfigDerived().
|
inlinevirtual |
Set the fsm element name.
Derived classes may implement this to add extra logic. The fsm element name defaults to "state"
This can be called at any time
| [in] | en | the new element name |
Definition at line 271 of file fsmNode.hpp.
References m_fsmElName, and xigNode::name().
| const std::string & fsmNode::fsmKey | ( | ) | const |
Get the FSM unique key.
Definition at line 290 of file fsmNode.hpp.
References m_fsmKey.
Referenced by SCENARIO().
|
inline |
Get the fsm property name.
Definition at line 266 of file fsmNode.hpp.
References m_fsmPropName.
Referenced by loadConfigDerived().
|
inlinevirtual |
Set the fsm property name.
Derived classes may implement this to add extra logic. The fsm property name defaults to "fsm"
This can only be called before device is set
| [in] | pn | the new property name |
Definition at line 233 of file fsmNode.hpp.
References m_device, m_fsmPropName, and xigNode::name().
|
inlinevirtual |
INDI SetProperty callback with indication if action was taken.
The possible actions are determined by m_fsmAction. If the action was taken then the caller should return without further processing.
| ipRecv | < [out] indicates if action taken (true). [in] the received INDI property to handle |
Definition at line 381 of file fsmNode.hpp.
References active, xigNode::m_changes, m_fsmAction, m_fsmElName, m_fsmKey, xigNode::m_node, xigNode::m_parentGraph, m_state, m_stateOnTarget, m_stateStr, m_targetStates, MagAOX::app::stateCodes::str2CodeFast(), threshOff, xigNode::togglePutsOff(), and xigNode::togglePutsOn().
|
inlinevirtual |
INDI SetProperty callback.
| [in] | ipRecv | the received INDI property to handle |
Implements xigNode.
Reimplemented in indiPropNode, and stdMotionNode.
Definition at line 375 of file fsmNode.hpp.
References handleSetProperty().
Referenced by handleSetProperty(), indiPropNode::handleSetProperty(), and stdMotionNode::handleSetProperty().
|
inlineinherited |
Add a key to the set.
Definition at line 116 of file xigNode.hpp.
References xigNode::m_keys.
Referenced by device(), stdMotionNode::device(), stdMotionNode::presetPrefix(), indiPropNode::propKey(), pwrOnOffNode::pwrKey(), SCENARIO(), stdMotionNode::trackerKey(), and stdMotionNode::trackingReqKey().
|
inlineinherited |
Get the set holding the INDI keys for this node.
Definition at line 111 of file xigNode.hpp.
References xigNode::m_keys.
Referenced by SCENARIO().
|
inline |
Load this specific node's settings from an application configuration.
Verifies that the named node is an fsmNode.
| std::runtime_error | if m_parentGraph is nullptr or the config is not for an fsmNode. |
| [in] | config | the application configurator loaded with this node's options |
Definition at line 310 of file fsmNode.hpp.
References loadConfigDerived(), xigNode::m_parentGraph, and xigNode::name().
Referenced by SCENARIO().
|
inlineprotected |
Load this specific node's settings from an application configuration of a derived class.
Does not cerifies that the named node is an fsmNode.
| [in] | config | the application configurator loaded with this node's options |
Definition at line 336 of file fsmNode.hpp.
References device(), fsmElName(), fsmNodeActionT2String(), fsmNodeActionTFromString(), fsmPropName(), m_fsmAction, xigNode::m_node, xigNode::m_parentGraph, m_targetStates, xigNode::name(), MagAOX::app::stateCodes::str2Code(), targetStates(), unknown, and XIGN_EXCEPTION.
Referenced by loadConfig(), and indiPropNode::loadConfig().
|
inlineinherited |
Get the name of this node.
Definition at line 106 of file xigNode.hpp.
References xigNode::m_node.
Referenced by xigNode::xigNode(), device(), fsmElName(), fsmPropName(), loadConfig(), indiPropNode::loadConfig(), pwrOnOffNode::loadConfig(), staticNode::loadConfig(), stdMotionNode::loadConfig(), loadConfigDerived(), SCENARIO(), SCENARIO(), SCENARIO(), SCENARIO(), SCENARIO(), TEST_CASE(), TEST_CASE(), stdMotionNode::togglePutsOff(), and stdMotionNode::togglePutsOn().
|
inlineinherited |
Get the pointer to the underlying node.
Definition at line 121 of file xigNode.hpp.
References xigNode::m_node.
Referenced by SCENARIO(), SCENARIO(), SCENARIO(), SCENARIO(), SCENARIO(), TEST_CASE(), and TEST_CASE().
| const std::vector< fsmNode::stateCodeT > & fsmNode::targetStates | ( | ) | const |
Get the target states.
Definition at line 305 of file fsmNode.hpp.
References m_targetStates.
Referenced by loadConfigDerived(), and SCENARIO().
|
inlinevirtualinherited |
Change the state of all inputs and all outputs to off.
Reimplemented in staticNode, and stdMotionNode.
Definition at line 141 of file xigNode.hpp.
References xigNode::m_node.
Referenced by handleSetProperty(), indiPropNode::toggleOff(), and pwrOnOffNode::toggleOff().
|
inlinevirtualinherited |
Change the state of all inputs and all outputs to on.
Reimplemented in staticNode, and stdMotionNode.
Definition at line 126 of file xigNode.hpp.
References xigNode::m_node.
Referenced by handleSetProperty(), indiPropNode::toggleOn(), pwrOnOffNode::toggleOn(), and stdMotionNode::togglePutsOn().
|
inlinevirtual |
Definition at line 456 of file fsmNode.hpp.
|
protectedinherited |
Counter that can be incremented when changes are detected. Set to 0 when graph is updated.
Definition at line 39 of file xigNode.hpp.
Referenced by handleSetProperty(), indiPropNode::handleSetProperty(), and stdMotionNode::handleSetProperty().
|
protected |
The INDI device name. Defaults to the node name set on construction.
Definition at line 74 of file fsmNode.hpp.
Referenced by device(), device(), stdMotionNode::device(), fsmPropName(), and stdMotionNode::presetPrefix().
|
protected |
Definition at line 80 of file fsmNode.hpp.
Referenced by fsmAction(), fsmAction(), handleSetProperty(), and loadConfigDerived().
|
protected |
The INDI property element name for the FSM, normally "state".
Definition at line 76 of file fsmNode.hpp.
Referenced by fsmElName(), fsmElName(), and handleSetProperty().
|
protected |
The unique INDI key, <device>.<fsmPropName>, for the FSM state INDI property.
Definition at line 78 of file fsmNode.hpp.
Referenced by device(), fsmKey(), and handleSetProperty().
|
protected |
The INDI property name for the FSM, normally "fsm".
Definition at line 75 of file fsmNode.hpp.
Referenced by device(), fsmPropName(), and fsmPropName().
|
protectedinherited |
The INDI keys (device.property) which this node subscribes to.
Definition at line 33 of file xigNode.hpp.
Referenced by xigNode::key(), and xigNode::keys().
|
protectedinherited |
The underlying instGraph node.
Definition at line 37 of file xigNode.hpp.
Referenced by indiPropNode::indiPropNode(), pwrOnOffNode::pwrOnOffNode(), xigNode::xigNode(), handleSetProperty(), indiPropNode::handleSetProperty(), stdMotionNode::handleSetProperty(), loadConfigDerived(), xigNode::name(), xigNode::node(), pwrOnOffNode::toggleOff(), pwrOnOffNode::toggleOn(), staticNode::togglePutsAll(), stdMotionNode::togglePutsOff(), xigNode::togglePutsOff(), stdMotionNode::togglePutsOn(), and xigNode::togglePutsOn().
|
protectedinherited |
The parent instGraph that this node is a part of.
Definition at line 35 of file xigNode.hpp.
Referenced by indiPropNode::indiPropNode(), pwrOnOffNode::pwrOnOffNode(), xigNode::xigNode(), handleSetProperty(), indiPropNode::handleSetProperty(), loadConfig(), indiPropNode::loadConfig(), pwrOnOffNode::loadConfig(), staticNode::loadConfig(), stdMotionNode::loadConfig(), loadConfigDerived(), pwrOnOffNode::toggleOff(), pwrOnOffNode::toggleOn(), stdMotionNode::togglePutsOff(), and stdMotionNode::togglePutsOn().
|
protected |
The numerical code of the current state.
Definition at line 84 of file fsmNode.hpp.
Referenced by handleSetProperty(), stdMotionNode::handleSetProperty(), and stdMotionNode::togglePutsOn().
|
protected |
Flag indicating if the current state matches any of the target states.
Definition at line 87 of file fsmNode.hpp.
Referenced by handleSetProperty().
|
protected |
The string name of the current state.
Definition at line 85 of file fsmNode.hpp.
Referenced by handleSetProperty().
|
protected |
Definition at line 82 of file fsmNode.hpp.
Referenced by handleSetProperty(), loadConfigDerived(), and targetStates().