22 #include <epicsTime.h>
23 #include <epicsThread.h>
24 #include <epicsEvent.h>
25 #include <epicsMutex.h>
26 #include <epicsString.h>
27 #include <epicsStdio.h>
28 #include <cantProceed.h>
30 #include <epicsExit.h>
32 #include <unordered_map>
37 #include <epicsExport.h>
40 #define RETIGA_POLL_TIME .010
41 #define MAX_FILENAME_LEN 256
42 #define MAX_ARRAY_LEN 40
47 QImage(
const char *portName,
const char *model,
NDDataType_t dataType,
int numbuffs,
int debug,
int maxBuffers,
size_t maxMemory,
int priority,
int stackSize);
49 friend void QCAMAPI
QImageCallback(
void* usrPtr,
unsigned long frameId, QCam_Err errorcode,
unsigned long flags);
54 virtual void report(FILE *fp,
int details);
55 virtual asynStatus
readEnum(asynUser *pasynUser,
char *strings[],
int values[],
int severities[],
56 size_t nElements,
size_t *nIn);
68 #define FIRST_QIMAGE_PARAM qMaxBitDepthRBV
110 #define LAST_QIMAGE_PARAM qInitialize
112 #define NUM_QIMAGE_PARAMS (&LAST_QIMAGE_PARAM - &FIRST_QIMAGE_PARAM + 1)
117 asynStatus resultCode(
const char *funcName,
const char *cmdName, QCam_Err errorcode);
118 asynStatus connectQImage();
119 asynStatus disconnectQImage();
122 asynStatus initializeQImage();
123 asynStatus queryQImageSettings();
125 asynStatus initializeFrames();
128 void resetFrameQueues();
130 asynStatus getCameraInfo();
132 asynStatus q_acquire(epicsInt32
value);
133 asynStatus q_setTriggerMode(epicsInt32
value);
134 asynStatus q_autoExposure(epicsInt32
value);
135 asynStatus q_whiteBalance(epicsInt32
value);
136 asynStatus q_setDataTypeAndColorMode(epicsInt32
function, epicsInt32
value);
137 asynStatus q_setImageSize(epicsInt32
function, epicsInt32
value);
138 asynStatus q_setBinning(epicsInt32
function, epicsInt32
value);
139 asynStatus q_setMinXY(epicsInt32
function, epicsInt32
value);
140 asynStatus q_resetCamera(epicsInt32
value);
141 asynStatus q_setTemperature(epicsFloat64
value);
142 asynStatus q_setCoolerActive(epicsInt32
value);
143 asynStatus q_setReadoutSpeed(epicsInt32
value);
147 epicsEvent captureEvent;
148 epicsEvent captureEvent2;
157 unsigned long frameId;
161 epicsTimeStamp startTime;
162 epicsEventId stopEventId;
163 epicsEventId m_acquireEventId;
164 epicsMutex freeFrameMutex;
165 epicsMutex capFrameMutex;
166 epicsMutex aquireMutex;
170 double camPushSleepAmt;
171 double m_exposureTime;
187 signed long offsetMax;
188 signed long offsetMin;
191 unsigned long coolerReg;
192 unsigned long rawDataSize;
194 double m_acquirePeriod;
195 double m_acquireTime;
199 unsigned long maxWidth;
200 unsigned long maxHeight;
202 unsigned long binningTable[32];
203 int binningTableSize = 32;
205 unsigned long imageFormatTable[32];
206 int imageFormatTableSize = 32;
208 unsigned long triggerType;
210 volatile bool _adAcquire;
211 std::queue<int> freeFrames;
212 std::queue<int> collectedFrames;
213 std::unordered_map<unsigned long, QNDFrame*> pFrames;
214 unsigned long m_frameCntr;
217 asynStatus allocFrame(
unsigned long &frameId);
218 asynStatus releaseFrame(
unsigned long frameId);
223 QCam_SettingsEx qSettings;
227 #define qMaxBitDepthRBVString "MAX_BIT_DEPTH_RBV"
228 #define qSerialNumberRBVString "SERIAL_NUMBER_RBV"
229 #define qUniqueIdRBVString "UNIQUE_ID_RBV"
230 #define qCcdTypeRBVString "CCD_TYPE_RBV"
231 #define qCooledRBVString "COOLED_RBV"
232 #define qRegulatedCoolingRBVString "REGULATED_COOLING_RBV"
233 #define qFanControlRBVString "FAN_CONTROL_RBV"
234 #define qHighSensitivityModeRBVString "HIGH_SENSITIVITY_MODE_RBV"
235 #define qBlackoutModeRBVString "BLACK_OUT_MODE_RBV"
236 #define qAsymmetricalBinningRBVString "ASYMMETRICAL_BINNING_RBV"
237 #define qCoolerActiveString "COOLER_ACTIVE"
238 #define qReadoutSpeedString "READOUT_SPEED"
239 #define qOffsetString "OFFSET"
240 #define qImageFormatString "IMAGE_FORMAT"
241 #define qAcquireTimeRBVString "ACQUIRE_TIME_RBV"
242 #define qMinXRBVString "MIN_X_RBV"
243 #define qMinYRBVString "MIN_Y_RBV"
244 #define qSizeXRBVString "SIZE_X_RBV"
245 #define qSizeYRBVString "SIZE_Y_RBV"
246 #define qTriggerModeRBVString "TRIGGER_MODE_RBV"
247 #define qGainRBVString "GAIN_RBV"
248 #define qTemperatureRBVString "TEMPERATURE_RBV"
249 #define qReadoutSpeedRBVString "READOUT_SPEED_RBV"
250 #define qOffsetRBVString "OFFSET_RBV"
251 #define qImageFormatRBVString "IMAGE_FORMAT_RBV"
252 #define qCoolerActiveRBVString "COOLER_ACTIVE_RBV"
253 #define qRegulatedCoolingLockRBVString "REGULATED_COOLING_LOCK_RBV"
254 #define qExposureStatusMessageRBVString "EXPOSURE_STATUS_MESSAGE"
255 #define qFrameStatusMessageRBVString "FRAME_STATUS_MESSAGE"
256 #define qTrgCntString "TRIGGER_COUNT"
257 #define qExpCntString "EXPOSURE_COUNT_RBV"
258 #define qFrmCntString "FRAME_COUNT_RBV"
259 #define qShowDiagsString "SHOW_DIAGS"
260 #define qResetCamString "RESET_DETECTOR"
261 #define qExposureMaxString "EXPOSURE_MAX_RBV"
262 #define qExposureMinString "EXPOSURE_MIN_RBV"
263 #define qGainMaxString "GAIN_MAX_RBV"
264 #define qGainMinString "GAIN_MIN_RBV"
265 #define qBinningString "QBINNING"
266 #define qAutoExposureString "AUTO_EXPOSURE"
267 #define qWhiteBalanceString "WHITE_BALANCE"
268 #define qInitializeString "INITIALIZE_DETECTOR"
270 static void QImageShutdown(
void* arg) {
NDDataType_t dataType
Definition: ADPylon.cpp:60
const char * driverName
Definition: ADTimePix.cpp:73
NDDataType_t
Enumeration of NDArray data types.
Definition: NDAttribute.h:30
Class from which areaDetector drivers are directly derived.
Definition: ADDriver.h:132
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:99
Definition: QImaging.h:45
int qCcdTypeRBV
Definition: QImaging.h:71
int qRegulatedCoolingLockRBV
Definition: QImaging.h:94
int qMinXRBV
Definition: QImaging.h:83
virtual void report(FILE *fp, int details)
QImage::report.
Definition: QImaging.cpp:2140
int qGainMax
Definition: QImaging.h:104
friend void QCAMAPI QImageCallback(void *usrPtr, unsigned long frameId, QCam_Err errorcode, unsigned long flags)
Callback function from the detector when a frame or exposure occur.
Definition: QImaging.cpp:42
int qTemperatureRBV
Definition: QImaging.h:89
int qSizeYRBV
Definition: QImaging.h:86
int qTriggerModeRBV
Definition: QImaging.h:87
void shutdown()
QImage::shutdown: Function called at IOC exit.
Definition: QImaging.cpp:945
int qOffsetRBV
Definition: QImaging.h:91
int qImageFormatRBV
Definition: QImaging.h:92
int qBlackoutModeRBV
Definition: QImaging.h:76
int qOffset
Definition: QImaging.h:80
void pushCollectedFrame(int id)
QImage::pushCollectedFrame: Pushes an aquired frame to a queue to be proecssed by consumer thread.
Definition: QImaging.cpp:1020
int qAcquireTimeRBV
Definition: QImaging.h:82
int qCoolerActiveRBV
Definition: QImaging.h:93
virtual asynStatus writeInt32(asynUser *pasynUser, epicsInt32 value)
QImage::writeInt32: Called when asyn clients call pasynInt32->write().
Definition: QImaging.cpp:2228
int qResetCam
Definition: QImaging.h:101
QImage(const char *portName, const char *model, NDDataType_t dataType, int numbuffs, int debug, int maxBuffers, size_t maxMemory, int priority, int stackSize)
QImage::QImage Class constructor.
Definition: QImaging.cpp:83
int qExposureMin
Definition: QImaging.h:103
void frameTask()
QImage::frameTask: Thread function for generating software triggers for the detector.
Definition: QImaging.cpp:521
int qFanControlRBV
Definition: QImaging.h:74
int qExposureMax
Definition: QImaging.h:102
int qImageFormat
Definition: QImaging.h:81
int qReadoutSpeed
Definition: QImaging.h:79
int qMaxBitDepthRBV
Definition: QImaging.h:67
int qCoolerActive
Definition: QImaging.h:78
int qHighSensitivityModeRBV
Definition: QImaging.h:75
int qAsymmetricalBinningRBV
Definition: QImaging.h:77
int qGainRBV
Definition: QImaging.h:88
int qGainMin
Definition: QImaging.h:105
int qWhiteBalance
Definition: QImaging.h:108
int qFrameStatusMessageRBV
Definition: QImaging.h:96
int qShowDiags
Definition: QImaging.h:100
int qInitialize
Definition: QImaging.h:109
int qSizeXRBV
Definition: QImaging.h:85
int qBinning
Definition: QImaging.h:106
int qReadoutSpeedRBV
Definition: QImaging.h:90
int qExpCnt
Definition: QImaging.h:98
virtual asynStatus writeFloat64(asynUser *pasynUser, epicsFloat64 value)
QImage::writeFloat64: Called when asyn clients call pasynFloat64->write().
Definition: QImaging.cpp:2341
int qMinYRBV
Definition: QImaging.h:84
void consumerTask()
QImage::consumerTask: Thread function to accept new frames from the detector and push them down the p...
Definition: QImaging.cpp:410
int qRegulatedCoolingRBV
Definition: QImaging.h:73
int qExposureStatusMessageRBV
Definition: QImaging.h:95
int qFrmCnt
Definition: QImaging.h:99
int qAutoExposure
Definition: QImaging.h:107
int qUniqueIdRBV
Definition: QImaging.h:70
int qCooledRBV
Definition: QImaging.h:72
int qSerialNumberRBV
Definition: QImaging.h:69
int qTrgCnt
Definition: QImaging.h:97
void setExposureDone()
QImage::setExposureDone: Call signal when exposure happened on the detector.
Definition: QImaging.cpp:1032
virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[], size_t nElements, size_t *nIn)
QImage::readEnum: Adds frame data type and color mode to enums.
Definition: QImaging.cpp:1958
list value
Definition: makeDbAndEdl.py:234