An instGraph node which tracks a specific INDI property and element of that property. More...
#include <indiPropNode.hpp>


Public Member Functions | |
| indiPropNode (const std::string &name, ingr::instGraphXML *parentGraph) | |
| Only c'tor. Must be constructed with node name and a parent graph. | |
| void | propKey (const std::string &pk) |
| Set the unique key of the INDI property to track. | |
| const std::string & | propKey () const |
| Get the unique key of the INDI property to track. | |
| void | propEl (const std::string &pe) |
| Set the element of the INDI property to track. | |
| const std::string & | propEl () const |
| Get the element of the INDI property to track. | |
| void | propValStr (const std::string &pv) |
| Set the target value of the INDI element. | |
| const std::string & | propValStr () const |
| Get the target value of the INDI element. | |
| const double & | propValNum () const |
| Get the target value of the INDI element if it's a number. | |
| const pcf::IndiElement::SwitchStateType & | propValSw () |
| Get the target value of the INDI element if it's a switch. | |
| const pcf::IndiProperty::Type & | type () const |
| Get the type of the INDI property being tracked. | |
| const double & | tol () const |
| Get the tolerance used for numeric comparison. | |
| const bool & | state () const |
| Get the current value of the comparison. | |
| virtual int | handleSetProperty (const pcf::IndiProperty &ipRecv) |
| INDI SetProperty callback. | |
| virtual void | toggleOn () |
| Toggle all puts on. | |
| virtual void | toggleOff () |
| Toggle all puts off. | |
| void | loadConfig (mx::app::appConfigurator &config) |
| Configure this node form an appConfigurator. | |
| 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. | |
| 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 | |
| virtual int | firstSetProperty (const pcf::IndiProperty &ipRecv) |
| On first call to handleSetProperty we find the property type and convert the target value. | |
| 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_propKey |
| unique key, device.name, of the property tp track | |
| std::string | m_propEl |
| the element of the property to track | |
| std::string | m_propValStr |
| the target value of the element. This is always set. | |
| double | m_propValNum { std::numeric_limits<double>::lowest() } |
| pcf::IndiElement::SwitchStateType | m_propValSw { pcf::IndiElement::SwitchStateType::UnknownSwitchState } |
| pcf::IndiProperty::Type | m_type { pcf::IndiProperty::Unknown } |
| The property type. Discovered introspectively on first call to handleSetProperty. | |
| double | m_tol { 1e-7 } |
| The tolerance for floating point comparison. Default is 1e-7. | |
| bool | m_state { false } |
| The current state of the comparison. | |
| bool | m_first { true } |
| Flag indicating if it's the first call to handleSetProperty. | |
| std::string | m_onStr {"ON"} |
| std::string | m_offStr {"OFF"} |
| 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 |
| 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 |
An instGraph node which tracks a specific INDI property and element of that property.
When the element matches the target value all puts are turned on. All puts are off otherwise.
Definition at line 16 of file indiPropNode.hpp.
|
privateinherited |
Definition at line 71 of file fsmNode.hpp.
| indiPropNode::indiPropNode | ( | const std::string & | name, |
| ingr::instGraphXML * | parentGraph | ||
| ) |
Only c'tor. Must be constructed with node name and a parent graph.
| [in] | parentGraph | the name of this node [in] the graph which this node belongs to |
Definition at line 129 of file indiPropNode.hpp.
References xigNode::m_node, and xigNode::m_parentGraph.
|
inlineinherited |
Get the device name.
Definition at line 228 of file fsmNode.hpp.
References fsmNode::m_device.
Referenced by stdMotionNode::device(), and fsmNode::loadConfigDerived().
|
inlinevirtualinherited |
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(), fsmNode::m_device, fsmNode::m_fsmKey, fsmNode::m_fsmPropName, and xigNode::name().
Referenced by SCENARIO().
|
inlineprotectedvirtual |
On first call to handleSetProperty we find the property type and convert the target value.
| [in] | ipRecv | the received INDI property |
Definition at line 194 of file indiPropNode.hpp.
References m_propValNum, m_propValStr, m_propValSw, m_type, and XIGN_EXCEPTION.
Referenced by handleSetProperty().
|
inherited |
Get the action.
Definition at line 295 of file fsmNode.hpp.
References fsmNode::m_fsmAction.
Referenced by SCENARIO().
|
inherited |
|
inlineinherited |
Get the fsm element name.
Definition at line 285 of file fsmNode.hpp.
References fsmNode::m_fsmElName.
Referenced by fsmNode::loadConfigDerived().
|
inlinevirtualinherited |
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 fsmNode::m_fsmElName, and xigNode::name().
|
inherited |
Get the FSM unique key.
Definition at line 290 of file fsmNode.hpp.
References fsmNode::m_fsmKey.
Referenced by SCENARIO().
|
inlineinherited |
Get the fsm property name.
Definition at line 266 of file fsmNode.hpp.
References fsmNode::m_fsmPropName.
Referenced by fsmNode::loadConfigDerived().
|
inlinevirtualinherited |
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 fsmNode::m_device, fsmNode::m_fsmPropName, and xigNode::name().
|
inlinevirtualinherited |
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, fsmNode::m_fsmAction, fsmNode::m_fsmElName, fsmNode::m_fsmKey, xigNode::m_node, xigNode::m_parentGraph, fsmNode::m_state, fsmNode::m_stateOnTarget, fsmNode::m_stateStr, fsmNode::m_targetStates, MagAOX::app::stateCodes::str2CodeFast(), threshOff, xigNode::togglePutsOff(), and xigNode::togglePutsOn().
|
inlinevirtual |
INDI SetProperty callback.
| [in] | ipRecv | the received INDI property to handle |
Reimplemented from fsmNode.
Definition at line 258 of file indiPropNode.hpp.
References firstSetProperty(), fsmNode::handleSetProperty(), xigNode::m_changes, m_first, xigNode::m_node, m_offStr, m_onStr, xigNode::m_parentGraph, m_propEl, m_propKey, m_propValNum, m_propValStr, m_propValSw, m_state, m_tol, m_type, toggleOff(), toggleOn(), and XIGN_EXCEPTION.
Referenced by SCENARIO().
|
inlineinherited |
Add a key to the set.
Definition at line 116 of file xigNode.hpp.
References xigNode::m_keys.
Referenced by fsmNode::device(), stdMotionNode::device(), stdMotionNode::presetPrefix(), 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 |
Configure this node form an appConfigurator.
| [in] | config | the loaded configuration |
Definition at line 382 of file indiPropNode.hpp.
References fsmNode::loadConfigDerived(), m_offStr, m_onStr, xigNode::m_parentGraph, m_propEl, m_propValStr, m_tol, xigNode::name(), propKey(), type(), and XIGN_EXCEPTION.
Referenced by SCENARIO().
|
inlineprotectedinherited |
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 fsmNode::device(), fsmNode::fsmElName(), fsmNodeActionT2String(), fsmNodeActionTFromString(), fsmNode::fsmPropName(), fsmNode::m_fsmAction, xigNode::m_node, xigNode::m_parentGraph, fsmNode::m_targetStates, xigNode::name(), MagAOX::app::stateCodes::str2Code(), fsmNode::targetStates(), unknown, and XIGN_EXCEPTION.
Referenced by fsmNode::loadConfig(), and loadConfig().
|
inlineinherited |
Get the name of this node.
Definition at line 106 of file xigNode.hpp.
References xigNode::m_node.
Referenced by xigNode::xigNode(), fsmNode::device(), fsmNode::fsmElName(), fsmNode::fsmPropName(), fsmNode::loadConfig(), loadConfig(), pwrOnOffNode::loadConfig(), staticNode::loadConfig(), stdMotionNode::loadConfig(), fsmNode::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::string & indiPropNode::propEl | ( | ) | const |
Get the element of the INDI property to track.
Definition at line 154 of file indiPropNode.hpp.
References m_propEl.
|
inline |
Set the element of the INDI property to track.
| [in] | pe |
Definition at line 149 of file indiPropNode.hpp.
References m_propEl.
Referenced by SCENARIO().
| const std::string & indiPropNode::propKey | ( | ) | const |
Get the unique key of the INDI property to track.
Definition at line 144 of file indiPropNode.hpp.
References m_propKey.
Referenced by loadConfig().
|
inline |
Set the unique key of the INDI property to track.
| [in] | pk |
Definition at line 137 of file indiPropNode.hpp.
References xigNode::key(), and m_propKey.
Referenced by SCENARIO().
| const double & indiPropNode::propValNum | ( | ) | const |
Get the target value of the INDI element if it's a number.
Definition at line 169 of file indiPropNode.hpp.
References m_propValNum.
Referenced by SCENARIO().
| const std::string & indiPropNode::propValStr | ( | ) | const |
Get the target value of the INDI element.
Definition at line 164 of file indiPropNode.hpp.
References m_propValStr.
|
inline |
Set the target value of the INDI element.
Always set in its string form and converted as needed
| [in] | pv |
Definition at line 159 of file indiPropNode.hpp.
References m_propValStr.
Referenced by SCENARIO().
| const pcf::IndiElement::SwitchStateType & indiPropNode::propValSw | ( | ) |
Get the target value of the INDI element if it's a switch.
Definition at line 174 of file indiPropNode.hpp.
References m_propValSw.
Referenced by SCENARIO().
| const bool & indiPropNode::state | ( | ) | const |
Get the current value of the comparison.
Definition at line 189 of file indiPropNode.hpp.
References m_state.
Referenced by SCENARIO().
|
inherited |
Get the target states.
Definition at line 305 of file fsmNode.hpp.
References fsmNode::m_targetStates.
Referenced by fsmNode::loadConfigDerived(), and SCENARIO().
|
inlinevirtual |
Toggle all puts off.
Definition at line 377 of file indiPropNode.hpp.
References xigNode::togglePutsOff().
Referenced by handleSetProperty().
|
inlinevirtual |
Toggle all puts on.
Definition at line 372 of file indiPropNode.hpp.
References xigNode::togglePutsOn().
Referenced by handleSetProperty().
|
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 fsmNode::handleSetProperty(), 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 fsmNode::handleSetProperty(), toggleOn(), pwrOnOffNode::toggleOn(), and stdMotionNode::togglePutsOn().
| const double & indiPropNode::tol | ( | ) | const |
Get the tolerance used for numeric comparison.
Definition at line 184 of file indiPropNode.hpp.
References m_tol.
Referenced by SCENARIO().
| const pcf::IndiProperty::Type & indiPropNode::type | ( | ) | const |
Get the type of the INDI property being tracked.
Definition at line 179 of file indiPropNode.hpp.
References m_type.
Referenced by loadConfig(), and SCENARIO().
|
inlinevirtualinherited |
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 fsmNode::handleSetProperty(), handleSetProperty(), and stdMotionNode::handleSetProperty().
|
protectedinherited |
The INDI device name. Defaults to the node name set on construction.
Definition at line 74 of file fsmNode.hpp.
Referenced by fsmNode::device(), fsmNode::device(), stdMotionNode::device(), fsmNode::fsmPropName(), and stdMotionNode::presetPrefix().
|
protected |
Flag indicating if it's the first call to handleSetProperty.
Definition at line 41 of file indiPropNode.hpp.
Referenced by handleSetProperty().
|
protectedinherited |
Definition at line 80 of file fsmNode.hpp.
Referenced by fsmNode::fsmAction(), fsmNode::fsmAction(), fsmNode::handleSetProperty(), and fsmNode::loadConfigDerived().
|
protectedinherited |
The INDI property element name for the FSM, normally "state".
Definition at line 76 of file fsmNode.hpp.
Referenced by fsmNode::fsmElName(), fsmNode::fsmElName(), and fsmNode::handleSetProperty().
|
protectedinherited |
The unique INDI key, <device>.<fsmPropName>, for the FSM state INDI property.
Definition at line 78 of file fsmNode.hpp.
Referenced by fsmNode::device(), fsmNode::fsmKey(), and fsmNode::handleSetProperty().
|
protectedinherited |
The INDI property name for the FSM, normally "fsm".
Definition at line 75 of file fsmNode.hpp.
Referenced by fsmNode::device(), fsmNode::fsmPropName(), and fsmNode::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(), pwrOnOffNode::pwrOnOffNode(), xigNode::xigNode(), fsmNode::handleSetProperty(), handleSetProperty(), stdMotionNode::handleSetProperty(), fsmNode::loadConfigDerived(), xigNode::name(), xigNode::node(), pwrOnOffNode::toggleOff(), pwrOnOffNode::toggleOn(), staticNode::togglePutsAll(), stdMotionNode::togglePutsOff(), xigNode::togglePutsOff(), stdMotionNode::togglePutsOn(), and xigNode::togglePutsOn().
|
protected |
Definition at line 44 of file indiPropNode.hpp.
Referenced by handleSetProperty(), and loadConfig().
|
protected |
Definition at line 43 of file indiPropNode.hpp.
Referenced by handleSetProperty(), and loadConfig().
|
protectedinherited |
The parent instGraph that this node is a part of.
Definition at line 35 of file xigNode.hpp.
Referenced by indiPropNode(), pwrOnOffNode::pwrOnOffNode(), xigNode::xigNode(), fsmNode::handleSetProperty(), handleSetProperty(), fsmNode::loadConfig(), loadConfig(), pwrOnOffNode::loadConfig(), staticNode::loadConfig(), stdMotionNode::loadConfig(), fsmNode::loadConfigDerived(), pwrOnOffNode::toggleOff(), pwrOnOffNode::toggleOn(), stdMotionNode::togglePutsOff(), and stdMotionNode::togglePutsOn().
|
protected |
the element of the property to track
Definition at line 21 of file indiPropNode.hpp.
Referenced by handleSetProperty(), loadConfig(), propEl(), and propEl().
|
protected |
unique key, device.name, of the property tp track
Definition at line 20 of file indiPropNode.hpp.
Referenced by handleSetProperty(), propKey(), and propKey().
|
protected |
the numeric target value, set from m_propValStr if the property is a number.
Definition at line 25 of file indiPropNode.hpp.
Referenced by firstSetProperty(), handleSetProperty(), and propValNum().
|
protected |
the target value of the element. This is always set.
Definition at line 23 of file indiPropNode.hpp.
Referenced by firstSetProperty(), handleSetProperty(), loadConfig(), propValStr(), and propValStr().
|
protected |
The switch target value, set from m_propValStr if the property is a switch. In this case m_propValStr can have values On or Off. The comparison is made insensitive to case (ON and off are valid).
Definition at line 32 of file indiPropNode.hpp.
Referenced by firstSetProperty(), handleSetProperty(), and propValSw().
|
protected |
The current state of the comparison.
Definition at line 39 of file indiPropNode.hpp.
Referenced by handleSetProperty(), and state().
|
protectedinherited |
Flag indicating if the current state matches any of the target states.
Definition at line 87 of file fsmNode.hpp.
Referenced by fsmNode::handleSetProperty().
|
protectedinherited |
The string name of the current state.
Definition at line 85 of file fsmNode.hpp.
Referenced by fsmNode::handleSetProperty().
|
protectedinherited |
Definition at line 82 of file fsmNode.hpp.
Referenced by fsmNode::handleSetProperty(), fsmNode::loadConfigDerived(), and fsmNode::targetStates().
|
protected |
The tolerance for floating point comparison. Default is 1e-7.
Definition at line 37 of file indiPropNode.hpp.
Referenced by handleSetProperty(), loadConfig(), and tol().
|
protected |
The property type. Discovered introspectively on first call to handleSetProperty.
Definition at line 35 of file indiPropNode.hpp.
Referenced by firstSetProperty(), handleSetProperty(), and type().