API
 
Loading...
Searching...
No Matches
MagAOX::app::zaberLowLevelBinary Class Reference

The low-level binary-protocol Zaber controller. More...

#include <zaberLowLevelBinary.hpp>

Inheritance diagram for MagAOX::app::zaberLowLevelBinary:
Inheritance graph
Collaboration diagram for MagAOX::app::zaberLowLevelBinary:
Collaboration graph

Public Types

typedef XWC_DEFAULT_VERBOSITY verboseT
 
typedef logger::logManager< MagAOXApp< _useINDI >, logFileRaw< verboseT > > logManagerT
 The log manager type.
 

Public Member Functions

 zaberLowLevelBinary ()
 Default constructor.
 
 ~zaberLowLevelBinary () noexcept
 Destructor.
 
virtual void setupConfig ()
 Set up application configuration.
 
virtual void loadConfig ()
 Load application configuration.
 
int connect ()
 Connect to the binary-protocol stage chain and discover configured devices.
 
int loadStages ()
 Discover configured stages on the binary bus.
 
int loadStages (const std::vector< int > &addresses, const std::vector< std::string > &serials)
 Apply a discovered address-to-serial snapshot to the configured stages.
 
int refreshStageDiscovery ()
 Refresh discovery on an already-connected binary bus.
 
int queryDevice (int32_t &response, uint8_t deviceAddress, uint8_t commandNumber, int32_t data, uint8_t expectedReply)
 Query a device directly for discovery-time replies.
 
int sendCommandNoReply (uint8_t deviceAddress, uint8_t commandNumber, int32_t data)
 Send a broadcast or address-specific command with no awaited reply.
 
int resetConnection ()
 Reset the active binary connection bookkeeping.
 
int recoverFromError (bool devicePresent)
 Recover from a binary-transport error without terminating the app.
 
virtual int appStartup ()
 Set up the INDI properties and restore retained stage state.
 
virtual int appLogic ()
 Execute the main FSM for zaberLowLevelBinary.
 
virtual int onPowerOff ()
 Handle the transition into the powered-off state.
 
virtual int whilePowerOff ()
 Execute the powered-off loop.
 
virtual int appShutdown ()
 Perform any shutdown tasks before exit.
 
virtual void setDefaults (int argc, char **argv)
 Set the paths for config files.
 
virtual void setupBasicConfig ()
 The basic MagAO-X configuration setup method. Should not normally be overridden.
 
virtual void loadBasicConfig ()
 The basic MagAO-X configuration processing method. Should not normally be overridden.
 
virtual void checkConfig ()
 Check for unused and unrecognized config options and settings.
 
virtual int execute ()
 The execute method implementing the standard main loop. Should not normally be overridden.
 
int setupConfig (mx::app::appConfigurator &config)
 Setup an application configurator for the USB section.
 
int loadConfig (mx::app::appConfigurator &config)
 Load the USB section from an application configurator.
 
int getDeviceName ()
 Get the device name from udev using the vendor, product, and serial number.
 
INDI Stage State
 INDI_NEWCALLBACK_DECL (zaberLowLevelBinary, m_indiP_tgt_pos)
 
 INDI_NEWCALLBACK_DECL (zaberLowLevelBinary, m_indiP_req_home)
 
 INDI_NEWCALLBACK_DECL (zaberLowLevelBinary, m_indiP_req_home_all)
 
 INDI_NEWCALLBACK_DECL (zaberLowLevelBinary, m_indiP_req_halt)
 
 INDI_NEWCALLBACK_DECL (zaberLowLevelBinary, m_indiP_req_ehalt)
 
 INDI_NEWCALLBACK_DECL (zaberLowLevelBinary, m_indiP_knob_enable)
 
Threads
int threadStart (std::thread &thrd, bool &thrdInit, pid_t &tpid, pcf::IndiProperty &thProp, int thrdPrio, const std::string &cpuset, const std::string &thrdName, thisPtr *thrdThis, Function &&thrdStart)
 Start a thread, using this class's privileges to set priority, etc.
 
Member Accessors
std::string basePath ()
 Get the.
 
std::string configName ()
 Get the config name.
 
std::string configDir ()
 Get the config directory.
 
std::string configBase ()
 Get the config base file.
 
std::string calibDir ()
 Get the calibration directory.
 
std::string sysPath ()
 Get the system path.
 
std::string secretsPath ()
 Get the secrets path.
 
std::string cpusetPath ()
 Get the cpuset path.
 
unsigned long loopPause ()
 Get the loop pause time.
 
int shutdown ()
 Get the value of the shutdown flag.
 
std::string driverInName ()
 Get the INDI input FIFO file name.
 
std::string driverOutName ()
 Get the INDI output FIFO file name.
 
std::string driverCtrlName ()
 Get the INDI control FIFO file name.
 

Public Attributes

std::string m_idVendor
 The vendor id 4-digit code.
 
std::string m_idProduct
 The product id 4-digit code.
 
std::string m_serial
 The serial number.
 
speed_t m_baudRate {0}
 The baud rate specification.
 
std::string m_deviceName
 The device path name, e.g. /dev/ttyUSB0.
 
int m_fileDescrip {0}
 The file descriptor.
 

Protected Attributes

int m_numStages { 0 }
 Number of configured stages.
 
z_port m_port { 0 }
 Connected binary protocol port.
 
std::string m_basePath
 The base path of the MagAO-X system.
 
std::string m_configName
 The name of the configuration file (minus .conf).
 
std::string m_configDir
 The path to configuration files for MagAOX.
 
std::string m_configBase
 The name of a base config class for this app (minus .conf).
 
std::string m_calibDir
 The path to calibration files for MagAOX.
 
std::string m_sysPath
 The path to the system directory, for PID file, etc.
 
std::string m_secretsPath
 Path to the secrets directory, where passwords, etc, are stored.
 
std::string m_cpusetPath
 Path to the cpusets mount.
 
unsigned long m_loopPause
 
int m_shutdown
 Flag to signal it's time to shutdown. When not 0, the main loop exits.
 
Configurable Parameters
bool m_renumberOnConnect { true }
 Whether to renumber the daisy chain during connect.
 
int m_maxDiscoveryAddress { 16 }
 Maximum device address to probe while matching configured serial numbers.
 
int m_commandTimeout { 250 }
 Binary command timeout in milliseconds.
 
int m_renumberPauseMs { 750 }
 Pause in milliseconds after renumbering before further commands are sent.
 
Stage Mapping - Data
std::vector< zaberBinaryStage< zaberLowLevelBinary > > m_stages
 Stage helpers in configuration order.
 
std::unordered_map< int, size_tm_stageAddress
 Map from binary device address to configured stage index.
 
std::unordered_map< std::string, size_tm_stageSerial
 Map from configured serial number to configured stage index.
 
std::unordered_map< std::string, size_tm_stageName
 Map from configured stage name to configured stage index.
 
bool m_stageDiscoveryInitialized { false }
 Whether the active connection has completed an initial discovery pass.
 
INDI Stage State - Data
pcf::IndiProperty m_indiP_curr_state
 Current stage state reported per configured stage.
 
pcf::IndiProperty m_indiP_max_pos
 Maximum raw position reported per configured stage.
 
pcf::IndiProperty m_indiP_parked
 Parked-state bookkeeping reported per configured stage.
 
pcf::IndiProperty m_indiP_lastHomed
 Last-homed timestamps reported per configured stage.
 
pcf::IndiProperty m_indiP_curr_pos
 Current raw position reported per configured stage.
 
pcf::IndiProperty m_indiP_temp
 Driver temperature reported per configured stage.
 
pcf::IndiProperty m_indiP_warn
 Warning-state switch reported per configured stage.
 
pcf::IndiProperty m_indiP_tgt_pos
 Requested target raw position per configured stage.
 
pcf::IndiProperty m_indiP_req_home
 Per-stage home requests.
 
pcf::IndiProperty m_indiP_req_home_all
 Global request to home all configured stages.
 
pcf::IndiProperty m_indiP_req_halt
 Per-stage halt requests.
 
pcf::IndiProperty m_indiP_req_ehalt
 Per-stage emergency-halt requests.
 
pcf::IndiProperty m_indiP_knob_enable
 Enable or disable a stage's potentiometer.
 

Private Member Functions

int clearFSMAlert ()
 Clear the FSM alert state.
 

Friends

class zaberLowLevelBinary_test
 

PID Locking

Each MagAOXApp has a PID lock file in the system directory. The app will not startup if it detects that the PID is already locked, preventing duplicates. This is based on the configured name, not the invoked name (argv[0]).

std::string pidFileName
 The name of the PID file.
 
pid_t m_pid
 This process's PID.
 
int lockPID ()
 
int unlockPID ()
 Remove the PID file.
 

INDI Interface

For reference: "Get" and "New" refer to properties we own. "Set" refers to properties owned by others. So we respond to GetProperties by listing our own properties, and NewProperty is a request to change a property we own. Whereas SetProperty is a notification that someone else has changed a property.

std::unordered_map< std::string, indiCallBack > m_indiNewCallBacks
 Map to hold the NewProperty indiCallBacks for this App, with fast lookup by property name.
 
std::unordered_map< std::string, indiCallBack > m_indiSetCallBacks
 Map to hold the SetProperty indiCallBacks for this App, with fast lookup by property name.
 
bool m_allDefsReceived
 Flag indicating that all registered Set properties have been updated since last Get.
 
std::string m_driverInName
 Full path name of the INDI driver input FIFO.
 
std::string m_driverOutName
 Full path name of the INDI driver output FIFO.
 
std::string m_driverCtrlName
 Full path name of the INDI driver control FIFO.
 
pcf::IndiProperty m_indiP_state
 indi Property to report the application state.
 
pcf::IndiProperty m_indiP_clearFSMAlert
 indi Property to clear an FSM alert.
 
int createStandardIndiText (pcf::IndiProperty &prop, const std::string &propName, const std::string &label="", const std::string &group="")
 Create a standard R/W INDI Text property with target and current elements.
 
int createROIndiText (pcf::IndiProperty &prop, const std::string &propName, const std::string &elName, const std::string &propLabel="", const std::string &propGroup="", const std::string &elLabel="")
 Create a standard ReadOnly INDI Text property, with at least one element.
 
int createStandardIndiNumber (pcf::IndiProperty &prop, const std::string &name, const T &min, const T &max, const T &step, const std::string &format, const std::string &label="", const std::string &group="")
 Create a standard R/W INDI Number property with target and current elements.
 
