areaDetector  3-13
EPICS areaDetector framework
ADTimePix.h
Go to the documentation of this file.
1 /*
2  * Header file for the ADTimePix3 EPICS driver
3  *
4  * This file contains the definitions of PV params, and the definition of the ADTimePix3 class and functions.
5  *
6  * Author: Kazimierz Gofron
7  * Created: June, 2022
8  * Last edited: February 25, 2023
9  * Copyright (c) : Oak Ridge National Laboratory
10  *
11  */
12 
13 // header guard
14 #ifndef ADTIMEPIX_H
15 #define ADTIMEPIX_H
16 
17 // version numbers
18 #define ADTIMEPIX_VERSION 0
19 #define ADTIMEPIX_REVISION 1
20 #define ADTIMEPIX_MODIFICATION 0
21 
22 #include <nlohmann/json.hpp>
24 
25 
26 // Driver-specific PV string definitions here
27 /* String asyn interface access Description */
28 #define ADTimePixServerNameString "TPX3_SERVER_NAME" // (asynOctet, r) Server Name
29 #define ADTimePixDetTypeString "TPX3_DETECTOR_TYPE" // (asynOctet, r) Detector Type, should be binary DetConnected
30 #define ADTimePixFWTimeStampString "TPX3_FW_TIMESTAMP" // (asynOctet, r) Firmware TimeStamp
31 //#define ADTimePixDetConnectedString "TPX3_DETECTOR_CONNECTED" // (asynOctet, r) Detector Connected, TODO
32 #define ADTimePixFreeSpaceString "TPX3_FREE_SPACE" // (asynInt64 r) Free Space [Bytes]
33 #define ADTimePixWriteSpeedString "TPX3_WRITE_SPEED" // (asynFloat64, r) Hits? [320 Mhits/s]
34 #define ADTimePixLowerLimitString "TPX3_LLIM_SPACE" // (asynInt64, w) Lower limit on available disk space [Bytes]
35 #define ADTimePixLLimReachedString "TPX3_LLIM_REACH" // (asynInt32, r) Reached Lower disk limit
36 #define ADTimePixHttpCodeString "TPX3_HTTP_CODE" // (asynInt32, r) 200/OK, 204/NoContent, 302/MovedTemporarly, 400/BadRequest, 404/NotFound, 409/Conflict, 500/InternalError, 503/ServiceUnavailable
37 
38 // Detector Health
39 #define ADTimePixLocalTempString "TPX3_LOCAL_TEMP" // (asynFloat64, r) Local Temperature
40 #define ADTimePixFPGATempString "TPX3_FPGA_TEMP" // (asynFloat64, r) FPGA Temperature
41 #define ADTimePixFan1SpeedString "TPX3_FAN1_SPEED" // (asynFloat64, r) Fan1 Speed
42 #define ADTimePixFan2SpeedString "TPX3_FAN2_SPEED" // (asynFloat64, r) Fan Speed
43 #define ADTimePixBiasVoltageString "TPX3_BIAS_VOLT_H" // (asynFloat64, r) Bias Voltage
44 #define ADTimePixHumidityString "TPX3_HUMIDITY" // (asynInt32, r) Humidity
45 #define ADTimePixChipTemperatureString "TPX3_CHIP_TEMPS" // (asynOctet, r) Chip temperature list
46 #define ADTimePixVDDString "TPX3_VDD" // (asynOctet, r) VDD list
47 #define ADTimePixAVDDString "TPX3_AVDD" // (asynOctet, r) AVDD list
48 #define ADTimePixHealthString "TPX3_HEALTH" // (asynInt32, r) Scan detector/health
49 
50  // Detector Info
51 #define ADTimePixIfaceNameString "TPX3_IFACE" // (asynOctet, r) IfaceName
52 #define ADTimePixSW_versionString "TPX3_SW_VER" // (asynOctet, r) SW_version
53 #define ADTimePixFW_versionString "TPX3_FW_VER" // (asynOctet, r) FW_versionS
54 #define ADTimePixPixCountString "TPX3_PEL_CNT" // (asynInt32, r) PixCount
55 #define ADTimePixRowLenString "TPX3_ROWLEN" // (asynInt32, r) RowLen
56 #define ADTimePixNumberOfChipsString "TPX3_NUM_CHIPS" // (asynInt32, r) NumberOfChip
57 #define ADTimePixNumberOfRowsString "TPX3_NUM_ROWS" // (asynInt32, r) NumberOfRows
58 #define ADTimePixMpxTypeString "TPX3_MPX_TYPE" // (asynInt32, r) MpxType
59 
60 #define ADTimePixBoardsIDString "TPX3_BOARDS_ID" // (asynOctet, r) Boards->ChipboardId
61 #define ADTimePixBoardsIPString "TPX3_BOARDS_IP" // (asynOctet, r) Boards->IpAddress
62 #define ADTimePixBoardsCh1String "TPX3_BOARDS_CH1" // (asynOctet, r) Boards->Chip1{Id,Name}
63 #define ADTimePixBoardsCh2String "TPX3_BOARDS_CH2" // (asynOctet, r) Boards->Chip2{Id,Name}
64 #define ADTimePixBoardsCh3String "TPX3_BOARDS_CH3" // (asynOctet, r) Boards->Chip3{Id,Name}
65 #define ADTimePixBoardsCh4String "TPX3_BOARDS_CH4" // (asynOctet, r) Boards->Chip4{Id,Name}
66 
67 #define ADTimePixSuppAcqModesString "TPX3_ACQ_MODES" // (asynInt32, r) SuppAcqModes
68 #define ADTimePixClockReadoutString "TPX3_CLOCK_READ" // (asynFloat64, r) ClockReadout
69 #define ADTimePixMaxPulseCountString "TPX3_PULSE_CNT" // (asynInt32, r) MaxPulseCount
70 #define ADTimePixMaxPulseHeightString "TPX3_PULSE_HIGHT" // (asynFloat64, r) MaxPulseHeight
71 #define ADTimePixMaxPulsePeriodString "TPX3_PULSE_PERIOD" // (asynFloat64, r) MaxPulsePeriod
72 #define ADTimePixTimerMaxValString "TPX3_TIME_MAX" // (asynFloat64, r) TimerMaxVal
73 #define ADTimePixTimerMinValString "TPX3_TIME_MIN" // (asynFloat64, r) TimerMinVal
74 #define ADTimePixTimerStepString "TPX3_TIME_STEP" // (asynFloat64, r) TimerStep
75 #define ADTimePixClockTimepixString "TPX3_CLOCK" // (asynFloat64, r) ClockTimepix
76 
77  // Detector Config
78 #define ADTimePixFan1PWMString "TPX3_FAN1PWM" // (asynInt32, r) Fan1PWM
79 #define ADTimePixFan2PWMString "TPX3_FAN2PWM" // (asynInt32, r) Fan2PWM
80 #define ADTimePixBiasVoltString "TPX3_BIAS_VOLT_R" // (asynInt32, r) BiasVoltage
81 #define ADTimePixBiasEnableString "TPX3_BIAS_ENBL" // (asynInt32, r) BiasEnabled
82 #define ADTimePixChainModeString "TPX3_CHAIN_MODE" // (asynInt32, r) ChainMode
83 #define ADTimePixTriggerInString "TPX3_TRIGGER_IN" // (asynInt32, r) TriggerIn
84 #define ADTimePixTriggerOutString "TPX3_TRIGGER_OUT" // (asynInt32, r) TriggerOut
85 #define ADTimePixPolarityString "TPX3_POLARITY" // (asynInt32, r) Polarity
86 #define ADTimePixTriggerModeString "TPX3_TRIGGER_MODE" // (asynOctet, r) TriggerMode
87 #define ADTimePixExposureTimeString "TPX3_EXPOSURE_TIME" // (asynFloat64, r) ExposureTime
88 #define ADTimePixTriggerPeriodString "TPX3_TRIGGER_PERIOD" // (asynFloat64, r) TriggerPeriod
89 #define ADTimePixnTriggersString "TPX3_NTRIGGERS" // (asynInt32, r) nTriggers
90 #define ADTimePixPeriphClk80String "TPX3_PERIPH_CLK80" // (asynInt32, r) PeriphClk80
91 #define ADTimePixTriggerDelayString "TPX3_TRIG_DELAY" // (asynFloat64, r) TriggerDelay
92 #define ADTimePixTdcString "TPX3_TDC" // (asynOctet, r) Tdc
93 #define ADTimePixTdc0String "TPX3_TDC0" // (asynInt32, r) Tdc0
94 #define ADTimePixTdc1String "TPX3_TDC1" // (asynInt32, r) Tdc1
95 #define ADTimePixGlobalTimestampIntervalString "TPX3_GL_TIMESTAMP_INT" // (asynFloat64, r) GlobalTimestampInterval
96 #define ADTimePixExternalReferenceClockString "TPX3_EXT_REF_CLOCK" // (asynInt32, r) ExternalReferenceClock
97 #define ADTimePixLogLevelString "TPX3_LOG_LEVEL" // (asynInt32, r) LogLevel
98 
99 // Detector Chips: Chip0; Chips count from 0-3. The index come from ADDR parameter
100 #define ADTimePixCP_PLLString "TPX3_CP_PLL" // (asynInt32, r) DACs->Ibias_CP_PLL
101 #define ADTimePixDiscS1OFFString "TPX3_DISCS1OFF" // (asynInt32, r) DACs->Ibias_DiscS1_OFF
102 #define ADTimePixDiscS1ONString "TPX3_DISCS1ON" // (asynInt32, r) DACs->Ibias_DiscS1_ON
103 #define ADTimePixDiscS2OFFString "TPX3_DISCS2OFF" // (asynInt32, r) DACs->Ibias_DiscS2_OFF
104 #define ADTimePixDiscS2ONString "TPX3_DISCS2ON" // (asynInt32, r) DACs->Ibias_DiscS2_ON
105 #define ADTimePixIkrumString "TPX3_IKRUM" // (asynInt32, r) DACs->Ibias_Ikrum
106 #define ADTimePixPixelDACString "TPX3_PIXELDAC" // (asynInt32, r) DACs->Ibias_PixelDAC
107 #define ADTimePixPreampOFFString "TPX3_PREAMPOFF" // (asynInt32, r) DACs->Ibias_Preamp_OFF
108 #define ADTimePixPreampONString "TPX3_PREAMPON" // (asynInt32, r) DACs->Ibias_Preamp_ON
109 #define ADTimePixTPbufferInString "TPX3_TPBUFFERIN" // (asynInt32, r) DACs->Ibias_TPbufferIn
110 #define ADTimePixTPbufferOutString "TPX3_TPBUFFEROUT" // (asynInt32, r) DACs->Ibias_TPbufferOut
111 #define ADTimePixPLL_VcntrlString "TPX3_PLL_VCNTRL" // (asynInt32, r) DACs->PLL_Vcntrl
112 #define ADTimePixVPreampNCASString "TPX3_VPREAMPNCAS" // (asynInt32, r) DACs->VPreamp_NCAS
113 #define ADTimePixVTPcoarseString "TPX3_VTP_COARSE" // (asynInt32, r) DACs->VTP_coarse
114 #define ADTimePixVTPfineString "TPX3_VTP_FINE" // (asynInt32, r) DACs->VTP_fine
115 #define ADTimePixVfbkString "TPX3_VFBK" // (asynInt32, r) DACs->Vfbk
116 #define ADTimePixVthresholdCoarseString "TPX3_VTH_COARSE" // (asynInt32, r) DACs->Vthreshold_coarse
117 #define ADTimePixVthresholdFineString "TPX3_VTH_FINE" // (asynInt32, r) DACs->Vthreshold_fine
118 #define ADTimePixAdjustString "TPX3_ADJUST" // (asynInt32, r) DACs->Adjust
119 // Chip Layout
120 #define ADTimePixDetectorOrientationString "TPX3_DET_ORIENTATION" // (asynInt32, r) DetectorOrientation, in Detector/Layout since 3.0.0
121 #define ADTimePixLayoutString "TPX3_LAYOUT" // (asynOctet, r) Chip layout
122 
123  // Absolute path to the binary pixel configuration, absolute path to the text chips configuration
124 #define ADTimePixBPCFilePathString "BPC_FILE_PATH"
125 #define ADTimePixBPCFilePathExistsString "BPC_FILE_PATH_EXISTS"
126 #define ADTimePixBPCFileNameString "BPC_FILE_NAME"
127 #define ADTimePixDACSFilePathString "DACS_FILE_PATH"
128 #define ADTimePixDACSFilePathExistsString "DACS_FILE_PATH_EXISTS"
129 #define ADTimePixDACSFileNameString "DACS_FILE_NAME"
130 #define ADTimePixWriteMsgString "WRITE_FILE_MESSAGE"
131 #define ADTimePixWriteBPCFileString "WRITE_BPC_FILE"
132 #define ADTimePixWriteDACSFileString "WRITE_DACS_FILE"
135  // Server, write data channels
136 #define ADTimePixWriteDataString "TPX3_WRITE_DATA" // (asynInt32, w) Write Data output channels (raw,img,preview)
137 #define ADTimePixWriteRawString "TPX3_WRITE_RAW" // (asynInt32, w) Write Data output channels (raw)
138 #define ADTimePixWriteRaw1String "TPX3_WRITE_RAW1" // (asynInt32, w) Write Data output channels (raw), Serval 3.3.0
139 #define ADTimePixWriteImgString "TPX3_WRITE_IMG" // (asynInt32, w) Write Data output channels (img)
140 #define ADTimePixWritePrvImgString "TPX3_WRITE_PRVIMG" // (asynInt32, w) Write Data output channels (preview->img)
141 #define ADTimePixWritePrvImg1String "TPX3_WRITE_PRVIMG1" // (asynInt32, w) Write Data output channels (preview->img1)
142 #define ADTimePixWritePrvHstString "TPX3_WRITE_PRVHST" // (asynInt32, w) Write Data output channels (preview->hst)
143 
144  // Server, raw
145 #define ADTimePixRawBaseString "TPX3_RAW_BASE" // (asynOctet, w) Raw Destination Base
146 #define ADTimePixRawFilePatString "TPX3_RAW_FILEPAT" // (asynOctet, w) Raw Destination File Pattern
147 #define ADTimePixRawSplitStrategyString "TPX3_RAW_SPLITSTG" // (asynOctet, w) Raw Destination Split Strategy
148 #define ADTimePixRawQueueSizeString "TPX3_RAW_QUEUESIZE" // (asynInt32, w) Raw Destination Queue Size
149 #define ADTimePixRawFilePathExistsString "RAW_FILE_PATH_EXISTS" // (asynInt32, r/w) File path exists? */
150 
151  // Server, raw stream or .tpx3 file (Serval 3.3.0)
152 #define ADTimePixRaw1BaseString "TPX3_RAW1_BASE" // (asynOctet, w) Raw Destination Base
153 #define ADTimePixRaw1FilePatString "TPX3_RAW1_FILEPAT" // (asynOctet, w) Raw Destination File Pattern
154 #define ADTimePixRaw1SplitStrategyString "TPX3_RAW1_SPLITSTG" // (asynOctet, w) Raw Destination Split Strategy
155 #define ADTimePixRaw1QueueSizeString "TPX3_RAW1_QUEUESIZE" // (asynInt32, w) Raw Destination Queue Size
156 #define ADTimePixRaw1FilePathExistsString "RAW1_FILE_PATH_EXISTS" // (asynInt32, r/w) File path exists? */
157 
158  // Server, Image, ImageChannels[0]
159 #define ADTimePixImgBaseString "TPX3_IMG_IMGBASE" // (asynOctet, w) ImageChannels Base file (Place raw files)
160 #define ADTimePixImgFilePatString "TPX3_IMG_IMGPAT" // (asynOctet, w) ImageChannels FilePattern
161 #define ADTimePixImgFormatString "TPX3_IMG_IMGFORMAT" // (asynInt32, w) ImageChannels Format
162 #define ADTimePixImgModeString "TPX3_IMG_IMGMODE" // (asynInt32, w) ImageChannels Mode
163 #define ADTimePixImgThsString "TPX3_IMG_IMGTHS" // (asynOctet, w) ImageChannels Thresholds
164 #define ADTimePixImgIntSizeString "TPX3_IMG_INTSIZE" // (asynInt32, w) ImageChannels IntegrationSize
165 #define ADTimePixImgIntModeString "TPX3_IMG_INTMODE" // (asynInt32, w) ImageChannels IntegrationMode
166 #define ADTimePixImgStpOnDskLimString "TPX3_IMG_STPONDSK" // (asynInt32, w) ImageChannels StopMeasurementOnDiskLimit
167 #define ADTimePixImgQueueSizeString "TPX3_IMG_QUEUESIZE" // (asynInt32, w) ImageChannels QueueSize
168 #define ADTimePixImgFilePathExistsString "IMG_FILE_PATH_EXISTS" // (asynInt32, r/w) File path exists? */
169 
170  // Server, Preview
171 #define ADTimePixPrvPeriodString "TPX3_PRV_PERIOD" // (asynFloat64, w) Preview Period
172 #define ADTimePixPrvSamplingModeString "TPX3_PRV_SAMPLMODE" // (asynOctet, w) Preview Sampling Mode
173  // Server, Preview, ImageChannels[0]
174 #define ADTimePixPrvImgBaseString "TPX3_PRV_IMGBASE" // (asynOctet, w) Preview ImageChannels Base file (Place raw files)
175 #define ADTimePixPrvImgFilePatString "TPX3_PRV_IMGPAT" // (asynOctet, w) Preview ImageChannels FilePattern
176 #define ADTimePixPrvImgFormatString "TPX3_PRV_IMGFORMAT" // (asynInt32, w) Preview ImageChannels Format
177 #define ADTimePixPrvImgModeString "TPX3_PRV_IMGMODE" // (asynInt32, w) Preview ImageChannels Mode
178 #define ADTimePixPrvImgThsString "TPX3_PRV_IMGTHS" // (asynOctet, w) Preview ImageChannels Thresholds
179 #define ADTimePixPrvImgIntSizeString "TPX3_PRV_INTSIZE" // (asynInt32, w) Preview ImageChannels IntegrationSize
180 #define ADTimePixPrvImgIntModeString "TPX3_PRV_INTMODE" // (asynInt32, w) Preview ImageChannels IntegrationMode
181 #define ADTimePixPrvImgStpOnDskLimString "TPX3_PRV_STPONDSK" // (asynInt32, w) Preview ImageChannels StopMeasurementOnDiskLimit
182 #define ADTimePixPrvImgQueueSizeString "TPX3_PRV_QUEUESIZE" // (asynInt32, w) Preview ImageChannels QueueSize
183 #define ADTimePixPrvImgFilePathExistsString "PRV_IMG_FILE_PATH_EXISTS" // (asynInt32, r/w) File path exists? */
184  // Server, Preview, ImageChannels[1]
185 #define ADTimePixPrvImg1BaseString "TPX3_PRV_IMG1BASE" // (asynOctet, w) Preview ImageChannels Preview files Base
186 #define ADTimePixPrvImg1FilePatString "TPX3_PRV_IMG1PAT" // (asynOctet, w) Preview ImageChannels FilePattern
187 #define ADTimePixPrvImg1FormatString "TPX3_PRV_IMG1FORMAT" // (asynInt32, w) Preview ImageChannels Preview files Format
188 #define ADTimePixPrvImg1ModeString "TPX3_PRV_IMG1MODE" // (asynInt32, w) Preview ImageChannels Preview files Mode
189 #define ADTimePixPrvImg1ThsString "TPX3_PRV_IMG1THS" // (asynOctet, w) Preview ImageChannels Preview files Thresholds
190 #define ADTimePixPrvImg1IntSizeString "TPX3_PRV_IMG1INTSIZE" // (asynInt32, w) Preview ImageChannels Preview files IntegrationSize
191 #define ADTimePixPrvImg1IntModeString "TPX3_PRV_IMG1INTMODE" // (asynInt32, w) Preview ImageChannels IntegrationMode
192 #define ADTimePixPrvImg1StpOnDskLimString "TPX3_PRV_IMG1STPONDSK" // (asynInt32, w) Preview ImageChannels Preview files StopMeasurementOnDiskLimit
193 #define ADTimePixPrvImg1QueueSizeString "TPX3_PRV_IMG1QUEUESIZE" // (asynInt32, w) Preview ImageChannels Preview files QueueSize
194 #define ADTimePixPrvImg1FilePathExistsString "PRV_IMG1_FILE_PATH_EXISTS" // (asynInt32, r/w) File path exists? */
195 
196  // Server, Preview, HistogramChannels[0]
197 #define ADTimePixPrvHstBaseString "TPX3_PRV_HSTBASE" // (asynOctet, w) Preview HistogramChannels Base file (Place raw files)
198 #define ADTimePixPrvHstFilePatString "TPX3_PRV_HSTPAT" // (asynOctet, w) Preview HistogramChannels FilePattern
199 #define ADTimePixPrvHstFormatString "TPX3_PRV_HSTFORMAT" // (asynInt32, w) Preview HistogramChannels Format
200 #define ADTimePixPrvHstModeString "TPX3_PRV_HSTMODE" // (asynInt32, w) Preview HistogramChannels Mode
201 #define ADTimePixPrvHstThsString "TPX3_PRV_HSTTHS" // (asynOctet, w) Preview HistogramChannels Thresholds
202 #define ADTimePixPrvHstIntSizeString "TPX3_PRV_HSTINTSIZE" // (asynInt32, w) Preview HistogramChannels IntegrationSize
203 #define ADTimePixPrvHstIntModeString "TPX3_PRV_HSTINTMODE" // (asynInt32, w) Preview HistogramChannels IntegrationMode
204 #define ADTimePixPrvHstStpOnDskLimString "TPX3_PRV_HSTSTPONDSK" // (asynInt32, w) Preview HistogramChannels StopMeasurementOnDiskLimit
205 #define ADTimePixPrvHstQueueSizeString "TPX3_PRV_HSTQUEUESIZE" // (asynInt32, w) Preview HistogramChannels QueueSize
206 #define ADTimePixPrvHstFilePathExistsString "PRV_HST_FILE_PATH_EXISTS" // (asynInt32, r/w) File path exists? */
207 
208  // Measurement
209 #define ADTimePixPelRateString "TPX3_PEL_RATE" // (asynInt32, w) PixelEventRate
210 #define ADTimePixTdc1RateString "TPX3_TDC1_RATE" // (asynInt32, w) Tdc1EventRate
211 #define ADTimePixTdc2RateString "TPX3_TDC2_RATE" // (asynInt32, w) Tdc2EventRate
212 #define ADTimePixStartTimeString "TPX3_START_TIME" // (asynInt64, w) StartDateTime
213 #define ADTimePixElapsedTimeString "TPX3_ELAPSED_TIME" // (asynFloat64, w) ElapsedTime
214 #define ADTimePixTimeLeftString "TPX3_TIME_LEFT" // (asynFloat64, w) TimeLeft
215 #define ADTimePixFrameCountString "TPX3_FRAME_COUNT" // (asynInt32, w) FrameCount
216 #define ADTimePixDroppedFramesString "TPX3_DROPPED_FRAMES" // (asynInt32, w) DroppedFrames
217 #define ADTimePixStatusString "TPX3_MSMT_STATUS" // (asynOctet, w) Status
218 
219 // Control
220 #define ADTimePixRawStreamString "TPX3_RAW_STREAM" // (asynInt32, w) file:/, http://, tcp://
221 #define ADTimePixRaw1StreamString "TPX3_RAW1_STREAM" // (asynInt32, w) file:/, http://, tcp://; Serval 3.3.0
222 
223 // Place any required inclues here
224 
225 #include "ADDriver.h"
226 #include "cpr/cpr.h"
227 #include "nlohmann/json.hpp"
228 #include <Magick++.h>
229 using namespace Magick;
230 
231 
232 
233 // ----------------------------------------
234 // ADTimePix3 Data Structures
235 //-----------------------------------------
236 
237 // Place any in use Data structures here
238 
239 
240 
241 /*
242  * Class definition of the ADTimePix driver. It inherits from the base ADDriver class
243  *
244  * Includes constructor/destructor, PV params, function defs and variable defs
245  *
246  */
248 
249  public:
250 
251  // Constructor - NOTE THERE IS A CHANCE THAT YOUR CAMERA DOESNT CONNECT WITH SERIAL # AND THIS MUST BE CHANGED
252  ADTimePix(const char* portName, const char* serial, int maxBuffers, size_t maxMemory, int priority, int stackSize);
253 
254 
255  // ADDriver overrides
256  virtual asynStatus writeOctet(asynUser *pasynUser, const char *value, size_t nChars, size_t *nActual);
257  virtual asynStatus writeInt32(asynUser* pasynUser, epicsInt32 value);
258  virtual asynStatus writeFloat64(asynUser* pasynUser, epicsFloat64 value);
259 
260 
261  void timePixCallback();
262 
263  // destructor. Disconnects from camera, deletes the object
264  ~ADTimePix();
265 
266  protected:
268  #define ADTIMEPIX_FIRST_PARAM ADTimePixHttpCode
269 
270  // Dashboard
275 
278  // int ADTimePixDetConnected; // TODO
279 
281 
282  // Health
293 
294  // Detector Info
303 
310 
320 
321  // Detector Config
342 
343  // Detector Chips
363 
364  // Detector Chip layout
367 
368  // Files BPC, Chip/DACS
378 
379  // Server, write output channels/modes
382  int ADTimePixWriteRaw1; // Serval 3.3.0
387 
388  // Server, raw
394 
395  // Server, raw; Serval 3.3.0 multiple stream/file
401 
402  // Server, Image
413 
414  // Server, Preview
417  // Server, Preview, ImageChannels[0]
428  // Server, Preview, ImageChannel[1]
439  // Server, Preview, HistogramChannels[0]
450 
451  // Measurement
461 
462  // Controls
465 
466  #define ADTIMEPIX_LAST_PARAM ADTimePixRaw1Stream
467 
468  private:
469 
470  // Some data variables
471  epicsEventId startEventId;
472  epicsEventId endEventId;
473 
474  std::map<std::string, int> mDetOrientationMap;
475 
476  std::string serverURL;
477  Image image;
478 
479  bool acquiring=false;
480 
481  epicsThreadId callbackThreadId;
482 
483  // ----------------------------------------
484  // DRIVERNAMESTANDARD Global Variables
485 
486  // ----------------------------------------
487  // DRIVERNAMESTANDARD Functions - Logging/Reporting
488  //-----------------------------------------
489 
490  // reports device and driver info into a log file
491  void report(FILE* fp, int details);
492 
493  // writes to ADStatus PV
494  void updateStatus(const char* status);
495 
496  //function used for connecting to a TimePix3 serval URL device
497  // NOTE - THIS MAY ALSO NEED TO CHANGE IF SERIAL # NOT USED
498  asynStatus initialServerCheckConnection();
499 
500  void printConnectedDeviceInfo();
501 
502  //function that begins image aquisition
503  asynStatus acquireStart();
504 
505  //function that stops aquisition
506  asynStatus acquireStop();
507 
508  // TimePix3 specific functions
509  asynStatus getDashboard();
510  asynStatus getServer();
511  asynStatus getHealth();
512  asynStatus getDetector();
513  asynStatus initCamera();
514  asynStatus initAcquisition();
515  asynStatus checkBPCPath();
516  asynStatus checkDACSPath();
517  asynStatus checkRawPath();
518  asynStatus checkRaw1Path();
519  asynStatus checkImgPath();
520  asynStatus checkPrvImgPath();
521  asynStatus checkPrvImg1Path();
522  asynStatus checkPrvHstPath();
523  bool checkPath(std::string &filePath);
524  asynStatus uploadBPC();
525  asynStatus uploadDACS();
526  asynStatus writeDac(int chip, const std::string &dac, int value);
527  asynStatus fetchDacs(json &data, int chip);
528  asynStatus readImage();
529  asynStatus fileWriter();
530  asynStatus writeLayout();
531 
532 };
533 
534 // Stores number of additional PV parameters are added by the driver
535 #define NUM_TIMEPIX_PARAMS ((int)(&ADTIMEPIX_LAST_PARAM - &ADTIMEPIX_FIRST_PARAM + 1))
536 
537 #endif
nlohmann::json json
Definition: ADTimePix.cpp:67
nlohmann::json json
Definition: ADTimePix.h:23
Class from which areaDetector drivers are directly derived.
Definition: ADDriver.h:132
Definition: ADTimePix.h:247
int ADTimePixImgMode
Definition: ADTimePix.h:406
int ADTimePixPreampON
Definition: ADTimePix.h:352
int ADTimePixPrvImgIntMode
Definition: ADTimePix.h:424
int ADTimePixVthresholdFine
Definition: ADTimePix.h:361
int ADTimePixRaw1SplitStrategy
Definition: ADTimePix.h:398
int ADTimePixPrvImgFilePat
Definition: ADTimePix.h:419
int ADTimePixPolarity
Definition: ADTimePix.h:329
int ADTimePixDiscS2ON
Definition: ADTimePix.h:348
int ADTimePixPrvHstIntMode
Definition: ADTimePix.h:446
int ADTimePixHealth
Definition: ADTimePix.h:292
int ADTimePixBoardsCh2
Definition: ADTimePix.h:307
int ADTimePixPixelDAC
Definition: ADTimePix.h:350
int ADTimePixVthresholdCoarse
Definition: ADTimePix.h:360
int ADTimePixRawFilePathExists
Definition: ADTimePix.h:393
int ADTimePixPrvHstFormat
Definition: ADTimePix.h:442
int ADTimePixMaxPulseCount
Definition: ADTimePix.h:313
int ADTimePixPrvHstThs
Definition: ADTimePix.h:444
int ADTimePixPrvImgFilePathExists
Definition: ADTimePix.h:427
int ADTimePixImgFormat
Definition: ADTimePix.h:405
int ADTimePixImgFilePat
Definition: ADTimePix.h:404
int ADTimePixPreampOFF
Definition: ADTimePix.h:351
int ADTimePixLogLevel
Definition: ADTimePix.h:341
int ADTimePixVTPfine
Definition: ADTimePix.h:358
int ADTimePixWriteRaw1
Definition: ADTimePix.h:382
int ADTimePixWritePrvHst
Definition: ADTimePix.h:386
int ADTimePixTdc1Rate
Definition: ADTimePix.h:453
int ADTimePixPrvHstMode
Definition: ADTimePix.h:443
int ADTimePixFW_version
Definition: ADTimePix.h:297
int ADTimePixPrvImg1IntMode
Definition: ADTimePix.h:435
int ADTimePixTriggerPeriod
Definition: ADTimePix.h:332
int ADTimePixPrvImg1FilePathExists
Definition: ADTimePix.h:438
int ADTimePixBPCFilePathExists
Definition: ADTimePix.h:370
int ADTimePixWriteBPCFile
Definition: ADTimePix.h:376
int ADTimePixPrvImg1IntSize
Definition: ADTimePix.h:434
int ADTimePixLayout
Definition: ADTimePix.h:366
int ADTimePixBoardsCh3
Definition: ADTimePix.h:308
int ADTimePixFan1PWM
Definition: ADTimePix.h:322
int ADTimePixBiasEnable
Definition: ADTimePix.h:325
int ADTimePixVfbk
Definition: ADTimePix.h:359
int ADTimePixPrvImgMode
Definition: ADTimePix.h:421
int ADTimePixWritePrvImg
Definition: ADTimePix.h:384
int ADTimePixFWTimeStamp
Definition: ADTimePix.h:277
int ADTimePixHumidity
Definition: ADTimePix.h:288
int ADTimePixPrvHstIntSize
Definition: ADTimePix.h:445
int ADTimePixDetectorOrientation
Definition: ADTimePix.h:365
int ADTimePixBoardsID
Definition: ADTimePix.h:304
int ADTimePixTdc0
Definition: ADTimePix.h:337
int ADTimePixServer
Definition: ADTimePix.h:280
int ADTimePixRawFilePat
Definition: ADTimePix.h:390
int ADTimePixPrvImg1Base
Definition: ADTimePix.h:429
int ADTimePixPrvHstQueueSize
Definition: ADTimePix.h:448
int ADTimePixTriggerDelay
Definition: ADTimePix.h:335
int ADTimePixWriteData
Definition: ADTimePix.h:380
int ADTimePixRaw1QueueSize
Definition: ADTimePix.h:399
int ADTimePixDiscS1ON
Definition: ADTimePix.h:346
int ADTimePixRaw1Stream
Definition: ADTimePix.h:464
int ADTimePixRaw1Base
Definition: ADTimePix.h:396
int ADTimePixFreeSpace
Definition: ADTimePix.h:271
int ADTimePixTriggerMode
Definition: ADTimePix.h:330
int ADTimePixVDD
Definition: ADTimePix.h:290
int ADTimePixImgQueueSize
Definition: ADTimePix.h:411
int ADTimePixnTriggers
Definition: ADTimePix.h:333
int ADTimePixIfaceName
Definition: ADTimePix.h:295
int ADTimePixTdc1
Definition: ADTimePix.h:338
int ADTimePixDACSFileName
Definition: ADTimePix.h:374
int ADTimePixBoardsCh1
Definition: ADTimePix.h:306
int ADTimePixPrvImg1QueueSize
Definition: ADTimePix.h:437
int ADTimePixChainMode
Definition: ADTimePix.h:326
int ADTimePixPrvImg1FilePat
Definition: ADTimePix.h:430
int ADTimePixRawBase
Definition: ADTimePix.h:389
int ADTimePixDiscS1OFF
Definition: ADTimePix.h:345
int ADTimePixBiasVolt
Definition: ADTimePix.h:324
int ADTimePixBPCFilePath
Definition: ADTimePix.h:369
int ADTimePixTdc2Rate
Definition: ADTimePix.h:454
int ADTimePixLocalTemp
Definition: ADTimePix.h:283
int ADTimePixTriggerOut
Definition: ADTimePix.h:328
int ADTimePixElapsedTime
Definition: ADTimePix.h:456
int ADTimePixBoardsIP
Definition: ADTimePix.h:305
int ADTimePixTPbufferIn
Definition: ADTimePix.h:353
int ADTimePixPrvImg1StpOnDskLim
Definition: ADTimePix.h:436
int ADTimePixPrvHstBase
Definition: ADTimePix.h:440
int ADTimePixNumberOfChips
Definition: ADTimePix.h:300
int ADTimePixWriteSpeed
Definition: ADTimePix.h:272
int ADTimePixPrvImgIntSize
Definition: ADTimePix.h:423
int ADTimePixTPbufferOut
Definition: ADTimePix.h:354
int ADTimePixMaxPulsePeriod
Definition: ADTimePix.h:315
int ADTimePixSuppAcqModes
Definition: ADTimePix.h:311
int ADTimePixBiasVoltage
Definition: ADTimePix.h:287
int ADTimePixWritePrvImg1
Definition: ADTimePix.h:385
int ADTimePixRawStream
Definition: ADTimePix.h:463
int ADTimePixPrvImg1Format
Definition: ADTimePix.h:431
int ADTimePixDACSFilePathExists
Definition: ADTimePix.h:373
int ADTimePixFPGATemp
Definition: ADTimePix.h:284
int ADTimePixTriggerIn
Definition: ADTimePix.h:327
int ADTimePixPrvPeriod
Definition: ADTimePix.h:415
int ADTimePixPrvHstStpOnDskLim
Definition: ADTimePix.h:447
int ADTimePixRowLen
Definition: ADTimePix.h:299
int ADTimePixMaxPulseHeight
Definition: ADTimePix.h:314
int ADTimePixBPCFileName
Definition: ADTimePix.h:371
int ADTimePixTimerMinVal
Definition: ADTimePix.h:317
int ADTimePixTdc
Definition: ADTimePix.h:336
int ADTimePixImgFilePathExists
Definition: ADTimePix.h:412
int ADTimePixPixCount
Definition: ADTimePix.h:298
int ADTimePixDACSFilePath
Definition: ADTimePix.h:372
int ADTimePixPrvHstFilePathExists
Definition: ADTimePix.h:449
int ADTimePixImgThs
Definition: ADTimePix.h:407
int ADTimePixPrvImg1Mode
Definition: ADTimePix.h:432
int ADTimePixStatus
Definition: ADTimePix.h:460
int ADTimePixPrvSamplingMode
Definition: ADTimePix.h:416
int ADTimePixBoardsCh4
Definition: ADTimePix.h:309
int ADTimePixWriteRaw
Definition: ADTimePix.h:381
int ADTimePixImgStpOnDskLim
Definition: ADTimePix.h:410
int ADTimePixVPreampNCAS
Definition: ADTimePix.h:356
int ADTimePixImgBase
Definition: ADTimePix.h:403
int ADTimePixGlobalTimestampInterval
Definition: ADTimePix.h:339
int ADTimePixPelRate
Definition: ADTimePix.h:452
int ADTimePixAVDD
Definition: ADTimePix.h:291
int ADTimePixWriteDACSFile
Definition: ADTimePix.h:377
int ADTimePixCP_PLL
Definition: ADTimePix.h:344
int ADTimePixRaw1FilePathExists
Definition: ADTimePix.h:400
int ADTimePixExternalReferenceClock
Definition: ADTimePix.h:340
int ADTimePixRawSplitStrategy
Definition: ADTimePix.h:391
int ADTimePixFrameCount
Definition: ADTimePix.h:458
int ADTimePixWriteImg
Definition: ADTimePix.h:383
int ADTimePixSW_version
Definition: ADTimePix.h:296
int ADTimePixPrvImgStpOnDskLim
Definition: ADTimePix.h:425
int ADTimePixLLimReached
Definition: ADTimePix.h:274
int ADTimePixTimeLeft
Definition: ADTimePix.h:457
int ADTimePixPrvImg1Ths
Definition: ADTimePix.h:433
int ADTimePixStartTime
Definition: ADTimePix.h:455
int ADTimePixDiscS2OFF
Definition: ADTimePix.h:347
int ADTimePixFan2Speed
Definition: ADTimePix.h:286
int ADTimePixImgIntMode
Definition: ADTimePix.h:409
int ADTimePixIkrum
Definition: ADTimePix.h:349
int ADTimePixPrvImgFormat
Definition: ADTimePix.h:420
int ADTimePixDroppedFrames
Definition: ADTimePix.h:459
int ADTimePixImgIntSize
Definition: ADTimePix.h:408
int ADTimePixPrvHstFilePat
Definition: ADTimePix.h:441
int ADTimePixPrvImgBase
Definition: ADTimePix.h:418
int ADTimePixExposureTime
Definition: ADTimePix.h:331
int ADTimePixPeriphClk80
Definition: ADTimePix.h:334
int ADTimePixPLL_Vcntrl
Definition: ADTimePix.h:355
int ADTimePixDetType
Definition: ADTimePix.h:276
int ADTimePixChipTemperature
Definition: ADTimePix.h:289
int ADTimePixFan2PWM
Definition: ADTimePix.h:323
int ADTimePixNumberOfRows
Definition: ADTimePix.h:301
int ADTimePixMpxType
Definition: ADTimePix.h:302
int ADTimePixPrvImgThs
Definition: ADTimePix.h:422
int ADTimePixClockReadout
Definition: ADTimePix.h:312
int ADTimePixWriteMsg
Definition: ADTimePix.h:375
int ADTimePixRaw1FilePat
Definition: ADTimePix.h:397
int ADTimePixAdjust
Definition: ADTimePix.h:362
int ADTimePixLowerLimit
Definition: ADTimePix.h:273
int ADTimePixTimerMaxVal
Definition: ADTimePix.h:316
int ADTimePixClockTimepix
Definition: ADTimePix.h:319
int ADTimePixFan1Speed
Definition: ADTimePix.h:285
int ADTimePixVTPcoarse
Definition: ADTimePix.h:357
int ADTimePixPrvImgQueueSize
Definition: ADTimePix.h:426
int ADTimePixTimerStep
Definition: ADTimePix.h:318
int ADTimePixRawQueueSize
Definition: ADTimePix.h:392
int ADTimePixHttpCode
Definition: ADTimePix.h:267
@ string
Definition: NDFileHDF5Layout.h:44
list value
Definition: makeDbAndEdl.py:234