API
MagAOX::app::sysMonitor Class Reference

#include <sysMonitor.hpp>

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

Public Types

typedef logger::logManager< MagAOXApp< _useINDI >, logFileRawlogManagerT
 The log manager type. More...
 
typedef logger::logManager< sysMonitor, logFileRaw > logManagerT
 The log manager type. More...
 

Public Member Functions

 sysMonitor ()
 Default c'tor. More...
 
 ~sysMonitor () noexcept
 D'tor, declared and defined for noexcept. More...
 
virtual void setupConfig ()
 Setup the user-defined warning and critical values for core and drive temperatures. More...
 
virtual void loadConfig ()
 Load the warning and critical temperature values for core and drive temperatures. More...
 
virtual int appStartup ()
 Registers all new Indi properties for each of the reported values to publish. More...
 
virtual int appLogic ()
 Implementation of reading and logging each of the measured statistics. More...
 
virtual int appShutdown ()
 Do any needed shutdown tasks; currently nothing in this app. More...
 
int findCPUTemperatures (std::vector< float > &)
 Finds all CPU core temperatures. More...
 
int parseCPUTemperatures (std::string, float &)
 Parses string from system call to find CPU temperatures. More...
 
int criticalCoreTemperature (std::vector< float > &)
 Checks if any core temperatures are warning or critical levels. More...
 
int findCPULoads (std::vector< float > &)
 Finds all CPU core usage loads. More...
 
int parseCPULoads (std::string, float &)
 Parses string from system call to find CPU usage loads. More...
 
int findDiskTemperature (std::vector< std::string > &hdd_names, std::vector< float > &hdd_temps)
 Finds all drive temperatures. More...
 
int parseDiskTemperature (std::string &driveName, float &temp, const std::string &line)
 Parses string from system call to find drive temperatures. More...
 
int criticalDiskTemperature (std::vector< float > &)
 Checks if any drive temperatures are warning or critical levels. More...
 
int findDiskUsage (float &, float &, float &)
 Finds usages of space for following directory paths: /; /data; /boot. More...
 
int parseDiskUsage (std::string, float &, float &, float &)
 Parses string from system call to find drive usage space. More...
 
int findRamUsage (float &)
 Finds current RAM usage. More...
 
int parseRamUsage (std::string, float &)
 Parses string from system call to find RAM usage. More...
 
int shutdown ()
 Get the value of the shutdown flag. More...
 
virtual void setDefaults (int argc, char **argv)
 Set the paths for config files. More...
 
virtual void setupBasicConfig ()
 The basic MagAO-X configuration setup method. Should not normally be overridden. More...
 
virtual void loadBasicConfig ()
 The basic MagAO-X configuration processing method. Should not normally be overridden. More...
 
virtual void checkConfig ()
 Check for unused and unrecognized config options and settings. More...
 
virtual int execute ()
 The execute method implementing the standard main loop. Should not normally be overridden. More...
 
int telem (const typename telT::messageT &msg)
 Make a telemetry recording. More...
 
int telem ()
 Make a telemetry recording, for an empty record. More...
 
int setupConfig (appConfigurator &config)
 Setup an application configurator for the device section. More...
 
int loadConfig (appConfigurator &config)
 Load the device section from an application configurator. More...
 
int checkRecordTimes (const telT &tel, telTs... tels)
 Check the time of the last record for each telemetry type and make an entry if needed. More...
 
int checkRecordTimes (timespec &ts, const telT &tel, telTs... tels)
 Worker function to actually perform the record time checking logic. More...
 
int checkRecordTimes (timespec &ts)
 Empty function called at the end of the template list. More...
 
Telemeter Interface
int checkRecordTimes ()
 
int recordTelem (const telem_coreloads *)
 
int recordTelem (const telem_coretemps *)
 
int recordTelem (const telem_drivetemps *)
 
int recordTelem (const telem_usage *)
 
int recordTelem (const telem_chrony_status *)
 
int recordTelem (const telem_chrony_stats *)
 
int recordCoreLoads (bool force=false)
 
int recordCoreTemps (bool force=false)
 
int recordDriveTemps (bool force=false)
 
int recordUsage (bool force=false)
 
int recordChronyStatus (bool force=false)
 
int recordChronyStats (bool force=false)
 
Threads
template<class thisPtr , class Function >
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. More...
 
Member Accessors
std::string configName ()
 Get the config name. More...
 
std::string configDir ()
 Get the config directory. More...
 
std::string driverInName ()
 Get the INDI input FIFO file name. More...
 
std::string driverOutName ()
 Get the INDI output FIFO file name. More...
 
std::string driverCtrlName ()
 Get the INDI control FIFO file name. More...
 

Public Attributes

logManagerT m_tel
 
double m_maxInterval
 The maximum interval, in seconds, between telemetry records. Default is 10.0 seconds. More...
 

Protected Member Functions

int updateVals ()
 Updates Indi property values of all system statistics. More...
 

Protected Attributes

int m_warningCoreTemp = 0
 User defined warning temperature for CPU cores. More...
 
int m_criticalCoreTemp = 0
 User defined critical temperature for CPU cores. More...
 
int m_warningDiskTemp = 0
 User defined warning temperature for drives. More...
 
int m_criticalDiskTemp = 0
 User defined critical temperature for drives. More...
 
pcf::IndiProperty m_indiP_core_loads
 Indi variable for reporting CPU core loads. More...
 
pcf::IndiProperty m_indiP_core_temps
 Indi variable for reporting CPU core temperature(s) More...
 
pcf::IndiProperty m_indiP_drive_temps
 Indi variable for reporting drive temperature(s) More...
 
pcf::IndiProperty m_indiP_usage
 Indi variable for reporting drive usage of all paths. More...
 
std::vector< float > m_coreTemps
 List of current core temperature(s) More...
 
std::vector< float > m_coreLoads
 List of current core load(s) More...
 
std::vector< std::string > m_diskNameList
 vector of names of the hard disks to monitor More...
 
std::vector< std::string > m_diskNames
 vector of names of the hard disks returned by hdd_temp More...
 
std::vector< float > m_diskTemps
 vector of current disk temperature(s) More...
 
float m_rootUsage = 0
 Disk usage in root path as a value out of 100. More...
 
float m_dataUsage = 0
 Disk usage in /data path as a value out of 100. More...
 
float m_bootUsage = 0
 Disk usage in /boot path as a value out of 100. More...
 
float m_ramUsage = 0
 RAM usage as a decimal value between 0 and 1. More...
 
std::string MagAOXPath
 The base path of the MagAO-X system. More...
 
std::string m_configName
 The name of the configuration file (minus .conf). More...
 
std::string m_configDir
 The path to configuration files for MagAOX. More...
 
std::string m_configBase
 The name of a base config class for this app (minus .conf). More...
 
std::string m_calibDir
 The path to calibration files for MagAOX. More...
 
std::string sysPath
 The path to the system directory, for PID file, etc. More...
 
std::string secretsPath
 Path to the secrets directory, where passwords, etc, are stored. More...
 
unsigned long m_loopPause {MAGAOX_default_loopPause}
 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. More...
 
int m_shutdown {0}
 Flag to signal it's time to shutdown. When not 0, the main loop exits. More...
 
cpusets

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

std::string m_cpusetPath {MAGAOX_cpusetPath}
 

Private Member Functions

int clearFSMAlert ()
 Clear the FSM alert state. More...
 
sysMonitorderived ()
 Access the derived class. More...
 

Friends

class dev::telemeter< sysMonitor >
 

Chrony Status

std::string m_chronySourceMac
 
std::string m_chronySourceIP
 
std::string m_chronySynch
 
double m_chronySystemTime {0}
 
double m_chronyLastOffset {0}
 
double m_chronyRMSOffset {0}
 
double m_chronyFreq {0}
 
double m_chronyResidFreq {0}
 
double m_chronySkew {0}
 
double m_chronyRootDelay {0}
 
double m_chronyRootDispersion {0}
 
double m_chronyUpdateInt {0}
 
std::string m_chronyLeap
 
pcf::IndiProperty m_indiP_chronyStatus
 
pcf::IndiProperty m_indiP_chronyStats
 
int findChronyStatus ()
 Finds current chronyd status. More...
 

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. More...
 
pid_t m_pid {0}
 This process's PID. More...
 
int lockPID ()
 Attempt to lock the PID by writing it to a file. Fails if a process is already running with the same config name. More...
 
int unlockPID ()
 Remove the PID file. More...
 

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, indiCallBackm_indiNewCallBacks
 Map to hold the NewProperty indiCallBacks for this App, with fast lookup by property name. More...
 
std::unordered_map< std::string, indiCallBackm_indiSetCallBacks
 Map to hold the SetProperty indiCallBacks for this App, with fast lookup by property name. More...
 
bool m_allDefsReceived {false}
 Flag indicating that all registered Set properties have been updated since last Get. More...
 
std::string m_driverInName
 Full path name of the INDI driver input FIFO. More...
 
std::string m_driverOutName
 Full path name of the INDI driver output FIFO. More...
 
std::string m_driverCtrlName
 Full path name of the INDI driver control FIFO. More...
 
pcf::IndiProperty m_indiP_state
 indi Property to report the application state. More...
 
pcf::IndiProperty m_indiP_clearFSMAlert
 indi Property to clear an FSM alert. More...
 
indiDriver< MagAOXApp > * m_indiDriver {nullptr}
 The INDI driver wrapper. Constructed and initialized by execute, which starts and stops communications. More...
 
std::mutex m_indiMutex
 Mutex for locking INDI communications. More...
 
int createINDIFIFOS ()
 Create the INDI FIFOs. More...
 
int startINDI ()
 Start INDI Communications. More...
 
template<typename T >
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. More...
 
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. More...
 
template<typename T >
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. More...
 