int createROIndiNumber (pcf::IndiProperty &prop, const std::string &propName, const std::string &propLabel="", const std::string &propGroup="")
 Create a ReadOnly INDI Number property.
 
int createStandardIndiToggleSw (pcf::IndiProperty &prop, const std::string &name, const std::string &label="", const std::string &group="")
 Create a standard R/W INDI switch with a single toggle element.
 
int createStandardIndiRequestSw (pcf::IndiProperty &prop, const std::string &name, const std::string &label="", const std::string &group="")
 Create a standard R/W INDI switch with a single request element.
 
int createStandardIndiSelectionSw (pcf::IndiProperty &prop, const std::string &name, const std::vector< std::string > &elements, const std::vector< std::string > &elementLabels, const std::string &label="", const std::string &group="")
 Create a standard R/W INDI selection (one of many) switch with vector of elements and element labels.
 
int createStandardIndiSelectionSw (pcf::IndiProperty &prop, const std::string &name, const std::vector< std::string > &elements, const std::string &label="", const std::string &group="")
 
int registerIndiPropertyReadOnly (pcf::IndiProperty &prop)
 Register an INDI property which is read only.
 
int registerIndiPropertyReadOnly (pcf::IndiProperty &prop, const std::string &propName, const pcf::IndiProperty::Type &propType, const pcf::IndiProperty::PropertyPermType &propPerm, const pcf::IndiProperty::PropertyStateType &propState)
 Register an INDI property which is read only.
 
int registerIndiPropertyNew (pcf::IndiProperty &prop, int(*)(void *, const pcf::IndiProperty &))
 Register an INDI property which is exposed for others to request a New Property for.
 
int registerIndiPropertyNew (pcf::IndiProperty &prop, const std::string &propName, const pcf::IndiProperty::Type &propType, const pcf::IndiProperty::PropertyPermType &propPerm, const pcf::IndiProperty::PropertyStateType &propState, int(*)(void *, const pcf::IndiProperty &))
 Register an INDI property which is exposed for others to request a New Property for.
 
int registerIndiPropertyNew (pcf::IndiProperty &prop, const std::string &propName, const pcf::IndiProperty::Type &propType, const pcf::IndiProperty::PropertyPermType &propPerm, const pcf::IndiProperty::PropertyStateType &propState, const pcf::IndiProperty::SwitchRuleType &propRule, int(*)(void *, const pcf::IndiProperty &))
 Register an INDI property which is exposed for others to request a New Property for, with a switch rule.
 
int registerIndiPropertySet (pcf::IndiProperty &prop, const std::string &devName, const std::string &propName, int(*)(void *, const pcf::IndiProperty &))
 Register an INDI property which is monitored for updates from others.
 
void resetIndiSetPropertyRetry (indiCallBack &callBack)
 Reset retry tracking for a monitored INDI Set-property subscription.
 
bool indiSetPropertyShouldRequest (const indiCallBack &callBack, bool all, const std::chrono::steady_clock::time_point &now) const
 Determine whether an unresolved Set-property subscription should be requested now.
 
void noteIndiSetPropertyRequested (indiCallBack &callBack, const std::chrono::steady_clock::time_point &now)
 Update retry tracking after sending a GetProperties request for a monitored Set-property.
 
void sendGetPropertySetList (bool all=false)
 
void handleDefProperty (const pcf::IndiProperty &ipRecv)
 Handler for the DEF INDI properties notification.
 
void handleGetProperties (const pcf::IndiProperty &ipRecv)
 Handler for the get INDI properties request.
 
void handleNewProperty (const pcf::IndiProperty &ipRecv)
 Handler for the new INDI property request.
 
void handleSetProperty (const pcf::IndiProperty &ipRecv)
 Handler for the set INDI property request.
 
typedef std::pair< std::string, indiCallBack > callBackValueType
 Value type of the indiCallBack map.
 
typedef std::unordered_map< std::string, indiCallBack >::iterator callBackIterator
 Iterator type of the indiCallBack map.
 
typedef std::pair< callBackIterator, boolcallBackInsertResult
 Return type of insert on the indiCallBack map.
 
static constexpr bool m_useINDI
 Flag controlling whether INDI is used. If false, then no INDI code executes.
 
indiDriver< MagAOXApp > * m_indiDriver
 The INDI driver wrapper. Constructed and initialized by execute, which starts and stops communications.
 
std::mutex m_indiMutex
 Mutex for locking INDI communications.
 
std::mutex m_indiCallBackMutex
 Mutex for locking INDI callback maps and per-entry callback state.
 
static int st_newCallBack_clearFSMAlert (void *app, const pcf::IndiProperty &ipRecv)
 The static callback function to be registered for requesting to clear the FSM alert.
 
int createINDIFIFOS ()
 Create the INDI FIFOs.
 
int startINDI ()
 Start INDI Communications.
 
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.
 
void updateIfChanged (pcf::IndiProperty &p, const std::string &el, const char *newVal, pcf::IndiProperty::PropertyStateType ipState=pcf::IndiProperty::Ok)
 Update an INDI property element value if it has changed.
 
void updateIfChanged (pcf::IndiProperty &p, const std::string &el, const std::vector< T > &newVals, pcf::IndiProperty::PropertyStateType ipState=pcf::IndiProperty::Ok)
 Update an INDI property if values have changed.
 
void updateIfChanged (pcf::IndiProperty &p, const std::vector< std::string > &els, const std::vector< T > &newVals, pcf::IndiProperty::PropertyStateType newState=pcf::IndiProperty::Ok)
 Update an INDI property if values have changed.
 
void updateSwitchIfChanged (pcf::IndiProperty &p, const std::string &el, const pcf::IndiElement::SwitchStateType &newVal, pcf::IndiProperty::PropertyStateType ipState=pcf::IndiProperty::Ok)
 Update an INDI switch element value if it has changed.
 
void updatesIfChanged (pcf::IndiProperty &p, const std::vector< const char * > &els, const std::vector< T > &newVals, pcf::IndiProperty::PropertyStateType newState=pcf::IndiProperty::Ok)
 
int indiTargetUpdate (pcf::IndiProperty &localProperty, T &localTarget, const pcf::IndiProperty &remoteProperty, bool setBusy=true)
 Get the target element value from an new property.
 
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)
 
int sendNewProperty (const pcf::IndiProperty &ipSend)
 Send a newProperty command to another device (using the INDI Client interface)
 
int sendNewStandardIndiToggle (const std::string &device, const std::string &property, bool onoff)
 Send a new property commmand for a standard toggle switch.
 
int newCallBack_clearFSMAlert (const pcf::IndiProperty &ipRecv)
 The callback called by the static version, to actually process the FSM Alert Clear request.
 

Power Management

For devices which have remote power management (e.g. from one of the PDUs) we implement a standard power state monitoring and management component for the FSM. This needs to be enabled in the derived app constructor. To stay enabled, m_powerDevice and m_powerChannel must be not empty strings after the configuration. These could be set in the derived app defaults.

If power management is enabled, then while power is off, appLogic will not be called. Instead a parrallel set of virtual functions is called, onPowerOff (to allow apps to perform cleanup) and whilePowerOff (to allow apps to keep variables updated, etc). Note that these could merely call appLogic if desired.

bool m_powerMgtEnabled
 
std::string m_powerDevice
 The INDI device name of the power controller.
 
std::string m_powerChannel
 The INDI property name of the channel controlling this device's power.
 
std::string m_powerElement
 The INDI element name to monitor for this device's power state.
 
std::string m_powerTargetElement
 The INDI element name to monitor for this device's power state.
 
unsigned long m_powerOnWait
 Default time in sec to wait for device to boot after power on.
 
int m_powerOnCounter
 
int m_powerState
 Current power state, 1=On, 0=Off, -1=Unk.
 
int m_powerTargetState
 Current target power state, 1=On, 0=Off, -1=Unk.
 
pcf::IndiProperty m_indiP_powerChannel
 INDI property used to communicate power state.
 
int powerState ()
 Returns the current power state.
 
int powerStateTarget ()
 Returns the target power state.
 
 INDI_SETCALLBACK_DECL (MagAOXApp, m_indiP_powerChannel)
 
bool powerOnWaitElapsed ()
 This method tests whether the power on wait time has elapsed.
 

Logging

void logMessage (bufferPtrT &b)
 Handle a log message from the logging system.
 
static logManagerT m_log
 
