16#include "../../libMagAOX/libMagAOX.hpp"
17#include "../../magaox_git_version.h"
28#ifndef PL_ERR_LIBRARY_NOT_INITIALIZED
29#define PL_ERR_LIBRARY_NOT_INITIALIZED (157)
38 const std::string & more
41 char pvmsg[ERROR_MSG_LEN];
42 pl_error_message(pec, pvmsg);
44 std::string msg = func +
" failed: " + pvmsg;
45 if(more !=
"") msg +=
" " + more;
51#define log_pvcam_software_error( func, \
55 int pec = pl_error_code(); \
56 log<software_error>({__FILE__, __LINE__, 0, pec , pvcamErrMessage(func, pec, more)}); \
345 config.add(
"camera.serialNumber",
"",
"camera.serialNumber", argType::Required,
"camera",
"serialNumber",
false,
"int",
"The identifying serial number of the camera.");
348 config.add(
"camera.circBuffMaxBytes",
"",
"camera.circBuffMaxBytes", argType::Required,
"camera",
"circBuffMaxBytes",
false,
"int",
"Maximum size in bytes of the circular buffer to allocate. Default is 0.5 GB.");
883 mx::sys::timespecAddNsec(
ts, 1
e9);
1115 std::cerr <<
"Found " <<
nports <<
" ports\n";
1132 std::cerr <<
"failed to allocate string\n";
1148 std::cerr <<
"Port: " << p <<
" name: " <<
text <<
" value: " << value <<
"\n";
1164 std::cerr <<
" Speeds: " <<
nspeeds <<
"\n";
1206 std::cerr <<
" Speed: " <<
s <<
" " <<
" pixtime: " <<
pixtime <<
" gains: " <<
ngains <<
" [" <<
ming <<
"-" <<
maxg <<
"]\n";
1229 std::cerr <<
" Gain: " <<
g <<
" bitdepth: " <<
bitdepth <<
"\n";
1252 std::cerr <<
paramMnem <<
": count 0\n";
1285 std::cerr <<
"dumpEnum: not CONNECTED\n";
The base-class for MagAO-X applications.
stateCodes::stateCodeT state()
Get the current state code.
int powerState()
Returns the current power state.
int m_shutdown
Flag to signal it's time to shutdown. When not 0, the main loop exits.
int powerStateTarget()
Returns the target power state.
int stateLogged()
Updates and returns the value of m_stateLogged. Will be 0 on first call after a state change,...
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
bool powerOnWaitElapsed()
This method tests whether the power on wait time has elapsed.
unsigned long m_powerOnWait
Time in sec to wait for device to boot after power on.
std::mutex m_indiMutex
Mutex for locking INDI communications.
MagAO-X Uniblitz DSS Shutter interface.
int appStartup()
Startup function.
void loadConfig(mx::app::appConfigurator &config)
load the configuration system results
int appLogic()
application logic
int appShutdown()
applogic shutdown
void setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
int setShutterState(int sh)
Change shutter state.
timespec m_currImageTimestamp
The timestamp of the current image.
uint32_t m_width
The width of the image, once deinterlaced etc.
int appShutdown()
Shuts down the framegrabber thread.
int recordFGTimings(bool force=false)
int loadConfig(mx::app::appConfigurator &config)
load the configuration system results
int updateINDI()
Update the INDI properties for this device controller.
uint8_t m_dataType
The ImageStreamIO type code.
bool m_reconfig
Flag to set if a camera reconfiguration requires a framegrabber reset.
int appLogic()
Checks the framegrabber thread.
int appStartup()
Startup function.
uint32_t m_height
The height of the image, once deinterlaced etc.
int setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
MagAO-X standard camera interface.
std::vector< std::string > m_readoutSpeedNames
float m_fpsSet
The commanded fps, as set by user.
float m_default_x
Power-on ROI center x coordinate.
std::string m_tempControlStatusStr
Camera specific description of temperature control status.
std::vector< std::string > m_readoutSpeedNameLabels
int m_full_w
The full ROI width.
std::string m_defaultReadoutSpeed
The default readout speed of the camera.
float m_expTime
The current exposure time, in seconds.
int m_default_bin_x
Power-on ROI x binning.
int m_default_w
Power-on ROI width.
int recordCamera(bool force=false)
int m_default_h
Power-on ROI height.
float m_expTimeSet
The exposure time, in seconds, as set by user.
void setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
int m_full_h
The full ROI height.
float m_full_y
The full ROI center y coordinate.
std::string m_readoutSpeedName
The current readout speed name.
float m_ccdTempSetpt
The desired temperature, in C.
bool m_tempControlStatus
Whether or not temperature control is active.
float m_full_x
The full ROI center x coordinate.
int appLogic()
Application logic.
float m_ccdTemp
The current temperature, in C.
int updateINDI()
Update the INDI properties for this device controller.
bool m_tempControlOnTarget
Whether or not the temperature control system is on its target temperature.
void loadConfig(mx::app::appConfigurator &config)
load the configuration system results
int appStartup()
Startup function.
float m_default_y
Power-on ROI center y coordinate.
float m_fps
The current FPS.
int m_default_bin_y
Power-on ROI y binning.
std::string m_readoutSpeedNameSet
The user requested readout speed name, to be set by derived()
The MagAO-X pvcam controller.
static constexpr bool c_stdCamera_exptimeCtrl
app::dev config to tell stdCamera to expose exposure time controls
int16 m_handle
Camera handle, set when camera is opened.
static constexpr bool c_stdCamera_usesROI
app:dev config to tell stdCamera to expose ROI controls
static constexpr bool c_stdCamera_emGain
app::dev config to tell stdCamera to expose EM gain controls
static constexpr bool c_stdCamera_usesStateString
app::dev confg to tell stdCamera to expose the state string property
static constexpr bool c_stdCamera_fps
app::dev config to tell stdCamera not to expose FPS status
friend class pvcamCtrl_test
void endOfFrameCallback(FRAME_INFO *finfo)
virtual void loadConfig()
static constexpr bool c_stdCamera_tempControl
app::dev config to tell stdCamera to expose temperature controls
int recordTelem(const telem_stdcam *)
static void st_endOfFrameCallback(FRAME_INFO *finfo, void *pvcamCtrlInst)
int setShutter(int sh)
Sets the shutter state, via call to dssShutter::setShutterState(int) [stdCamera interface].
static constexpr bool c_stdCamera_usesModes
app:dev config to tell stdCamera not to expose mode controls
std::vector< port > m_ports
virtual int appShutdown()
Shutdown the app.
uint32_t m_circBuffMaxBytes
Max size in bytes of the circular buffer to allocate. Default is 0.5 GB.
int checkNextROI()
Check the next ROI.
std::vector< speed > speeds
static constexpr bool c_stdCamera_hasShutter
app:dev config to tell stdCamera to expose shutter controls
int acquireAndCheckValid()
static constexpr bool c_stdCamera_fpsCtrl
app::dev config to tell stdCamera not to expose FPS controls
int configureAcquisition()
dev::stdCamera< pvcamCtrl > stdCameraT
dev::frameGrabber< pvcamCtrl > frameGrabberT
static constexpr bool c_stdCamera_temp
app::dev config to tell stdCamera to expose temperature
pvcamCtrl()
Default c'tor.
virtual int appLogic()
Implementation of the FSM for pvcamCtrl.
sem_t m_frSemaphore
Semaphore used to signal that a frame is ready.
int loadConfigImpl(mx::app::appConfigurator &_config)
Implementation of loadConfig logic, separated for testing.
~pvcamCtrl() noexcept
D'tor, declared and defined for noexcept.
std::string m_camName
Camera name, filled in as part of opening the camera.
virtual int appStartup()
Startup function.
int loadImageIntoStream(void *dest)
dev::dssShutter< pvcamCtrl > shutterT
static constexpr bool c_stdCamera_readoutSpeed
app::dev config to tell stdCamera to expose readout speed controls
void dumpEnum(uns32 paramID, const std::string ¶mMnem)
static constexpr bool c_stdCamera_synchro
app::dev config to tell stdCamera to not expose synchro mode controls
dev::telemeter< pvcamCtrl > telemeterT
std::vector< gain > gains
static constexpr bool c_stdCamera_cropMode
app:dev config to tell stdCamera to expose Crop Mode controls
float m_tempTol
Tolerance in degrees C to declare the temperature control locked.
std::string m_serialNumber
The camera serial number.
virtual void setupConfig()
static constexpr bool c_stdCamera_vShiftSpeed
app:dev config to tell stdCamera to expose vertical shift speed control
static constexpr bool c_frameGrabber_flippable
app:dev config to tell framegrabber this camera can be flipped
@ OPERATING
The device is operating, other than homing.
@ NODEVICE
No device exists for the application to control.
@ FAILURE
The application has failed, should be used when m_shutdown is set for an error.
@ ERROR
The application has encountered an error, from which it is recovering (with or without intervention)
@ READY
The device is ready for operation, but is not operating.
@ CONNECTED
The application has connected to the device or service.
@ NOTCONNECTED
The application is not connected to the device or service.
@ POWERON
The device power is on.
std::unique_lock< std::mutex > lock(m_indiMutex)
static constexpr logPrioT LOG_INFO
Informational. The info log level is the lowest level recorded during normal operations.
static constexpr logPrioT LOG_CRITICAL
The process can not continue and will shut down (fatal)
#define PL_ERR_LIBRARY_NOT_INITIALIZED
std::string pvcamErrMessage(const std::string &func, int pec, const std::string &more)
Format an error message using pvcam facilities.
#define log_pvcam_software_error(func, more)
Helper for logging an error from pvcam.
A device base class which saves telemetry.
int appShutdown()
Perform telemeter application shutdown.
int loadConfig(appConfigurator &config)
Load the device section from an application configurator.
int appLogic()
Perform telemeter application logic.
int setupConfig(appConfigurator &config)
Setup an application configurator for the device section.
int appStartup()
Starts the telemetry log thread.
int checkRecordTimes(const telT &tel, telTs... tels)
Check the time of the last record for each telemetry type and make an entry if needed.
Software CRITICAL log entry.
Log entry recording framegrabber timings.
Log entry recording stdcam stage specific status.