template<typename T >
void updateIfChanged (pcf::IndiProperty &p, const std::vector< std::string > &els, const std::vector< T > &newVals)
 Update an INDI property if values have changed. More...
 
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. More...
 
template<typename T >
int indiTargetUpdate (pcf::IndiProperty &localProperty, T &localTarget, const pcf::IndiProperty &remoteProperty, bool setBusy=true)
 Get the target element value from an new property. More...
 
template<typename T >
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) More...
 
int sendNewProperty (const pcf::IndiProperty &ipSend)
 Send a newProperty command to another device (using the INDI Client interface) More...
 
int sendNewStandardIndiToggle (const std::string &device, const std::string &property, bool onoff)
 Send a new property commmand for a standard toggle switch. More...
 
int newCallBack_clearFSMAlert (const pcf::IndiProperty &ipRecv)
 The callback called by the static version, to actually process the FSM Alert Clear request. More...
 
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. More...
 
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. More...
 
template<typename T >
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. More...
 
int createROIndiNumber (pcf::IndiProperty &prop, const std::string &propName, const std::string &propLabel="", const std::string &propGroup="")
 Create a ReadOnly INDI Number property. More...
 
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. More...
 
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. More...
 
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. More...
 
int createStandardIndiSelectionSw (pcf::IndiProperty &prop, const std::string &name, const std::vector< std::string > &elements, const std::string &label="", const std::string &group="")
 Create a standard R/W INDI selection (one of many) switch with vector of elements using the element strings as their own labels. More...
 
int registerIndiPropertyReadOnly (pcf::IndiProperty &prop)
 Register an INDI property which is read only. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
void sendGetPropertySetList (bool all=false)
 
void handleDefProperty (const pcf::IndiProperty &ipRecv)
 Handler for the DEF INDI properties notification. More...
 
void handleGetProperties (const pcf::IndiProperty &ipRecv)
 Handler for the get INDI properties request. More...
 
void handleNewProperty (const pcf::IndiProperty &ipRecv)
 Handler for the new INDI property request. More...
 
void handleSetProperty (const pcf::IndiProperty &ipRecv)
 Handler for the set INDI property request. More...
 
typedef std::pair< std::string, indiCallBackcallBackValueType
 Value type of the indiCallBack map. More...
 
typedef std::unordered_map< std::string, indiCallBack >::iterator callBackIterator
 Iterator type of the indiCallBack map. More...
 
typedef std::pair< callBackIterator, bool > callBackInsertResult
 Return type of insert on the indiCallBack map. More...
 
constexpr static bool m_useINDI = _useINDI
 Flag controlling whether INDI is used. If false, then no INDI code executes. More...
 
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. More...
 

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 {false}
 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. More...
 
std::string m_powerDevice
 The INDI device name of the power controller. More...
 
std::string m_powerChannel
 The INDI property name of the channel controlling this device's power. More...
 
std::string m_powerElement {"state"}
 The INDI element name to monitor for this device's power state. More...
 
std::string m_powerTargetElement {"target"}
 The INDI element name to monitor for this device's power state. More...
 
unsigned long m_powerOnWait {0}
 Time in sec to wait for device to boot after power on. More...
 
int m_powerOnCounter {-1}
 Counts numer of loops after power on, implements delay for device bootup. If -1, then device was NOT powered off on app startup. More...
 
int m_powerState {-1}
 Current power state, 1=On, 0=Off, -1=Unk. More...
 
int m_powerTargetState {-1}
 Current target power state, 1=On, 0=Off, -1=Unk. More...
 
pcf::IndiProperty m_indiP_powerChannel
 INDI property used to communicate power state. More...
 
virtual int onPowerOff ()
 This method is called when the change to poweroff is detected. More...
 
virtual int whilePowerOff ()
 This method is called while the power is off, once per FSM loop. More...
 
bool powerOnWaitElapsed ()
 This method tests whether the power on wait time has elapsed. More...
 
int powerState ()
 Returns the current power state. More...
 
int powerStateTarget ()
 Returns the target power state. More...
 
 INDI_SETCALLBACK_DECL (MagAOXApp, m_indiP_powerChannel)
 

Set Latency

This thread spins up the cpus to minimize latency when requested

bool m_setLatency {false}
 
int m_setlatThreadPrio {0}
 Priority of the set latency thread, should normally be > 00. More...
 
std::thread m_setlatThread
 A separate thread for the actual setting of low latency. More...
 
bool m_setlatThreadInit {true}
 Synchronizer to ensure set lat thread initializes before doing dangerous things. More...
 
pid_t m_setlatThreadID {0}
 Set latency thread ID. More...
 
pcf::IndiProperty m_setlatThreadProp
 The property to hold the setlat thread details. More...
 
pcf::IndiProperty m_indiP_setlat
 
void setlatThreadExec ()
 Execute the frame grabber main loop. More...
 
 INDI_NEWCALLBACK_DECL (sysMonitor, m_indiP_setlat)
 
static void setlatThreadStart (sysMonitor *s)
 Thread starter, called by threadStart on thread construction. Calls setlatThreadExec. More...
 

Logging

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

Application State

stateCodes::stateCodeT state ()
 Get the current state code. More...
 
void state (const stateCodes::stateCodeT &s, bool stateAlert=false)
 Set the current state code. More...
 
int stateLogged ()
 Updates and returns the value of m_stateLogged. Will be 0 on first call after a state change, >0 afterwards. More...
 
stateCodes::stateCodeT m_state {stateCodes::UNINITIALIZED}
 The application's state. Never ever set this directly, use state(const stateCodeT & s). More...
 
bool m_stateAlert {false}
 
bool m_gitAlert {false}
 
int m_stateLogged {0}
 Counter and flag for use to log errors just once. Never ever access directly, use stateLogged(). More...
 

Signal Handling

libMagAOX/logger/types/software_log.hpp

static MagAOXAppm_self = nullptr
 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. More...
 
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. More...
 
int setSigTermHandler ()
 Sets the handler for SIGTERM, SIGQUIT, and SIGINT. More...
 
void handlerSigTerm (int signum, siginfo_t *siginf, void *ucont)
 Handles SIGTERM, SIGQUIT, and SIGINT. Sets m_shutdown to 1 and logs the signal. More...
 

Privilege Management

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

Detailed Description

MagAO-X application to read and report system statistics

Definition at line 41 of file sysMonitor.hpp.

Member Typedef Documentation

◆ callBackInsertResult

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

Return type of insert on the indiCallBack map.

Definition at line 561 of file MagAOXApp.hpp.

◆ callBackIterator

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

Iterator type of the indiCallBack map.

Definition at line 558 of file MagAOXApp.hpp.

◆ callBackValueType

template<bool _useINDI = true>
typedef std::pair<std::string, indiCallBack> MagAOX::app::MagAOXApp< _useINDI >::callBackValueType
inherited

Value type of the indiCallBack map.

Definition at line 555 of file MagAOXApp.hpp.

◆ logManagerT [1/2]

The log manager type.

Definition at line 54 of file telemeter.hpp.

◆ logManagerT [2/2]

template<bool _useINDI = true>
typedef logger::logManager<MagAOXApp<_useINDI>, logFileRaw> MagAOX::app::MagAOXApp< _useINDI >::logManagerT
inherited

The log manager type.

Definition at line 82 of file MagAOXApp.hpp.

Constructor & Destructor Documentation

◆ sysMonitor()

MagAOX::app::sysMonitor::sysMonitor ( )
inline

Default c'tor.

Definition at line 333 of file sysMonitor.hpp.

◆ ~sysMonitor()

MagAOX::app::sysMonitor::~sysMonitor ( )
inlinenoexcept

D'tor, declared and defined for noexcept.

Definition at line 84 of file sysMonitor.hpp.

Member Function Documentation

◆ _handlerSigTerm()

template<bool _useINDI>
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 1709 of file MagAOXApp.hpp.

◆ appLogic()

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

Implementation of reading and logging each of the measured statistics.

Implements MagAOX::app::MagAOXApp< _useINDI >.

Definition at line 426 of file sysMonitor.hpp.

◆ appShutdown()

int MagAOX::app::sysMonitor::appShutdown ( )
virtual

Do any needed shutdown tasks; currently nothing in this app.

Implements MagAOX::app::MagAOXApp< _useINDI >.

Definition at line 529 of file sysMonitor.hpp.

◆ appStartup()

int MagAOX::app::sysMonitor::appStartup ( )
virtual

Registers all new Indi properties for each of the reported values to publish.

Implements MagAOX::app::MagAOXApp< _useINDI >.

Definition at line 361 of file sysMonitor.hpp.

◆ checkConfig()

template<bool _useINDI>
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 1327 of file MagAOXApp.hpp.

◆ checkRecordTimes() [1/4]

int MagAOX::app::sysMonitor::checkRecordTimes ( )
inline

Definition at line 1293 of file sysMonitor.hpp.

◆ checkRecordTimes() [2/4]

int MagAOX::app::dev::telemeter< sysMonitor >::checkRecordTimes ( const telT &  tel,
telTs...  tels 
)
inherited

Check the time of the last record for each telemetry type and make an entry if needed.

This must be called from derivedT::checkRecordTimes(), with one template parameter for ach telemetry log type being recorded.

Returns
0 on succcess
-1 on error
Parameters
[in]tel[unused] object of the telemetry type to record
[in]tels[unused] objects of the additional telemetry types to record

Definition at line 131 of file telemeter.hpp.

◆ checkRecordTimes() [3/4]

int MagAOX::app::dev::telemeter< sysMonitor >::checkRecordTimes ( timespec &  ts)
inherited

Empty function called at the end of the template list.

Returns
0 on succcess
-1 on error
Parameters
[in]ts[unused] the timestamp that records are compared to

Definition at line 152 of file telemeter.hpp.