static int log (const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
 Make a log entry.
 
static int log (logPrioT level=logPrio::LOG_DEFAULT)
 Make a log entry.
 
static void configLog (const std::string &name, const int &code, const std::string &value, const std::string &source)
 Callback for config system logging.
 

Application State

stateCodes::stateCodeT state ()
 Get the current state code.
 
void state (const stateCodes::stateCodeT &s, bool stateAlert=false)
 Set the current state code.
 
bool stateAlert ()
 Get the value of the state alert flag.
 
bool gitAlert ()
 Get the value of the git alert flag.
 
int stateLogged ()
 Updates and returns the value of m_stateLogged. Will be 0 on first call after a state change, >0 afterwards.
 
stateCodes::stateCodeT m_state
 
bool m_stateAlert
 
bool m_gitAlert
 
int m_stateLogged
 

Signal Handling

libMagAOX/logger/types/software_log.hpp

static MagAOXAppm_self
 
int setSigTermHandler ()
 Sets the handler for SIGTERM, SIGQUIT, and SIGINT.
 
void handlerSigTerm (int signum, siginfo_t *siginf, void *ucont)
 Handles SIGTERM, SIGQUIT, and SIGINT. Sets m_shutdown to 1 and logs the signal.
 
static void _handlerSigTerm (int signum, siginfo_t *siginf, void *ucont)
 The handler called when SIGTERM, SIGQUIT, or SIGINT is received. Just a wrapper for handlerSigTerm.
 

Privilege Management

uid_t m_euidReal
 The real user id of the proces (i.e. the lower privileged id of the user)
 
uid_t m_euidCalled
 
uid_t m_suid
 The save-set user id of the process.
 
int setEuidCalled ()
 Set the effective user ID to the called value, i.e. the highest possible.
 
int setEuidReal ()
 Set the effective user ID to the real value, i.e. the file owner.
 

Detailed Description

The low-level binary-protocol Zaber controller.

This app mirrors zaberLowLevel as closely as possible while speaking the firmware 5.xx T-series binary protocol.

Definition at line 48 of file zaberLowLevelBinary.hpp.

Member Typedef Documentation

◆ callBackInsertResult

typedef std::pair<callBackIterator, bool> MagAOX::app::MagAOXApp< _useINDI >::callBackInsertResult
inherited

Return type of insert on the indiCallBack map.

Definition at line 694 of file MagAOXApp.hpp.

◆ callBackIterator

typedef std::unordered_map<std::string,indiCallBack>::iterator MagAOX::app::MagAOXApp< _useINDI >::callBackIterator
inherited

Iterator type of the indiCallBack map.

Definition at line 691 of file MagAOXApp.hpp.

◆ callBackValueType

typedef std::pair<std::string, indiCallBack> MagAOX::app::MagAOXApp< _useINDI >::callBackValueType
inherited

Value type of the indiCallBack map.

Definition at line 688 of file MagAOXApp.hpp.

◆ logManagerT

The log manager type.

Definition at line 178 of file MagAOXApp.hpp.

◆ verboseT

Definition at line 175 of file MagAOXApp.hpp.

Constructor & Destructor Documentation

◆ zaberLowLevelBinary()

MagAOX::app::zaberLowLevelBinary::zaberLowLevelBinary ( )

Default constructor.

Definition at line 222 of file zaberLowLevelBinary.hpp.

References MagAOX::app::MagAOXApp< true >::m_powerMgtEnabled.

◆ ~zaberLowLevelBinary()

MagAOX::app::zaberLowLevelBinary::~zaberLowLevelBinary ( )
inlinenoexcept

Destructor.

Definition at line 103 of file zaberLowLevelBinary.hpp.

Member Function Documentation

◆ _handlerSigTerm()

void MagAOX::app::MagAOXApp< _useINDI >::_handlerSigTerm ( int  signum,
siginfo_t *  siginf,
void *  ucont 
)
staticprivateinherited

The handler called when SIGTERM, SIGQUIT, or SIGINT is received. Just a wrapper for handlerSigTerm.

Parameters
[in]signumspecifies the signal.
[in]siginfignored by MagAOXApp
[in]ucontignored by MagAOXApp

Definition at line 397 of file MagAOXApp.hpp.

◆ appLogic()

int MagAOX::app::zaberLowLevelBinary::appLogic ( )
virtual

◆ appShutdown()

int MagAOX::app::zaberLowLevelBinary::appShutdown ( )
inlinevirtual

◆ appStartup()

◆ basePath()

std::string MagAOX::app::MagAOXApp< _useINDI >::basePath ( )
inherited

Get the.

Returns
the value of m_ *

Definition at line 1244 of file MagAOXApp.hpp.

◆ calibDir()

std::string MagAOX::app::MagAOXApp< _useINDI >::calibDir ( )
inherited

Get the calibration directory.

Returns
the value of m_calibDir

Definition at line 1266 of file MagAOXApp.hpp.

◆ checkConfig()

void MagAOX::app::MagAOXApp< _useINDI >::checkConfig ( )
virtualinherited

Check for unused and unrecognized config options and settings.

Logs the unused targets as warnings. Unrecognized and unused options are logged as critical, and m_shutdown is set. Any command line argument (not an option) will also be critical and cause shutdown.

Definition at line 271 of file MagAOXApp.hpp.

◆ clearFSMAlert()

int MagAOX::app::MagAOXApp< _useINDI >::clearFSMAlert ( )
privateinherited

Clear the FSM alert state.

This can only be done from within this class, and this should only be possible via user action via INDI.

Definition at line 635 of file MagAOXApp.hpp.

◆ configBase()

std::string MagAOX::app::MagAOXApp< _useINDI >::configBase ( )
inherited

Get the config base file.

Returns
the value of m_confgBase

Definition at line 1261 of file MagAOXApp.hpp.

◆ configDir()

std::string MagAOX::app::MagAOXApp< _useINDI >::configDir ( )
inherited

Get the config directory.

Returns
the current value of m_configDir

Definition at line 1256 of file MagAOXApp.hpp.

◆ configLog()

void MagAOX::app::MagAOXApp< _useINDI >::configLog ( const std::string &  name,
const int &  code,
const std::string &  value,
const std::string &  source 
)
staticprotectedinherited

Callback for config system logging.

Called by appConfigurator each time a value is set using the config() operator. You never need to call this directly.

Parameters
[in]nameThe name of the config value
[in]codenumeric code specifying the type
[in]valuethe value read by the config system
[in]sourcethe source of the value.

Definition at line 377 of file MagAOXApp.hpp.

◆ configName()

std::string MagAOX::app::MagAOXApp< _useINDI >::configName ( )
inherited

Get the config name.

Returns
the current value of m_configName

Definition at line 1250 of file MagAOXApp.hpp.

◆ connect()

◆ cpusetPath()

std::string MagAOX::app::MagAOXApp< _useINDI >::cpusetPath ( )
inherited

Get the cpuset path.

Returns
the value of m_cpusetPath

Definition at line 1281 of file MagAOXApp.hpp.

◆ createINDIFIFOS()

int MagAOX::app::MagAOXApp< _useINDI >::createINDIFIFOS ( )
protectedinherited

Create the INDI FIFOs.

Changes permissions to max available and creates the FIFOs at the configured path.

Todo:
make driver FIFO path full configurable.

Definition at line 953 of file MagAOXApp.hpp.

◆ createROIndiNumber()

int MagAOX::app::MagAOXApp< _useINDI >::createROIndiNumber ( pcf::IndiProperty &  prop,
const std::string &  propName,
const std::string &  propLabel = "",
const std::string &  propGroup = "" 
)
inherited

Create a ReadOnly INDI Number property.

Returns
0 on success
-1 on error
Parameters
[out]propthe property to create and setup
[in]propNamethe name of the property
[in]propLabel[optional] the GUI label suggestion for this property
[in]propGroup[optional] the group for this property

Definition at line 776 of file MagAOXApp.hpp.

◆ createROIndiText()

int MagAOX::app::MagAOXApp< _useINDI >::createROIndiText ( pcf::IndiProperty &  prop,
const std::string &  propName,
const std::string &  elName,
const std::string &  propLabel = "",
const std::string &  propGroup = "",
const std::string &  elLabel = "" 
)
inherited

Create a standard ReadOnly INDI Text property, with at least one element.

Returns
0 on success
-1 on error
Parameters
[out]propthe property to create and setup
[in]propNamethe name of the property
[in]elNamethe name of the element
[in]propLabel[optional] the GUI label suggestion for this property
[in]propGroup[optional] the group for this property
[in]elLabel[optional] the GUI label suggestion for the element

Definition at line 741 of file MagAOXApp.hpp.

◆ createStandardIndiNumber()

int MagAOX::app::MagAOXApp< _useINDI >::createStandardIndiNumber ( pcf::IndiProperty &  prop,
const std::string &  name,
const T &  min,
const T &  max,
const T &  step,
const std::string &  format,
const std::string &  label = "",
const std::string &  group = "" 
)
inherited

Create a standard R/W INDI Number property with target and current elements.

Returns
0 on success
-1 on error
Parameters
[out]propthe property to create and setup
[in]namethe name of the property
[in]minthe minimum value for the elements, applied to both target and current
[in]maxthe minimum value for the elements, applied to both target and current
[in]stepthe step size for the elements, applied to both target and current
[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
[in]group[optional] the group for this property

Definition at line 755 of file MagAOXApp.hpp.

◆ createStandardIndiRequestSw()

int MagAOX::app::MagAOXApp< _useINDI >::createStandardIndiRequestSw ( pcf::IndiProperty &  prop,
const std::string &  name,
const std::string &  label = "",
const std::string &  group = "" 
)
inherited

Create a standard R/W INDI switch with a single request element.

This switch is intended to function like a momentary switch.

Returns
0 on success
-1 on error
Parameters
[out]propthe property to create and setup
[in]namethe name of the property
[in]label[optional] the GUI label suggestion for this property
[in]group[optional] the group for this property

Definition at line 802 of file MagAOXApp.hpp.

◆ createStandardIndiSelectionSw() [1/2]

int MagAOX::app::MagAOXApp< _useINDI >::createStandardIndiSelectionSw ( pcf::IndiProperty &  prop,
const std::string &  name,
const std::vector< std::string > &  elements,
const std::string &  label = "",
const std::string &  group = "" 
)
inherited

Create a standard R/W INDI selection (one of many) switch with vector of elements using the element strings as their own labels This switch is intended to function like drop down menu.

Returns
0 on success
-1 on error
Parameters
[out]propthe property to create and setup
[in]namethe name of the property,
[in]elementsthe element names to give to the switches
[in]label[optional] the GUI label suggestion for this property
[in]group[optional] the group for this property

Definition at line 833 of file MagAOXApp.hpp.

◆ createStandardIndiSelectionSw() [2/2]

int MagAOX::app::MagAOXApp< _useINDI >::createStandardIndiSelectionSw ( pcf::IndiProperty &  prop,
const std::string &  name,
const std::vector< std::string > &  elements,
const std::vector< std::string > &  elementLabels,
const std::string &  label = "",
const std::string &  group = "" 
)
inherited

Create a standard R/W INDI selection (one of many) switch with vector of elements and element labels.

This switch is intended to function like drop down menu.

Returns
0 on success
-1 on error
Parameters
[out]propthe property to create and setup
[in]namethe name of the property,
[in]elementsthe element names to give to the switches
[in]elementLabelsthe element labels to give to the switches
[in]label[optional] the GUI label suggestion for this property
[in]group[optional] the group for this property

Definition at line 815 of file MagAOXApp.hpp.

◆ createStandardIndiText()

int MagAOX::app::MagAOXApp< _useINDI >::createStandardIndiText ( pcf::IndiProperty &  prop,
const std::string &  propName,
const std::string &  label = "",
const std::string &  group = "" 
)
inherited

Create a standard R/W INDI Text property with target and current elements.

Returns
0 on success
-1 on error
Parameters
[out]propthe property to create and setup
[in]propNamethe name of the property
[in]label[optional] the GUI label suggestion for this property
[in]group[optional] the group for this property

Definition at line 728 of file MagAOXApp.hpp.

◆ createStandardIndiToggleSw()

int MagAOX::app::MagAOXApp< _useINDI >::createStandardIndiToggleSw ( pcf::IndiProperty &  prop,
const std::string &  name,
const std::string &  label = "",
const std::string &  group = "" 
)
inherited

Create a standard R/W INDI switch with a single toggle element.

This switch is intended to function like an on/off toggle switch.

Returns
0 on success
-1 on error
Parameters
[out]propthe property to create and setup
[in]namethe name of the property
[in]label[optional] the GUI label suggestion for this property
[in]group[optional] the group for this property

Definition at line 789 of file MagAOXApp.hpp.

◆ driverCtrlName()

std::string MagAOX::app::MagAOXApp< _useINDI >::driverCtrlName ( )
inherited

Get the INDI control FIFO file name.

Returns
the current value of m_driverCtrlName

Definition at line 1310 of file MagAOXApp.hpp.

◆ driverInName()

std::string MagAOX::app::MagAOXApp< _useINDI >::driverInName ( )
inherited

Get the INDI input FIFO file name.

Returns
the current value of m_driverInName

Definition at line 1298 of file MagAOXApp.hpp.

◆ driverOutName()

std::string MagAOX::app::MagAOXApp< _useINDI >::driverOutName ( )
inherited

Get the INDI output FIFO file name.

Returns
the current value of m_driverOutName

Definition at line 1304 of file MagAOXApp.hpp.

◆ execute()

int MagAOX::app::MagAOXApp< _useINDI >::execute ( )
virtualinherited

The execute method implementing the standard main loop. Should not normally be overridden.

Performs final startup steps. That is:

  • Verifies correct effective user-id by comparison to logs directory.
  • PID locking lockPID()
  • log thread startup by logThreadStart()
  • signal handling installation by setSigTermHandler()
  • appStartup() is called
  • INDI communications started by startINDI()
  • power state is checked, pausing if unknown (if being managed)

Errors in the above steps will cause a process exit.

Then commences the main event loop. Conditions on entry to the main loop:

  • PID locked
  • Log thread running
  • Signal handling installed
  • appStartup successful
  • INDI communications started successfully (if being used)
  • power state known (if being managed)

In the event loop, the power state is checked (if being managed). If power is off, then onPowerOff is called. If power is on, or power is not managed, appLogic is called. These methods are implemented in derived classes, and are called every m_loopPause interval.

If an error is returned by either onPowerOff or appLogic, or a signal is handled, then the shutdown is managed. This includes shutting down INDI, calling appShutdown, and unlocking the PID. The log thread will shutdown.

Todo:
Need a heartbeat update here.

Definition at line 301 of file MagAOXApp.hpp.

◆ getDeviceName()

◆ gitAlert()

bool MagAOX::app::MagAOXApp< _useINDI >::gitAlert ( )
inherited

Get the value of the git alert flag.

Returns
the current value of m_gitAlert

Definition at line 606 of file MagAOXApp.hpp.

◆ handleDefProperty()

void MagAOX::app::MagAOXApp< _useINDI >::handleDefProperty ( const pcf::IndiProperty &  ipRecv)
inherited

Handler for the DEF INDI properties notification.

Uses the properties registered in m_indiSetCallBacks to process the notification. This is called by m_indiDriver's indiDriver::handleDefProperties.

Parameters
[in]ipRecvThe property being sent.

Definition at line 969 of file MagAOXApp.hpp.

◆ handleGetProperties()

void MagAOX::app::MagAOXApp< _useINDI >::handleGetProperties ( const pcf::IndiProperty &  ipRecv)
inherited

Handler for the get INDI properties request.

Uses the properties registered in m_indiCallBacks to respond to the request. This is called by m_indiDriver's indiDriver::handleGetProperties.

Parameters
[in]ipRecvThe property being requested.

Definition at line 975 of file MagAOXApp.hpp.

◆ handleNewProperty()

void MagAOX::app::MagAOXApp< _useINDI >::handleNewProperty ( const pcf::IndiProperty &  ipRecv)
inherited

Handler for the new INDI property request.

Uses the properties registered in m_indiCallBacks to respond to the request, looking up the callback for this property and calling it.

This is called by m_indiDriver's indiDriver::handleGetProperties.

Todo:
handle errors, are they FATAL?
Parameters
[in]ipRecvThe property being changed.

Definition at line 985 of file MagAOXApp.hpp.

◆ handlerSigTerm()

void MagAOX::app::MagAOXApp< _useINDI >::handlerSigTerm ( int  signum,
siginfo_t *  siginf,
void *  ucont 
)
privateinherited

Handles SIGTERM, SIGQUIT, and SIGINT. Sets m_shutdown to 1 and logs the signal.

Parameters
[in]signumspecifies the signal.
[in]siginfignored by MagAOXApp
[in]ucontignored by MagAOXApp

Definition at line 403 of file MagAOXApp.hpp.

◆ handleSetProperty()

void MagAOX::app::MagAOXApp< _useINDI >::handleSetProperty ( const pcf::IndiProperty &  ipRecv)
inherited

Handler for the set INDI property request.

This is called by m_indiDriver's indiDriver::handleSetProperties.

Todo:
handle errors, are they FATAL?
Todo:
log an error here because callBack should not be null
Todo:
log invalid SetProperty request.
Parameters
[in]ipRecvThe property being changed.

Definition at line 994 of file MagAOXApp.hpp.

◆ INDI_NEWCALLBACK_DECL() [1/6]

MagAOX::app::zaberLowLevelBinary::INDI_NEWCALLBACK_DECL ( zaberLowLevelBinary  ,
m_indiP_knob_enable   
)

◆ INDI_NEWCALLBACK_DECL() [2/6]

MagAOX::app::zaberLowLevelBinary::INDI_NEWCALLBACK_DECL ( zaberLowLevelBinary  ,
m_indiP_req_ehalt   
)

◆ INDI_NEWCALLBACK_DECL() [3/6]

MagAOX::app::zaberLowLevelBinary::INDI_NEWCALLBACK_DECL ( zaberLowLevelBinary  ,
m_indiP_req_halt   
)

◆ INDI_NEWCALLBACK_DECL() [4/6]

MagAOX::app::zaberLowLevelBinary::INDI_NEWCALLBACK_DECL ( zaberLowLevelBinary  ,
m_indiP_req_home   
)

◆ INDI_NEWCALLBACK_DECL() [5/6]

MagAOX::app::zaberLowLevelBinary::INDI_NEWCALLBACK_DECL ( zaberLowLevelBinary  ,
m_indiP_req_home_all   
)

◆ INDI_NEWCALLBACK_DECL() [6/6]

MagAOX::app::zaberLowLevelBinary::INDI_NEWCALLBACK_DECL ( zaberLowLevelBinary  ,
m_indiP_tgt_pos   
)

◆ INDI_SETCALLBACK_DECL()

MagAOX::app::MagAOXApp< _useINDI >::INDI_SETCALLBACK_DECL ( MagAOXApp< true >  ,
m_indiP_powerChannel   
)
inherited

◆ indiSetPropertyShouldRequest()

bool MagAOX::app::MagAOXApp< _useINDI >::indiSetPropertyShouldRequest ( const indiCallBack &  callBack,
bool  all,
const std::chrono::steady_clock::time_point &  now 
) const
inlineinherited

Determine whether an unresolved Set-property subscription should be requested now.

Parameters
[in]callBackthe subscription retry state to evaluate
[in]allif true, force an immediate refresh regardless of retry timing
[in]nowthe current monotonic time for scheduling

Definition at line 937 of file MagAOXApp.hpp.

◆ indiTargetUpdate()

int MagAOX::app::MagAOXApp< _useINDI >::indiTargetUpdate ( pcf::IndiProperty &  localProperty,
T &  localTarget,
const pcf::IndiProperty &  remoteProperty,
bool  setBusy = true 
)
protectedinherited

Get the target element value from an new property.

Returns
0 on success
-1 on error
Parameters
[out]localPropertyThe local property to update
[out]localTargetThe local value to update
[in]remotePropertythe new property received
[in]setBusy[optional] set property to busy if true

Definition at line 1091 of file MagAOXApp.hpp.

◆ loadBasicConfig()

void MagAOX::app::MagAOXApp< _useINDI >::loadBasicConfig ( )
virtualinherited

The basic MagAO-X configuration processing method. Should not normally be overridden.

This method processes the standard MagAO-X key=value pairs.

Though it is virtual, it should not normally be overridden unless you need to depart from the MagAO-X standard.

Processing of app specific config goes in loadConfig() implemented by the derived class.

Definition at line 265 of file MagAOXApp.hpp.

◆ loadConfig() [1/2]

◆ loadConfig() [2/2]

int MagAOX::tty::usbDevice::loadConfig ( mx::app::appConfigurator &  config)
inherited

Load the USB section from an application configurator.

If config does not contain a baud rate, m_baudRate is unchanged. If m_baudRate is 0 at the end of this method, an error is returned. Set m_baudRate prior to calling to avoid this error.

Returns
0 on success
-1 on error (nothing implemented yet)
Parameters
[in]configan application configuration from which to load values

Definition at line 34 of file usbDevice.cpp.

References MagAOX::tty::usbDevice::getDeviceName(), MagAOX::tty::usbDevice::m_baudRate, MagAOX::tty::usbDevice::m_idProduct, MagAOX::tty::usbDevice::m_idVendor, MagAOX::tty::usbDevice::m_serial, and TTY_E_BADBAUDRATE.

Referenced by MagAOX::app::filterWheelCtrl::loadConfig(), MagAOX::app::smc100ccCtrl::loadConfig(), MagAOX::app::zaberLowLevel::loadConfig(), loadConfig(), MagAOX::app::flipperCtrl::loadConfigImpl(), MagAOX::app::koolanceCtrl::loadConfigImpl(), MagAOX::app::pi335Ctrl::loadConfigImpl(), and MagAOX::app::rhusbMon::loadConfigImpl().

◆ loadStages() [1/2]

◆ loadStages() [2/2]

int MagAOX::app::zaberLowLevelBinary::loadStages ( const std::vector< int > &  addresses,
const std::vector< std::string > &  serials 
)

Apply a discovered address-to-serial snapshot to the configured stages.

Parameters
[in]addressesdiscovered device addresses
[in]serialsdiscovered device serial numbers

Definition at line 506 of file zaberLowLevelBinary.hpp.

References MagAOX::app::MagAOXApp< true >::log(), flatlogs::logPrio::LOG_ERROR, flatlogs::logPrio::LOG_WARNING, m_stageAddress, m_stageDiscoveryInitialized, m_stages, m_stageSerial, MagAOX::app::MagAOXApp< true >::state(), and ZBC_CONNECTED.

◆ lockPID()

int MagAOX::app::MagAOXApp< _useINDI >::lockPID ( )
protectedinherited

Attempt to lock the PID by writing it to a file. Fails if a process is already running with the same config name. First checks the PID file for an existing PID. If found, interrogates /proc to determine if that process is running and if so if the command line matches. If a matching process is currently running, then this returns an error.

Will not fail if a PID file exists but the stored PID does not correspond to a running process with the same command line name.

Reference: https://linux.die.net/man/3/getpid

Returns
0 on success.
-1 on any error, including creating the PID file or if this app is already running.

Definition at line 515 of file MagAOXApp.hpp.

◆ log() [1/2]

int MagAOX::app::MagAOXApp< _useINDI >::log ( const typename logT::messageT &  msg,
logPrioT  level = logPrio::LOG_DEFAULT 
)
staticinherited

Make a log entry.

Wrapper for logManager::log

Template Parameters
logTthe log entry type
retvalthe value returned by this method.
Parameters
[in]msgthe message to log
[in]level[optional] the log level. The default is used if not specified.

Definition at line 348 of file MagAOXApp.hpp.

◆ log() [2/2]

int MagAOX::app::MagAOXApp< _useINDI >::log ( logPrioT  level = logPrio::LOG_DEFAULT)
staticinherited

Make a log entry.

Wrapper for logManager::log

Template Parameters
logTthe log entry type
retvalthe value returned by this method.
Parameters
[in]level[optional] the log level. The default is used if not specified.

Definition at line 361 of file MagAOXApp.hpp.

◆ logMessage()

void MagAOX::app::MagAOXApp< _useINDI >::logMessage ( bufferPtrT b)
inherited

Handle a log message from the logging system.

This is a callback from the logManager, and is called when the log thread is processing log entries.

Decides whether to display to stderr and whether to send via INDI.

Definition at line 370 of file MagAOXApp.hpp.

◆ loopPause()

unsigned long MagAOX::app::MagAOXApp< _useINDI >::loopPause ( )
inherited

Get the loop pause time.

Returns
the value of m_loopPause

Definition at line 1286 of file MagAOXApp.hpp.

◆ newCallBack_clearFSMAlert()

int MagAOX::app::MagAOXApp< _useINDI >::newCallBack_clearFSMAlert ( const pcf::IndiProperty &  ipRecv)
protectedinherited

The callback called by the static version, to actually process the FSM Alert Clear request.

Returns
0 on success.
-1 on error.
Parameters
[in]ipRecvthe INDI property sent with the new property request.

Definition at line 1148 of file MagAOXApp.hpp.

◆ noteIndiSetPropertyRequested()

void MagAOX::app::MagAOXApp< _useINDI >::noteIndiSetPropertyRequested ( indiCallBack &  callBack,
const std::chrono::steady_clock::time_point &  now 
)
inlineinherited

Update retry tracking after sending a GetProperties request for a monitored Set-property.

Parameters
callBack[in/out] the subscription retry state to update
[in]nowthe current monotonic time for scheduling

Definition at line 944 of file MagAOXApp.hpp.

◆ onPowerOff()

◆ powerOnWaitElapsed()

bool MagAOX::app::MagAOXApp< _useINDI >::powerOnWaitElapsed ( )
protectedinherited

This method tests whether the power on wait time has elapsed.

You would call this once per appLogic loop while in state POWERON. While false, you would return 0. Once it becomes true, take post-power-on actions and go on with life.

Returns
true if the time since POWERON is greater than the power-on wait, or if power management is not enabled
false otherwise

Definition at line 1209 of file MagAOXApp.hpp.

◆ powerState()

int MagAOX::app::MagAOXApp< _useINDI >::powerState ( )
inherited

Returns the current power state.

If power management is not enabled, this always returns 1=On.

Returns
-1 if power state is unknown
0 if power is off
1 if power is on or m_powerMgtEnabled==false

Definition at line 1219 of file MagAOXApp.hpp.

◆ powerStateTarget()

int MagAOX::app::MagAOXApp< _useINDI >::powerStateTarget ( )
inherited

Returns the target power state.

If power management is not enabled, this always returns 1=On.

Returns
-1 if target power state is unknown
0 if target power state is off
1 if target power is on or m_powerMgtEnabled==false

Definition at line 1228 of file MagAOXApp.hpp.

◆ queryDevice()

int MagAOX::app::zaberLowLevelBinary::queryDevice ( int32_t response,
uint8_t  deviceAddress,
uint8_t  commandNumber,
int32_t  data,
uint8_t  expectedReply 
)

Query a device directly for discovery-time replies.

Parameters
[out]responsedecoded reply data
[in]deviceAddressdevice address
[in]commandNumbercommand number
[in]datacommand data
[in]expectedReplyexpected reply command number

Definition at line 318 of file zaberLowLevelBinary.hpp.

References MagAOX::app::MagAOXApp< true >::log(), m_port, Z_SUCCESS, zb_decode(), zb_encode(), zb_receive(), and zb_send().

Referenced by loadStages().

◆ recoverFromError()

int MagAOX::app::zaberLowLevelBinary::recoverFromError ( bool  devicePresent)

Recover from a binary-transport error without terminating the app.

Parameters
[in]devicePresenttrue if the USB tty still exists in udev

Definition at line 395 of file zaberLowLevelBinary.hpp.

References MagAOX::app::MagAOXApp< true >::log(), m_indiP_curr_state, m_stages, MagAOX::app::stateCodes::NODEVICE, MagAOX::app::stateCodes::NOTCONNECTED, resetConnection(), MagAOX::app::MagAOXApp< true >::state(), and MagAOX::app::MagAOXApp< true >::updateIfChanged().

Referenced by appLogic(), and libXWCTest::zaberLowLevelBinaryTest::SCENARIO().

◆ refreshStageDiscovery()

int MagAOX::app::zaberLowLevelBinary::refreshStageDiscovery ( )

Refresh discovery on an already-connected binary bus.

Definition at line 581 of file zaberLowLevelBinary.hpp.

References loadStages(), m_port, and ZBC_NOT_CONNECTED.

Referenced by appLogic().

◆ registerIndiPropertyNew() [1/3]

int MagAOX::app::MagAOXApp< _useINDI >::registerIndiPropertyNew ( pcf::IndiProperty &  prop,
const std::string &  propName,
const pcf::IndiProperty::Type &  propType,
const pcf::IndiProperty::PropertyPermType &  propPerm,
const pcf::IndiProperty::PropertyStateType &  propState,
const pcf::IndiProperty::SwitchRuleType &  propRule,
int(*)(void *, const pcf::IndiProperty &)   
)
inherited

Register an INDI property which is exposed for others to request a New Property for, with a switch rule.

This verison sets up the INDI property according to the arguments.

Returns
0 on success.
-1 on error.
Parameters
[out]propthe property to register
[in]propNamethe name of the property
[in]propTypethe type of the property
[in]propPermthe permissions of the property
[in]propStatethe state of the property
[in]propRulethe switch rule type

◆ registerIndiPropertyNew() [2/3]

int MagAOX::app::MagAOXApp< _useINDI >::registerIndiPropertyNew ( pcf::IndiProperty &  prop,
const std::string &  propName,
const pcf::IndiProperty::Type &  propType,
const pcf::IndiProperty::PropertyPermType &  propPerm,
const pcf::IndiProperty::PropertyStateType &  propState,
int(*)(void *, const pcf::IndiProperty &)   
)
inherited

Register an INDI property which is exposed for others to request a New Property for.

This verison sets up the INDI property according to the arguments.

Returns
0 on success.
-1 on error.
Parameters
[out]propthe property to register
[in]propNamethe name of the property
[in]propTypethe type of the property
[in]propPermthe permissions of the property
[in]propStatethe state of the property

◆ registerIndiPropertyNew() [3/3]

int MagAOX::app::MagAOXApp< _useINDI >::registerIndiPropertyNew ( pcf::IndiProperty &  prop,
int(*)(void *, const pcf::IndiProperty &)   
)
inherited

Register an INDI property which is exposed for others to request a New Property for.

In this version the supplied IndiProperty must be fully set up before passing in.

Returns
0 on success.
-1 on error.
Parameters
[in]propthe property to register, must be fully set up

◆ registerIndiPropertyReadOnly() [1/2]

int MagAOX::app::MagAOXApp< _useINDI >::registerIndiPropertyReadOnly ( pcf::IndiProperty &  prop)
inherited

Register an INDI property which is read only.

This version requires the property be fully set up.

Returns
0 on success.
-1 on error.
Parameters
[in]propthe property to register, must be completely setup

Definition at line 849 of file MagAOXApp.hpp.

◆ registerIndiPropertyReadOnly() [2/2]

int MagAOX::app::MagAOXApp< _useINDI >::registerIndiPropertyReadOnly ( pcf::IndiProperty &  prop,
const std::string &  propName,
const pcf::IndiProperty::Type &  propType,
const pcf::IndiProperty::PropertyPermType &  propPerm,
const pcf::IndiProperty::PropertyStateType &  propState 
)
inherited

Register an INDI property which is read only.

This verison sets up the INDI property according to the arguments.

Returns
0 on success.
-1 on error.
Parameters
[out]propthe property to register, will be configured
[in]propNamethe name of the property
[in]propTypethe type of the property
[in]propPermthe permissions of the property
[in]propStatethe state of the property

Definition at line 859 of file MagAOXApp.hpp.

◆ registerIndiPropertySet()

int MagAOX::app::MagAOXApp< _useINDI >::registerIndiPropertySet ( pcf::IndiProperty &  prop,
const std::string &  devName,
const std::string &  propName,
int(*)(void *, const pcf::IndiProperty &)   
)
inherited

Register an INDI property which is monitored for updates from others.

Returns
0 on success.
-1 on error.
Parameters
[out]propthe property to register
[in]devNamethe device which owns this property
[in]propNamethe name of the property

Definition at line 926 of file MagAOXApp.hpp.

◆ resetConnection()

int MagAOX::app::zaberLowLevelBinary::resetConnection ( )

◆ resetIndiSetPropertyRetry()

void MagAOX::app::MagAOXApp< _useINDI >::resetIndiSetPropertyRetry ( indiCallBack &  callBack)
inlineinherited

Reset retry tracking for a monitored INDI Set-property subscription.

Parameters
callBack[in/out] the subscription retry state to reset

Definition at line 934 of file MagAOXApp.hpp.

◆ secretsPath()

std::string MagAOX::app::MagAOXApp< _useINDI >::secretsPath ( )
inherited

Get the secrets path.

Returns
the value of m_secretsPath

Definition at line 1276 of file MagAOXApp.hpp.

◆ sendCommandNoReply()

int MagAOX::app::zaberLowLevelBinary::sendCommandNoReply ( uint8_t  deviceAddress,
uint8_t  commandNumber,
int32_t  data 
)

Send a broadcast or address-specific command with no awaited reply.

Parameters
[in]deviceAddressdevice address
[in]commandNumbercommand number
[in]datacommand data

Definition at line 362 of file zaberLowLevelBinary.hpp.

References MagAOX::app::MagAOXApp< true >::log(), m_port, Z_SUCCESS, zb_encode(), and zb_send().

Referenced by connect().

◆ sendGetPropertySetList()

void MagAOX::app::MagAOXApp< _useINDI >::sendGetPropertySetList ( bool  all = false)
inherited

Definition at line 963 of file MagAOXApp.hpp.

◆ sendNewProperty() [1/2]

int MagAOX::app::MagAOXApp< _useINDI >::sendNewProperty ( const pcf::IndiProperty &  ipSend)
protectedinherited

Send a newProperty command to another device (using the INDI Client interface)

Returns
0 on success.
-1 on an error, which will be logged
Parameters
[in]ipSendThe property to send a "new" INDI command for

Definition at line 1114 of file MagAOXApp.hpp.

◆ sendNewProperty() [2/2]

int MagAOX::app::MagAOXApp< _useINDI >::sendNewProperty ( const pcf::IndiProperty &  ipSend,
const std::string &  el,
const T &  newVal 
)
protectedinherited

Send a newProperty command to another device (using the INDI Client interface)

Copies the input IndiProperty, then updates the element with the new value.

Returns
0 on success.
-1 on an errory.
Parameters
[in]ipSendThe property to send a "new" INDI command for
[in]elThe element of the property to change
[in]newValThe value to request for the element.

Definition at line 1104 of file MagAOXApp.hpp.

◆ sendNewStandardIndiToggle()

int MagAOX::app::MagAOXApp< _useINDI >::sendNewStandardIndiToggle ( const std::string &  device,
const std::string &  property,
bool  onoff 
)
protectedinherited

Send a new property commmand for a standard toggle switch.

Returns
0 on success
-1 on an error, which will be logged.
Parameters
[in]deviceThe device name
[in]propertyThe property name
[in]onoffSwitch state to send: true = on, false = off

Definition at line 1121 of file MagAOXApp.hpp.

◆ setDefaults()

void MagAOX::app::MagAOXApp< _useINDI >::setDefaults ( int  argc,
char **  argv 
)
virtualinherited

Set the paths for config files.

Replaces the mx::application defaults with the MagAO-X config system.

This function parses the CL for "-n" or "--name".

Do not override this unless you intend to depart from the MagAO-X standard.

Parameters
[in]argcstandard command line result specifying number of arguments in argv
[in]argvstandard command line result containing the arguments.

Definition at line 243 of file MagAOXApp.hpp.

◆ setEuidCalled()

int MagAOX::app::MagAOXApp< _useINDI >::setEuidCalled ( )
privateinherited

Set the effective user ID to the called value, i.e. the highest possible.

If setuid is set on the file, this will be super-user privileges.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/seteuid.html

Returns
0 on success
-1 on error from setuid().

Definition at line 474 of file MagAOXApp.hpp.

◆ setEuidReal()

int MagAOX::app::MagAOXApp< _useINDI >::setEuidReal ( )
privateinherited

Set the effective user ID to the real value, i.e. the file owner.

Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/seteuid.html

Returns
0 on success
-1 on error from setuid().

Definition at line 483 of file MagAOXApp.hpp.

◆ setSigTermHandler()

int MagAOX::app::MagAOXApp< _useINDI >::setSigTermHandler ( )
privateinherited

Sets the handler for SIGTERM, SIGQUIT, and SIGINT.

Definition at line 394 of file MagAOXApp.hpp.

◆ setupBasicConfig()

void MagAOX::app::MagAOXApp< _useINDI >::setupBasicConfig ( )
virtualinherited

The basic MagAO-X configuration setup method. Should not normally be overridden.

This method sets up the config system with the standard MagAO-X key=value pairs.

Though it is virtual, it should not normally be overridden unless you need to depart from the MagAO-X standard.

Setting up app specific config goes in setupConfig() implemented in the derived class.

Definition at line 255 of file MagAOXApp.hpp.

◆ setupConfig() [1/2]

void MagAOX::app::zaberLowLevelBinary::setupConfig ( )
virtual

Set up application configuration.

Definition at line 227 of file zaberLowLevelBinary.hpp.

References MagAOX::tty::usbDevice::setupConfig().

◆ setupConfig() [2/2]

int MagAOX::tty::usbDevice::setupConfig ( mx::app::appConfigurator &  config)
inherited

Setup an application configurator for the USB section.

Returns
0 on success.
-1 on error (nothing implemented yet)
Parameters
[in]configan application configuration to setup

Definition at line 24 of file usbDevice.cpp.

Referenced by MagAOX::app::filterWheelCtrl::setupConfig(), MagAOX::app::flipperCtrl::setupConfig(), MagAOX::app::koolanceCtrl::setupConfig(), MagAOX::app::pi335Ctrl::setupConfig(), MagAOX::app::rhusbMon::setupConfig(), MagAOX::app::smc100ccCtrl::setupConfig(), MagAOX::app::zaberLowLevel::setupConfig(), and setupConfig().

◆ shutdown()

int MagAOX::app::MagAOXApp< _useINDI >::shutdown ( )
inherited

Get the value of the shutdown flag.

Returns
the current value of m_shutdown

Definition at line 1292 of file MagAOXApp.hpp.

◆ st_newCallBack_clearFSMAlert()

int MagAOX::app::MagAOXApp< _useINDI >::st_newCallBack_clearFSMAlert ( void *  app,
const pcf::IndiProperty &  ipRecv 
)
staticprotectedinherited

The static callback function to be registered for requesting to clear the FSM alert.

Returns
0 on success.
-1 on error.
Parameters
[in]appa pointer to this, will be static_cast-ed to MagAOXApp.
[in]ipRecvthe INDI property sent with the new property request.

Definition at line 1137 of file MagAOXApp.hpp.

◆ startINDI()

int MagAOX::app::MagAOXApp< _useINDI >::startINDI ( )
protectedinherited

Start INDI Communications.

Returns
0 on success
-1 on error. This is fatal.

Definition at line 960 of file MagAOXApp.hpp.

◆ state() [1/2]

Get the current state code.

Returns
m_state

Definition at line 584 of file MagAOXApp.hpp.

◆ state() [2/2]

void MagAOX::app::MagAOXApp< _useINDI >::state ( const stateCodes::stateCodeT s,
bool  stateAlert = false 
)
inherited

Set the current state code.

Todo:
move this to a function in stateCodes
Parameters
[in]sThe new application state
[in]stateAlert[optional] flag to set the alert state of the FSM property.

Definition at line 592 of file MagAOXApp.hpp.

◆ stateAlert()

bool MagAOX::app::MagAOXApp< _useINDI >::stateAlert ( )
inherited

Get the value of the state alert flag.

Returns
the current value of m_stateAlert

Definition at line 600 of file MagAOXApp.hpp.

◆ stateLogged()

int MagAOX::app::MagAOXApp< _useINDI >::stateLogged ( )
inherited

Updates and returns the value of m_stateLogged. Will be 0 on first call after a state change, >0 afterwards.

This method exists to facilitate logging the reason for a state change once, but not logging it on subsequent event loops. Returns the current value upon entry, but updates before returning so that the next call returns the incremented value. Example usage:

if( connection_failed ) //some condition set this to true
{
if(!stateLogged()) log<text_log>("Not connected");
}
stateCodes::stateCodeT state()
Get the current state code.
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.
@ NOTCONNECTED
The application is not connected to the device or service.

In this example, the log entry is made the first time the state changes. If there are no changes to a different state in the mean time, then when the event loop gets here again and decides it is not connected, the log entry will not be made.

Returns
current value of m_stateLogged, that is the value before it is incremented.

Definition at line 625 of file MagAOXApp.hpp.

◆ sysPath()

std::string MagAOX::app::MagAOXApp< _useINDI >::sysPath ( )
inherited

Get the system path.

Returns
the value of m_sysPath

Definition at line 1271 of file MagAOXApp.hpp.

◆ threadStart()

int MagAOX::app::MagAOXApp< _useINDI >::threadStart ( std::thread &  thrd,
bool &  thrdInit,
pid_t &  tpid,
pcf::IndiProperty &  thProp,
int  thrdPrio,
const std::string &  cpuset,
const std::string &  thrdName,
thisPtr *  thrdThis,
Function &&  thrdStart 
)
inherited

Start a thread, using this class's privileges to set priority, etc.

The thread initialization synchronizer bool is set to true at the beginning of this function, then is set to false once all initialization is complete. The thread exec function should wait until this is false before doing anything except setting the pid. This is to avoid privilege escalation bugs.

The interface of the thread start function is:

static void impl::myThreadStart( impl * o )
{
o->myThreadExec(); //A member function which actually executes the thread
}

where impl is the derived class, and mThreadStart and myThreadExec are members of impl.

Returns
0 on success
-1 on error
Parameters
[out]thrdThe thread object to start executing
thrdInit[in/out] The thread initilization synchronizer.
tpid[in/out] The thread pid to be filled in by thrdStart immediately upon call
thProp[in/out] The INDI property to publish the thread details
[in]thrdPrioThe r/t priority to set for this thread
[in]cpusetthe cpuset to place this thread on. Ignored if "".
[in]thrdNameThe name of the thread (just for logging)
[in]thrdThisThe this pointer to pass to the thread starter function
[in]thrdStartThe thread starting function, a static function taking a this pointer as argument.

Definition at line 549 of file MagAOXApp.hpp.

◆ unlockPID()

int MagAOX::app::MagAOXApp< _useINDI >::unlockPID ( )
protectedinherited

Remove the PID file.

Definition at line 518 of file MagAOXApp.hpp.

◆ updateIfChanged() [1/4]

void MagAOX::app::MagAOXApp< _useINDI >::updateIfChanged ( pcf::IndiProperty &  p,
const std::string &  el,
const char *  newVal,
pcf::IndiProperty::PropertyStateType  ipState = pcf::IndiProperty::Ok 
)
protectedinherited

Update an INDI property element value if it has changed.

Will only peform a SetProperty if the new element value has changed compared to the stored value, or if the property state has changed.

This comparison is done in the true type of the value.

This is a specialization for const char * to std::string.

For a property with multiple elements, you should use the vector version to minimize network traffic. This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
p[in/out] The property containing the element to possibly update
[in]elThe element name
[in]newValthe new value

Definition at line 1024 of file MagAOXApp.hpp.

◆ updateIfChanged() [2/4]

void MagAOX::app::MagAOXApp< _useINDI >::updateIfChanged ( pcf::IndiProperty &  p,
const std::string &  el,
const std::vector< T > &  newVals,
pcf::IndiProperty::PropertyStateType  ipState = pcf::IndiProperty::Ok 
)
protectedinherited

Update an INDI property if values have changed.

Will only peform a SetProperty if at least one value has changed compared to the stored value, or if the property state has changed.

Constructs the element names for each value as elX where X is the index of the vector.

This comparison is done in the true type of the value.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
p[in/out] The property containing the element to possibly update
[in]elBeginning of each element name
[in]newValsthe new values
[in]ipState[optional] the new state

Definition at line 1053 of file MagAOXApp.hpp.

◆ updateIfChanged() [3/4]

void MagAOX::app::MagAOXApp< _useINDI >::updateIfChanged ( pcf::IndiProperty &  p,
const std::string &  el,
const T &  newVal,
pcf::IndiProperty::PropertyStateType  ipState = pcf::IndiProperty::Ok 
)
protectedinherited

Update an INDI property element value if it has changed.

Will only peform a SetProperty if the new element value has changed compared to the stored value, or if the property state has changed.

This comparison is done in the true type of the value.

For a property with multiple elements, you should use the vector version to minimize network traffic.

Parameters
p[in/out] The property containing the element to possibly update
[in]elThe element name
[in]newValthe new value

Definition at line 1007 of file MagAOXApp.hpp.

◆ updateIfChanged() [4/4]

void MagAOX::app::MagAOXApp< _useINDI >::updateIfChanged ( pcf::IndiProperty &  p,
const std::vector< std::string > &  els,
const std::vector< T > &  newVals,
pcf::IndiProperty::PropertyStateType  newState = pcf::IndiProperty::Ok 
)
protectedinherited

Update an INDI property if values have changed.

Will only peform a SetProperty if at least one value has changed compared to the stored value, or if the property state has changed.

This comparison is done in the true type of the value.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters
p[in/out] The property containing the element to possibly update
[in]elsString vector of element names
[in]newValsthe new values
[in]newState[optional] The state of the property

Definition at line 1070 of file MagAOXApp.hpp.

◆ updatesIfChanged()

void MagAOX::app::MagAOXApp< _useINDI >::updatesIfChanged ( pcf::IndiProperty &  p,
const std::vector< const char * > &  els,
const std::vector< T > &  newVals,
pcf::IndiProperty::PropertyStateType  newState = pcf::IndiProperty::Ok 
)
protectedinherited
Parameters
p[in/out] The property containing the element to possibly update
[in]elsString vector of element names
[in]newValsthe new values
[in]newState[optional] The state of the property

Definition at line 1078 of file MagAOXApp.hpp.

◆ updateSwitchIfChanged()

void MagAOX::app::MagAOXApp< _useINDI >::updateSwitchIfChanged ( pcf::IndiProperty &  p,
const std::string &  el,
const pcf::IndiElement::SwitchStateType &  newVal,
pcf::IndiProperty::PropertyStateType  ipState = pcf::IndiProperty::Ok 
)
protectedinherited

Update an INDI switch element value if it has changed.

Will only peform a SetProperty if the new element switch state has changed, or the propery state has changed.

Parameters
p[in/out] The property containing the element to possibly update
[in]elThe element name
[in]newValthe new value

Definition at line 1035 of file MagAOXApp.hpp.

◆ whilePowerOff()

int MagAOX::app::zaberLowLevelBinary::whilePowerOff ( )
inlinevirtual

Execute the powered-off loop.

Reimplemented from MagAOX::app::MagAOXApp< true >.

Definition at line 1072 of file zaberLowLevelBinary.hpp.

Friends And Related Symbol Documentation

◆ zaberLowLevelBinary_test

friend class zaberLowLevelBinary_test
friend

Definition at line 50 of file zaberLowLevelBinary.hpp.

Member Data Documentation

◆ m_allDefsReceived

bool MagAOX::app::MagAOXApp< _useINDI >::m_allDefsReceived
protectedinherited

Flag indicating that all registered Set properties have been updated since last Get.

Definition at line 709 of file MagAOXApp.hpp.

◆ m_basePath

std::string MagAOX::app::MagAOXApp< _useINDI >::m_basePath
protectedinherited

The base path of the MagAO-X system.

Definition at line 181 of file MagAOXApp.hpp.

◆ m_baudRate

◆ m_calibDir

std::string MagAOX::app::MagAOXApp< _useINDI >::m_calibDir
protectedinherited

The path to calibration files for MagAOX.

Definition at line 189 of file MagAOXApp.hpp.

◆ m_commandTimeout

int MagAOX::app::zaberLowLevelBinary::m_commandTimeout { 250 }
protected

Binary command timeout in milliseconds.

Definition at line 70 of file zaberLowLevelBinary.hpp.

Referenced by connect(), and loadConfig().

◆ m_configBase

std::string MagAOX::app::MagAOXApp< _useINDI >::m_configBase
protectedinherited

The name of a base config class for this app (minus .conf).

Definition at line 187 of file MagAOXApp.hpp.

◆ m_configDir

std::string MagAOX::app::MagAOXApp< _useINDI >::m_configDir
protectedinherited

The path to configuration files for MagAOX.

Definition at line 185 of file MagAOXApp.hpp.

◆ m_configName

std::string MagAOX::app::MagAOXApp< _useINDI >::m_configName
protectedinherited

The name of the configuration file (minus .conf).

Definition at line 183 of file MagAOXApp.hpp.

◆ m_cpusetPath

std::string MagAOX::app::MagAOXApp< _useINDI >::m_cpusetPath
protectedinherited

Path to the cpusets mount.

The path to the cpusets mount is configured by the environment variable defined by MAGOX_env_cpuset in environment.hpp. This environment variable is normally named "CGROUPS1_CPUSET_MOUNTPOINT". If the environment variable is not set, the default defined by MAGAOX_cpusetPath in paths.hpp is used.

Definition at line 200 of file MagAOXApp.hpp.

◆ m_deviceName

◆ m_driverCtrlName

std::string MagAOX::app::MagAOXApp< _useINDI >::m_driverCtrlName
protectedinherited

Full path name of the INDI driver control FIFO.

This is currently only used to signal restarts.

Definition at line 720 of file MagAOXApp.hpp.

◆ m_driverInName

std::string MagAOX::app::MagAOXApp< _useINDI >::m_driverInName
protectedinherited

Full path name of the INDI driver input FIFO.

Definition at line 712 of file MagAOXApp.hpp.

◆ m_driverOutName

std::string MagAOX::app::MagAOXApp< _useINDI >::m_driverOutName
protectedinherited

Full path name of the INDI driver output FIFO.

Definition at line 715 of file MagAOXApp.hpp.

◆ m_euidCalled

uid_t MagAOX::app::MagAOXApp< _useINDI >::m_euidCalled
privateinherited

The user id of the process as called (i.e. the higher privileged id of the owner, root if setuid).

Definition at line 415 of file MagAOXApp.hpp.

◆ m_euidReal

uid_t MagAOX::app::MagAOXApp< _useINDI >::m_euidReal
privateinherited

The real user id of the proces (i.e. the lower privileged id of the user)

Definition at line 414 of file MagAOXApp.hpp.

◆ m_fileDescrip

int MagAOX::tty::usbDevice::m_fileDescrip {0}
inherited

◆ m_gitAlert

bool MagAOX::app::MagAOXApp< _useINDI >::m_gitAlert
privateinherited

Definition at line 575 of file MagAOXApp.hpp.

◆ m_idProduct

◆ m_idVendor

◆ m_indiCallBackMutex

std::mutex MagAOX::app::MagAOXApp< _useINDI >::m_indiCallBackMutex
inherited

Mutex for locking INDI callback maps and per-entry callback state.

Lock ordering policy: 1) Prefer never holding both m_indiMutex and m_indiCallBackMutex at the same time. 2) If both are required in future code, always acquire m_indiMutex before m_indiCallBackMutex.

