10 #define xt1121DCDU_hpp
13 #include "../../libMagAOX/libMagAOX.hpp"
14 #include "../../magaox_git_version.h"
150 config.add(
"device.name",
"",
"device.name", argType::Required,
"device",
"name",
false,
"string",
"The device INDI name.");
152 config.add(
"device.channelNumbers",
"",
"device.channelNumbers", argType::Required,
"device",
"channelNumbers",
false,
"vector<int>",
"The channel numbers to use for the outlets, in order.");
242 if(ip->find(
"current"))
355 return updateOutletState(0);
362 return updateOutletState(1);
369 return updateOutletState(2);
376 return updateOutletState(3);
383 return updateOutletState(4);
390 return updateOutletState(5);
397 return updateOutletState(6);
404 return updateOutletState(7);
The base-class for MagAO-X applications.
stateCodes::stateCodeT state()
Get the current state code.
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
std::mutex m_indiMutex
Mutex for locking INDI communications.
int sendNewProperty(const pcf::IndiProperty &ipSend, const std::string &el, const T &newVal)
Send a newProperty command to another device (using the INDI Client interface)
MagAO-X application to control D.C. distribution via an xt1121 DIO unit.
virtual int turnOutletOff(int outletNum)
Turn off an outlet.
virtual int updateOutletState(int outletNum)
Update a single outlet state.
pcf::IndiProperty * xtChannelProperty(int outletNum)
Helper function to get a pointer to the right INDI property for an outlet number.
virtual int appStartup()
Startup functions.
INDI_SETCALLBACK_DECL(xt1121DCDU, ip_ch5)
INDI_SETCALLBACK_DECL(xt1121DCDU, ip_ch1)
virtual void loadConfig()
load the configuration system results (called by MagAOXApp::setup())
virtual void setupConfig()
Setup the configuration system (called by MagAOXApp::setup())
INDI_SETCALLBACK_DECL(xt1121DCDU, ip_ch3)
virtual int appShutdown()
Do any needed shutdown tasks. Currently nothing in this app.
virtual int appLogic()
Implementation of the FSM for the xt1121 DCDU.
std::string xtChannelName(int chno)
Helper function to get the xt1121Ctrl channel name for the given channel number.
std::vector< int > m_channelNumbers
Vector of outlet numbers, used to construct the channel names to monitor as outlets 0-7.
int m_outletStateDelay
The maximum time to wait for an outlet to change state [msec].
INDI_SETCALLBACK_DECL(xt1121DCDU, ip_ch2)
~xt1121DCDU() noexcept
D'tor, declared and defined for noexcept.
INDI_SETCALLBACK_DECL(xt1121DCDU, ip_ch0)
INDI_SETCALLBACK_DECL(xt1121DCDU, ip_ch6)
std::string m_deviceName
The device address.
xt1121DCDU()
Default c'tor.
virtual int turnOutletOn(int outletNum)
Turn on an outlet.
INDI_SETCALLBACK_DECL(xt1121DCDU, ip_ch7)
INDI_SETCALLBACK_DECL(xt1121DCDU, ip_ch4)
#define REG_INDI_SETPROP(prop, devName, propName)
Register a SET INDI property with the class, using the standard callback name.
@ FAILURE
The application has failed, should be used when m_shutdown is set for an error.
@ READY
The device is ready for operation, but is not operating.
@ NOTCONNECTED
The application is not connected to the device or service.
@ POWERON
The device power is on.
const pcf::IndiProperty & ipRecv
INDI_SETCALLBACK_DEFN(adcTracker, m_indiP_teldata)(const pcf
std::unique_lock< std::mutex > lock(m_indiMutex)
constexpr static logPrioT LOG_CRITICAL
The process can not continue and will shut down (fatal)
#define OUTLET_STATE_UNKNOWN
A generic outlet controller.
int updateINDI()
Update the INDI properties for this device controller.
bool m_firstOne
Flag is true if the first outlet is numbered 1, otherwise assumes starting at 0.
int loadConfig(mx::app::appConfigurator &config)
Load the [channel] sections from an application configurator.
int setupConfig(mx::app::appConfigurator &config)
Setup an application configurator for an outletController.
virtual int updateOutletStates()
Get the states of all outlets from the device.
int setNumberOfOutlets(int numOuts)
Sets the number of outlets. This should be called by the derived class constructor.
std::vector< int > m_outletStates
The current states of each outlet. These MUST be updated by derived classes in the overridden updated...
A simple text log, a string-type log.