◆ checkRecordTimes() [4/4]

int MagAOX::app::dev::telemeter< sysMonitor >::checkRecordTimes ( timespec &  ts,
const telT &  tel,
telTs...  tels 
)
inherited

Worker function to actually perform the record time checking logic.

Recursively calls itself until the variadic template list is exhausted.

Returns
0 on succcess
-1 on error
Parameters
[in]ts[unused] the timestamp that records are compared to
[in]tel[unused] objects of the telemetry type to record
[in]tels[unused] objects of the additional telemetry types to record

Definition at line 142 of file telemeter.hpp.

◆ clearFSMAlert()

template<bool _useINDI>
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 2155 of file MagAOXApp.hpp.

◆ configDir()

template<bool _useINDI>
std::string MagAOX::app::MagAOXApp< _useINDI >::configDir
inherited

Get the config directory.

Returns
the current value of m_configDir

Definition at line 3247 of file MagAOXApp.hpp.

◆ configLog()

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

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 1650 of file MagAOXApp.hpp.

◆ configName()

template<bool _useINDI>
std::string MagAOX::app::MagAOXApp< _useINDI >::configName
inherited

Get the config name.

Returns
the current value of m_configName

Definition at line 3241 of file MagAOXApp.hpp.

Referenced by MagAOXApp_tests::MagAOXApp_test::configName(), MagAOX::app::andorCtrl::loadConfig(), and MagAOX::app::andorCtrl::writeConfig().

◆ createINDIFIFOS()

template<bool _useINDI>
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 2603 of file MagAOXApp.hpp.

◆ createROIndiNumber()

template<bool _useINDI>
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 2294 of file MagAOXApp.hpp.

Referenced by MagAOX::app::picamCtrl::appStartup(), and MagAOX::app::zaberCtrl::appStartup().

◆ createROIndiText()

template<bool _useINDI>
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 2209 of file MagAOXApp.hpp.

◆ createStandardIndiNumber()

template<bool _useINDI>
template<typename T >
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 2246 of file MagAOXApp.hpp.

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

◆ createStandardIndiRequestSw()

template<bool _useINDI>
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 2352 of file MagAOXApp.hpp.

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

◆ createStandardIndiSelectionSw() [1/2]

template<bool _useINDI>
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 2426 of file MagAOXApp.hpp.

◆ createStandardIndiSelectionSw() [2/2]

template<bool _useINDI>
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 2383 of file MagAOXApp.hpp.

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

◆ createStandardIndiText()

template<bool _useINDI>
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 2180 of file MagAOXApp.hpp.

◆ createStandardIndiToggleSw()

template<bool _useINDI>
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 2321 of file MagAOXApp.hpp.

Referenced by MagAOX::app::siglentSDG::appStartup(), MagAOX::app::streamWriter::appStartup(), and appStartup().

◆ criticalCoreTemperature()

int MagAOX::app::sysMonitor::criticalCoreTemperature ( std::vector< float > &  v)

Checks if any core temperatures are warning or critical levels.

Warning and critical temperatures are either user-defined or generated based on initial core temperature values

Returns
1 if a temperature value is at the warning level
2 if a temperature value is at critical level
0 otherwise (all temperatures are considered normal)
Parameters
[in]vthe vector of temperature values to be checked

Definition at line 676 of file sysMonitor.hpp.

Referenced by appLogic().

◆ criticalDiskTemperature()

int MagAOX::app::sysMonitor::criticalDiskTemperature ( std::vector< float > &  v)

Checks if any drive temperatures are warning or critical levels.

Warning and critical temperatures are either user-defined or generated based on initial drive temperature values

Returns
1 if a temperature value is at the warning level
2 if a temperature value is at critical level
0 otherwise (all temperatures are considered normal)
Parameters
[in]vthe vector of temperature values to be checked

Definition at line 874 of file sysMonitor.hpp.

Referenced by appLogic().

◆ derived()

sysMonitor & MagAOX::app::dev::telemeter< sysMonitor >::derived ( )
inlineprivateinherited

Access the derived class.

Definition at line 157 of file telemeter.hpp.

◆ driverCtrlName()

template<bool _useINDI>
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 3265 of file MagAOXApp.hpp.

◆ driverInName()

template<bool _useINDI>
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 3253 of file MagAOXApp.hpp.

◆ driverOutName()

template<bool _useINDI>
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 3259 of file MagAOXApp.hpp.

◆ execute()

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

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

Performs final startup steps. That is:

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 1370 of file MagAOXApp.hpp.

◆ findChronyStatus()

int MagAOX::app::sysMonitor::findChronyStatus ( )

Finds current chronyd status.

Uses the chrony tracking command

Returns
-1 on error
0 on success

Definition at line 1051 of file sysMonitor.hpp.

Referenced by appLogic().

◆ findCPULoads()

int MagAOX::app::sysMonitor::findCPULoads ( std::vector< float > &  loads)

Finds all CPU core usage loads.

Makes system call and then parses result to add usage loads to vector of values

Returns
-1 on error with system command or output file reading
0 on completion
Parameters
[out]loadsthe vector of measured CPU usages

Definition at line 700 of file sysMonitor.hpp.

Referenced by appLogic().

◆ findCPUTemperatures()

int MagAOX::app::sysMonitor::findCPUTemperatures ( std::vector< float > &  temps)

Finds all CPU core temperatures.

Makes system call and then parses result to add temperatures to vector of values

Returns
-1 on error with system command or output reading
0 on successful completion otherwise
Parameters
[out]tempsthe vector of measured CPU core temperatures

Definition at line 545 of file sysMonitor.hpp.

Referenced by appLogic().

◆ findDiskTemperature()

int MagAOX::app::sysMonitor::findDiskTemperature ( std::vector< std::string > &  hdd_names,
std::vector< float > &  hdd_temps 
)

Finds all drive temperatures.

Makes 'hddtemp' system call and then parses result to add temperatures to vector of values For hard drive temp utility: wget http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/h/hddtemp-0.3-0.31.beta15.el7.x86_64.rpm su rpm -Uvh hddtemp-0.3-0.31.beta15.el7.x86_64.rpm Check install with rpm -q -a | grep -i hddtemp

Returns
-1 on error with system command or output reading
0 on successful completion otherwise
Parameters
[out]hdd_namesthe names of the drives reported by hddtemp
[out]hdd_tempsthe vector of measured drive temperatures

Definition at line 768 of file sysMonitor.hpp.

Referenced by appLogic(), and appStartup().

◆ findDiskUsage()

int MagAOX::app::sysMonitor::findDiskUsage ( float &  rootUsage,
float &  dataUsage,
float &  bootUsage 
)

Finds usages of space for following directory paths: /; /data; /boot.

These usage values are stored as integer values between 0 and 100 (e.g. value of 39 means directory is 39% full) If directory is not found, space usage value will remain 0 \TODO: What about multiple drives? What does this do?

Returns
-1 on error with system command or output reading
0 if at least one of the return values is found
Parameters
[out]rootUsagethe return value for usage in root path
[out]dataUsagethe return value for usage in /data path
[out]bootUsagethe return value for usage in /boot path

Definition at line 897 of file sysMonitor.hpp.

Referenced by appLogic().

◆ findRamUsage()

int MagAOX::app::sysMonitor::findRamUsage ( float &  ramUsage)

Finds current RAM usage.

This usage value is stored as a decimal value between 0 and 1 (e.g. value of 0.39 means RAM usage is 39%)

Returns
-1 on error with system command or output reading
0 on completion
Parameters
[out]ramUsagethe return value for current RAM usage

Definition at line 989 of file sysMonitor.hpp.

Referenced by appLogic().

◆ handleDefProperty()

template<bool _useINDI>
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 2759 of file MagAOXApp.hpp.

◆ handleGetProperties()

template<bool _useINDI>
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 2765 of file MagAOXApp.hpp.

◆ handleNewProperty()

template<bool _useINDI>
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 2827 of file MagAOXApp.hpp.

Referenced by MagAOXApp_tests::SCENARIO().

◆ handlerSigTerm()

template<bool _useINDI>
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 1718 of file MagAOXApp.hpp.

Referenced by MagAOX::app::MagAOXApp< _useINDI >::_handlerSigTerm().

◆ handleSetProperty()

template<bool _useINDI>
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 2849 of file MagAOXApp.hpp.

◆ INDI_NEWCALLBACK_DECL()

MagAOX::app::sysMonitor::INDI_NEWCALLBACK_DECL ( sysMonitor  ,
m_indiP_setlat   
)

◆ INDI_SETCALLBACK_DECL()

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

◆ indiTargetUpdate()

template<bool _useINDI>
template<typename T >
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 2951 of file MagAOXApp.hpp.

Referenced by MagAOX::app::picoMotorCtrl::newCallBack_picopos().

◆ loadBasicConfig()

template<bool _useINDI>
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 1278 of file MagAOXApp.hpp.

◆ loadConfig() [1/2]

void MagAOX::app::sysMonitor::loadConfig ( )
virtual

Load the warning and critical temperature values for core and drive temperatures.

Definition at line 350 of file sysMonitor.hpp.

◆ loadConfig() [2/2]

int MagAOX::app::dev::telemeter< sysMonitor >::loadConfig ( appConfigurator &  config)
inherited

Load the device section from an application configurator.

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

Definition at line 95 of file telemeter.hpp.

◆ lockPID()

template<bool _useINDI>
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 1796 of file MagAOXApp.hpp.

◆ log() [1/2]

template<bool _useINDI>
template<typename logT , int retval>
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 1590 of file MagAOXApp.hpp.