Definition at line 662 of file MagAOXApp.hpp.

◆ m_indiDriver

indiDriver<MagAOXApp>* MagAOX::app::MagAOXApp< _useINDI >::m_indiDriver
inherited

The INDI driver wrapper. Constructed and initialized by execute, which starts and stops communications.

Todo:
instead of making this public, provide an accessor.

Definition at line 652 of file MagAOXApp.hpp.

◆ m_indiMutex

std::mutex MagAOX::app::MagAOXApp< _useINDI >::m_indiMutex
inherited

Mutex for locking INDI communications.

Definition at line 655 of file MagAOXApp.hpp.

◆ m_indiNewCallBacks

std::unordered_map<std::string, indiCallBack> MagAOX::app::MagAOXApp< _useINDI >::m_indiNewCallBacks
protectedinherited

Map to hold the NewProperty indiCallBacks for this App, with fast lookup by property name.

The key for these is the property name.

Definition at line 700 of file MagAOXApp.hpp.

◆ m_indiP_clearFSMAlert

pcf::IndiProperty MagAOX::app::MagAOXApp< _useINDI >::m_indiP_clearFSMAlert
protectedinherited

indi Property to clear an FSM alert.

Definition at line 1130 of file MagAOXApp.hpp.

◆ m_indiP_curr_pos

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_curr_pos
protected

