WPOCT Software Developer's Kit (SDK)
SDK For using Wasatch Photonics OCT Spectrometers
CameraLinkCamera.h
Go to the documentation of this file.
1 #pragma once
2 
8 #include <atomic>
9 #include <mutex>
10 
11 #include "WPCamera.h"
12 #include <SapClassBasic.h>
13 
14 // Forward class declarations.
15 
16 using namespace std;
17 
19 class CameraLinkCamera : public WPCamera
20 {
21 public:
24  {
25  LinePeriod = 0x12100,
26  ExposureTime = 0x12108,
27  TriggerMode = 0x1210C
28  };
29 
30  enum ServerCategory
31  {
32  ServerAll,
33  ServerAcq,
34  ServerAcqDevice
35  };
36 
37  enum ResourceType
38  {
39  ResourceAcq = 0,
40  ResourceDisplay,
41  ResourceCab,
42  ResourcePixPro,
43  ResourceRtPro = ResourcePixPro,
44  ResourceObsolete1,
45  ResourceGraphic,
46  ResourceGio,
47  ResourceCounter,
48  ResourceAcqDevice,
49  ResourceLast = ResourceAcqDevice
50  };
51 
54 
56  virtual ~CameraLinkCamera();
57 
58  // Events
59 
60  // Getters
61 
63  float GetLinePeriod () const override;
64 
66  float GetExposureTime () const override;
67 
69  int GetTriggerMode () const override;
70 
72  int GetCameraWidth () const override { return _scanWidth; }
73 
75  int GetNumCameras () const override;
76 
78  const char* GetCameraID (int index = 0) override;
79 
81  int GetNumBitsInPixel () const override;
82 
84  int GetNumBytesInPixel () const override;
85 
86  // Setters
87 
89  bool SetLinePeriod (float value) override;
90 
92  bool SetExposureTime (float value) override;
93 
95  bool SetTriggerMode (int value) override;
96 
98  bool SetCameraFileName (const char* name) override;
99 
100  // Methods
101  bool InitializeLibrary () override;
102  bool ShutDownLibrary () override;
103 
105  bool Open (const char* id) override;
106 
108  bool Open (int id = 0) override { return false; }
109  bool Close () override;
110 
111  bool ReadParameter (unsigned int address, unsigned int* value) const override;
112  bool WriteParameter (unsigned int address, unsigned int value) override;
113 
114  bool SetParameters () override;
115  bool SetParameters (int height, int numBuffers) override;
116 
117  bool StartAcquiring () override;
118  bool StopAcquiring (bool flushBuffers) override;
119 
120  bool GetBuffer (void** buffer) override;
121  bool GetBuffer2 (unsigned short** buffer) override;
122  bool GetBufferCopy (unsigned short* buffer) override;
123  bool GetBufferAndIndex (void** buffer, int** index, unsigned long* frameNumber) override;
124  bool GetBufferAndIndex2 (unsigned short** buffer, int** index, unsigned long* frameNumber) override;
125  bool AbortGetBuffer () override;
126  bool RequeueBuffer () override;
127  bool RequeueBuffer (int* bufferHandle) override;
128  bool FlushBuffers () override;
129 
131  bool ResetDevice () override;
132 
133 protected:
134  bool DeleteResources () override;
135 
136 private:
137  std::mutex _mutexGetBuffer;
138  std::mutex _mutexCopyBuffer;
139 
140  SapAcquisition* _acquisition;
141  SapLocation* _location;
142  SapBufferWithTrash* _buffers;
143  SapTransfer* _xfer;
144 
145  SapAcqDevice _acqDevice;
146  int _curBufferIndex;
147 
148  ServerCategory _serverCategory;
149  bool _saperaItemsInitialized;
150  bool _saperaResourcesCreated;
151  atomic<unsigned long> _frameNumber;
152 
153  static vector<atomic<bool>> _bufferDataReady;
154 
155  char _serverName [CORSERVER_MAX_STRLEN];
156  char _tempServerName [CORSERVER_MAX_STRLEN];
157 
159  void Init();
160  bool InitSapera (const char* serverName, int numBuffers);
161  bool CreateSaperaResources ();
162 
163  //void InitResourceCombo ();
164  bool GetCurBufferIndex (int* index);
165 
166  static void XferCallback0 (SapXferCallbackInfo *pInfo);
167  static void XferCallback1 (SapXferCallbackInfo *pInfo);
168 };
Interface and implementation of the WPCamera class.
Class that converts a scanned image from one format to another.
Definition: WPCamera.h:25