Referenced by MagAOX::app::zylaCtrl::acquireAndCheckValid(), MagAOX::app::streamWriter::allocate_circbufs(), MagAOX::app::streamWriter::allocate_xrif(), MagAOX::app::andorCtrl::appLogic(), MagAOX::app::cameraSim::appLogic(), MagAOX::app::filterWheelCtrl::appLogic(), MagAOX::app::ocam2KCtrl::appLogic(), MagAOX::app::picamCtrl::appLogic(), MagAOX::app::qhyCtrl::appLogic(), MagAOX::app::trippLitePDU::appLogic(), MagAOX::app::xt1121Ctrl::appLogic(), MagAOX::app::xt1121DCDU::appLogic(), MagAOX::app::zylaCtrl::appLogic(), MagAOX::app::acronameUsbHub::appStartup(), MagAOX::app::andorCtrl::appStartup(), MagAOX::app::cameraSim::appStartup(), MagAOX::app::filterWheelCtrl::appStartup(), MagAOX::app::hsfwCtrl::appStartup(), MagAOX::app::ocam2KCtrl::appStartup(), MagAOX::app::picamCtrl::appStartup(), MagAOX::app::picoMotorCtrl::appStartup(), MagAOX::app::qhyCtrl::appStartup(), MagAOX::app::siglentSDG::appStartup(), MagAOX::app::smc100ccCtrl::appStartup(), MagAOX::app::streamWriter::appStartup(), appStartup(), MagAOX::app::trippLitePDU::appStartup(), MagAOX::app::xt1121DCDU::appStartup(), MagAOX::app::zaberCtrl::appStartup(), MagAOX::app::zylaCtrl::appStartup(), MagAOX::app::andorCtrl::cameraSelect(), MagAOX::app::zylaCtrl::cameraSelect(), visxCtrl.xapp.VisX::cancel_exposure(), MagAOX::app::siglentSDG::changeOutp(), MagAOX::app::xt1121Ctrl::channelSetCallback(), MagAOX::app::andorCtrl::configureAcquisition(), MagAOX::app::picamCtrl::configureAcquisition(), MagAOX::app::qhyCtrl::configureAcquisition(), MagAOX::app::zylaCtrl::configureAcquisition(), visxCtrl.xapp.VisX::finalize_exposure(), findChronyStatus(), findCPULoads(), findCPUTemperatures(), findDiskUsage(), findRamUsage(), MagAOX::app::ocam2KCtrl::getEMGain(), MagAOX::app::andorCtrl::getFPS(), MagAOX::app::ocam2KCtrl::getFPS(), MagAOX::app::xt1121Ctrl::getState(), MagAOX::app::zylaCtrl::getTemp(), MagAOX::app::ocam2KCtrl::getTemps(), visxCtrl.xapp.VisX::handle_expose(), visxCtrl.xapp.VisX::handle_exptime(), visxCtrl.xapp.VisX::handle_gain(), audibleAlerts.core.AudibleAlerts::handle_personality_switch(), audibleAlerts.core.AudibleAlerts::handle_soundboard_switch(), audibleAlerts.core.AudibleAlerts::handle_speech_request(), audibleAlerts.core.AudibleAlerts::handle_speech_text(), visxCtrl.xapp.VisX::handle_temp_ccd(), MagAOX::app::filterWheelCtrl::home(), dbIngest.dbIngest::ingest_line(), MagAOX::app::streamWriter::initialize_xrif(), dbIngest.dbIngest::launch_follower(), MagAOX::app::zylaCtrl::loadImageIntoStream(), audibleAlerts.core.AudibleAlerts::loop(), visxCtrl.xapp.VisX::loop(), MagAOX::app::ttmModulator::modTTM(), MagAOX::app::hsfwCtrl::moveTo(), MagAOX::app::zaberCtrl::moveTo(), MagAOX::app::filterWheelCtrl::moveToRaw(), MagAOX::app::filterWheelCtrl::moveToRawRelative(), MagAOX::app::picoMotorCtrl::newCallBack_picopos(), MagAOX::app::ttmModulator::offset12(), MagAOX::app::filterWheelCtrl::onPowerOnConnect(), audibleAlerts.core.AudibleAlerts::preprocess(), audibleAlerts.core.AudibleAlerts::reaction_handler(), MagAOX::app::zylaCtrl::reconfig(), dbIngest.dbIngest::rescan_files(), MagAOX::app::ocam2KCtrl::resetEMProtection(), MagAOX::app::ttmModulator::restTTM(), MagAOX::app::ocam2KCtrl::setEMGain(), MagAOX::app::picamCtrl::setEMGain(), MagAOX::app::ocam2KCtrl::setFPS(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::andorCtrl::setReadoutSpeed(), MagAOX::app::andorCtrl::setShutter(), MagAOX::app::ocam2KCtrl::setSynchro(), MagAOX::app::ocam2KCtrl::setTempControl(), MagAOX::app::zylaCtrl::setTempControl(), MagAOX::app::ocam2KCtrl::setTempSetPt(), MagAOX::app::ttmModulator::setTTM(), corAlign.corAlign::setup(), efcControl.efcControl::setup(), visxCtrl.xapp.VisX::setup(), MagAOX::app::andorCtrl::setVShiftSpeed(), MagAOX::app::andorCtrl::startAcquisition(), MagAOX::app::zylaCtrl::startAcquisition(), MagAOX::app::zaberCtrl::startHoming(), MagAOX::app::filterWheelCtrl::stop(), MagAOX::app::zaberCtrl::stop(), visxCtrl.xapp.VisX::subscribe_to_other_devices(), MagAOX::app::acronameUsbHub::turnOutletOff(), MagAOX::app::trippLitePDU::turnOutletOff(), MagAOX::app::xt1121DCDU::turnOutletOff(), MagAOX::app::acronameUsbHub::turnOutletOn(), MagAOX::app::trippLitePDU::turnOutletOn(), MagAOX::app::xt1121DCDU::turnOutletOn(), MagAOX::app::acronameUsbHub::updateOutletState(), and MagAOX::app::xt1121DCDU::updateOutletState().

◆ log() [2/2]

◆ logMessage()

template<bool _useINDI>
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 1607 of file MagAOXApp.hpp.

◆ newCallBack_clearFSMAlert()

template<bool _useINDI>
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 the new property request.

Definition at line 3130 of file MagAOXApp.hpp.

◆ onPowerOff()

template<bool _useINDI>
int MagAOX::app::MagAOXApp< _useINDI >::onPowerOff
protectedvirtualinherited

◆ parseCPULoads()

int MagAOX::app::sysMonitor::parseCPULoads ( std::string  line,
float &  loadVal 
)

Parses string from system call to find CPU usage loads.

When a valid string is read in, the value from that string is stored

Returns
-1 on invalid string being read in
0 on completion and storing of value
Parameters
[in]linethe string to be parsed
[out]loadValthe return value from the string

Definition at line 738 of file sysMonitor.hpp.

Referenced by findCPULoads(), and SCENARIO().

◆ parseCPUTemperatures()

int MagAOX::app::sysMonitor::parseCPUTemperatures ( std::string  line,
float &  temps 
)

Parses string from system call to find CPU temperatures.

When a valid string is read in, the value from that string is stored

Returns
-1 on invalid string being read in
0 on completion and storing of value
Parameters
[in]linethe string to be parsed
[out]tempsthe return value from the string

Definition at line 578 of file sysMonitor.hpp.

Referenced by findCPUTemperatures(), and SCENARIO().

◆ parseDiskTemperature()

int MagAOX::app::sysMonitor::parseDiskTemperature ( std::string &  driveName,
float &  temp,
const std::string &  line 
)

Parses string from system call to find drive temperatures.

When a valid string is read in, the drive name and value from that string is stored

Returns
-1 on invalid string being read in
0 on completion and storing of value
Parameters
[out]driveNamethe name of the drive
[out]tempthe return value from the string
[in]linethe string to be parsed

Definition at line 811 of file sysMonitor.hpp.

Referenced by SCENARIO().

◆ parseDiskUsage()

int MagAOX::app::sysMonitor::parseDiskUsage ( std::string  line,
float &  rootUsage,
float &  dataUsage,
float &  bootUsage 
)

Parses string from system call to find drive usage space.

When a valid string is read in, the value from that string is stored

Returns
-1 on invalid string being read in
0 on completion and storing of value
Parameters
[in]linethe string to be parsed
[out]rootUsagethe return value for usage in root path
[out]dataUsagethe return value for usage in /data path
[out]bootUsagethe return value for usage in /boot path

Definition at line 929 of file sysMonitor.hpp.

Referenced by findDiskUsage(), and SCENARIO().

◆ parseRamUsage()

int MagAOX::app::sysMonitor::parseRamUsage ( std::string  line,
float &  ramUsage 
)

Parses string from system call to find RAM usage.

When a valid string is read in, the value from that string is stored

Returns
-1 on invalid string being read in
0 on completion and storing of value
Parameters
[in]linethe string to be parsed
[out]ramUsagethe return value for current RAM usage

Definition at line 1019 of file sysMonitor.hpp.

Referenced by findRamUsage(), and SCENARIO().

◆ powerOnWaitElapsed()

template<bool _useINDI>
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 3163 of file MagAOXApp.hpp.

Referenced by MagAOX::app::picoMotorCtrl::appLogic(), and MagAOX::app::smc100ccCtrl::appLogic().

◆ powerState()

template<bool _useINDI>
int MagAOX::app::MagAOXApp< _useINDI >::powerState
inherited

◆ powerStateTarget()

template<bool _useINDI>
int MagAOX::app::MagAOXApp< _useINDI >::powerStateTarget
inherited

◆ recordChronyStats()

int MagAOX::app::sysMonitor::recordChronyStats ( bool  force = false)

Definition at line 1457 of file sysMonitor.hpp.

Referenced by findChronyStatus(), and recordTelem().

◆ recordChronyStatus()

int MagAOX::app::sysMonitor::recordChronyStatus ( bool  force = false)

Definition at line 1436 of file sysMonitor.hpp.

Referenced by findChronyStatus(), and recordTelem().

◆ recordCoreLoads()

int MagAOX::app::sysMonitor::recordCoreLoads ( bool  force = false)

Definition at line 1328 of file sysMonitor.hpp.

Referenced by appLogic(), and recordTelem().

◆ recordCoreTemps()

int MagAOX::app::sysMonitor::recordCoreTemps ( bool  force = false)

Definition at line 1357 of file sysMonitor.hpp.

Referenced by appLogic(), and recordTelem().

◆ recordDriveTemps()

int MagAOX::app::sysMonitor::recordDriveTemps ( bool  force = false)

Definition at line 1385 of file sysMonitor.hpp.

Referenced by appLogic(), and recordTelem().

◆ recordTelem() [1/6]

int MagAOX::app::sysMonitor::recordTelem ( const telem_chrony_stats )

Definition at line 1323 of file sysMonitor.hpp.

◆ recordTelem() [2/6]

int MagAOX::app::sysMonitor::recordTelem ( const telem_chrony_status )

Definition at line 1318 of file sysMonitor.hpp.

◆ recordTelem() [3/6]

int MagAOX::app::sysMonitor::recordTelem ( const telem_coreloads )

Definition at line 1298 of file sysMonitor.hpp.

◆ recordTelem() [4/6]

int MagAOX::app::sysMonitor::recordTelem ( const telem_coretemps )

Definition at line 1303 of file sysMonitor.hpp.

◆ recordTelem() [5/6]

int MagAOX::app::sysMonitor::recordTelem ( const telem_drivetemps )

Definition at line 1308 of file sysMonitor.hpp.

◆ recordTelem() [6/6]

int MagAOX::app::sysMonitor::recordTelem ( const telem_usage )

Definition at line 1313 of file sysMonitor.hpp.

◆ recordUsage()

int MagAOX::app::sysMonitor::recordUsage ( bool  force = false)

Definition at line 1416 of file sysMonitor.hpp.

Referenced by appLogic(), and recordTelem().

◆ registerIndiPropertyNew() [1/3]

template<bool _useINDI = true>
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]