Current raw position reported per configured stage.

Definition at line 180 of file zaberLowLevelBinary.hpp.

Referenced by appLogic(), appStartup(), and onPowerOff().

◆ m_indiP_curr_state

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_curr_state
protected

Current stage state reported per configured stage.

Definition at line 168 of file zaberLowLevelBinary.hpp.

Referenced by appLogic(), appShutdown(), appStartup(), onPowerOff(), and recoverFromError().

◆ m_indiP_knob_enable

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_knob_enable
protected

Enable or disable a stage's potentiometer.

Definition at line 204 of file zaberLowLevelBinary.hpp.

Referenced by appLogic(), appStartup(), and onPowerOff().

◆ m_indiP_lastHomed

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_lastHomed
protected

Last-homed timestamps reported per configured stage.

Definition at line 177 of file zaberLowLevelBinary.hpp.

Referenced by appLogic(), appStartup(), and onPowerOff().

◆ m_indiP_max_pos

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_max_pos
protected

Maximum raw position reported per configured stage.

Definition at line 171 of file zaberLowLevelBinary.hpp.

Referenced by appLogic(), appStartup(), and onPowerOff().

◆ m_indiP_parked

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_parked
protected

Parked-state bookkeeping reported per configured stage.

Definition at line 174 of file zaberLowLevelBinary.hpp.

