API
 
Loading...
Searching...
No Matches
MagAOX::app::indi Namespace Reference

Functions

int addTextElement (pcf::IndiProperty &prop, const std::string &name, const std::string &label="")
 Add a standard INDI Text element.
 
template<typename T >
int addNumberElement (pcf::IndiProperty &prop, const std::string &name, const T &min, const T &max, const T &step, const std::string &format, const std::string &label="")
 Add a standard INDI Number element.
 
template<typename T , class indiDriverT >
void updateIfChanged (pcf::IndiProperty &p, const std::string &el, const T &newVal, indiDriverT *indiDriver, pcf::IndiProperty::PropertyStateType newState=pcf::IndiProperty::Ok)
 Update the value of the INDI element, but only if it has changed.
 
template<typename T , class indiDriverT >
void updateIfChanged (pcf::IndiProperty &p, const std::vector< std::string > &els, const std::vector< T > &newVals, indiDriverT *indiDriver, pcf::IndiProperty::PropertyStateType newState=pcf::IndiProperty::Ok)
 Update the elements of an INDI propery, but only if there has been a change in at least one.
 
template<class indiDriverT >
void updateSwitchIfChanged (pcf::IndiProperty &p, const std::string &el, const pcf::IndiElement::SwitchStateType &newVal, indiDriverT *indiDriver, pcf::IndiProperty::PropertyStateType newState=pcf::IndiProperty::Ok)
 Update the value of the INDI element, but only if it has changed.
 
template<class indiDriverT >
void updateSelectionSwitchIfChanged (pcf::IndiProperty &p, const std::string &el, indiDriverT *indiDriver, pcf::IndiProperty::PropertyStateType newState=pcf::IndiProperty::Ok)
 Update the values of a one-of-many INDI switch vector, but only if it has changed.
 
int parseIndiKey (std::string &devName, std::string &propName, const std::string &key)
 Parse an INDI key into the device and property names.
 

Function Documentation

◆ addNumberElement()

template<typename T >
int MagAOX::app::indi::addNumberElement ( pcf::IndiProperty &  prop,
const std::string &  name,
const T &  min,
const T &  max,
const T &  step,
const std::string &  format,
const std::string &  label = "" 
)

Add a standard INDI Number element.

Returns
0 on success
-1 on error
Parameters
[out]propthe property to which to add the elemtn
[in]namethe name of the element
[in]minthe minimum value for the element
[in]maxthe minimum value for the element
[in]stepthe step size of the lement
[in]formatthe _ value for the elements, applied to both target and current. Set to "" to use the MagAO-X standard for type.
[in]label[optional] the GUI label suggestion for this property

Definition at line 63 of file indiUtils.hpp.

Referenced by MagAOX::app::refRMS::appStartup(), MagAOX::app::userGainCtrl::appStartup(), MagAOX::app::zaberCtrl::appStartup(), and MagAOX::app::userGainCtrl::getModeBlocks().

◆ addTextElement()

int MagAOX::app::indi::addTextElement ( pcf::IndiProperty &  prop,
const std::string &  name,
const std::string &  label = "" 
)
inline

Add a standard INDI Text element.

Returns
0 on success
-1 on error
Parameters
[out]propthe property to which to add the elemtn
[in]namethe name of the element
[in]label[optional] the GUI label suggestion for this property

Definition at line 40 of file indiUtils.hpp.

Referenced by MagAOX::app::cacaoInterface::appStartup().

◆ parseIndiKey()

int MagAOX::app::indi::parseIndiKey ( std::string &  devName,
std::string &  propName,
const std::string &  key 
)
inline

Parse an INDI key into the device and property names.

We often represent an INDI property as a unique key in the form deviceName.propName. This function parses such a key into its parts.

Returns
0 on success
-1 if the provided key is not at least 3 characters long
-2 if no '.' is found
-3 if '.' is the first character
-4 if '.' is the last character
Parameters
[out]devNamethe device name
[out]propNamethe property name
[in]keythe key to parse