template<bool _useINDI = true>
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]

template<bool _useINDI = true>
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

Referenced by MagAOX::app::filterWheelCtrl::appStartup(), MagAOX::app::magAOXMaths::appStartup(), MagAOX::app::ocam2KCtrl::appStartup(), MagAOX::app::picoMotorCtrl::appStartup(), MagAOX::app::siglentSDG::appStartup(), MagAOX::app::streamWriter::appStartup(), appStartup(), MagAOX::app::zaberCtrl::appStartup(), and MagAOXApp_tests::SCENARIO().

◆ registerIndiPropertyReadOnly() [1/2]

template<bool _useINDI>
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 2437 of file MagAOXApp.hpp.

Referenced by MagAOX::app::picamCtrl::appStartup(), and MagAOX::app::zaberCtrl::appStartup().

◆ registerIndiPropertyReadOnly() [2/2]

template<bool _useINDI>
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 2463 of file MagAOXApp.hpp.

◆ registerIndiPropertySet()

template<bool _useINDI = true>
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 2569 of file MagAOXApp.hpp.

◆ sendGetPropertySetList()

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

Definition at line 2723 of file MagAOXApp.hpp.

◆ sendNewProperty() [1/2]

template<bool _useINDI>
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 3066 of file MagAOXApp.hpp.

◆ sendNewProperty() [2/2]

template<bool _useINDI>
template<typename T >
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 3031 of file MagAOXApp.hpp.

Referenced by MagAOX::app::ttmModulator::modTTM(), MagAOX::app::zaberCtrl::moveTo(), MagAOX::app::ttmModulator::offset12(), MagAOX::app::ttmModulator::offsetXY(), MagAOX::app::ttmModulator::restTTM(), MagAOX::app::MagAOXApp< _useINDI >::sendNewProperty(), MagAOX::app::ocam2KCtrl::setFPS(), MagAOX::app::ttmModulator::setTTM(), MagAOX::app::zaberCtrl::startHoming(), MagAOX::app::zaberCtrl::stop(), MagAOX::app::xt1121DCDU::turnOutletOff(), and MagAOX::app::xt1121DCDU::turnOutletOn().

◆ sendNewStandardIndiToggle()

template<bool _useINDI>
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 3084 of file MagAOXApp.hpp.

◆ setDefaults()

template<bool _useINDI>
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 1152 of file MagAOXApp.hpp.

◆ setEuidCalled()

template<bool _useINDI>
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 1757 of file MagAOXApp.hpp.

Referenced by MagAOX::app::MagAOXApp< _useINDI >::elevatedPrivileges::elevate().

◆ setEuidReal()

template<bool _useINDI>
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 1776 of file MagAOXApp.hpp.

Referenced by MagAOX::app::MagAOXApp< _useINDI >::elevatedPrivileges::restore().

◆ setlatThreadExec()

void MagAOX::app::sysMonitor::setlatThreadExec ( )
inline

Execute the frame grabber main loop.

Todo:
this needs error checks
Todo:
this needs error checks

Definition at line 1192 of file sysMonitor.hpp.

Referenced by setlatThreadStart().

◆ setlatThreadStart()

void MagAOX::app::sysMonitor::setlatThreadStart ( sysMonitor s)
inlinestatic

Thread starter, called by threadStart on thread construction. Calls setlatThreadExec.

Parameters
[in]sa pointer to a sysMonitor instance (normally this)

Definition at line 1186 of file sysMonitor.hpp.

Referenced by appStartup().

◆ setSigTermHandler()

template<bool _useINDI>
int MagAOX::app::MagAOXApp< _useINDI >::setSigTermHandler
privateinherited

Sets the handler for SIGTERM, SIGQUIT, and SIGINT.

Definition at line 1660 of file MagAOXApp.hpp.

◆ setupBasicConfig()

template<bool _useINDI>
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 1249 of file MagAOXApp.hpp.

◆ setupConfig() [1/2]

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

Setup the user-defined warning and critical values for core and drive temperatures.

Definition at line 339 of file sysMonitor.hpp.

◆ setupConfig() [2/2]

int MagAOX::app::dev::telemeter< sysMonitor >::setupConfig ( appConfigurator &  config)
inherited

Setup an application configurator for the device section.

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

Definition at line 87 of file telemeter.hpp.

◆ shutdown()

template<bool _useINDI>
int MagAOX::app::MagAOXApp< _useINDI >::shutdown
inherited

Get the value of the shutdown flag.

Returns
the current value of m_shutdown

Definition at line 1146 of file MagAOXApp.hpp.

Referenced by MagAOX::app::streamWriter::swThreadExec().

◆ st_newCallBack_clearFSMAlert()

template<bool _useINDI>
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 the new property request.

Definition at line 3122 of file MagAOXApp.hpp.

◆ startINDI()

template<bool _useINDI>
int MagAOX::app::MagAOXApp< _useINDI >::startINDI
protectedinherited

Start INDI Communications.

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

Definition at line 2666 of file MagAOXApp.hpp.

◆ state() [1/2]

template<bool _useINDI>
stateCodes::stateCodeT MagAOX::app::MagAOXApp< _useINDI >::state
inherited

Get the current state code.

Returns
m_state

Definition at line 2082 of file MagAOXApp.hpp.

Referenced by MagAOX::app::picamCtrl::acquireAndCheckValid(), MagAOX::app::qhyCtrl::acquireAndCheckValid(), MagAOX::app::acronameUsbHub::appLogic(), MagAOX::app::andorCtrl::appLogic(), MagAOX::app::cameraSim::appLogic(), MagAOX::app::filterWheelCtrl::appLogic(), MagAOX::app::hsfwCtrl::appLogic(), MagAOX::app::ocam2KCtrl::appLogic(), MagAOX::app::picamCtrl::appLogic(), MagAOX::app::picoMotorCtrl::appLogic(), MagAOX::app::siglentSDG::appLogic(), MagAOX::app::smc100ccCtrl::appLogic(), MagAOX::app::streamWriter::appLogic(), MagAOX::app::trippLitePDU::appLogic(), MagAOX::app::ttmModulator::appLogic(), MagAOX::app::xt1121Ctrl::appLogic(), MagAOX::app::xt1121DCDU::appLogic(), MagAOX::app::zaberCtrl::appLogic(), MagAOX::app::zylaCtrl::appLogic(), MagAOX::app::acronameUsbHub::appStartup(), MagAOX::app::andorCtrl::appStartup(), MagAOX::app::cameraSim::appStartup(), MagAOX::app::filterWheelCtrl::appStartup(), MagAOX::app::hsfwCtrl::appStartup(), MagAOX::app::magAOXMaths::appStartup(), MagAOX::app::qhyCtrl::appStartup(), MagAOX::app::smc100ccCtrl::appStartup(), appStartup(), MagAOX::app::trippLitePDU::appStartup(), MagAOX::app::xt1121DCDU::appStartup(), MagAOX::app::zylaCtrl::appStartup(), MagAOX::app::andorCtrl::cameraSelect(), MagAOX::app::siglentSDG::changeAmp(), MagAOX::app::siglentSDG::changeFreq(), MagAOX::app::siglentSDG::changeOfst(), MagAOX::app::siglentSDG::changeOutp(), MagAOX::app::siglentSDG::changePhse(), MagAOX::app::siglentSDG::changeSync(), MagAOX::app::siglentSDG::changeWdth(), MagAOX::app::siglentSDG::changeWvtp(), MagAOX::app::picoMotorCtrl::channelThreadExec(), MagAOX::app::siglentSDG::checkSetup(), MagAOX::app::andorCtrl::configureAcquisition(), MagAOX::app::cameraSim::configureAcquisition(), MagAOX::app::ocam2KCtrl::configureAcquisition(), MagAOX::app::picamCtrl::configureAcquisition(), MagAOX::app::qhyCtrl::configureAcquisition(), MagAOX::app::picamCtrl::connect(), MagAOX::app::qhyCtrl::connect(), MagAOX::app::picamCtrl::getAcquisitionState(), MagAOX::app::smc100ccCtrl::getCtrlState(), MagAOX::app::qhyCtrl::getExpTime(), MagAOX::app::qhyCtrl::getTemp(), MagAOX::app::picamCtrl::getTemps(), MagAOX::app::filterWheelCtrl::home(), MagAOX::app::qhyCtrl::loadImageIntoStream(), MagAOX::app::hsfwCtrl::moveTo(), MagAOX::app::smc100ccCtrl::moveTo(), MagAOX::app::siglentSDG::queryBTWV(), MagAOX::app::siglentSDG::queryMDWV(), MagAOX::app::siglentSDG::querySWWV(), MagAOX::app::andorCtrl::reconfig(), MagAOX::app::ocam2KCtrl::reconfig(), MagAOX::app::picamCtrl::reconfig(), MagAOX::app::streamWriter::recordSavingState(), MagAOX::app::andorCtrl::setCropMode(), MagAOX::app::picamCtrl::setEMGain(), MagAOX::app::andorCtrl::setExpTime(), MagAOX::app::picamCtrl::setExpTime(), MagAOX::app::andorCtrl::setNextROI(), MagAOX::app::qhyCtrl::setNextROI(), MagAOX::app::andorCtrl::setReadoutSpeed(), MagAOX::app::andorCtrl::setShutter(), MagAOX::app::andorCtrl::setVShiftSpeed(), MagAOX::app::andorCtrl::startAcquisition(), MagAOX::app::cameraSim::startAcquisition(), MagAOX::app::qhyCtrl::startAcquisition(), MagAOX::app::hsfwCtrl::startHoming(), MagAOX::app::ocam2KCtrl::stateStringValid(), MagAOX::app::streamWriter::swThreadExec(), MagAOX::app::acronameUsbHub::updateOutletState(), MagAOX::app::trippLitePDU::updateOutletStates(), and MagAOX::app::siglentSDG::writeRead().