Referenced by appLogic(), appStartup(), and onPowerOff().

◆ m_indiP_powerChannel

pcf::IndiProperty MagAOX::app::MagAOXApp< _useINDI >::m_indiP_powerChannel
protectedinherited

INDI property used to communicate power state.

Definition at line 1186 of file MagAOXApp.hpp.

◆ m_indiP_req_ehalt

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_req_ehalt
protected

Per-stage emergency-halt requests.

Definition at line 201 of file zaberLowLevelBinary.hpp.

Referenced by appStartup().

◆ m_indiP_req_halt

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_req_halt
protected

Per-stage halt requests.

Definition at line 198 of file zaberLowLevelBinary.hpp.

Referenced by appStartup().

◆ m_indiP_req_home

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_req_home
protected

Per-stage home requests.

Definition at line 192 of file zaberLowLevelBinary.hpp.

Referenced by appStartup().

◆ m_indiP_req_home_all

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_req_home_all
protected

Global request to home all configured stages.

Definition at line 195 of file zaberLowLevelBinary.hpp.

Referenced by appStartup().

◆ m_indiP_state

pcf::IndiProperty MagAOX::app::MagAOXApp< _useINDI >::m_indiP_state
protectedinherited

indi Property to report the application state.

Definition at line 1127 of file MagAOXApp.hpp.

