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

#include <streamWriter.hpp>

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

Public Types

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

Public Member Functions

 streamWriter ()
 Default c'tor.
 
 ~streamWriter () noexcept
 Destructor.
 
virtual void setupConfig ()
 Setup the configuration system (called by MagAOXApp::setup())
 
virtual void loadConfig ()
 load the configuration system results (called by MagAOXApp::setup())
 
virtual int appStartup ()
 Startup functions.
 
virtual int appLogic ()
 Implementation of the FSM for the Siglent SDG.
 
virtual int appShutdown ()
 Do any needed shutdown tasks. Currently nothing in this app.
 
 INDI_NEWCALLBACK_DECL (streamWriter, m_indiP_writing)
 
void updateINDI ()
 
virtual void setDefaults (int argc, char **argv)
 Set the paths for config files.
 
virtual void setupBasicConfig ()
 The basic MagAO-X configuration setup method. Should not normally be overridden.
 
virtual void loadBasicConfig ()
 The basic MagAO-X configuration processing method. Should not normally be overridden.
 
virtual void checkConfig ()
 Check for unused and unrecognized config options and settings.
 
virtual int execute ()
 The execute method implementing the standard main loop. Should not normally be overridden.
 
int telem (const typename telT::messageT &msg)
 Make a telemetry recording.
 
int setupConfig (appConfigurator &config)
 Setup an application configurator for the device section.
 
int loadConfig (appConfigurator &config)
 Load the device section from an application configurator.
 
int checkRecordTimes (const telT &tel, telTs... tels)
 Check the time of the last record for each telemetry type and make an entry if needed.
 
int checkRecordTimes (timespec &ts, const telT &tel, telTs... tels)
 Worker function to actually perform the record time checking logic.
 
int checkRecordTimes (timespec &ts)
 Empty function called at the end of the template list.
 
Telemeter Interface
int checkRecordTimes ()
 
int recordTelem (const telem_saving_state *)
 
int recordSavingState (bool force=false)
 