◆ state() [2/2]

template<bool _useINDI>
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 2088 of file MagAOXApp.hpp.

◆ stateLogged()

template<bool _useINDI>
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.
Definition: MagAOXApp.hpp:2082
int stateLogged()
Updates and returns the value of m_stateLogged. Will be 0 on first call after a state change,...
Definition: MagAOXApp.hpp:2140
@ NOTCONNECTED
The application is not connected to the device or service.
Definition: stateCodes.hpp:44

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 2140 of file MagAOXApp.hpp.

Referenced by MagAOX::app::acronameUsbHub::appLogic(), MagAOX::app::filterWheelCtrl::appLogic(), MagAOX::app::hsfwCtrl::appLogic(), MagAOX::app::picoMotorCtrl::appLogic(), MagAOX::app::siglentSDG::appLogic(), MagAOX::app::smc100ccCtrl::appLogic(), MagAOX::app::trippLitePDU::appLogic(), MagAOX::app::ttmModulator::appLogic(), MagAOX::app::xt1121Ctrl::appLogic(), MagAOX::app::andorCtrl::cameraSelect(), MagAOX::app::picamCtrl::connect(), and MagAOX::app::qhyCtrl::connect().

◆ telem() [1/2]

int MagAOX::app::dev::telemeter< sysMonitor >::telem
inherited

Make a telemetry recording, for an empty record.

Wrapper for logManager::log, which updates telT::lastRecord.

Template Parameters
logTthe log entry type
retvalthe value returned by this method.

Definition at line 80 of file telemeter.hpp.

◆ telem() [2/2]

int MagAOX::app::dev::telemeter< sysMonitor >::telem ( const typename telT::messageT &  msg)
inherited

Make a telemetry recording.

Wrapper for logManager::log, which updates telT::lastRecord.

Template Parameters
logTthe log entry type
retvalthe value returned by this method.
Parameters
[in]msgthe data to log

Definition at line 70 of file telemeter.hpp.

◆ threadStart()

template<bool _useINDI>
template<class thisPtr , class Function >
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 1950 of file MagAOXApp.hpp.

Referenced by MagAOX::app::picoMotorCtrl::appStartup(), MagAOX::app::streamWriter::appStartup(), and appStartup().

◆ unlockPID()

template<bool _useINDI>
int MagAOX::app::MagAOXApp< _useINDI >::unlockPID
protectedinherited

Remove the PID file.

Definition at line 1927 of file MagAOXApp.hpp.

◆ updateIfChanged() [1/4]

template<bool _useINDI>
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 2891 of file MagAOXApp.hpp.

◆ updateIfChanged() [2/4]

template<bool _useINDI>
template<typename T >
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 2916 of file MagAOXApp.hpp.

◆ updateIfChanged() [3/4]

template<bool _useINDI>
template<typename T >
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 2877 of file MagAOXApp.hpp.

Referenced by MagAOX::app::filterWheelCtrl::appLogic(), MagAOX::app::ocam2KCtrl::appLogic(), MagAOX::app::picoMotorCtrl::appLogic(), MagAOX::app::smc100ccCtrl::appLogic(), MagAOX::app::ttmModulator::appLogic(), MagAOX::app::zaberCtrl::appLogic(), MagAOX::app::xt1121Ctrl::channelSetCallback(), MagAOX::app::cameraSim::checkNextROI(), MagAOX::app::andorCtrl::configureAcquisition(), MagAOX::app::picamCtrl::configureAcquisition(), MagAOX::app::qhyCtrl::configureAcquisition(), MagAOX::app::zylaCtrl::configureAcquisition(), MagAOX::app::xt1121Ctrl::getState(), MagAOX::app::ocam2KCtrl::getTemps(), MagAOX::app::INDI_NEWCALLBACK_DEFN(), MagAOX::app::smc100ccCtrl::moveTo(), MagAOX::app::filterWheelCtrl::moveToRaw(), MagAOX::app::acronameUsbHub::onPowerOff(), MagAOX::app::ocam2KCtrl::onPowerOff(), MagAOX::app::siglentSDG::onPowerOff(), MagAOX::app::xt1121Ctrl::onPowerOff(), MagAOX::app::siglentSDG::queryBSWV(), MagAOX::app::siglentSDG::queryOUTP(), MagAOX::app::ocam2KCtrl::resetEMProtection(), MagAOX::app::picamCtrl::setExpTime(), MagAOX::app::trippLitePDU::updateOutletStates(), MagAOX::app::magAOXMaths::updateVals(), and updateVals().

◆ updateIfChanged() [4/4]

template<bool _useINDI>
template<typename T >
void MagAOX::app::MagAOXApp< _useINDI >::updateIfChanged ( pcf::IndiProperty &  p,
const std::vector< std::string > &  els,
const std::vector< T > &  newVals 
)
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

Definition at line 2936 of file MagAOXApp.hpp.

◆ updateSwitchIfChanged()

template<bool _useINDI>
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

◆ updateVals()

int MagAOX::app::sysMonitor::updateVals ( )
protected

Updates Indi property values of all system statistics.

This includes updating values for core loads, core temps, drive temps, / usage, /boot usage, /data usage, and RAM usage Unsure if this method can fail in any way, as of now always returns 0

\TODO: Check to see if any method called in here can fail

Returns
0 on completion

Definition at line 1126 of file sysMonitor.hpp.

Referenced by appLogic().

◆ whilePowerOff()

template<bool _useINDI>
int MagAOX::app::MagAOXApp< _useINDI >::whilePowerOff
protectedvirtualinherited

Friends And Related Function Documentation

◆ dev::telemeter< sysMonitor >

friend class dev::telemeter< sysMonitor >
friend

Definition at line 1457 of file sysMonitor.hpp.

Member Data Documentation

◆ m_allDefsReceived

template<bool _useINDI = true>
bool MagAOX::app::MagAOXApp< _useINDI >::m_allDefsReceived {false}
protectedinherited

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

Definition at line 576 of file MagAOXApp.hpp.

◆ m_bootUsage

float MagAOX::app::sysMonitor::m_bootUsage = 0
protected

Disk usage in /boot path as a value out of 100.

Definition at line 66 of file sysMonitor.hpp.

Referenced by appLogic(), recordUsage(), and updateVals().

◆ m_calibDir

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::m_calibDir
protectedinherited

The path to calibration files for MagAOX.

Definition at line 94 of file MagAOXApp.hpp.

◆ m_chronyFreq

double MagAOX::app::sysMonitor::m_chronyFreq {0}
protected

Definition at line 247 of file sysMonitor.hpp.

Referenced by findChronyStatus().

◆ m_chronyLastOffset

double MagAOX::app::sysMonitor::m_chronyLastOffset {0}
protected

Definition at line 245 of file sysMonitor.hpp.

Referenced by findChronyStatus(), and updateVals().

◆ m_chronyLeap

std::string MagAOX::app::sysMonitor::m_chronyLeap
protected

Definition at line 253 of file sysMonitor.hpp.

Referenced by findChronyStatus(), and recordChronyStatus().

◆ m_chronyResidFreq

double MagAOX::app::sysMonitor::m_chronyResidFreq {0}
protected

Definition at line 248 of file sysMonitor.hpp.

Referenced by findChronyStatus().

◆ m_chronyRMSOffset

double MagAOX::app::sysMonitor::m_chronyRMSOffset {0}
protected

Definition at line 246 of file sysMonitor.hpp.

Referenced by findChronyStatus(), and updateVals().

◆ m_chronyRootDelay

double MagAOX::app::sysMonitor::m_chronyRootDelay {0}
protected

Definition at line 250 of file sysMonitor.hpp.