◆ m_indiP_temp

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_temp
protected

Driver temperature reported per configured stage.

Definition at line 183 of file zaberLowLevelBinary.hpp.

Referenced by appLogic(), appStartup(), and onPowerOff().

◆ m_indiP_tgt_pos

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_tgt_pos
protected

Requested target raw position per configured stage.

Definition at line 189 of file zaberLowLevelBinary.hpp.

Referenced by appLogic(), appStartup(), and onPowerOff().

◆ m_indiP_warn

pcf::IndiProperty MagAOX::app::zaberLowLevelBinary::m_indiP_warn
protected

Warning-state switch reported per configured stage.

Definition at line 186 of file zaberLowLevelBinary.hpp.

Referenced by appLogic(), appStartup(), and onPowerOff().

◆ m_indiSetCallBacks

std::unordered_map<std::string, indiCallBack> MagAOX::app::MagAOXApp< _useINDI >::m_indiSetCallBacks
protectedinherited

Map to hold the SetProperty indiCallBacks for this App, with fast lookup by property name.

The key for these is device.name

Definition at line 705 of file MagAOXApp.hpp.

◆ m_log

Definition at line 338 of file MagAOXApp.hpp.

◆ m_loopPause

unsigned long MagAOX::app::MagAOXApp< _useINDI >::m_loopPause
protectedinherited

