areaDetector  3-13
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 SPStartedFrameCountString "SP_STARTED_FRAME_COUNT" // asynParamInt32, R/O
16 #define SPDeliveredFrameCountString "SP_DELIVERED_FRAME_COUNT" // asynParamInt32, R/O
17 #define SPReceivedFrameCountString "SP_RECEIVED_FRAME_COUNT" // asynParamInt32, R/O
18 #define SPIncompleteFrameCountString "SP_INCOMPLETE_FRAME_COUNT" // asynParamInt32, R/O
19 #define SPLostFrameCountString "SP_LOST_FRAME_COUNT" // asynParamInt32, R/O
20 #define SPDroppedFrameCountString "SP_DROPPED_FRAME_COUNT" // asynParamInt32, R/O
21 #define SPInputBufferCountString "SP_INPUT_BUFFER_COUNT" // asynParamInt32, R/O
22 #define SPOutputBufferCountString "SP_OUTPUT_BUFFER_COUNT" // asynParamInt32, R/O
23 #define SPReceivedPacketCountString "SP_RECEIVED_PACKET_COUNT" // asynParamInt32, R/O
24 #define SPMissedPacketCountString "SP_MISSED_PACKET_COUNT" // asynParamInt32, R/O
25 #define SPResendRequestedPacketCountString "SP_RESEND_REQUESTED_PACKET_COUNT" // asynParamInt32, R/O
26 #define SPResendReceivedPacketCountString "SP_RESEND_RECEIVED_PACKET_COUNT" // asynParamInt32, R/O
27 #define SPTimeStampModeString "SP_TIME_STAMP_MODE" // asynParamInt32, R/O
28 #define SPUniqueIdModeString "SP_UNIQUE_ID_MODE" // asynParamInt32, R/O
29 
30 class ADSpinnakerImageEventHandler : public ImageEventHandler
31 {
32 public:
33 
34  ADSpinnakerImageEventHandler(epicsMessageQueue *pMsgQ)
35  : pMsgQ_(pMsgQ)
36  {}
38 
39  void OnImageEvent(ImagePtr image) {
40  ImagePtr *imagePtrAddr = new ImagePtr(image);
41 
42  if (pMsgQ_->send(&imagePtrAddr, sizeof(imagePtrAddr)) != 0) {
43  printf("OnImageEvent error calling pMsgQ_->send()\n");
44  }
45  }
46 
47 private:
48  epicsMessageQueue *pMsgQ_;
49 
50 };
51 
52 
56 class ADSpinnaker : public ADGenICam
57 {
58 public:
59  ADSpinnaker(const char *portName, int cameraId, int numSPBuffers,
60  size_t maxMemory, int priority, int stackSize);
61 
62  // virtual methods to override from ADGenICam
63  //virtual asynStatus writeInt32( asynUser *pasynUser, epicsInt32 value);
64  //virtual asynStatus writeFloat64( asynUser *pasynUser, epicsFloat64 value);
65  virtual asynStatus readEnum(asynUser *pasynUser, char *strings[], int values[], int severities[],
66  size_t nElements, size_t *nIn);
67  void report(FILE *fp, int details);
68  virtual GenICamFeature *createFeature(GenICamFeatureSet *set,
69  std::string const & asynName, asynParamType asynType, int asynIndex,
70  std::string const & featureName, GCFeatureType_t featureType);
71  INodeMap *getNodeMap();
72 
74  void imageGrabTask();
75  void shutdown();
76 
77 private:
78  int SPConvertPixelFormat;
79 #define FIRST_SP_PARAM SPConvertPixelFormat
80  int SPStartedFrameCount;
81  int SPDeliveredFrameCount;
82  int SPReceivedFrameCount;
83  int SPIncompleteFrameCount;
84  int SPLostFrameCount;
85  int SPDroppedFrameCount;
86  int SPInputBufferCount;
87  int SPOutputBufferCount;
88  int SPReceivedPacketCount;
89  int SPMissedPacketCount;
90  int SPResendRequestedPacketCount;
91  int SPResendReceivedPacketCount;
92  int SPTimeStampMode;
93  int SPUniqueIdMode;
94  int SPFrameRateEnable;
95 
96  /* Local methods to this class */
97  asynStatus grabImage();
98  asynStatus startCapture();
99  asynStatus stopCapture();
100  asynStatus connectCamera();
101  asynStatus disconnectCamera();
102  void imageEventCallback(ImagePtr pImage);
103  void reportNode(FILE *fp, INodeMap *pNodeMap, gcstring nodeName, int level);
104  void updateStreamStat(const char *nodeName, int param);
105 
106  /* Data */
107  int cameraId_;
108 
109  INodeMap *pNodeMap_;
110  INodeMap *pTLStreamNodeMap_;
111  SystemPtr system_;
112  CameraList camList_;
113  CameraPtr pCamera_;
114  int numSPBuffers_;
115  ImageEventHandler *pImageEventHandler_;
116 
117  int exiting_;
118  epicsEventId startEventId_;
119  epicsMessageQueue *pCallbackMsgQ_;
120  NDArray *pRaw_;
121  int uniqueId_;
122 };
123 
124 #endif
125 
GCFeatureType_t
Definition: GenICamFeature.h:13
Definition: ADGenICam.h:25
Main driver class inherited from areaDetectors ADDriver class.
Definition: ADSpinnaker.h:57
Definition: ADSpinnaker.h:31
ADSpinnakerImageEventHandler(epicsMessageQueue *pMsgQ)
Definition: ADSpinnaker.h:34
void OnImageEvent(ImagePtr image)
Definition: ADSpinnaker.h:39
~ADSpinnakerImageEventHandler()
Definition: ADSpinnaker.h:37
Definition: GenICamFeature.h:41
Definition: GenICamFeature.h:123
N-dimensional array class; each array has a set of dimensions, a data type, pointer to data,...
Definition: NDArray.h:99
@ string
Definition: NDFileHDF5Layout.h:44
nodeName
Definition: makeAdl.py:469