Referenced by findChronyStatus().

◆ m_chronyRootDispersion

double MagAOX::app::sysMonitor::m_chronyRootDispersion {0}
protected

Definition at line 251 of file sysMonitor.hpp.

Referenced by findChronyStatus().

◆ m_chronySkew

double MagAOX::app::sysMonitor::m_chronySkew {0}
protected

Definition at line 249 of file sysMonitor.hpp.

Referenced by findChronyStatus().

◆ m_chronySourceIP

std::string MagAOX::app::sysMonitor::m_chronySourceIP
protected

Definition at line 242 of file sysMonitor.hpp.

Referenced by findChronyStatus(), recordChronyStatus(), and updateVals().

◆ m_chronySourceMac

std::string MagAOX::app::sysMonitor::m_chronySourceMac
protected

Definition at line 241 of file sysMonitor.hpp.

Referenced by findChronyStatus(), and recordChronyStatus().

◆ m_chronySynch

std::string MagAOX::app::sysMonitor::m_chronySynch
protected

Definition at line 243 of file sysMonitor.hpp.

Referenced by findChronyStatus(), recordChronyStatus(), and updateVals().

◆ m_chronySystemTime

double MagAOX::app::sysMonitor::m_chronySystemTime {0}
protected

Definition at line 244 of file sysMonitor.hpp.

Referenced by findChronyStatus(), and updateVals().

◆ m_chronyUpdateInt

double MagAOX::app::sysMonitor::m_chronyUpdateInt {0}
protected

Definition at line 252 of file sysMonitor.hpp.

Referenced by findChronyStatus().

◆ m_configBase

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::m_configBase
protectedinherited

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

Definition at line 92 of file MagAOXApp.hpp.

◆ m_configDir

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::m_configDir
protectedinherited

The path to configuration files for MagAOX.

Definition at line 90 of file MagAOXApp.hpp.

Referenced by MagAOX::app::ocam2KCtrl::configureAcquisition().

◆ m_configName

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::m_configName
protectedinherited

◆ m_coreLoads

std::vector<float> MagAOX::app::sysMonitor::m_coreLoads
protected

List of current core load(s)

Definition at line 58 of file sysMonitor.hpp.

Referenced by appLogic(), recordCoreLoads(), setlatThreadExec(), and updateVals().

◆ m_coreTemps

std::vector<float> MagAOX::app::sysMonitor::m_coreTemps
protected

List of current core temperature(s)

Definition at line 57 of file sysMonitor.hpp.

Referenced by appLogic(), recordCoreTemps(), and updateVals().

◆ m_cpusetPath

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::m_cpusetPath {MAGAOX_cpusetPath}
protectedinherited

Definition at line 421 of file MagAOXApp.hpp.

◆ m_criticalCoreTemp

int MagAOX::app::sysMonitor::m_criticalCoreTemp = 0
protected

User defined critical temperature for CPU cores.

Definition at line 48 of file sysMonitor.hpp.

Referenced by criticalCoreTemperature(), loadConfig(), and parseCPUTemperatures().

◆ m_criticalDiskTemp

int MagAOX::app::sysMonitor::m_criticalDiskTemp = 0
protected

User defined critical temperature for drives.

Definition at line 50 of file sysMonitor.hpp.

Referenced by criticalDiskTemperature(), loadConfig(), and parseDiskTemperature().

◆ m_dataUsage

float MagAOX::app::sysMonitor::m_dataUsage = 0
protected

Disk usage in /data path as a value out of 100.

Definition at line 65 of file sysMonitor.hpp.

Referenced by appLogic(), recordUsage(), and updateVals().

◆ m_diskNameList

std::vector<std::string> MagAOX::app::sysMonitor::m_diskNameList
protected

vector of names of the hard disks to monitor

Definition at line 60 of file sysMonitor.hpp.

Referenced by loadConfig().

◆ m_diskNames

std::vector<std::string> MagAOX::app::sysMonitor::m_diskNames
protected

vector of names of the hard disks returned by hdd_temp

Definition at line 61 of file sysMonitor.hpp.

Referenced by appLogic(), appStartup(), recordDriveTemps(), and updateVals().

◆ m_diskTemps

std::vector<float> MagAOX::app::sysMonitor::m_diskTemps
protected

vector of current disk temperature(s)

Definition at line 62 of file sysMonitor.hpp.

Referenced by appLogic(), appStartup(), recordDriveTemps(), and updateVals().

◆ m_driverCtrlName

template<bool _useINDI = true>
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 587 of file MagAOXApp.hpp.

◆ m_driverInName

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::m_driverInName
protectedinherited

Full path name of the INDI driver input FIFO.

Definition at line 579 of file MagAOXApp.hpp.

◆ m_driverOutName

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::m_driverOutName
protectedinherited

Full path name of the INDI driver output FIFO.

Definition at line 582 of file MagAOXApp.hpp.

◆ m_euidCalled

template<bool _useINDI = true>
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 315 of file MagAOXApp.hpp.

◆ m_euidReal

template<bool _useINDI = true>
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 314 of file MagAOXApp.hpp.

◆ m_gitAlert

template<bool _useINDI = true>
bool MagAOX::app::MagAOXApp< _useINDI >::m_gitAlert {false}
privateinherited

Definition at line 472 of file MagAOXApp.hpp.

◆ m_indiDriver

template<bool _useINDI = true>
indiDriver<MagAOXApp>* MagAOX::app::MagAOXApp< _useINDI >::m_indiDriver {nullptr}
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 537 of file MagAOXApp.hpp.

Referenced by MagAOX::app::picoMotorCtrl::appLogic(), MagAOX::app::smc100ccCtrl::appLogic(), MagAOX::app::zaberCtrl::appLogic(), MagAOX::app::streamWriter::updateINDI(), and MagAOX::app::magAOXMaths::updateVals().

◆ m_indiMutex

template<bool _useINDI = true>
std::mutex MagAOX::app::MagAOXApp< _useINDI >::m_indiMutex
inherited

Mutex for locking INDI communications.

Definition at line 540 of file MagAOXApp.hpp.

Referenced by MagAOX::app::acronameUsbHub::appLogic(), MagAOX::app::andorCtrl::appLogic(), MagAOX::app::cameraSim::appLogic(), MagAOX::app::filterWheelCtrl::appLogic(), MagAOX::app::hsfwCtrl::appLogic(), MagAOX::app::ocam2KCtrl::appLogic(), MagAOX::app::picamCtrl::appLogic(), MagAOX::app::picoMotorCtrl::appLogic(), MagAOX::app::siglentSDG::appLogic(), MagAOX::app::smc100ccCtrl::appLogic(), MagAOX::app::trippLitePDU::appLogic(), MagAOX::app::ttmModulator::appLogic(), MagAOX::app::xt1121Ctrl::appLogic(), MagAOX::app::xt1121DCDU::appLogic(), MagAOX::app::zaberCtrl::appLogic(), MagAOX::app::zylaCtrl::appLogic(), MagAOX::app::siglentSDG::changeAmp(), MagAOX::app::siglentSDG::changeFreq(), MagAOX::app::siglentSDG::changeOfst(), MagAOX::app::siglentSDG::changeOutp(), MagAOX::app::siglentSDG::changePhse(), MagAOX::app::siglentSDG::changeSync(), MagAOX::app::siglentSDG::changeWdth(), MagAOX::app::siglentSDG::changeWvtp(), MagAOX::app::xt1121Ctrl::channelSetCallback(), MagAOX::app::andorCtrl::configureAcquisition(), MagAOX::app::ocam2KCtrl::configureAcquisition(), MagAOX::app::picamCtrl::configureAcquisition(), MagAOX::app::qhyCtrl::configureAcquisition(), MagAOX::app::zylaCtrl::configureAcquisition(), MagAOX::app::INDI_NEWCALLBACK_DEFN(), MagAOX::app::picoMotorCtrl::newCallBack_picopos(), MagAOX::app::picoMotorCtrl::newCallBack_presetName(), MagAOX::app::acronameUsbHub::onPowerOff(), MagAOX::app::andorCtrl::onPowerOff(), MagAOX::app::ocam2KCtrl::onPowerOff(), MagAOX::app::picamCtrl::onPowerOff(), MagAOX::app::siglentSDG::onPowerOff(), MagAOX::app::xt1121Ctrl::onPowerOff(), MagAOX::app::zylaCtrl::onPowerOff(), MagAOX::app::filterWheelCtrl::onPowerOnConnect(), MagAOX::app::ocam2KCtrl::reconfig(), MagAOX::app::zylaCtrl::reconfig(), MagAOX::app::filterWheelCtrl::stop(), MagAOX::app::trippLitePDU::turnOutletOff(), MagAOX::app::xt1121DCDU::turnOutletOff(), MagAOX::app::trippLitePDU::turnOutletOn(), MagAOX::app::xt1121DCDU::turnOutletOn(), MagAOX::app::ocam2KCtrl::whilePowerOff(), and MagAOX::app::zylaCtrl::whilePowerOff().

◆ m_indiNewCallBacks

template<bool _useINDI = true>
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 567 of file MagAOXApp.hpp.

◆ m_indiP_chronyStats

pcf::IndiProperty MagAOX::app::sysMonitor::m_indiP_chronyStats
protected

Definition at line 256 of file sysMonitor.hpp.

Referenced by appStartup(), and updateVals().

◆ m_indiP_chronyStatus

pcf::IndiProperty MagAOX::app::sysMonitor::m_indiP_chronyStatus
protected

Definition at line 255 of file sysMonitor.hpp.

Referenced by appStartup(), and updateVals().

◆ m_indiP_clearFSMAlert

template<bool _useINDI = true>
pcf::IndiProperty MagAOX::app::MagAOXApp< _useINDI >::m_indiP_clearFSMAlert
protectedinherited