int recordSavingStats (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.
 
Member Accessors
std::string basePath ()
 Get the.
 
std::string configName ()
 Get the config name.
 
std::string configDir ()
 Get the config directory.
 
std::string configBase ()
 Get the config base file.
 
std::string calibDir ()
 Get the calibration directory.
 
std::string sysPath ()
 Get the system path.
 
std::string secretsPath ()
 Get the secrets path.
 
std::string cpusetPath ()
 Get the cpuset path.
 
unsigned long loopPause ()
 Get the loop pause time.
 
int shutdown ()
 Get the value of the shutdown flag.
 
std::string driverInName ()
 Get the INDI input FIFO file name.
 
std::string driverOutName ()
 Get the INDI output FIFO file name.
 
std::string driverCtrlName ()
 Get the INDI control FIFO file name.
 

Public Attributes

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

Protected Attributes

size_t m_circBuffLength { 1024 }
 The length of the circular buffer, in frames.
 
double m_circBuffSize { 2048.0 }
 The size of the circular buffer, in MB.
 
size_t m_writeChunkLength { 512 }
 The number of frames to write at a time.
 
size_t m_width { 0 }
 The width of the image.
 
size_t m_height { 0 }
 The height of the image.
 
uint8_t m_dataType { 0 }
 The ImageStreamIO type code.
 
int m_typeSize { 0 }
 The pixel byte depth.
 
charm_rawImageCircBuff { nullptr }
 
uint64_tm_timingCircBuff { nullptr }
 
size_t m_currImage { 0 }
 
uint64_t m_currImageTime { 0 }
 The write-time of the current image in nanoseconds.
 
uint64_t m_currChunkStartTime { 0 }
 The write-time of the first image in the chunk in nanoseconds.
 
std::atomic< uint64_tm_skippedFrameCount
 Count of skipped frames accumulated by the framegrabber thread since the last summary log.
 
std::atomic< uint64_tm_repeatSemaphoreCount
 Count of repeated semaphore wakes with unchanged frame count since the last summary log.
 
double m_skipSummaryIntervalSec { 10.0 }
 Current interval between summary skip logs.
 
double m_nextSkipSummaryTime { 0.0 }
 Time after which the next summary skip log may be emitted.
 
int m_writing { NOT_WRITING }
 
std::atomic< boolm_writePending
 Whether the writer thread still owns a queued save window and may touch the circular buffers.
 
double m_stopWriteDeadline { 0.0 }
 
double m_writeCompletionTimeout
 Seconds to wait for the writer thread to finish a queued flush during restart cleanup.
 
bool m_resumeAfterReconnect
 Tracks whether reconnect cleanup should resume writing immediately on the replacement stream.
 
uint64_t m_currChunkStart { 0 }
 The circular buffer starting position of the current to-be-written chunk.
 
uint64_t m_nextChunkStart { 0 }
 The circular buffer starting position of the next to-be-written chunk.
 
uint64_t m_currSaveStart { 0 }
 The circular buffer position at which to start saving.
 
uint64_t m_currSaveStop { 0 }
 The circular buffer position at which to stop saving.
 
uint64_t m_currSaveStopFrameNo { 0 }
 The frame number of the image at which saving stopped (for logging)
 
xrif_t m_xrif { nullptr }
 The xrif compression handle for image data.
 
charm_xrif_header { nullptr }
 Storage for the xrif image data file header.
 
xrif_t m_xrif_timing { nullptr }
 The xrif compression handle for image data.
 
charm_xrif_timing_header { nullptr }
 Storage for the xrif image data file header.
 
std::string m_outFilePath
 The full path for the latest output file.
 
pcf::IndiProperty m_indiP_writing
 
pcf::IndiProperty m_indiP_xrifStats
 
std::string m_basePath
 The base path of the MagAO-X system.
 
std::string m_configName
 The name of the configuration file (minus .conf).
 
std::string m_configDir
 The path to configuration files for MagAOX.
 
std::string m_configBase
 The name of a base config class for this app (minus .conf).
 
std::string m_calibDir
 The path to calibration files for MagAOX.
 
std::string m_sysPath
 The path to the system directory, for PID file, etc.
 
std::string m_secretsPath
 Path to the secrets directory, where passwords, etc, are stored.
 
std::string m_cpusetPath { MAGAOX_cpusetPath }
 Path to the cpusets mount.
 
unsigned long m_loopPause { MAGAOX_default_loopPause }
 
int m_shutdown { 0 }
 Flag to signal it's time to shutdown. When not 0, the main loop exits.
 
configurable parameters
std::string m_rawimageDir
 The path where files will be saved.
 
size_t m_maxCircBuffLength { 1024 }
 The maximum length of the circular buffer, in frames.
 
double m_maxCircBuffSize { 2048 }
 The maximum size of the circular bufffer in MB.
 
size_t m_maxWriteChunkLength { 512 }
 
double m_maxChunkTime { 10 }
 The maximum time before writing regardless of number of frames.
 
double m_writeStopTimeout
 Seconds to wait after a stop-writing command before flushing the pending data without a new frame.
 
bool m_startWriting { false }
 Whether writing should be armed automatically at application startup.
 
std::string m_shmimName
 The name of the shared memory buffer.
 
std::string m_outName
 The name to use for outputting files, Default is m_shmimName.
 
int m_semaphoreNumber { 7 }
 The image structure semaphore index.
 
unsigned m_semWaitSec { 0 }
 
unsigned m_semWaitNSec { 500000000 }
 
bool m_warnMissedData
 Whether missed-data backlog summaries should be emitted as warnings instead of informational logs.
 
int m_lz4accel { 1 }
 
bool m_compress { true }
 

Private Types

typedef dev::telemeter< streamWritertelemeterT
 

Private Member Functions

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

Friends

class dev::telemeter< streamWriter >
 
class streamWriter_test
 
class streamWriter_data_test
 

SIGSEGV & SIGBUS signal handling

These signals occur as a result of a ImageStreamIO source server resetting (e.g. changing frame sizes). When they occur a restart of the framegrabber and framewriter thread main loops is triggered.

bool m_restart { false }
 
static streamWriterm_selfWriter = nullptr
 
int initialize_xrif ()
 Initialize the xrif system.
 
int setSigSegvHandler ()
 Sets the handler for SIGSEGV and SIGBUS.
 
void handlerSigSegv (int signum, siginfo_t *siginf, void *ucont)
 Handles SIGSEGV and SIGBUS. Sets m_restart to true.
 
static void _handlerSigSegv (int signum, siginfo_t *siginf, void *ucont)
 

Framegrabber Thread

This thread monitors the ImageStreamIO buffer and copies its images to the circular buffer.

int m_fgThreadPrio { 1 }
 Priority of the framegrabber thread, should normally be > 00.
 
std::string m_fgCpuset
 The cpuset for the framegrabber thread. Ignored if empty (the default).
 
std::thread m_fgThread
 A separate thread for the actual framegrabbings.
 
bool m_fgThreadInit { true }
 Synchronizer to ensure f.g. thread initializes before doing dangerous things.
 
pid_t m_fgThreadID { 0 }
 F.g. thread PID.
 
pcf::IndiProperty m_fgThreadProp
 The property to hold the f.g. thread details.
 
int allocate_circbufs ()
 Worker function to allocate the circular buffers.
 
int allocate_xrif ()
 Worker function to configure and allocate the xrif handles.
 
void release_circbufs ()
 Release the circular buffers owned by the framegrabber thread.
 
bool waitForWriteCompletion (uint64_t saveStopFrameNo)
 Wait for the writer thread to finish any queued save work before buffer teardown.
 
void fgThreadExec ()
 Execute the frame grabber main loop.
 
static void fgThreadStart (streamWriter *s)
 Thread starter, called by fgThreadStart on thread construction. Calls fgThreadExec.
 
static void getCircBuffLengths (size_t &circBuffLength, double &circBuffSize, size_t &writeChunkLength, size_t maxCircBuffLength, double maxCircBuffSize, size_t maxWriteChunkLength, uint32_t width, uint32_t height, size_t typeSize)
 

Stream Writer Thread

This thread writes chunks of the circular buffer to disk.

int m_swThreadPrio { 1 }
 Priority of the stream writer thread, should normally be > 0, and <= m_fgThreadPrio.
 
std::string m_swCpuset
 The cpuset for the framegrabber thread. Ignored if empty (the default).
 
sem_t m_swSemaphore
 Semaphore used to synchronize the fg thread and the sw thread.
 
std::thread m_swThread
 A separate thread for the actual writing.
 
bool m_swThreadInit { true }
 Synchronizer to ensure s.w. thread initializes before doing dangerous things.
 
pid_t m_swThreadID { 0 }
 S.w. thread pid.
 
pcf::IndiProperty m_swThreadProp
 The property to hold the s.w. thread details.
 
void swThreadExec ()
 Execute the stream writer main loop.
 
int doEncode ()
 Function called when semaphore is raised to do the encode and write.
 
static void swThreadStart (streamWriter *s)
 Thread starter, called by swThreadStart on thread construction. Calls swThreadExec.
 

PID Locking

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

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

INDI Interface

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

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

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

Logging

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

Application State

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

Signal Handling

libMagAOX/logger/types/software_log.hpp

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

Privilege Management

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

Detailed Description

MagAO-X application to control writing ImageStreamIO streams to disk.

Definition at line 57 of file streamWriter.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 701 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 698 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 695 of file MagAOXApp.hpp.

◆ logManagerT [1/2]

The log manager type.

Definition at line 79 of file telemeter.hpp.

◆ logManagerT [2/2]

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

The log manager type.

Definition at line 185 of file MagAOXApp.hpp.

◆ telemeterT

◆ verboseT [1/2]

Definition at line 76 of file telemeter.hpp.

◆ verboseT [2/2]

template<bool _useINDI = true>
typedef XWC_DEFAULT_VERBOSITY MagAOX::app::MagAOXApp< _useINDI >::verboseT
inherited

Definition at line 182 of file MagAOXApp.hpp.

Constructor & Destructor Documentation

◆ streamWriter()

MagAOX::app::streamWriter::streamWriter ( )

Default c'tor.

Definition at line 351 of file streamWriter.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::m_powerMgtEnabled, and m_selfWriter.

◆ ~streamWriter()

MagAOX::app::streamWriter::~streamWriter ( )
noexcept

Member Function Documentation

◆ _handlerSigSegv()

void MagAOX::app::streamWriter::_handlerSigSegv ( int  signum,
siginfo_t siginf,
void ucont 
)
staticprotected

The handler called when SIGSEGV or SIGBUS is received, which will be due to ImageStreamIO server resets. Just a wrapper for handlerSigSegv.

Definition at line 1029 of file streamWriter.hpp.

References handlerSigSegv(), MagAOX::app::MagAOXApp< _useINDI >::log(), and m_selfWriter.

Referenced by setSigSegvHandler().

◆ _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 2219 of file MagAOXApp.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::handlerSigTerm().

◆ allocate_circbufs()

int MagAOX::app::streamWriter::allocate_circbufs ( )
protected

◆ allocate_xrif()

int MagAOX::app::streamWriter::allocate_xrif ( )
protected

Worker function to configure and allocate the xrif handles.

This takes place in the fg thread after connecting to the stream.

Returns
0 on sucess.
-1 on error.

Definition at line 1161 of file streamWriter.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::log(), m_compress, m_dataType, m_height, m_width, m_writeChunkLength, m_xrif, m_xrif_timing, xrif_allocate_raw, xrif_allocate_reordered, xrif_configure, and xrif_set_size.

Referenced by fgThreadExec(), libXWCTest::streamWriterTest::TEST_CASE(), libXWCTest::streamWriterTest::TEST_CASE(), and libXWCTest::streamWriterTest::TEST_CASE().

◆ appLogic()

◆ appShutdown()

◆ appStartup()

◆ basePath()

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

Get the.

Returns
the value of m_ *

Definition at line 3976 of file MagAOXApp.hpp.

Referenced by loadConfig().

◆ calibDir()

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

Get the calibration directory.

Returns
the value of m_calibDir

Definition at line 4000 of file MagAOXApp.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 1658 of file MagAOXApp.hpp.

References MagAOX::app::it, flatlogs::logPrio::LOG_CRITICAL, flatlogs::logPrio::LOG_WARNING, and MagAOX::app::msg.

◆ checkRecordTimes() [1/4]

int MagAOX::app::streamWriter::checkRecordTimes ( )

◆ checkRecordTimes() [2/4]

int MagAOX::app::dev::telemeter< streamWriter >::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 156 of file telemeter.hpp.

◆ checkRecordTimes() [3/4]

int MagAOX::app::dev::telemeter< streamWriter >::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 177 of file telemeter.hpp.

◆ checkRecordTimes() [4/4]

int MagAOX::app::dev::telemeter< streamWriter >::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 167 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 2692 of file MagAOXApp.hpp.

References INDI_ALERT, INDI_BUSY, INDI_IDLE, INDI_OK, and flatlogs::logPrio::LOG_WARNING.

◆ configBase()

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

Get the config base file.

Returns
the value of m_confgBase

Definition at line 3994 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 3988 of file MagAOXApp.hpp.

Referenced by libXWCTest::xInstGraphTest::TEST_CASE().

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

Callback for config system logging.

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

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

Definition at line 2139 of file MagAOXApp.hpp.

◆ configName()

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

◆ cpusetPath()

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

Get the cpuset path.

Returns
the value of m_cpusetPath

Definition at line 4018 of file MagAOXApp.hpp.

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

References flatlogs::logPrio::LOG_CRITICAL, and MAGAOX_driverFIFORelPath.

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

Referenced by MagAOX::app::cred2Ctrl::appStartup(), 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 2764 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 2800 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 2903 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 2978 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 2933 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 2736 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 2873 of file MagAOXApp.hpp.

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

◆ derived()

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

Access the derived class.

Definition at line 181 of file telemeter.hpp.

◆ doEncode()

◆ 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 4048 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 4036 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 4042 of file MagAOXApp.hpp.

◆ execute()

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

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

Performs final startup steps. That is:

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

Errors in the above steps will cause a process exit.

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

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

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

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

Todo:
Need a heartbeat update here.

Definition at line 1725 of file MagAOXApp.hpp.

References flatlogs::logPrio::LOG_CRITICAL.

◆ fgThreadExec()

◆ fgThreadStart()

void MagAOX::app::streamWriter::fgThreadStart ( streamWriter s)
staticprotected

Thread starter, called by fgThreadStart on thread construction. Calls fgThreadExec.

Parameters
[in]sa pointer to an streamWriter instance (normally this)

Definition at line 1276 of file streamWriter.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::log().

Referenced by appStartup().

◆ getCircBuffLengths()

void MagAOX::app::streamWriter::getCircBuffLengths ( size_t circBuffLength,
double circBuffSize,
size_t writeChunkLength,
size_t  maxCircBuffLength,
double  maxCircBuffSize,
size_t  maxWriteChunkLength,
uint32_t  width,
uint32_t  height,
size_t  typeSize 
)
static

◆ gitAlert()

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

Get the value of the git alert flag.

Returns
the current value of m_gitAlert

Definition at line 2671 of file MagAOXApp.hpp.

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

References MagAOX::app::ipRecv.

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

References MagAOX::app::ipRecv, MagAOX::app::it, and MagAOX::app::lock().

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

References MagAOX::app::ipRecv, MagAOX::app::it, and MagAOX::app::lock().

Referenced by libXWCTest::appTest::MagAOXAppTest::SCENARIO().

◆ handlerSigSegv()

void MagAOX::app::streamWriter::handlerSigSegv ( int  signum,
siginfo_t siginf,
void ucont 
)
protected

Handles SIGSEGV and SIGBUS. Sets m_restart to true.

Definition at line 1034 of file streamWriter.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::log(), and m_restart.

Referenced by _handlerSigSegv().

◆ 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 2225 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 3562 of file MagAOXApp.hpp.

References MagAOX::app::ipRecv, MagAOX::app::it, and MagAOX::app::lock().

Referenced by MagAOX::app::xInstGraph::igHandleSetProperty().

◆ INDI_NEWCALLBACK_DECL()

MagAOX::app::streamWriter::INDI_NEWCALLBACK_DECL ( streamWriter  ,
m_indiP_writing   
)

◆ INDI_SETCALLBACK_DECL()

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

◆ indiSetPropertyShouldRequest()

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

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

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

Definition at line 3182 of file MagAOXApp.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::indiCallBack::m_defReceived, and MagAOX::app::MagAOXApp< _useINDI >::indiCallBack::m_nextRetry.

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

References INDI_BUSY, and flatlogs::logPrio::LOG_ERROR.

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

◆ initialize_xrif()

int MagAOX::app::streamWriter::initialize_xrif ( )
protected

Initialize the xrif system.

Allocates the handles and headers pointers.

Returns
0 on success.
-1 on error.

Definition at line 932 of file streamWriter.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::log(), m_compress, m_xrif, m_xrif_header, m_xrif_timing, m_xrif_timing_header, and xrif_configure.

Referenced by appStartup(), and libXWCTest::streamWriterTest::TEST_CASE().

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

References INDI_SETCALLBACK, flatlogs::logPrio::LOG_CRITICAL, and flatlogs::logPrio::LOG_ERROR.

◆ loadConfig() [1/2]

◆ loadConfig() [2/2]

int MagAOX::app::dev::telemeter< streamWriter >::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 120 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 2296 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 2081 of file MagAOXApp.hpp.

References MagAOX::app::msg.

Referenced by MagAOX::app::picoMotorCtrl::motorChannel::motorChannel(), MagAOX::app::zylaCtrl::zylaCtrl(), MagAOX::app::picamCtrl::~picamCtrl(), ~streamWriter(), MagAOX::app::zylaCtrl::~zylaCtrl(), dbIngest.dbIngest::_ensure_connected(), visxCtrl.core.visxCtrl::_gather_metadata(), _handlerSigSegv(), visxCtrl.core.visxCtrl::_init_properties(), MagAOX::app::qhyCtrl::AbortAcquisition(), MagAOX::app::andorCtrl::acquireAndCheckValid(), MagAOX::app::baslerCtrl::acquireAndCheckValid(), MagAOX::app::cameraSim::acquireAndCheckValid(), MagAOX::app::cred2Ctrl::acquireAndCheckValid(), MagAOX::app::ocam2KCtrl::acquireAndCheckValid(), MagAOX::app::picamCtrl::acquireAndCheckValid(), MagAOX::app::zylaCtrl::acquireAndCheckValid(), allocate_circbufs(), allocate_xrif(), MagAOX::app::acronameUsbHub::appLogic(), MagAOX::app::andorCtrl::appLogic(), MagAOX::app::baslerCtrl::appLogic(), MagAOX::app::cameraSim::appLogic(), MagAOX::app::cred2Ctrl::appLogic(), MagAOX::app::filterWheelCtrl::appLogic(), MagAOX::app::hsfwCtrl::appLogic(), MagAOX::app::mzmqClient::appLogic(), MagAOX::app::mzmqServer::appLogic(), MagAOX::app::ocam2KCtrl::appLogic(), MagAOX::app::picamCtrl::appLogic(), MagAOX::app::picoMotorCtrl::appLogic(), MagAOX::app::qhyCtrl::appLogic(), MagAOX::app::siglentSDG::appLogic(), MagAOX::app::smc100ccCtrl::appLogic(), appLogic(), MagAOX::app::sysMonitor::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::andorCtrl::appShutdown(), MagAOX::app::baslerCtrl::appShutdown(), MagAOX::app::hsfwCtrl::appShutdown(), MagAOX::app::mzmqClient::appShutdown(), MagAOX::app::mzmqServer::appShutdown(), MagAOX::app::picamCtrl::appShutdown(), MagAOX::app::picoMotorCtrl::appShutdown(), MagAOX::app::qhyCtrl::appShutdown(), appShutdown(), MagAOX::app::zylaCtrl::appShutdown(), MagAOX::app::acronameUsbHub::appStartup(), MagAOX::app::andorCtrl::appStartup(), MagAOX::app::baslerCtrl::appStartup(), MagAOX::app::cameraSim::appStartup(), MagAOX::app::cred2Ctrl::appStartup(), MagAOX::app::filterWheelCtrl::appStartup(), MagAOX::app::hsfwCtrl::appStartup(), MagAOX::app::magAOXMaths::appStartup(), MagAOX::app::mzmqClient::appStartup(), MagAOX::app::mzmqServer::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(), appStartup(), MagAOX::app::sysMonitor::appStartup(), MagAOX::app::trippLitePDU::appStartup(), MagAOX::app::xt1121DCDU::appStartup(), MagAOX::app::zaberCtrl::appStartup(), MagAOX::app::zylaCtrl::appStartup(), MagAOX::app::ttmModulator::calcState(), MagAOX::app::andorCtrl::cameraSelect(), MagAOX::app::zylaCtrl::cameraSelect(), visxCtrl.core.visxCtrl::cancel_exposure(), MagAOX::app::picamCtrl::capExpTime(), MagAOX::app::siglentSDG::changeAmp(), MagAOX::app::siglentSDG::changeAmp(), MagAOX::app::siglentSDG::changeFreq(), MagAOX::app::siglentSDG::changeFreq(), MagAOX::app::siglentSDG::changeOfst(), MagAOX::app::siglentSDG::changeOfst(), MagAOX::app::siglentSDG::changeOutp(), MagAOX::app::siglentSDG::changeOutp(), MagAOX::app::siglentSDG::changePhse(), MagAOX::app::siglentSDG::changePhse(), MagAOX::app::siglentSDG::changeSync(), MagAOX::app::siglentSDG::changeSync(), MagAOX::app::siglentSDG::changeWdth(), MagAOX::app::siglentSDG::changeWdth(), MagAOX::app::siglentSDG::changeWvtp(), MagAOX::app::siglentSDG::changeWvtp(), MagAOX::app::xt1121Ctrl::channelSetCallback(), MagAOX::app::picoMotorCtrl::channelThreadExec(), MagAOX::app::picoMotorCtrl::channelThreadStart(), MagAOX::app::baslerCtrl::checkNextROI(), MagAOX::app::cred2Ctrl::checkNextROI(), MagAOX::app::andorCtrl::checkRecordTimes(), MagAOX::app::baslerCtrl::checkRecordTimes(), MagAOX::app::cameraSim::checkRecordTimes(), MagAOX::app::cred2Ctrl::checkRecordTimes(), MagAOX::app::ocam2KCtrl::checkRecordTimes(), MagAOX::app::picamCtrl::checkRecordTimes(), MagAOX::app::qhyCtrl::checkRecordTimes(), MagAOX::app::siglentSDG::checkRecordTimes(), MagAOX::app::smc100ccCtrl::checkRecordTimes(), MagAOX::app::sysMonitor::checkRecordTimes(), MagAOX::app::zaberCtrl::checkRecordTimes(), MagAOX::app::zylaCtrl::checkRecordTimes(), MagAOX::app::siglentSDG::checkSetup(), MagAOX::app::andorCtrl::configureAcquisition(), MagAOX::app::baslerCtrl::configureAcquisition(), MagAOX::app::cameraSim::configureAcquisition(), MagAOX::app::cred2Ctrl::configureAcquisition(), MagAOX::app::ocam2KCtrl::configureAcquisition(), MagAOX::app::picamCtrl::configureAcquisition(), MagAOX::app::qhyCtrl::configureAcquisition(), MagAOX::app::zylaCtrl::configureAcquisition(), MagAOX::app::baslerCtrl::connect(), MagAOX::app::picamCtrl::connect(), MagAOX::app::qhyCtrl::connect(), pupilCorAlign.pupilCorAlign::control_position(), MagAOX::app::sysMonitor::criticalCoreTemperature(), MagAOX::app::sysMonitor::criticalDiskTemperature(), MagAOX::app::ocam2KCtrl::destroySyncStream(), MagAOX::app::trippLitePDU::devConnect(), MagAOX::app::trippLitePDU::devLogin(), MagAOX::app::trippLitePDU::devPostLogin(), MagAOX::app::trippLitePDU::devStatus(), doEncode(), MagAOX::app::ocam2KCtrl::ensureSyncStream(), fgThreadExec(), fgThreadStart(), visxCtrl.core.visxCtrl::finalize_exposure(), MagAOX::app::sysMonitor::findChronyStatus(), MagAOX::app::sysMonitor::findCPULoads(), MagAOX::app::sysMonitor::findCPUTemperatures(), MagAOX::app::sysMonitor::findDiskTemperature(), MagAOX::app::sysMonitor::findDiskUsage(), MagAOX::app::sysMonitor::findRamUsage(), camtipSR.core.camtipSR::fit_SR_EE(), camtipSR.core.camtipSR::fit_SR_gauss(), MagAOX::app::ocam2KCtrl::frameGrabberPostPublish(), pupilCorAlign.pupilCorAlign::get_current_state(), MagAOX::app::picamCtrl::getAcquisitionState(), MagAOX::app::cred2Ctrl::getAnalogGain(), getCircBuffLengths(), MagAOX::app::smc100ccCtrl::getCtrlState(), MagAOX::app::andorCtrl::getEMGain(), MagAOX::app::ocam2KCtrl::getEMGain(), MagAOX::app::baslerCtrl::getExpTime(), MagAOX::app::qhyCtrl::getExpTime(), MagAOX::app::cred2Ctrl::getFanSpeed(), MagAOX::app::picamCtrl::getFanSpeed(), MagAOX::app::andorCtrl::getFPS(), MagAOX::app::cred2Ctrl::getFPS(), MagAOX::app::ocam2KCtrl::getFPS(), MagAOX::app::smc100ccCtrl::getLastError(), MagAOX::app::cred2Ctrl::getLEDState(), MagAOX::app::filterWheelCtrl::getMoving(), MagAOX::app::picamCtrl::getPicamParameter(), MagAOX::app::picamCtrl::getPicamParameter(), MagAOX::app::filterWheelCtrl::getPos(), MagAOX::app::smc100ccCtrl::getPosition(), MagAOX::app::xt1121Ctrl::getState(), MagAOX::app::filterWheelCtrl::getSwitch(), MagAOX::app::andorCtrl::getTemp(), MagAOX::app::baslerCtrl::getTemp(), MagAOX::app::qhyCtrl::getTemp(), MagAOX::app::zylaCtrl::getTemp(), MagAOX::app::cred2Ctrl::getTemps(), MagAOX::app::ocam2KCtrl::getTemps(), MagAOX::app::picamCtrl::getTemps(), camtipSR.core.camtipSR::grab_img(), camtipSR.core.camtipSR::grab_stack(), pupilCorAlign.pupilCorAlign::handle_centroid_ref(), corAlign.corAlign::handle_closed_loop(), adcCtrl.app.adcCtrl::handle_ctrl_mtx(), visxCtrl.core.visxCtrl::handle_expose(), visxCtrl.core.visxCtrl::handle_exptime(), pupilCorAlign.pupilCorAlign::handle_fwlyot(), pupilCorAlign.pupilCorAlign::handle_fwlyot_ref(), pupilCorAlign.pupilCorAlign::handle_fwpupil(), pupilCorAlign.pupilCorAlign::handle_fwpupil_ref(), adcCtrl.app.adcCtrl::handle_gain(), pupilCorAlign.pupilCorAlign::handle_gain(), visxCtrl.core.visxCtrl::handle_gain(), adcCtrl.app.adcCtrl::handle_knife_edge(), adcCtrl.app.adcCtrl::handle_knife_edge_findzero(), adcCtrl.app.adcCtrl::handle_labmode(), adcCtrl.app.adcCtrl::handle_n_avg(), camtipSR.core.camtipSR::handle_n_avg(), corAlign.corAlign::handle_n_avg(), camtipSR.core.camtipSR::handle_n_jitter(), adcCtrl.app.adcCtrl::handle_no_measurements(), pupilCorAlign.pupilCorAlign::handle_nstack(), adcCtrl.app.adcCtrl::handle_offset(), audibleAlerts.core.AudibleAlerts::handle_personality_switch(), corAlign.corAlign::handle_ref_x(), corAlign.corAlign::handle_ref_y(), adcCtrl.app.adcCtrl::handle_reset(), xapp.aoSim.aoSim::handle_reset(), audibleAlerts.core.AudibleAlerts::handle_soundboard_switch(), audibleAlerts.core.AudibleAlerts::handle_speech_request(), audibleAlerts.core.AudibleAlerts::handle_speech_text(), adcCtrl.app.adcCtrl::handle_state(), corAlign.corAlign::handle_state(), visxCtrl.core.visxCtrl::handle_temp_ccd(), handlerSigSegv(), MagAOX::app::filterWheelCtrl::home(), MagAOX::app::INDI_NEWCALLBACK_DEFN(), MagAOX::app::INDI_NEWCALLBACK_DEFN(), dbIngest.dbIngest::ingest_line(), initialize_xrif(), MagAOX::app::cred2Ctrl::issueCommand(), dbIngest.dbIngest::launch_followers(), audibleAlerts.core.AudibleAlerts::load_personality(), MagAOX::app::andorCtrl::loadConfig(), MagAOX::app::baslerCtrl::loadConfig(), MagAOX::app::cred2Ctrl::loadConfig(), MagAOX::app::filterWheelCtrl::loadConfig(), MagAOX::app::hsfwCtrl::loadConfig(), MagAOX::app::mzmqClient::loadConfig(), MagAOX::app::mzmqServer::loadConfig(), MagAOX::app::ocam2KCtrl::loadConfig(), MagAOX::app::picoMotorCtrl::loadConfig(), MagAOX::app::qhyCtrl::loadConfig(), MagAOX::app::smc100ccCtrl::loadConfig(), loadConfig(), MagAOX::app::sysMonitor::loadConfig(), MagAOX::app::xt1121Ctrl::loadConfig(), MagAOX::app::baslerCtrl::loadConfigImpl(), MagAOX::app::picoMotorCtrl::loadConfigImpl(), MagAOX::app::zaberCtrl::loadConfigImpl(), MagAOX::app::cameraSim::loadConfigImpl(), MagAOX::app::cred2Ctrl::loadConfigImpl(), MagAOX::app::andorCtrl::loadImageIntoStream(), MagAOX::app::baslerCtrl::loadImageIntoStream(), MagAOX::app::cameraSim::loadImageIntoStream(), MagAOX::app::cred2Ctrl::loadImageIntoStream(), MagAOX::app::ocam2KCtrl::loadImageIntoStream(), MagAOX::app::picamCtrl::loadImageIntoStream(), MagAOX::app::qhyCtrl::loadImageIntoStream(), MagAOX::app::zylaCtrl::loadImageIntoStream(), adcCtrl.app.adcCtrl::loop(), audibleAlerts.core.AudibleAlerts::loop(), corAlign.corAlign::loop(), dbIngest.dbIngest::loop(), pupilCorAlign.pupilCorAlign::loop(), visxCtrl.core.visxCtrl::loop(), MagAOX::app::smc100ccCtrl::makeCom(), corAlign.corAlign::measure_fpm_mask_shift(), MagAOX::app::ttmModulator::modTTM(), MagAOX::app::filterWheelCtrl::moveTo(), MagAOX::app::hsfwCtrl::moveTo(), MagAOX::app::zaberCtrl::moveTo(), MagAOX::app::smc100ccCtrl::moveTo(), MagAOX::app::filterWheelCtrl::moveToRaw(), MagAOX::app::filterWheelCtrl::moveToRawRelative(), MagAOX::app::picoMotorCtrl::newCallBack_picopos(), MagAOX::app::picoMotorCtrl::newCallBack_presetName(), MagAOX::app::siglentSDG::normalizeSetup(), MagAOX::app::ttmModulator::offset12(), MagAOX::app::ttmModulator::offsetXY(), MagAOX::app::acronameUsbHub::onPowerOff(), MagAOX::app::andorCtrl::onPowerOff(), MagAOX::app::cred2Ctrl::onPowerOff(), MagAOX::app::filterWheelCtrl::onPowerOff(), MagAOX::app::hsfwCtrl::onPowerOff(), MagAOX::app::ocam2KCtrl::onPowerOff(), MagAOX::app::picamCtrl::onPowerOff(), MagAOX::app::zylaCtrl::onPowerOff(), MagAOX::app::filterWheelCtrl::onPowerOnConnect(), MagAOX::app::sysMonitor::parseCPULoads(), MagAOX::app::sysMonitor::parseCPUTemperatures(), MagAOX::app::sysMonitor::parseCPUTemperaturesAMD(), MagAOX::app::sysMonitor::parseCPUTemperaturesIntel(), MagAOX::app::sysMonitor::parseDiskTemperature(), MagAOX::app::sysMonitor::parseDiskUsage(), MagAOX::app::trippLitePDU::parsePDUStatus(), MagAOX::app::sysMonitor::parseRamUsage(), MagAOX::app::zylaCtrl::powerOnDefaults(), audibleAlerts.core.AudibleAlerts::preprocess(), MagAOX::app::filterWheelCtrl::presetNumber(), MagAOX::app::smc100ccCtrl::presetNumber(), MagAOX::app::zaberCtrl::presetNumber(), MagAOX::app::siglentSDG::queryARWV(), MagAOX::app::siglentSDG::queryBSWV(), MagAOX::app::siglentSDG::queryBTWV(), MagAOX::app::siglentSDG::queryMDWV(), MagAOX::app::siglentSDG::queryOUTP(), MagAOX::app::siglentSDG::querySWWV(), MagAOX::app::siglentSDG::querySYNC(), audibleAlerts.core.AudibleAlerts::reaction_handler(), MagAOX::app::picoMotorCtrl::readChannelCounts(), MagAOX::app::andorCtrl::reconfig(), MagAOX::app::cred2Ctrl::reconfig(), MagAOX::app::ocam2KCtrl::reconfig(), MagAOX::app::picamCtrl::reconfig(), MagAOX::app::zylaCtrl::reconfig(), MagAOX::app::sysMonitor::recordChronyStatus(), MagAOX::app::sysMonitor::recordCoreLoads(), MagAOX::app::sysMonitor::recordCoreTemps(), MagAOX::app::sysMonitor::recordDriveTemps(), MagAOX::app::siglentSDG::recordParams(), recordSavingState(), recordSavingStats(), MagAOX::app::filterWheelCtrl::recordStage(), MagAOX::app::smc100ccCtrl::recordStage(), MagAOX::app::zaberCtrl::recordTelem(), MagAOX::app::sysMonitor::recordUsage(), MagAOX::app::zaberCtrl::recordZaber(), dbIngest.dbIngest::refresh_properties(), visxCtrl.core.visxCtrl::refresh_properties(), release_circbufs(), MagAOX::app::mzmqClient::reportError(), MagAOX::app::mzmqServer::reportError(), MagAOX::app::mzmqClient::reportInfo(), MagAOX::app::mzmqServer::reportInfo(), MagAOX::app::mzmqClient::reportNotice(), MagAOX::app::mzmqServer::reportNotice(), MagAOX::app::mzmqClient::reportWarning(), MagAOX::app::mzmqServer::reportWarning(), MagAOX::app::ocam2KCtrl::resetEMProtection(), MagAOX::app::ttmModulator::restTTM(), adcCtrl.app.adcCtrl::send_command(), MagAOX::app::cred2Ctrl::sendCommand(), MagAOX::app::cred2Ctrl::setAnalogGain(), MagAOX::app::andorCtrl::setCropMode(), MagAOX::app::andorCtrl::setEMGain(), MagAOX::app::ocam2KCtrl::setEMGain(), MagAOX::app::picamCtrl::setEMGain(), MagAOX::app::andorCtrl::setExpTime(), MagAOX::app::baslerCtrl::setExpTime(), MagAOX::app::cameraSim::setExpTime(), MagAOX::app::picamCtrl::setExpTime(), MagAOX::app::qhyCtrl::setExpTime(), MagAOX::app::cred2Ctrl::setFanSpeed(), MagAOX::app::baslerCtrl::setFPS(), MagAOX::app::cameraSim::setFPS(), MagAOX::app::cred2Ctrl::setFPS(), MagAOX::app::ocam2KCtrl::setFPS(), MagAOX::app::sysMonitor::setlatThreadExec(), MagAOX::app::sysMonitor::setlatThreadStart(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::picamCtrl::setPicamParameterOnline(), MagAOX::app::picamCtrl::setPicamParameterOnline(), MagAOX::app::picamCtrl::setPicamParameterOnline(), MagAOX::app::picamCtrl::setPicamParameterOnline(), MagAOX::app::andorCtrl::setReadoutSpeed(), MagAOX::app::cred2Ctrl::setSerialBaud(), MagAOX::app::ocam2KCtrl::setShutter(), MagAOX::app::picamCtrl::setShutter(), MagAOX::app::zylaCtrl::setShutter(), MagAOX::app::cameraSim::setShutter(), MagAOX::app::andorCtrl::setShutter(), setSigSegvHandler(), MagAOX::app::ocam2KCtrl::setSynchro(), MagAOX::app::andorCtrl::setTempControl(), MagAOX::app::cred2Ctrl::setTempControl(), MagAOX::app::ocam2KCtrl::setTempControl(), MagAOX::app::zylaCtrl::setTempControl(), MagAOX::app::andorCtrl::setTempSetPt(), MagAOX::app::cred2Ctrl::setTempSetPt(), MagAOX::app::ocam2KCtrl::setTempSetPt(), MagAOX::app::ttmModulator::setTTM(), adcCtrl.app.adcCtrl::setup(), camtipSR.core.camtipSR::setup(), corAlign.corAlign::setup(), efcControl.efcControl::setup(), pupilCorAlign.pupilCorAlign::setup(), sparkleTracker.sparkleTracker::setup(), MagAOX::app::andorCtrl::setVShiftSpeed(), MagAOX::app::smc100ccCtrl::splitResponse(), pupilCorAlign.pupilCorAlign::stages_are_ready(), MagAOX::app::andorCtrl::startAcquisition(), MagAOX::app::baslerCtrl::startAcquisition(), MagAOX::app::cred2Ctrl::startAcquisition(), MagAOX::app::ocam2KCtrl::startAcquisition(), MagAOX::app::zylaCtrl::startAcquisition(), MagAOX::app::hsfwCtrl::startHoming(), MagAOX::app::smc100ccCtrl::startHoming(), MagAOX::app::zaberCtrl::startHoming(), MagAOX::app::baslerCtrl::stateString(), MagAOX::app::ocam2KCtrl::stateString(), MagAOX::app::filterWheelCtrl::stop(), MagAOX::app::smc100ccCtrl::stop(), MagAOX::app::zaberCtrl::stop(), visxCtrl.core.visxCtrl::subscribe_to_other_devices(), swThreadExec(), swThreadStart(), MagAOX::app::zaberCtrl::syncPowerOffStageTelemetry(), MagAOX::app::cred2Ctrl::syncROIFromCamera(), MagAOX::app::smc100ccCtrl::testConnection(), adcCtrl.app.adcCtrl::transition_to_idle(), camtipSR.core.camtipSR::transition_to_idle(), corAlign.corAlign::transition_to_idle(), MagAOX::app::acronameUsbHub::turnOutletOff(), MagAOX::app::trippLitePDU::turnOutletOff(), MagAOX::app::xt1121DCDU::turnOutletOff(), MagAOX::app::acronameUsbHub::turnOutletOn(), MagAOX::app::trippLitePDU::turnOutletOn(), MagAOX::app::xt1121DCDU::turnOutletOn(), pupilCorAlign.pupilCorAlign::update_properties(), adcCtrl.app.adcCtrl::update_wavelength(), MagAOX::app::trippLitePDU::updateAlarmsAndWarnings(), MagAOX::app::cred2Ctrl::updateFPSLimits(), MagAOX::app::acronameUsbHub::updateOutletState(), MagAOX::app::trippLitePDU::updateOutletState(), MagAOX::app::xt1121DCDU::updateOutletState(), MagAOX::app::trippLitePDU::updateOutletStates(), MagAOX::app::magAOXMaths::updateVals(), MagAOX::app::sysMonitor::updateVals(), waitForWriteCompletion(), audibleAlerts.core.AudibleAlerts::walkup_handler(), MagAOX::app::andorCtrl::whilePowerOff(), MagAOX::app::cred2Ctrl::whilePowerOff(), MagAOX::app::filterWheelCtrl::whilePowerOff(), MagAOX::app::hsfwCtrl::whilePowerOff(), MagAOX::app::ocam2KCtrl::whilePowerOff(), MagAOX::app::picamCtrl::whilePowerOff(), MagAOX::app::zylaCtrl::whilePowerOff(), MagAOX::app::picoMotorCtrl::writeChannelCounts(), MagAOX::app::siglentSDG::writeCommand(), MagAOX::app::andorCtrl::writeConfig(), MagAOX::app::cred2Ctrl::writeConfig(), MagAOX::app::siglentSDG::writeRead(), MagAOX::app::xt1121DCDU::xtChannelName(), and MagAOX::app::xt1121DCDU::xtChannelProperty().

◆ log() [2/2]

template<bool _useINDI>
template<typename logT , int retval>
int MagAOX::app::MagAOXApp< _useINDI >::log ( logPrioT  level = logPrio::LOG_DEFAULT)
staticinherited

Make a log entry.

Wrapper for logManager::log

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

Definition at line 2089 of file MagAOXApp.hpp.

Referenced by dbIngest.dbIngest::_ensure_connected(), visxCtrl.core.visxCtrl::_gather_metadata(), visxCtrl.core.visxCtrl::_init_properties(), visxCtrl.core.visxCtrl::cancel_exposure(), pupilCorAlign.pupilCorAlign::control_position(), visxCtrl.core.visxCtrl::finalize_exposure(), camtipSR.core.camtipSR::fit_SR_EE(), camtipSR.core.camtipSR::fit_SR_gauss(), pupilCorAlign.pupilCorAlign::get_current_state(), camtipSR.core.camtipSR::grab_img(), camtipSR.core.camtipSR::grab_stack(), pupilCorAlign.pupilCorAlign::handle_centroid_ref(), corAlign.corAlign::handle_closed_loop(), adcCtrl.app.adcCtrl::handle_ctrl_mtx(), visxCtrl.core.visxCtrl::handle_expose(), visxCtrl.core.visxCtrl::handle_exptime(), pupilCorAlign.pupilCorAlign::handle_fwlyot(), pupilCorAlign.pupilCorAlign::handle_fwlyot_ref(), pupilCorAlign.pupilCorAlign::handle_fwpupil(), pupilCorAlign.pupilCorAlign::handle_fwpupil_ref(), adcCtrl.app.adcCtrl::handle_gain(), pupilCorAlign.pupilCorAlign::handle_gain(), visxCtrl.core.visxCtrl::handle_gain(), adcCtrl.app.adcCtrl::handle_knife_edge(), adcCtrl.app.adcCtrl::handle_knife_edge_findzero(), adcCtrl.app.adcCtrl::handle_labmode(), adcCtrl.app.adcCtrl::handle_n_avg(), camtipSR.core.camtipSR::handle_n_avg(), corAlign.corAlign::handle_n_avg(), camtipSR.core.camtipSR::handle_n_jitter(), adcCtrl.app.adcCtrl::handle_no_measurements(), pupilCorAlign.pupilCorAlign::handle_nstack(), adcCtrl.app.adcCtrl::handle_offset(), audibleAlerts.core.AudibleAlerts::handle_personality_switch(), corAlign.corAlign::handle_ref_x(), corAlign.corAlign::handle_ref_y(), adcCtrl.app.adcCtrl::handle_reset(), xapp.aoSim.aoSim::handle_reset(), audibleAlerts.core.AudibleAlerts::handle_soundboard_switch(), audibleAlerts.core.AudibleAlerts::handle_speech_request(), audibleAlerts.core.AudibleAlerts::handle_speech_text(), adcCtrl.app.adcCtrl::handle_state(), corAlign.corAlign::handle_state(), visxCtrl.core.visxCtrl::handle_temp_ccd(), dbIngest.dbIngest::ingest_line(), dbIngest.dbIngest::launch_followers(), audibleAlerts.core.AudibleAlerts::load_personality(), adcCtrl.app.adcCtrl::loop(), audibleAlerts.core.AudibleAlerts::loop(), corAlign.corAlign::loop(), dbIngest.dbIngest::loop(), pupilCorAlign.pupilCorAlign::loop(), visxCtrl.core.visxCtrl::loop(), corAlign.corAlign::measure_fpm_mask_shift(), audibleAlerts.core.AudibleAlerts::preprocess(), audibleAlerts.core.AudibleAlerts::reaction_handler(), dbIngest.dbIngest::refresh_properties(), visxCtrl.core.visxCtrl::refresh_properties(), adcCtrl.app.adcCtrl::send_command(), adcCtrl.app.adcCtrl::setup(), camtipSR.core.camtipSR::setup(), corAlign.corAlign::setup(), efcControl.efcControl::setup(), pupilCorAlign.pupilCorAlign::setup(), sparkleTracker.sparkleTracker::setup(), pupilCorAlign.pupilCorAlign::stages_are_ready(), visxCtrl.core.visxCtrl::subscribe_to_other_devices(), adcCtrl.app.adcCtrl::transition_to_idle(), camtipSR.core.camtipSR::transition_to_idle(), corAlign.corAlign::transition_to_idle(), pupilCorAlign.pupilCorAlign::update_properties(), adcCtrl.app.adcCtrl::update_wavelength(), and audibleAlerts.core.AudibleAlerts::walkup_handler().

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

References b(), flatlogs::logPrio::LOG_ERROR, flatlogs::logPrio::LOG_NOTICE, flatlogs::logHeader::logLevel(), MagAOX::logger::logMinStdFormat(), MagAOX::logger::logStdFormat(), MagAOX::app::msg, flatlogs::timespecX::time_ns, flatlogs::timespecX::time_s, and flatlogs::logHeader::timespec().

◆ loopPause()

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

Get the loop pause time.

Returns
the value of m_loopPause

Definition at line 4024 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 new property request.

Definition at line 3858 of file MagAOXApp.hpp.

References INDI_IDLE, and MagAOX::app::ipRecv.

◆ noteIndiSetPropertyRequested()

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

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

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

Definition at line 3200 of file MagAOXApp.hpp.

References flatlogs::logPrio::LOG_NOTICE, MagAOX::app::MagAOXApp< _useINDI >::indiCallBack::m_missingLogged, MagAOX::app::MagAOXApp< _useINDI >::indiCallBack::m_nextRetry, MagAOX::app::MagAOXApp< _useINDI >::indiCallBack::m_retryCount, MagAOX::app::MagAOXApp< _useINDI >::indiCallBack::m_retryDelay, and MagAOX::app::MagAOXApp< _useINDI >::indiCallBack::property.

◆ onPowerOff()

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

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

◆ powerState()

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

Returns the current power state.

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

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

Definition at line 3910 of file MagAOXApp.hpp.

Referenced by MagAOX::app::ocam2KCtrl::acquireAndCheckValid(), MagAOX::app::andorCtrl::appLogic(), MagAOX::app::cred2Ctrl::appLogic(), MagAOX::app::hsfwCtrl::appLogic(), MagAOX::app::ocam2KCtrl::appLogic(), MagAOX::app::picamCtrl::appLogic(), MagAOX::app::picoMotorCtrl::appLogic(), MagAOX::app::picamCtrl::capExpTime(), MagAOX::app::picoMotorCtrl::channelThreadExec(), MagAOX::app::ocam2KCtrl::configureAcquisition(), MagAOX::app::picamCtrl::configureAcquisition(), MagAOX::app::picamCtrl::connect(), MagAOX::app::picamCtrl::getAcquisitionState(), MagAOX::app::ocam2KCtrl::getEMGain(), MagAOX::app::picamCtrl::getFanSpeed(), MagAOX::app::ocam2KCtrl::getFPS(), MagAOX::app::picamCtrl::getPicamParameter(), MagAOX::app::picamCtrl::getPicamParameter(), MagAOX::app::ocam2KCtrl::getTemps(), MagAOX::app::picamCtrl::getTemps(), MagAOX::app::hsfwCtrl::moveTo(), MagAOX::app::ocam2KCtrl::resetEMProtection(), MagAOX::app::cred2Ctrl::sendCommand(), MagAOX::app::ocam2KCtrl::setEMGain(), MagAOX::app::picamCtrl::setEMGain(), MagAOX::app::picamCtrl::setExpTime(), MagAOX::app::ocam2KCtrl::setFPS(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::picamCtrl::setPicamParameterOnline(), MagAOX::app::picamCtrl::setPicamParameterOnline(), MagAOX::app::ocam2KCtrl::setSynchro(), MagAOX::app::ocam2KCtrl::setTempControl(), MagAOX::app::ocam2KCtrl::setTempSetPt(), and MagAOX::app::hsfwCtrl::startHoming().

◆ powerStateTarget()

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

Returns the target power state.

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

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

Definition at line 3921 of file MagAOXApp.hpp.

Referenced by MagAOX::app::ocam2KCtrl::acquireAndCheckValid(), MagAOX::app::andorCtrl::appLogic(), MagAOX::app::cred2Ctrl::appLogic(), MagAOX::app::hsfwCtrl::appLogic(), MagAOX::app::ocam2KCtrl::appLogic(), MagAOX::app::picamCtrl::appLogic(), MagAOX::app::picoMotorCtrl::appLogic(), MagAOX::app::picamCtrl::capExpTime(), MagAOX::app::picoMotorCtrl::channelThreadExec(), MagAOX::app::ocam2KCtrl::configureAcquisition(), MagAOX::app::picamCtrl::configureAcquisition(), MagAOX::app::picamCtrl::connect(), MagAOX::app::picamCtrl::getAcquisitionState(), MagAOX::app::ocam2KCtrl::getEMGain(), MagAOX::app::picamCtrl::getFanSpeed(), MagAOX::app::ocam2KCtrl::getFPS(), MagAOX::app::picamCtrl::getPicamParameter(), MagAOX::app::picamCtrl::getPicamParameter(), MagAOX::app::ocam2KCtrl::getTemps(), MagAOX::app::picamCtrl::getTemps(), MagAOX::app::hsfwCtrl::moveTo(), MagAOX::app::ocam2KCtrl::resetEMProtection(), MagAOX::app::cred2Ctrl::sendCommand(), MagAOX::app::ocam2KCtrl::setEMGain(), MagAOX::app::picamCtrl::setEMGain(), MagAOX::app::picamCtrl::setExpTime(), MagAOX::app::ocam2KCtrl::setFPS(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::picamCtrl::setPicamParameter(), MagAOX::app::picamCtrl::setPicamParameterOnline(), MagAOX::app::picamCtrl::setPicamParameterOnline(), MagAOX::app::ocam2KCtrl::setSynchro(), MagAOX::app::ocam2KCtrl::setTempControl(), MagAOX::app::ocam2KCtrl::setTempSetPt(), and MagAOX::app::hsfwCtrl::startHoming().

◆ recordSavingState()

◆ recordSavingStats()

int MagAOX::app::streamWriter::recordSavingStats ( bool  force = false)

◆ recordTelem()

int MagAOX::app::streamWriter::recordTelem ( const telem_saving_state )

Definition at line 2326 of file streamWriter.hpp.

References recordSavingState().

Referenced by libXWCTest::streamWriterTest::TEST_CASE().

◆ 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(), appStartup(), MagAOX::app::sysMonitor::appStartup(), MagAOX::app::zaberCtrl::appStartup(), and libXWCTest::appTest::MagAOXAppTest::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 2988 of file MagAOXApp.hpp.

References MagAOX::app::lock().

Referenced by MagAOX::app::cred2Ctrl::appStartup(), 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 3020 of file MagAOXApp.hpp.

References MagAOX::app::lock().

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

References MagAOX::app::lock().

◆ release_circbufs()

void MagAOX::app::streamWriter::release_circbufs ( )
protected

Release the circular buffers owned by the framegrabber thread.

Definition at line 1230 of file streamWriter.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::log(), m_rawImageCircBuff, and m_timingCircBuff.

Referenced by ~streamWriter(), appShutdown(), and fgThreadExec().

◆ resetIndiSetPropertyRetry()

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

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

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

Definition at line 3173 of file MagAOXApp.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::indiCallBack::m_missingLogged, MagAOX::app::MagAOXApp< _useINDI >::indiCallBack::m_nextRetry, MagAOX::app::MagAOXApp< _useINDI >::indiCallBack::m_retryCount, and MagAOX::app::MagAOXApp< _useINDI >::indiCallBack::m_retryDelay.

◆ secretsPath()

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

Get the secrets path.

Returns
the value of m_secretsPath

Definition at line 4012 of file MagAOXApp.hpp.

◆ sendGetPropertySetList()

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

Definition at line 3352 of file MagAOXApp.hpp.

References MagAOX::app::it, and MagAOX::app::lock().

◆ 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 3794 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 3758 of file MagAOXApp.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::sendNewProperty().

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::picamCtrl::setExpTime(), MagAOX::app::ocam2KCtrl::setFPS(), MagAOX::app::picamCtrl::setSynchro(), MagAOX::app::ttmModulator::setTTM(), MagAOX::app::zaberCtrl::startHoming(), MagAOX::app::zaberCtrl::stop(), MagAOX::app::xt1121DCDU::turnOutletOff(), MagAOX::app::xt1121DCDU::turnOutletOn(), and MagAOX::app::picamCtrl::updateFxnGenSync().

◆ 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 3815 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 1381 of file MagAOXApp.hpp.

References MAGAOX_calibRelPath, MAGAOX_configRelPath, MAGAOX_env_calib, MAGAOX_env_config, MAGAOX_env_cpuset, MAGAOX_env_log, MAGAOX_env_path, MAGAOX_env_secrets, MAGAOX_env_sys, MAGAOX_logRelPath, MAGAOX_path, MAGAOX_secretsRelPath, and MAGAOX_sysRelPath.

◆ 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 2259 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 2277 of file MagAOXApp.hpp.

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

◆ setSigSegvHandler()

int MagAOX::app::streamWriter::setSigSegvHandler ( )
protected

Sets the handler for SIGSEGV and SIGBUS.

These are caused by ImageStreamIO server resets.

Definition at line 992 of file streamWriter.hpp.

References _handlerSigSegv(), MagAOX::app::MagAOXApp< _useINDI >::log(), and flatlogs::logPrio::LOG_DEBUG.

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

References flatlogs::logPrio::LOG_DEBUG.

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

◆ setupConfig() [1/2]

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

Setup the configuration system (called by MagAOXApp::setup())

Definition at line 379 of file streamWriter.hpp.

References MagAOX::app::dev::telemeter< streamWriter >::setupConfig().

Referenced by libXWCTest::streamWriterTest::TEST_CASE().

◆ setupConfig() [2/2]

int MagAOX::app::dev::telemeter< streamWriter >::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 112 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 4030 of file MagAOXApp.hpp.

Referenced by MagAOX::app::xt1121Ctrl::channelSetCallback(), MagAOX::app::xt1121Ctrl::getState(), swThreadExec(), and libXWCTest::xInstGraphTest::TEST_CASE().

◆ 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 new property request.

Definition at line 3852 of file MagAOXApp.hpp.

References MagAOX::app::ipRecv.

◆ 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 3295 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 2601 of file MagAOXApp.hpp.

Referenced by MagAOX::app::baslerCtrl::acquireAndCheckValid(), MagAOX::app::picamCtrl::acquireAndCheckValid(), MagAOX::app::qhyCtrl::acquireAndCheckValid(), MagAOX::app::acronameUsbHub::appLogic(), MagAOX::app::andorCtrl::appLogic(), MagAOX::app::baslerCtrl::appLogic(), MagAOX::app::cameraSim::appLogic(), MagAOX::app::cred2Ctrl::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(), 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::baslerCtrl::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(), MagAOX::app::sysMonitor::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::baslerCtrl::configureAcquisition(), MagAOX::app::cameraSim::configureAcquisition(), MagAOX::app::cred2Ctrl::configureAcquisition(), MagAOX::app::ocam2KCtrl::configureAcquisition(), MagAOX::app::picamCtrl::configureAcquisition(), MagAOX::app::qhyCtrl::configureAcquisition(), MagAOX::app::baslerCtrl::connect(), MagAOX::app::picamCtrl::connect(), MagAOX::app::qhyCtrl::connect(), MagAOX::app::picamCtrl::getAcquisitionState(), MagAOX::app::smc100ccCtrl::getCtrlState(), MagAOX::app::baslerCtrl::getExpTime(), MagAOX::app::qhyCtrl::getExpTime(), MagAOX::app::picamCtrl::getFanSpeed(), MagAOX::app::baslerCtrl::getFPS(), MagAOX::app::baslerCtrl::getTemp(), MagAOX::app::qhyCtrl::getTemp(), MagAOX::app::picamCtrl::getTemps(), MagAOX::app::filterWheelCtrl::home(), MagAOX::app::baslerCtrl::loadImageIntoStream(), 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::cred2Ctrl::reconfig(), MagAOX::app::ocam2KCtrl::reconfig(), MagAOX::app::picamCtrl::reconfig(), recordSavingState(), MagAOX::app::andorCtrl::setCropMode(), MagAOX::app::picamCtrl::setEMGain(), MagAOX::app::andorCtrl::setExpTime(), MagAOX::app::picamCtrl::setExpTime(), MagAOX::app::andorCtrl::setNextROI(), MagAOX::app::cred2Ctrl::setNextROI(), MagAOX::app::qhyCtrl::setNextROI(), MagAOX::app::andorCtrl::setReadoutSpeed(), MagAOX::app::andorCtrl::setShutter(), MagAOX::app::andorCtrl::setVShiftSpeed(), MagAOX::app::andorCtrl::startAcquisition(), MagAOX::app::baslerCtrl::startAcquisition(), MagAOX::app::cameraSim::startAcquisition(), MagAOX::app::cred2Ctrl::startAcquisition(), MagAOX::app::qhyCtrl::startAcquisition(), MagAOX::app::hsfwCtrl::startHoming(), MagAOX::app::ocam2KCtrl::stateStringValid(), swThreadExec(), libXWCTest::flowRPMTest::TEST_CASE(), 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 2607 of file MagAOXApp.hpp.

References INDI_ALERT, INDI_BUSY, INDI_IDLE, INDI_OK, MagAOX::app::lock(), flatlogs::logPrio::LOG_CRITICAL, flatlogs::logPrio::LOG_ERROR, flatlogs::logPrio::LOG_INFO, and flatlogs::logPrio::LOG_WARNING.

◆ stateAlert()

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

Get the value of the state alert flag.

Returns
the current value of m_stateAlert

Definition at line 2665 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.
int stateLogged()
Updates and returns the value of m_stateLogged. Will be 0 on first call after a state change,...
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
@ NOTCONNECTED
The application is not connected to the device or service.

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

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

Definition at line 2677 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::baslerCtrl::connect(), MagAOX::app::picamCtrl::connect(), and MagAOX::app::qhyCtrl::connect().

◆ swThreadExec()

◆ swThreadStart()

void MagAOX::app::streamWriter::swThreadStart ( streamWriter s)
staticprotected

Thread starter, called by swThreadStart on thread construction. Calls swThreadExec.

Parameters
[in]sa pointer to an streamWriter instance (normally this)

Definition at line 1938 of file streamWriter.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::log().

Referenced by appStartup().

◆ sysPath()

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

Get the system path.

Returns
the value of m_sysPath

Definition at line 4006 of file MagAOXApp.hpp.

◆ telem()

int MagAOX::app::dev::telemeter< streamWriter >::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 95 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 2461 of file MagAOXApp.hpp.

References flatlogs::logPrio::LOG_NOTICE, and MAGAOX_RT_SCHED_POLICY.

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

◆ unlockPID()

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

Remove the PID file.

Definition at line 2435 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 3625 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 3650 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 3606 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::baslerCtrl::checkNextROI(), MagAOX::app::cameraSim::checkNextROI(), MagAOX::app::cred2Ctrl::checkNextROI(), MagAOX::app::andorCtrl::configureAcquisition(), MagAOX::app::baslerCtrl::configureAcquisition(), MagAOX::app::cred2Ctrl::configureAcquisition(), MagAOX::app::picamCtrl::configureAcquisition(), MagAOX::app::qhyCtrl::configureAcquisition(), MagAOX::app::zylaCtrl::configureAcquisition(), MagAOX::app::ocam2KCtrl::getEMGain(), MagAOX::app::xt1121Ctrl::getState(), MagAOX::app::cred2Ctrl::getTemps(), MagAOX::app::ocam2KCtrl::getTemps(), MagAOX::app::INDI_NEWCALLBACK_DEFN(), MagAOX::app::smc100ccCtrl::moveTo(), MagAOX::app::filterWheelCtrl::moveToRaw(), MagAOX::app::acronameUsbHub::onPowerOff(), MagAOX::app::cred2Ctrl::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::cred2Ctrl::syncROIFromCamera(), MagAOX::app::cred2Ctrl::updateFPSLimits(), MagAOX::app::trippLitePDU::updateOutletStates(), MagAOX::app::magAOXMaths::updateVals(), and MagAOX::app::sysMonitor::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,
pcf::IndiProperty::PropertyStateType  newState = pcf::IndiProperty::Ok 
)
protectedinherited

Update an INDI property if values have changed.

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

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

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

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

Definition at line 3671 of file MagAOXApp.hpp.

◆ updateINDI()

◆ updatesIfChanged()

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

Definition at line 3687 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

◆ waitForWriteCompletion()

bool MagAOX::app::streamWriter::waitForWriteCompletion ( uint64_t  saveStopFrameNo)
protected

Wait for the writer thread to finish any queued save work before buffer teardown.

Parameters
[in]saveStopFrameNoThe last frame number associated with the queued save for timeout logging.

Definition at line 1245 of file streamWriter.hpp.

References MagAOX::app::MagAOXApp< _useINDI >::log(), flatlogs::logPrio::LOG_DEBUG, flatlogs::logPrio::LOG_NOTICE, m_writeCompletionTimeout, and m_writePending.

Referenced by fgThreadExec().

◆ whilePowerOff()

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

Friends And Related Symbol Documentation

◆ dev::telemeter< streamWriter >

Definition at line 59 of file streamWriter.hpp.

◆ streamWriter_data_test

friend class streamWriter_data_test
friend

Definition at line 65 of file streamWriter.hpp.

◆ streamWriter_test

friend class streamWriter_test
friend

Definition at line 64 of file streamWriter.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 716 of file MagAOXApp.hpp.

◆ m_basePath

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

The base path of the MagAO-X system.

Definition at line 188 of file MagAOXApp.hpp.

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

◆ m_circBuffLength

size_t MagAOX::app::streamWriter::m_circBuffLength { 1024 }
protected

The length of the circular buffer, in frames.

Definition at line 109 of file streamWriter.hpp.

Referenced by allocate_circbufs(), and fgThreadExec().

◆ m_circBuffSize

double MagAOX::app::streamWriter::m_circBuffSize { 2048.0 }
protected

The size of the circular buffer, in MB.

Definition at line 110 of file streamWriter.hpp.

Referenced by allocate_circbufs().

◆ m_compress

bool MagAOX::app::streamWriter::m_compress { true }
protected

Definition at line 105 of file streamWriter.hpp.

Referenced by allocate_xrif(), initialize_xrif(), and loadConfig().

◆ 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 194 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 192 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_cpusetPath

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

Path to the cpusets mount.

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

Definition at line 207 of file MagAOXApp.hpp.

◆ m_currChunkStart

uint64_t MagAOX::app::streamWriter::m_currChunkStart { 0 }
protected

The circular buffer starting position of the current to-be-written chunk.

Definition at line 153 of file streamWriter.hpp.

Referenced by fgThreadExec().

◆ m_currChunkStartTime

uint64_t MagAOX::app::streamWriter::m_currChunkStartTime { 0 }
protected

The write-time of the first image in the chunk in nanoseconds.

Definition at line 125 of file streamWriter.hpp.

Referenced by fgThreadExec().

◆ m_currImage

size_t MagAOX::app::streamWriter::m_currImage { 0 }
protected

Definition at line 121 of file streamWriter.hpp.

Referenced by fgThreadExec().

◆ m_currImageTime

uint64_t MagAOX::app::streamWriter::m_currImageTime { 0 }
protected

The write-time of the current image in nanoseconds.

Definition at line 123 of file streamWriter.hpp.

Referenced by fgThreadExec().

◆ m_currSaveStart

uint64_t MagAOX::app::streamWriter::m_currSaveStart { 0 }
protected

The circular buffer position at which to start saving.

Definition at line 156 of file streamWriter.hpp.

Referenced by doEncode(), fgThreadExec(), and recordSavingState().

◆ m_currSaveStop

uint64_t MagAOX::app::streamWriter::m_currSaveStop { 0 }
protected

The circular buffer position at which to stop saving.

Definition at line 157 of file streamWriter.hpp.

Referenced by doEncode(), and fgThreadExec().

◆ m_currSaveStopFrameNo

uint64_t MagAOX::app::streamWriter::m_currSaveStopFrameNo { 0 }
protected

The frame number of the image at which saving stopped (for logging)

Definition at line 159 of file streamWriter.hpp.

Referenced by doEncode(), and fgThreadExec().

◆ m_dataType

uint8_t MagAOX::app::streamWriter::m_dataType { 0 }
protected

The ImageStreamIO type code.

Definition at line 115 of file streamWriter.hpp.

Referenced by allocate_xrif(), doEncode(), and fgThreadExec().

◆ 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 727 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 719 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 722 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 422 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 421 of file MagAOXApp.hpp.

◆ m_fgCpuset

std::string MagAOX::app::streamWriter::m_fgCpuset
protected

The cpuset for the framegrabber thread. Ignored if empty (the default).

Definition at line 240 of file streamWriter.hpp.

Referenced by appStartup(), and loadConfig().

◆ m_fgThread

std::thread MagAOX::app::streamWriter::m_fgThread
protected

A separate thread for the actual framegrabbings.

Definition at line 242 of file streamWriter.hpp.

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

◆ m_fgThreadID

pid_t MagAOX::app::streamWriter::m_fgThreadID { 0 }
protected

F.g. thread PID.

Definition at line 246 of file streamWriter.hpp.

Referenced by appStartup(), and fgThreadExec().

◆ m_fgThreadInit

bool MagAOX::app::streamWriter::m_fgThreadInit { true }
protected

Synchronizer to ensure f.g. thread initializes before doing dangerous things.

Definition at line 244 of file streamWriter.hpp.

Referenced by appStartup(), and fgThreadExec().

◆ m_fgThreadPrio

int MagAOX::app::streamWriter::m_fgThreadPrio { 1 }
protected

Priority of the framegrabber thread, should normally be > 00.

Definition at line 238 of file streamWriter.hpp.

Referenced by appStartup(), and loadConfig().

◆ m_fgThreadProp

pcf::IndiProperty MagAOX::app::streamWriter::m_fgThreadProp
protected

The property to hold the f.g. thread details.

Definition at line 248 of file streamWriter.hpp.

Referenced by appStartup().

◆ m_gitAlert

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

Definition at line 582 of file MagAOXApp.hpp.

◆ m_height

size_t MagAOX::app::streamWriter::m_height { 0 }
protected

The height of the image.

Definition at line 114 of file streamWriter.hpp.

Referenced by allocate_circbufs(), allocate_xrif(), doEncode(), fgThreadExec(), and updateINDI().

◆ m_indiCallBackMutex

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

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

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

Definition at line 669 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 659 of file MagAOXApp.hpp.

Referenced by MagAOX::app::picoMotorCtrl::appLogic(), MagAOX::app::smc100ccCtrl::appLogic(), MagAOX::app::zaberCtrl::appLogic(), 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 662 of file MagAOXApp.hpp.

Referenced by MagAOX::app::acronameUsbHub::appLogic(), MagAOX::app::andorCtrl::appLogic(), MagAOX::app::baslerCtrl::appLogic(), MagAOX::app::cameraSim::appLogic(), MagAOX::app::cred2Ctrl::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::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::cred2Ctrl::configureAcquisition(), MagAOX::app::ocam2KCtrl::configureAcquisition(), MagAOX::app::picamCtrl::configureAcquisition(), MagAOX::app::qhyCtrl::configureAcquisition(), MagAOX::app::zylaCtrl::configureAcquisition(), MagAOX::app::xt1121Ctrl::getState(), 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::cred2Ctrl::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::zylaCtrl::reconfig(), MagAOX::app::filterWheelCtrl::stop(), MagAOX::app::trippLitePDU::turnOutletOff(), MagAOX::app::xt1121DCDU::turnOutletOff(), MagAOX::app::trippLitePDU::turnOutletOn(), MagAOX::app::xt1121DCDU::turnOutletOn(), MagAOX::app::cred2Ctrl::whilePowerOff(), 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 707 of file MagAOXApp.hpp.

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

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

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

◆ m_indiP_writing

pcf::IndiProperty MagAOX::app::streamWriter::m_indiP_writing
protected

Definition at line 325 of file streamWriter.hpp.

Referenced by appStartup(), and updateINDI().

◆ m_indiP_xrifStats

pcf::IndiProperty MagAOX::app::streamWriter::m_indiP_xrifStats
protected

Definition at line 327 of file streamWriter.hpp.

Referenced by appStartup(), and updateINDI().

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

◆ m_log

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

Definition at line 345 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 209 of file MagAOXApp.hpp.

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

◆ m_lz4accel

int MagAOX::app::streamWriter::m_lz4accel { 1 }
protected

Definition at line 103 of file streamWriter.hpp.

Referenced by doEncode(), and loadConfig().

◆ m_maxChunkTime

double MagAOX::app::streamWriter::m_maxChunkTime { 10 }
protected

The maximum time before writing regardless of number of frames.

Definition at line 81 of file streamWriter.hpp.

Referenced by fgThreadExec(), and loadConfig().

◆ m_maxCircBuffLength

size_t MagAOX::app::streamWriter::m_maxCircBuffLength { 1024 }
protected

The maximum length of the circular buffer, in frames.

Definition at line 74 of file streamWriter.hpp.

Referenced by allocate_circbufs(), appStartup(), and loadConfig().

◆ m_maxCircBuffSize

double MagAOX::app::streamWriter::m_maxCircBuffSize { 2048 }
protected

The maximum size of the circular bufffer in MB.

Definition at line 76 of file streamWriter.hpp.

Referenced by allocate_circbufs(), and loadConfig().

◆ m_maxInterval

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

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

Definition at line 83 of file telemeter.hpp.

◆ m_maxWriteChunkLength

size_t MagAOX::app::streamWriter::m_maxWriteChunkLength { 512 }
protected

The maximum number of frames to write at a time. Must be an integer factor of m_maxCircBuffLength.

Definition at line 78 of file streamWriter.hpp.

Referenced by allocate_circbufs(), appStartup(), and loadConfig().

◆ m_nextChunkStart

uint64_t MagAOX::app::streamWriter::m_nextChunkStart { 0 }
protected

The circular buffer starting position of the next to-be-written chunk.

Definition at line 154 of file streamWriter.hpp.

Referenced by fgThreadExec().

◆ m_nextSkipSummaryTime

double MagAOX::app::streamWriter::m_nextSkipSummaryTime { 0.0 }
protected

Time after which the next summary skip log may be emitted.

Definition at line 135 of file streamWriter.hpp.

Referenced by appLogic().

◆ m_outFilePath

std::string MagAOX::app::streamWriter::m_outFilePath
protected

The full path for the latest output file.

Definition at line 173 of file streamWriter.hpp.

Referenced by doEncode().

◆ m_outName

std::string MagAOX::app::streamWriter::m_outName
protected

The name to use for outputting files, Default is m_shmimName.

Definition at line 90 of file streamWriter.hpp.

Referenced by doEncode(), and loadConfig().

◆ m_pid

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

This process's PID.

Definition at line 506 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 1179 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 1178 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 1180 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 1186 of file MagAOXApp.hpp.

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

◆ m_powerOnWait

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

◆ m_powerState

template<bool _useINDI = true>
int MagAOX::app::MagAOXApp< _useINDI >::m_powerState { -1 }
protectedinherited

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

◆ m_powerTargetState

◆ m_rawImageCircBuff

char* MagAOX::app::streamWriter::m_rawImageCircBuff { nullptr }
protected

Definition at line 118 of file streamWriter.hpp.

Referenced by allocate_circbufs(), doEncode(), fgThreadExec(), and release_circbufs().

◆ m_rawimageDir

std::string MagAOX::app::streamWriter::m_rawimageDir
protected

The path where files will be saved.

Definition at line 72 of file streamWriter.hpp.

Referenced by appStartup(), doEncode(), and loadConfig().

◆ m_repeatSemaphoreCount

std::atomic<uint64_t> MagAOX::app::streamWriter::m_repeatSemaphoreCount
protected
Initial value:
{
0 }

Count of repeated semaphore wakes with unchanged frame count since the last summary log.

Definition at line 130 of file streamWriter.hpp.

Referenced by appLogic(), and fgThreadExec().

◆ m_restart

bool MagAOX::app::streamWriter::m_restart { false }
protected

Definition at line 207 of file streamWriter.hpp.

Referenced by fgThreadExec(), and handlerSigSegv().

◆ m_resumeAfterReconnect

bool MagAOX::app::streamWriter::m_resumeAfterReconnect
protected
Initial value:
{
false }

Tracks whether reconnect cleanup should resume writing immediately on the replacement stream.

Definition at line 150 of file streamWriter.hpp.

Referenced by appShutdown(), doEncode(), and fgThreadExec().

◆ m_secretsPath

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

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

Definition at line 200 of file MagAOXApp.hpp.

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

◆ m_selfWriter

streamWriter * MagAOX::app::streamWriter::m_selfWriter = nullptr
staticprotected

Static pointer to this (set in constructor). Used for getting out of the static SIGSEGV handler.

Definition at line 209 of file streamWriter.hpp.

Referenced by streamWriter(), and _handlerSigSegv().

◆ m_semaphoreNumber

int MagAOX::app::streamWriter::m_semaphoreNumber { 7 }
protected

The image structure semaphore index.

Definition at line 92 of file streamWriter.hpp.

Referenced by fgThreadExec(), and loadConfig().

◆ m_semWaitNSec

unsigned MagAOX::app::streamWriter::m_semWaitNSec { 500000000 }
protected

The time in nsec to wait on the semaphore, added to m_semWaitSec. Max is 999999999. Default is 5e8 nsec.

Definition at line 97 of file streamWriter.hpp.

Referenced by fgThreadExec(), loadConfig(), and swThreadExec().

◆ m_semWaitSec

unsigned MagAOX::app::streamWriter::m_semWaitSec { 0 }
protected

The time in whole sec to wait on the semaphore, to which m_semWaitNSec is added. Default is 0 nsec.

Definition at line 94 of file streamWriter.hpp.

Referenced by fgThreadExec().

◆ m_shmimName

std::string MagAOX::app::streamWriter::m_shmimName
protected

The name of the shared memory buffer.

Definition at line 88 of file streamWriter.hpp.

Referenced by fgThreadExec(), and loadConfig().

◆ m_shutdown

◆ m_skippedFrameCount

std::atomic<uint64_t> MagAOX::app::streamWriter::m_skippedFrameCount
protected
Initial value:
{
0 }

Count of skipped frames accumulated by the framegrabber thread since the last summary log.

Definition at line 127 of file streamWriter.hpp.

Referenced by appLogic(), and fgThreadExec().

◆ m_skipSummaryIntervalSec

double MagAOX::app::streamWriter::m_skipSummaryIntervalSec { 10.0 }
protected

Current interval between summary skip logs.

Definition at line 133 of file streamWriter.hpp.

Referenced by appLogic().

◆ m_startWriting

bool MagAOX::app::streamWriter::m_startWriting { false }
protected

Whether writing should be armed automatically at application startup.

Definition at line 86 of file streamWriter.hpp.

Referenced by appStartup(), and loadConfig().

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

◆ m_stateAlert

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

Definition at line 579 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 584 of file MagAOXApp.hpp.

◆ m_stopWriteDeadline

double MagAOX::app::streamWriter::m_stopWriteDeadline { 0.0 }
protected

Absolute time after which a stop-writing request should flush without a new frame.

Definition at line 144 of file streamWriter.hpp.

Referenced by appShutdown(), doEncode(), and fgThreadExec().

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

◆ m_swCpuset

std::string MagAOX::app::streamWriter::m_swCpuset
protected

The cpuset for the framegrabber thread. Ignored if empty (the default).

Definition at line 300 of file streamWriter.hpp.

Referenced by appStartup(), and loadConfig().

◆ m_swSemaphore

sem_t MagAOX::app::streamWriter::m_swSemaphore
protected

Semaphore used to synchronize the fg thread and the sw thread.

Definition at line 302 of file streamWriter.hpp.

Referenced by appStartup(), fgThreadExec(), and swThreadExec().

◆ m_swThread

std::thread MagAOX::app::streamWriter::m_swThread
protected

A separate thread for the actual writing.

Definition at line 304 of file streamWriter.hpp.

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

◆ m_swThreadID

pid_t MagAOX::app::streamWriter::m_swThreadID { 0 }
protected

S.w. thread pid.

Definition at line 308 of file streamWriter.hpp.

Referenced by appStartup(), and swThreadExec().

◆ m_swThreadInit

bool MagAOX::app::streamWriter::m_swThreadInit { true }
protected

Synchronizer to ensure s.w. thread initializes before doing dangerous things.

Definition at line 306 of file streamWriter.hpp.

Referenced by appStartup(), and swThreadExec().

◆ m_swThreadPrio

int MagAOX::app::streamWriter::m_swThreadPrio { 1 }
protected

Priority of the stream writer thread, should normally be > 0, and <= m_fgThreadPrio.

Definition at line 298 of file streamWriter.hpp.

Referenced by appStartup(), and loadConfig().

◆ m_swThreadProp

pcf::IndiProperty MagAOX::app::streamWriter::m_swThreadProp
protected

The property to hold the s.w. thread details.

Definition at line 310 of file streamWriter.hpp.

Referenced by appStartup().

◆ m_sysPath

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

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

Definition at line 198 of file MagAOXApp.hpp.

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

◆ m_tel

Definition at line 81 of file telemeter.hpp.

◆ m_timingCircBuff

uint64_t* MagAOX::app::streamWriter::m_timingCircBuff { nullptr }
protected

Definition at line 119 of file streamWriter.hpp.

Referenced by allocate_circbufs(), doEncode(), fgThreadExec(), and release_circbufs().

◆ m_typeSize

int MagAOX::app::streamWriter::m_typeSize { 0 }
protected

The pixel byte depth.

Definition at line 116 of file streamWriter.hpp.

Referenced by allocate_circbufs(), doEncode(), fgThreadExec(), and updateINDI().

◆ m_useINDI

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

◆ m_warnMissedData

bool MagAOX::app::streamWriter::m_warnMissedData
protected
Initial value:
{
true }

Whether missed-data backlog summaries should be emitted as warnings instead of informational logs.

Definition at line 100 of file streamWriter.hpp.

Referenced by appLogic(), and loadConfig().

◆ m_width

size_t MagAOX::app::streamWriter::m_width { 0 }
protected

The width of the image.

Definition at line 113 of file streamWriter.hpp.

Referenced by allocate_circbufs(), allocate_xrif(), doEncode(), fgThreadExec(), and updateINDI().

◆ m_writeChunkLength

size_t MagAOX::app::streamWriter::m_writeChunkLength { 512 }
protected

The number of frames to write at a time.

Definition at line 111 of file streamWriter.hpp.

Referenced by allocate_circbufs(), allocate_xrif(), and fgThreadExec().

◆ m_writeCompletionTimeout

double MagAOX::app::streamWriter::m_writeCompletionTimeout
protected
Initial value:
{
5.0 }

Seconds to wait for the writer thread to finish a queued flush during restart cleanup.

Definition at line 147 of file streamWriter.hpp.

Referenced by waitForWriteCompletion().

◆ m_writePending

std::atomic<bool> MagAOX::app::streamWriter::m_writePending
protected
Initial value:
{
false }

Whether the writer thread still owns a queued save window and may touch the circular buffers.

Definition at line 141 of file streamWriter.hpp.

Referenced by appShutdown(), doEncode(), fgThreadExec(), and waitForWriteCompletion().

◆ m_writeStopTimeout

double MagAOX::app::streamWriter::m_writeStopTimeout
protected
Initial value:
{
1.0 }

Seconds to wait after a stop-writing command before flushing the pending data without a new frame.

Definition at line 83 of file streamWriter.hpp.

Referenced by loadConfig().

◆ m_writing

int MagAOX::app::streamWriter::m_writing { NOT_WRITING }
protected

Controls whether or not images are being written, and sequences start and stop of writing.

Definition at line 138 of file streamWriter.hpp.

Referenced by appLogic(), appShutdown(), appStartup(), doEncode(), fgThreadExec(), recordSavingState(), and updateINDI().

◆ m_xrif

xrif_t MagAOX::app::streamWriter::m_xrif { nullptr }
protected

The xrif compression handle for image data.

Definition at line 162 of file streamWriter.hpp.

Referenced by ~streamWriter(), allocate_xrif(), appShutdown(), doEncode(), initialize_xrif(), recordSavingStats(), and updateINDI().

◆ m_xrif_header

char* MagAOX::app::streamWriter::m_xrif_header { nullptr }
protected

Storage for the xrif image data file header.

Definition at line 165 of file streamWriter.hpp.

Referenced by ~streamWriter(), doEncode(), and initialize_xrif().

◆ m_xrif_timing

xrif_t MagAOX::app::streamWriter::m_xrif_timing { nullptr }
protected

The xrif compression handle for image data.

Definition at line 168 of file streamWriter.hpp.

Referenced by ~streamWriter(), allocate_xrif(), appShutdown(), doEncode(), and initialize_xrif().

◆ m_xrif_timing_header

char* MagAOX::app::streamWriter::m_xrif_timing_header { nullptr }
protected

Storage for the xrif image data file header.

Definition at line 171 of file streamWriter.hpp.

Referenced by ~streamWriter(), doEncode(), and initialize_xrif().

◆ pidFileName

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

The name of the PID file.

Definition at line 504 of file MagAOXApp.hpp.


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