Definition at line 317 of file indiUtils.hpp.

Referenced by MagAOX::app::stateRuleEngine::appStartup(), and SCENARIO().

◆ updateIfChanged() [1/2]

template<typename T , class indiDriverT >
void MagAOX::app::indi::updateIfChanged ( pcf::IndiProperty &  p,
const std::string &  el,
const T &  newVal,
indiDriverT *  indiDriver,
pcf::IndiProperty::PropertyStateType  newState = pcf::IndiProperty::Ok 
)

Update the value of the INDI element, but only if it has changed.

Only sends the set property message if the new value is different. For properties with more than one element that may have changed, you should use the vector version below.

Todo:
this needs a const char specialization to std::string
Parameters
p[in/out] The property containing the element to possibly update
[in]elThe element name
[in]newValthe new value
[in]indiDriverthe MagAOX INDI driver to use

Definition at line 95 of file indiUtils.hpp.

Referenced by MagAOX::app::dev::stdCamera< derivedT >::onPowerOff(), MagAOX::app::dev::outletController< derivedT >::turnChannelOff(), MagAOX::app::dev::outletController< derivedT >::turnChannelOn(), MagAOX::app::MagAOXApp< _useINDI >::updateIfChanged(), MagAOX::app::MagAOXApp< _useINDI >::updateIfChanged(), MagAOX::app::MagAOXApp< _useINDI >::updateIfChanged(), MagAOX::app::streamWriter::updateINDI(), MagAOX::app::tcsInterface::updateINDI(), MagAOX::app::dev::frameGrabber< derivedT >::updateINDI(), MagAOX::app::dev::outletController< derivedT >::updateINDI(), MagAOX::app::dev::shmimMonitor< derivedT, specificT >::updateINDI(), and MagAOX::app::dev::stdMotionStage< derivedT >::updateINDI().

◆ updateIfChanged() [2/2]

template<typename T , class indiDriverT >
void MagAOX::app::indi::updateIfChanged ( pcf::IndiProperty &  p,
const std::vector< std::string > &  els,
const std::vector< T > &  newVals,
indiDriverT *  indiDriver,
pcf::IndiProperty::PropertyStateType  newState = pcf::IndiProperty::Ok 
)

Update the elements of an INDI propery, but only if there has been a change in at least one.

Only sends the set property message if at least one of the new values is different, or if the state has changed.

Todo:
this needs a const char specialization to std::string
Parameters
p[in/out] The property containing the element to possibly update
[in]elsThe element names
[in]newValsthe new values
[in]indiDriverthe MagAOX INDI driver to use

Definition at line 143 of file indiUtils.hpp.

◆ updateSelectionSwitchIfChanged()

template<class indiDriverT >
void MagAOX::app::indi::updateSelectionSwitchIfChanged ( pcf::IndiProperty &  p,
const std::string &  el,
indiDriverT *  indiDriver,
pcf::IndiProperty::PropertyStateType  newState = pcf::IndiProperty::Ok 
)

Update the values of a one-of-many INDI switch vector, but only if it has changed.

Only sends the set property message if the new settings are different.

Parameters
p[in/out] The property containing the element to possibly update
[in]elThe element name which is now on
[in]indiDriverthe MagAOX INDI driver to use

Definition at line 249 of file indiUtils.hpp.

Referenced by MagAOX::app::dev::stdCamera< derivedT >::updateINDI().

◆ updateSwitchIfChanged()

template<class indiDriverT >
void MagAOX::app::indi::updateSwitchIfChanged ( pcf::IndiProperty &  p,
const std::string &  el,
const pcf::IndiElement::SwitchStateType &  newVal,
indiDriverT *  indiDriver,
pcf::IndiProperty::PropertyStateType  newState = pcf::IndiProperty::Ok 
)