indi Property to clear an FSM alert.

Definition at line 948 of file MagAOXApp.hpp.

◆ m_indiP_core_loads

pcf::IndiProperty MagAOX::app::sysMonitor::m_indiP_core_loads
protected

Indi variable for reporting CPU core loads.

Definition at line 52 of file sysMonitor.hpp.

Referenced by appStartup(), and updateVals().

◆ m_indiP_core_temps

pcf::IndiProperty MagAOX::app::sysMonitor::m_indiP_core_temps
protected

Indi variable for reporting CPU core temperature(s)

Definition at line 53 of file sysMonitor.hpp.

Referenced by appStartup(), and updateVals().

◆ m_indiP_drive_temps

pcf::IndiProperty MagAOX::app::sysMonitor::m_indiP_drive_temps
protected

Indi variable for reporting drive temperature(s)

Definition at line 54 of file sysMonitor.hpp.

Referenced by appStartup(), and updateVals().

◆ m_indiP_powerChannel

template<bool _useINDI = true>
pcf::IndiProperty MagAOX::app::MagAOXApp< _useINDI >::m_indiP_powerChannel
protectedinherited

INDI property used to communicate power state.

Definition at line 998 of file MagAOXApp.hpp.

◆ m_indiP_setlat

pcf::IndiProperty MagAOX::app::sysMonitor::m_indiP_setlat

Definition at line 292 of file sysMonitor.hpp.

Referenced by appStartup(), and updateVals().

◆ m_indiP_state

template<bool _useINDI = true>
pcf::IndiProperty MagAOX::app::MagAOXApp< _useINDI >::m_indiP_state
protectedinherited

indi Property to report the application state.

Definition at line 945 of file MagAOXApp.hpp.

◆ m_indiP_usage

pcf::IndiProperty MagAOX::app::sysMonitor::m_indiP_usage
protected

Indi variable for reporting drive usage of all paths.

Definition at line 55 of file sysMonitor.hpp.

Referenced by appStartup(), and updateVals().

◆ m_indiSetCallBacks

template<bool _useINDI = true>
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 572 of file MagAOXApp.hpp.

◆ m_log

template<bool _useINDI>
MagAOXApp< _useINDI >::logManagerT MagAOX::app::MagAOXApp< _useINDI >::m_log
staticinherited

Definition at line 242 of file MagAOXApp.hpp.

◆ m_loopPause

template<bool _useINDI = true>
unsigned long MagAOX::app::MagAOXApp< _useINDI >::m_loopPause {MAGAOX_default_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 100 of file MagAOXApp.hpp.

Referenced by MagAOX::app::trippLitePDU::trippLitePDU(), MagAOX::app::siglentSDG::appLogic(), and MagAOX::app::xt1121Ctrl::appLogic().

◆ m_maxInterval

double MagAOX::app::dev::telemeter< sysMonitor >::m_maxInterval
inherited

The maximum interval, in seconds, between telemetry records. Default is 10.0 seconds.

Definition at line 58 of file telemeter.hpp.

◆ m_pid

template<bool _useINDI = true>
pid_t MagAOX::app::MagAOXApp< _useINDI >::m_pid {0}
protectedinherited

This process's PID.

Definition at line 394 of file MagAOXApp.hpp.

◆ m_powerChannel

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::m_powerChannel
protectedinherited

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

Definition at line 985 of file MagAOXApp.hpp.

◆ m_powerDevice

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::m_powerDevice
protectedinherited

The INDI device name of the power controller.

Definition at line 984 of file MagAOXApp.hpp.

◆ m_powerElement

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::m_powerElement {"state"}
protectedinherited

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

Definition at line 986 of file MagAOXApp.hpp.

◆ m_powerMgtEnabled

◆ m_powerOnCounter

template<bool _useINDI = true>
int MagAOX::app::MagAOXApp< _useINDI >::m_powerOnCounter {-1}
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 992 of file MagAOXApp.hpp.

Referenced by MagAOX::app::andorCtrl::onPowerOff(), MagAOX::app::ocam2KCtrl::onPowerOff(), and MagAOX::app::zylaCtrl::onPowerOff().

◆ m_powerOnWait

template<bool _useINDI = true>
unsigned long MagAOX::app::MagAOXApp< _useINDI >::m_powerOnWait {0}
protectedinherited

Time in sec to wait for device to boot after power on.

Definition at line 989 of file MagAOXApp.hpp.

Referenced by MagAOX::app::andorCtrl::andorCtrl(), MagAOX::app::ocam2KCtrl::ocam2KCtrl(), MagAOX::app::smc100ccCtrl::smc100ccCtrl(), and MagAOX::app::zylaCtrl::zylaCtrl().

◆ m_powerState

◆ m_powerTargetElement

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::m_powerTargetElement {"target"}
protectedinherited

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

Definition at line 987 of file MagAOXApp.hpp.

◆ m_powerTargetState

◆ m_ramUsage

float MagAOX::app::sysMonitor::m_ramUsage = 0
protected

RAM usage as a decimal value between 0 and 1.

Definition at line 67 of file sysMonitor.hpp.

Referenced by appLogic(), recordUsage(), and updateVals().

◆ m_rootUsage

float MagAOX::app::sysMonitor::m_rootUsage = 0
protected

Disk usage in root path as a value out of 100.

Definition at line 64 of file sysMonitor.hpp.

Referenced by appLogic(), recordUsage(), and updateVals().

◆ m_self

template<bool _useINDI>
MagAOXApp< _useINDI > * MagAOX::app::MagAOXApp< _useINDI >::m_self = nullptr
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 291 of file MagAOXApp.hpp.

◆ m_setLatency

bool MagAOX::app::sysMonitor::m_setLatency {false}

Definition at line 274 of file sysMonitor.hpp.

Referenced by setlatThreadExec(), and updateVals().

◆ m_setlatThread

std::thread MagAOX::app::sysMonitor::m_setlatThread

A separate thread for the actual setting of low latency.

Definition at line 278 of file sysMonitor.hpp.

Referenced by appShutdown(), and appStartup().

◆ m_setlatThreadID

pid_t MagAOX::app::sysMonitor::m_setlatThreadID {0}

Set latency thread ID.

Definition at line 282 of file sysMonitor.hpp.

Referenced by appStartup(), and setlatThreadExec().

◆ m_setlatThreadInit

bool MagAOX::app::sysMonitor::m_setlatThreadInit {true}

Synchronizer to ensure set lat thread initializes before doing dangerous things.

Definition at line 280 of file sysMonitor.hpp.

Referenced by appStartup(), and setlatThreadExec().

◆ m_setlatThreadPrio

int MagAOX::app::sysMonitor::m_setlatThreadPrio {0}

Priority of the set latency thread, should normally be > 00.

Definition at line 276 of file sysMonitor.hpp.

Referenced by appStartup().

◆ m_setlatThreadProp

pcf::IndiProperty MagAOX::app::sysMonitor::m_setlatThreadProp

The property to hold the setlat thread details.

Definition at line 284 of file sysMonitor.hpp.

Referenced by appStartup().

◆ m_shutdown

◆ m_state

template<bool _useINDI = true>
stateCodes::stateCodeT MagAOX::app::MagAOXApp< _useINDI >::m_state {stateCodes::UNINITIALIZED}
privateinherited

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

Definition at line 468 of file MagAOXApp.hpp.

◆ m_stateAlert

template<bool _useINDI = true>
bool MagAOX::app::MagAOXApp< _useINDI >::m_stateAlert {false}
privateinherited

Definition at line 470 of file MagAOXApp.hpp.

◆ m_stateLogged

template<bool _useINDI = true>
int MagAOX::app::MagAOXApp< _useINDI >::m_stateLogged {0}
privateinherited

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

Definition at line 474 of file MagAOXApp.hpp.

◆ m_suid

template<bool _useINDI = true>
uid_t MagAOX::app::MagAOXApp< _useINDI >::m_suid
privateinherited

The save-set user id of the process.

Definition at line 316 of file MagAOXApp.hpp.

◆ m_tel

Definition at line 56 of file telemeter.hpp.

◆ m_useINDI

template<bool _useINDI = true>
constexpr static bool MagAOX::app::MagAOXApp< _useINDI >::m_useINDI = _useINDI
staticconstexprprotectedinherited

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

Definition at line 532 of file MagAOXApp.hpp.

◆ m_warningCoreTemp

int MagAOX::app::sysMonitor::m_warningCoreTemp = 0
protected

User defined warning temperature for CPU cores.

Definition at line 47 of file sysMonitor.hpp.

Referenced by criticalCoreTemperature(), loadConfig(), and parseCPUTemperatures().

◆ m_warningDiskTemp

int MagAOX::app::sysMonitor::m_warningDiskTemp = 0
protected

User defined warning temperature for drives.

Definition at line 49 of file sysMonitor.hpp.

Referenced by criticalDiskTemperature(), loadConfig(), and parseDiskTemperature().

◆ MagAOXPath

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::MagAOXPath
protectedinherited

The base path of the MagAO-X system.

Definition at line 86 of file MagAOXApp.hpp.

Referenced by MagAOX::app::streamWriter::loadConfig().

◆ pidFileName

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::pidFileName
protectedinherited

The name of the PID file.

Definition at line 392 of file MagAOXApp.hpp.

◆ secretsPath

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::secretsPath
protectedinherited

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

Definition at line 98 of file MagAOXApp.hpp.

◆ sysPath

template<bool _useINDI = true>
std::string MagAOX::app::MagAOXApp< _useINDI >::sysPath
protectedinherited

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

Definition at line 96 of file MagAOXApp.hpp.

Referenced by MagAOX::app::picoMotorCtrl::readChannelCounts(), and MagAOX::app::picoMotorCtrl::writeChannelCounts().


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