13#include "../../libMagAOX/libMagAOX.hpp"  
   14#include "../../magaox_git_version.h" 
  172   config.add(
"device.address", 
"", 
"device.address", argType::Required, 
"device", 
"address", 
true, 
"string", 
"The device I.P. address.");
 
  173   config.add(
"device.port", 
"", 
"device.port", argType::Required, 
"device", 
"port", 
true, 
"int", 
"The device port.  Default is 502.");
 
  175   config.add(
"device.inputOnly", 
"", 
"device.inputOnly", argType::Required, 
"device", 
"inputOnly", 
false, 
"vector<int>", 
"List of channels which are input-only.");
 
 
  186   config(
m_port, 
"device.port");
 
  188   std::vector<int> 
ino;
 
  189   config(
ino, 
"device.inputOnly");
 
  191   for(
size_t i=0; 
i< 
ino.size();++
i)
 
 
  360      if(!
lock.owns_lock()) 
return 0;
 
 
  461   catch(std::exception & 
e)
 
 
  498                                    const pcf::IndiProperty & 
ipRecv 
  503   if(
ipRecv.find(
"current"))
 
  510      target = 
ipRecv[
"target"].get<
unsigned>();
 
  513   if(target == -1) target = 
current;
 
  515   if(target < 0) 
return 0;
 
  538   catch(std::exception & 
e)
 
  546   log<text_log>(
"Set channel " + std::to_string(
chNo) + 
" to " + std::to_string(target));
 
 
The base-class for XWCTk applications.
 
void updateIfChanged(pcf::IndiProperty &p, const std::string &el, const T &newVal, pcf::IndiProperty::PropertyStateType ipState=pcf::IndiProperty::Ok)
Update an INDI property element value if it has changed.
 
stateCodes::stateCodeT state()
Get the current state code.
 
int m_powerState
Current power state, 1=On, 0=Off, -1=Unk.
 
int stateLogged()
Updates and returns the value of m_stateLogged. Will be 0 on first call after a state change,...
 
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
 
bool powerOnWaitElapsed()
This method tests whether the power on wait time has elapsed.
 
unsigned long m_powerOnWait
Time in sec to wait for device to boot after power on.
 
std::mutex m_indiMutex
Mutex for locking INDI communications.
 
virtual void setupConfig()
Setup the configuration system (called by MagAOXApp::setup())
 
pcf::IndiProperty m_indiP_ch11
 
virtual void loadConfig()
load the configuration system results (called by MagAOXApp::setup())
 
virtual int appLogic()
Implementation of the FSM for the Siglent SDG.
 
pcf::IndiProperty m_indiP_ch02
 
pcf::IndiProperty m_indiP_ch14
 
virtual int appStartup()
Startup functions.
 
~xt1121Ctrl() noexcept
Destructor.
 
virtual int appShutdown()
Do any needed shutdown tasks. Currently nothing in this app.
 
pcf::IndiProperty m_indiP_ch07
 
std::string m_address
The I.P. address of the device.
 
uint16_t m_port
The port to use. Default is 502 for modbus.
 
pcf::IndiProperty m_indiP_ch10
 
int getState()
Get the current state of the outlets.
 
pcf::IndiProperty m_indiP_ch00
 
pcf::IndiProperty m_indiP_ch08
 
pcf::IndiProperty m_indiP_ch06
 
pcf::IndiProperty m_indiP_ch15
 
pcf::IndiProperty m_indiP_ch01
 
pcf::IndiProperty m_indiP_ch05
 
xt1121Ctrl()
Default c'tor.
 
pcf::IndiProperty m_indiP_ch09
 
virtual int whilePowerOff()
Implementation of the while-powered-off FSM.
 
modbus * m_mb
The modbus protocol communication object.
 
virtual int onPowerOff()
Implementation of the on-power-off FSM logic.
 
pcf::IndiProperty m_indiP_ch12
 
pcf::IndiProperty m_indiP_ch03
 
pcf::IndiProperty m_indiP_ch13
 
pcf::IndiProperty m_indiP_ch04
 
int channelSetCallback(size_t chNo, pcf::IndiProperty &ipToSet, const pcf::IndiProperty &ipRecv)
Callback worker to actually set or clear a channel and send it to the device.
 
void modbus_read_input_registers(int address, int amount, uint16_t *buffer)
 
void modbus_set_slave_id(int id)
 
void modbus_write_registers(int address, int amount, uint16_t *value)
 
#define INDI_NEWCALLBACK_DEFN(class, prop)
Define the callback for a new property request.
 
#define REG_INDI_NEWPROP(prop, propName, type)
Register a NEW INDI property with the class, using the standard callback name.
 
#define INDI_NEWCALLBACK_DECL(class, prop)
Declare the callback for a new property request, and declare and define the static wrapper.
 
@ OPERATING
The device is operating, other than homing.
 
@ ERROR
The application has encountered an error, from which it is recovering (with or without intervention)
 
@ READY
The device is ready for operation, but is not operating.
 
@ CONNECTED
The application has connected to the device or service.
 
@ NOTCONNECTED
The application is not connected to the device or service.
 
@ POWERON
The device power is on.
 
#define INDI_VALIDATE_CALLBACK_PROPS(prop1, prop2)
Standard check for matching INDI properties in a callback.
 
const pcf::IndiProperty & ipRecv
 
std::unique_lock< std::mutex > lock(m_indiMutex)
 
static constexpr logPrioT LOG_ERROR
An error has occured which the software will attempt to correct.
 
Software CRITICAL log entry.
 
Utility class for managing Acromag xt12XX digital I/O channels.
 
int setRegisters(uint16_t registers[numRegisters])
Set registers based on current channel states.
 
int setChannel(size_t chNo)
Set a channel to true.
 
static constexpr int numRegisters
The number of registers needed for the number of channels.
 
int channel(size_t chNo)
Gets the current state of a channel.
 
int setInputOnly(size_t chNo)
Set a channel to be input only.
 
int clearChannel(size_t chNo)
Set a channel to false.
 
int readRegisters(uint16_t registers[numRegisters])
Read channel states from the registers.
 
Utility class for managing Acromag xt12XX digital I/O channels.