The time in nanoseconds to pause the main loop. The appLogic() function of the derived class is called every m_loopPause nanoseconds. Default is 1,000,000,000 ns. Config with loopPause=X.

Definition at line 202 of file MagAOXApp.hpp.

◆ m_maxDiscoveryAddress

int MagAOX::app::zaberLowLevelBinary::m_maxDiscoveryAddress { 16 }
protected

Maximum device address to probe while matching configured serial numbers.

Definition at line 67 of file zaberLowLevelBinary.hpp.

Referenced by loadConfig(), and loadStages().

◆ m_numStages

int MagAOX::app::zaberLowLevelBinary::m_numStages { 0 }
protected

Number of configured stages.

Definition at line 54 of file zaberLowLevelBinary.hpp.

◆ m_pid

pid_t MagAOX::app::MagAOXApp< _useINDI >::m_pid
protectedinherited

This process's PID.

Definition at line 499 of file MagAOXApp.hpp.

◆ m_port

z_port MagAOX::app::zaberLowLevelBinary::m_port { 0 }
protected

Connected binary protocol port.

Definition at line 57 of file zaberLowLevelBinary.hpp.

Referenced by appLogic(), connect(), loadStages(), queryDevice(), refreshStageDiscovery(), resetConnection(), and sendCommandNoReply().

◆ m_powerChannel

std::string MagAOX::app::MagAOXApp< _useINDI >::m_powerChannel
protectedinherited

The INDI property name of the channel controlling this device's power.

Definition at line 1172 of file MagAOXApp.hpp.

◆ m_powerDevice

std::string MagAOX::app::MagAOXApp< _useINDI >::m_powerDevice
protectedinherited

The INDI device name of the power controller.

Definition at line 1171 of file MagAOXApp.hpp.

◆ m_powerElement

std::string MagAOX::app::MagAOXApp< _useINDI >::m_powerElement
protectedinherited

The INDI element name to monitor for this device's power state.

Definition at line 1173 of file MagAOXApp.hpp.

◆ m_powerMgtEnabled

bool MagAOX::app::MagAOXApp< _useINDI >::m_powerMgtEnabled
protectedinherited

Flag controls whether power mgt is used. Set this in the constructor of a derived app. If true, then if after loadConfig the powerDevice and powerChannel are empty, then the app will exit with a critical error.

Definition at line 1166 of file MagAOXApp.hpp.

◆ m_powerOnCounter

int MagAOX::app::MagAOXApp< _useINDI >::m_powerOnCounter
protectedinherited

Counts numer of loops after power on, implements delay for device bootup. If -1, then device was NOT powered off on app startup.

Definition at line 1179 of file MagAOXApp.hpp.

◆ m_powerOnWait

unsigned long MagAOX::app::MagAOXApp< _useINDI >::m_powerOnWait
protectedinherited

Default time in sec to wait for device to boot after power on.

Definition at line 1176 of file MagAOXApp.hpp.

◆ m_powerState

int MagAOX::app::MagAOXApp< _useINDI >::m_powerState
protectedinherited

Current power state, 1=On, 0=Off, -1=Unk.

Definition at line 1183 of file MagAOXApp.hpp.

◆ m_powerTargetElement

std::string MagAOX::app::MagAOXApp< _useINDI >::m_powerTargetElement
protectedinherited

The INDI element name to monitor for this device's power state.

Definition at line 1174 of file MagAOXApp.hpp.

◆ m_powerTargetState

int MagAOX::app::MagAOXApp< _useINDI >::m_powerTargetState
protectedinherited

Current target power state, 1=On, 0=Off, -1=Unk.

Definition at line 1184 of file MagAOXApp.hpp.

◆ m_renumberOnConnect

bool MagAOX::app::zaberLowLevelBinary::m_renumberOnConnect { true }
protected

Whether to renumber the daisy chain during connect.

Definition at line 64 of file zaberLowLevelBinary.hpp.

Referenced by connect(), and loadConfig().

◆ m_renumberPauseMs

int MagAOX::app::zaberLowLevelBinary::m_renumberPauseMs { 750 }
protected

Pause in milliseconds after renumbering before further commands are sent.

Definition at line 73 of file zaberLowLevelBinary.hpp.

Referenced by connect(), and loadConfig().

◆ m_secretsPath

std::string MagAOX::app::MagAOXApp< _useINDI >::m_secretsPath
protectedinherited

Path to the secrets directory, where passwords, etc, are stored.

Definition at line 193 of file MagAOXApp.hpp.

◆ m_self

MagAOXApp< _useINDI > * MagAOX::app::MagAOXApp< _useINDI >::m_self
staticprivateinherited

Static pointer to this (set in constructor). Used to test whether a a MagAOXApp is already instatiated (a fatal error) and used for getting out of static signal handlers.

Definition at line 390 of file MagAOXApp.hpp.

◆ m_serial

◆ m_shutdown

int MagAOX::app::MagAOXApp< _useINDI >::m_shutdown
protectedinherited

Flag to signal it's time to shutdown. When not 0, the main loop exits.

Definition at line 207 of file MagAOXApp.hpp.

◆ m_stageAddress

std::unordered_map<int, size_t> MagAOX::app::zaberLowLevelBinary::m_stageAddress
protected

Map from binary device address to configured stage index.

Definition at line 85 of file zaberLowLevelBinary.hpp.

Referenced by loadStages().

◆ m_stageDiscoveryInitialized

bool MagAOX::app::zaberLowLevelBinary::m_stageDiscoveryInitialized { false }
protected

Whether the active connection has completed an initial discovery pass.

Definition at line 94 of file zaberLowLevelBinary.hpp.

Referenced by loadStages(), and resetConnection().

◆ m_stageName

std::unordered_map<std::string, size_t> MagAOX::app::zaberLowLevelBinary::m_stageName
protected

Map from configured stage name to configured stage index.

Definition at line 91 of file zaberLowLevelBinary.hpp.

Referenced by loadConfig().

◆ m_stages

std::vector<zaberBinaryStage<zaberLowLevelBinary> > MagAOX::app::zaberLowLevelBinary::m_stages
protected

Stage helpers in configuration order.

Definition at line 82 of file zaberLowLevelBinary.hpp.

Referenced by appLogic(), appShutdown(), appStartup(), loadConfig(), loadStages(), onPowerOff(), and recoverFromError().

◆ m_stageSerial

std::unordered_map<std::string, size_t> MagAOX::app::zaberLowLevelBinary::m_stageSerial
protected

Map from configured serial number to configured stage index.

Definition at line 88 of file zaberLowLevelBinary.hpp.

Referenced by loadConfig(), and loadStages().

◆ m_state

The application's state. Never ever set this directly, use state(const stateCodeT & s).

Definition at line 569 of file MagAOXApp.hpp.

◆ m_stateAlert

bool MagAOX::app::MagAOXApp< _useINDI >::m_stateAlert
privateinherited

Definition at line 572 of file MagAOXApp.hpp.

◆ m_stateLogged

int MagAOX::app::MagAOXApp< _useINDI >::m_stateLogged
privateinherited

Counter and flag for use to log errors just once. Never ever access directly, use stateLogged().

Definition at line 577 of file MagAOXApp.hpp.

◆ m_suid

uid_t MagAOX::app::MagAOXApp< _useINDI >::m_suid
privateinherited

The save-set user id of the process.

Definition at line 417 of file MagAOXApp.hpp.

◆ m_sysPath

std::string MagAOX::app::MagAOXApp< _useINDI >::m_sysPath
protectedinherited

The path to the system directory, for PID file, etc.

Definition at line 191 of file MagAOXApp.hpp.

◆ m_useINDI

constexpr bool MagAOX::app::MagAOXApp< _useINDI >::m_useINDI
staticconstexprprotectedinherited

Flag controlling whether INDI is used. If false, then no INDI code executes.

Definition at line 647 of file MagAOXApp.hpp.

◆ pidFileName

std::string MagAOX::app::MagAOXApp< _useINDI >::pidFileName
protectedinherited

The name of the PID file.

Definition at line 497 of file MagAOXApp.hpp.


The documentation for this class was generated from the following file: