areaDetector  3-12-1
EPICS areaDetector framework
ADSpinnaker.h
Go to the documentation of this file.
1 #ifndef ADSPINNAKER_H
2 #define ADSPINNAKER_H
3 
4 #include <epicsEvent.h>
5 
6 #include <ADGenICam.h>
7 #include "Spinnaker.h"
8 #include "SpinGenApi/SpinnakerGenApi.h"
9 
10 using namespace Spinnaker;
11 using namespace Spinnaker::GenApi;
12 using namespace Spinnaker::GenICam;
13 
14 #define SPConvertPixelFormatString "SP_CONVERT_PIXEL_FORMAT" // asynParamInt32, R/W
15 #define SPDeliveredFrameCountString "SP_DELIVERED_FRAME_COUNT" // asynParamInt32, R/O
16 #define SPLostFrameCountString "SP_LOST_FRAME_COUNT" // asynParamInt32, R/O
17 #define SPInputBufferCountString "SP_INPUT_BUFFER_COUNT" // asynParamInt32, R/O
18 #define SPOutputBufferCountString "SP_OUTPUT_BUFFER_COUNT" // asynParamInt32, R/O
19 #define SPFailedBufferCountString "SP_FAILED_BUFFER_COUNT" // asynParamInt32, R/O
20 #define SPTotalPacketCountString "SP_TOTAL_PACKET_COUNT" // asynParamInt32, R/O
21 #define SPResendPacketCountString "SP_RESEND_PACKET_COUNT" // asynParamInt32, R/O
22 #define SPFailedPacketCountString "SP_FAILED_PACKET_COUNT" // asynParamInt32, R/O
23 #define SPTimeStampModeString "SP_TIME_STAMP_MODE" // asynParamInt32, R/O
24 #define SPUniqueIdModeString "SP_UNIQUE_ID_MODE" // asynParamInt32, R/O
25 
26 class ADSpinnakerImageEventHandler : public ImageEventHandler
27 {
28 public:
29 
30  ADSpinnakerImageEventHandler(epicsMessageQueue *pMsgQ)
31  : pMsgQ_(pMsgQ)
32  {}
34 
35  void OnImageEvent(ImagePtr image) {
36  ImagePtr *imagePtrAddr = new ImagePtr(image);
37 
38  if (pMsgQ_->send(&imagePtrAddr, sizeof(imagePtrAddr)) != 0) {
39  printf("OnImageEvent error calling pMsgQ_->send()\n");
40  }
41  }
42 
43 private:
44  epicsMessageQueue *pMsgQ_;
45 
46 };
47 
48 
52 class ADSpinnaker : public ADGenICam
53 {
54 public:
55  ADSpinnaker(const char *portName, int cameraId, int numSPBuffers,
56  size_t maxMemory, int priority, int stackSize);
57 
58  // virtual methods to override from ADGenICam
59  //virtual asynStatus writeInt32( asynUser *pasynUser, epicsInt32 value);
60  //virtual asynStatus writeFloat64( asynUser *pasynUser, epicsFloat64 value);
61  virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[],
62  size_t nElements, size_t *nIn);
63  void report(FILE *fp, int details);
64  virtual GenICamFeature *createFeature(GenICamFeatureSet *set,
65  std::string const & asynName, asynParamType asynType, int asynIndex,
66  std::string const & featureName, GCFeatureType_t featureType);
67  INodeMap *getNodeMap();
68 
70  void imageGrabTask();
71  void shutdown();
72 
73 private:
74  int SPConvertPixelFormat;
75 #define FIRST_SP_PARAM SPConvertPixelFormat
76  int SPDeliveredFrameCount;
77  int SPLostFrameCount;
78  int SPInputBufferCount;
79  int SPOutputBufferCount;
80  int SPFailedBufferCount;
81  int SPTotalPacketCount;
82  int SPResendPacketCount;
83  int SPFailedPacketCount;
84  int SPTimeStampMode;
85  int SPUniqueIdMode;
86  int SPFrameRateEnable;
87 
88  /* Local methods to this class */
89  asynStatus grabImage();
90  asynStatus startCapture();
91  asynStatus stopCapture();
92  asynStatus connectCamera();
93  asynStatus disconnectCamera();
94  void imageEventCallback(ImagePtr pImage);
95  void reportNode(FILE *fp, INodeMap *pNodeMap, gcstring nodeName, int level);
96 
97  /* Data */
98  int cameraId_;
99 
100  INodeMap *pNodeMap_;
101  INodeMap *pTLStreamNodeMap_;
102  SystemPtr system_;
103  CameraList camList_;
104  CameraPtr pCamera_;
105  int numSPBuffers_;
106  ImageEventHandler *pImageEventHandler_;
107 
108  int exiting_;
109  epicsEventId startEventId_;
110  epicsMessageQueue *pCallbackMsgQ_;
111  NDArray *pRaw_;
112  int uniqueId_;
113 };
114 
115 #endif
116 
GCFeatureType_t
Definition: GenICamFeature.h:12
ADSpinnakerImageEventHandler(epicsMessageQueue *pMsgQ)
Definition: ADSpinnaker.h:30
Main driver class inherited from areaDetectors ADDriver class.
Definition: ADSpinnaker.h:52
~ADSpinnakerImageEventHandler()
Definition: ADSpinnaker.h:33
Definition: GenICamFeature.h:40
Definition: ADSpinnaker.h:26
Definition: GenICamFeature.h:122
void OnImageEvent(ImagePtr image)
Definition: ADSpinnaker.h:35
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:94
Definition: NDFileHDF5Layout.h:44
Definition: ADGenICam.h:24
nodeName
Definition: makeAdl.py:469