API
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
int parseIndiKey (std::string &devName, std::string &propName, const std::string &key)
 Parse an INDI key into the device and property names. More...
 

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 
)

◆ 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 
)

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.

Todo:

investigate how this handles floating point values and string conversions.

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 212 of file indiUtils.hpp.

Referenced by MagAOX::app::dev::dmPokeWFS< derivedT >::appLogic(), MagAOX::app::if(), MagAOX::app::INDI_NEWCALLBACK_DEFN(), MagAOX::app::dmSpeckle::modThreadExec(), MagAOX::app::sparkleClock::modThreadExec(), MagAOX::app::MagAOXApp< _useINDI >::newCallBack_clearFSMAlert(), MagAOX::app::dev::stdMotionStage< derivedT >::newCallBack_m_indiP_home(), MagAOX::app::dev::stdMotionStage< derivedT >::newCallBack_m_indiP_stop(), MagAOX::app::dev::stdCamera< derivedT >::newCallBack_reconfigure(), MagAOX::app::dev::stdCamera< derivedT >::newCallBack_roi_check(), MagAOX::app::dev::stdCamera< derivedT >::newCallBack_roi_default(), MagAOX::app::dev::stdCamera< derivedT >::newCallBack_roi_full(), MagAOX::app::dev::stdCamera< derivedT >::newCallBack_roi_fullbin(), MagAOX::app::dev::stdCamera< derivedT >::newCallBack_roi_last(), MagAOX::app::dev::stdCamera< derivedT >::newCallBack_roi_loadlast(), MagAOX::app::dev::stdCamera< derivedT >::newCallBack_roi_set(), MagAOX::app::dev::dm< derivedT, realT >::newCallBack_zeroAll(), MagAOX::app::baslerCtrl::setNextROI(), MagAOX::app::streamWriter::updateINDI(), and MagAOX::app::MagAOXApp< _useINDI >::updateSwitchIfChanged().