SeaBreeze
DeviceAdapter.h
Go to the documentation of this file.
1 /***************************************************/
32 #ifndef DEVICEADAPTER_H
33 #define DEVICEADAPTER_H
34 
35 /* Includes */
36 #include "common/devices/Device.h"
57 #include <vector>
58 
59 namespace seabreeze {
60  namespace api {
61 
62  class DeviceAdapter {
63  public:
64  DeviceAdapter(Device *dev, unsigned long id);
65  ~DeviceAdapter();
66 
67  int open(int *errorCode);
68  void close();
69 
70  DeviceLocatorInterface *getLocation();
71 
72  /* An for weak association to this object */
73  unsigned long getID();
74 
75  /* Get a string that describes the type of device */
76  int getDeviceType(int *errorCode, char *buffer, unsigned int maxLength);
77 
78  /* Get a usb endpoint for the device according to the enumerator */
79  /* endpointType. A 0 is returned if the endpoint requested is not in use. */
80  unsigned char getDeviceEndpoint(int *errorCode, usbEndpointType anEndpointType);
81 
82  /* Get one or more raw USB access features */
83  int getNumberOfRawUSBBusAccessFeatures();
84  int getRawUSBBusAccessFeatures(long *buffer, int maxFeatures);
85  int rawUSBBusAccessRead(long featureID,
86  int *errorCode, unsigned char *buffer, unsigned int bufferLength, unsigned char endpoint);
87  int rawUSBBusAccessWrite(long featureID,
88  int *errorCode, unsigned char *buffer, unsigned int bufferLength, unsigned char endpoint);
89 
90  /* Get one or more serial number features */
91  int getNumberOfSerialNumberFeatures();
92  int getSerialNumberFeatures(long *buffer, int maxFeatures);
93  int getSerialNumber(long featureID, int *errorCode,
94  char *buffer, int bufferLength);
95  unsigned char getSerialNumberMaximumLength(long featureID, int *errorCode);
96 
97  /* Get one or more spectrometer acquisition features */
98  int getNumberOfSpectrometerFeatures();
99  int getSpectrometerFeatures(long *buffer, int maxFeatures);
100  void spectrometerSetTriggerMode(long spectrometerFeatureID, int *errorCode, int mode);
101  void spectrometerSetIntegrationTimeMicros(long spectrometerFeatureID, int *errorCode,
102  unsigned long integrationTimeMicros);
103  unsigned long spectrometerGetMinimumIntegrationTimeMicros(
104  long spectrometerFeatureID, int *errorCode);
105  unsigned long spectrometerGetMaximumIntegrationTimeMicros(
106  long spectrometerFeatureID, int *errorCode);
107  double spectrometerGetMaximumIntensity(
108  long spectrometerFeatureID, int *errorCode);
109  int spectrometerGetUnformattedSpectrumLength(
110  long spectrometerFeatureID, int *errorCode);
111  int spectrometerGetUnformattedSpectrum(long spectrometerFeatureID,
112  int *errorCode, unsigned char *buffer, int bufferLength);
113  int spectrometerGetFormattedSpectrumLength(
114  long spectrometerFeatureID, int *errorCode);
115  int spectrometerGetFormattedSpectrum(long spectrometerFeatureID, int *errorCode,
116  double *buffer, int bufferLength);
117  int spectrometerGetWavelengths(long spectrometerFeatureID, int *errorCode,
118  double *wavelengths, int length);
119  int spectrometerGetElectricDarkPixelCount(
120  long spectrometerFeatureID, int *errorCode);
121  int spectrometerGetElectricDarkPixelIndices(
122  long spectrometerFeatureID, int *errorCode, int *indices, int length);
123 
124 
125  /* Get one or more pixel binning features */
126  int getNumberOfPixelBinningFeatures();
127  int getPixelBinningFeatures(long *buffer, int maxFeatures);
128  void binningSetPixelBinningFactor(long spectrometerFeatureID, int *errorCode, const unsigned char binningFactor);
129  unsigned char binningGetPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
130  void binningSetDefaultPixelBinningFactor(long spectrometerFeatureID, int *errorCode, const unsigned char binningFactor);
131  void binningSetDefaultPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
132  unsigned char binningGetDefaultPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
133  unsigned char binningGetMaxPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
134 
135  /* Get one or more TEC features */
136  int getNumberOfThermoElectricFeatures();
137  int getThermoElectricFeatures(long *buffer, int maxFeatures);
138  double tecReadTemperatureDegreesC(long featureID, int *errorCode);
139  void tecSetTemperatureSetpointDegreesC(long featureID, int *errorCode,
140  double temperatureDegreesCelsius);
141  void tecSetEnable(long featureID, int *errorCode, bool tecEnable);
142 
143  /* Get one or more irradiance calibration features */
144  int getNumberOfIrradCalFeatures();
145  int getIrradCalFeatures(long *buffer, int maxFeatures);
146  int irradCalibrationRead(long featureID,
147  int *errorCode, float *buffer, int bufferLength);
148  int irradCalibrationWrite(long featureID,
149  int *errorCode, float *buffer, int bufferLength);
150  int irradCalibrationHasCollectionArea(long featureID, int *errorCode);
151  float irradCalibrationReadCollectionArea(long featureID, int *errorCode);
152  void irradCalibrationWriteCollectionArea(long featureID,
153  int *errorCode, float area);
154 
155  /* Get one or more EEPROM features */
156  int getNumberOfEEPROMFeatures();
157  int getEEPROMFeatures(long *buffer, int maxFeatures);
158  int eepromReadSlot(long featureID, int *errorCode, int slotNumber,
159  unsigned char *buffer, int length);
160 
161  /* Get one or more light source features */
162  int getNumberOfLightSourceFeatures();
163  int getLightSourceFeatures(long *buffer, int maxFeatures);
164  int lightSourceGetCount(long featureID, int *errorCode);
165  bool lightSourceHasEnable(long featureID, int *errorCode,
166  int lightSourceIndex);
167  bool lightSourceIsEnabled(long featureID, int *errorCode,
168  int lightSourceIndex);
169  void lightSourceSetEnable(long featureID, int *errorCode,
170  int lightSourceIndex, bool enable);
171  bool lightSourceHasVariableIntensity(long featureID, int *errorCode,
172  int lightSourceIndex);
173  double lightSourceGetIntensity(long featureID, int *errorCode,
174  int lightSourceIndex);
175  void lightSourceSetIntensity(long featureID, int *errorCode,
176  int lightSourceIndex, double intensity);
177 
178  /* Get one or more strobe lamp enable features */
179  int getNumberOfStrobeLampFeatures();
180  int getStrobeLampFeatures(long *buffer, int maxFeatures);
181  void lampSetStrobeEnable(long featureID, int *errorCode, bool strobeEnable);
182 
183  /* Get one or more continuous strobe features */
184  int getNumberOfContinuousStrobeFeatures();
185  int getContinuousStrobeFeatures(long *buffer, int maxFeatures);
186  void continuousStrobeSetPeriodMicroseconds(long featureID, int *errorCode,
187  unsigned long period_usec);
188  void continuousStrobeSetEnable(long featureID, int *errorCode, bool enable);
189 
190  /* Get one or more shutter features */
191  int getNumberOfShutterFeatures();
192  int getShutterFeatures(long *buffer, int maxFeatures);
193  void shutterSetShutterOpen(long featureID, int *errorCode, bool opened);
194 
195  /* Get one or more nonlinearity coefficients features */
196  int getNumberOfNonlinearityCoeffsFeatures();
197  int getNonlinearityCoeffsFeatures(long *buffer, int maxFeatures);
198  int nonlinearityCoeffsGet(long featureID, int *errorCode,
199  double *buffer, int bufferLength);
200 
201  /* Get one or more temperature features */
202  int getNumberOfTemperatureFeatures();
203  int getTemperatureFeatures(long *buffer, int maxFeatures);
204  unsigned char temperatureCountGet(long temperatureFeatureID, int *errorCode);
205  double temperatureGet(long temperatureFeatureID, int *errorCode, int index);
206  int temperatureGetAll(long temperatureFeatureID, int *errorCode,
207  double *buffer, int bufferLength);
208 
209  /* Get one or more revision features */
210  int getNumberOfRevisionFeatures();
211  int getRevisionFeatures(long *buffer, int maxFeatures);
212  unsigned char revisionHardwareGet(long revisionFeatureID, int *errorCode);
213  unsigned short int revisionFirmwareGet(long revisionFeatureID, int *errorCode);
214 
215  /* Get one or more spectrum processing features */
216  int getNumberOfSpectrumProcessingFeatures();
217  int getSpectrumProcessingFeatures(long *buffer, int maxFeatures);
218  unsigned short int spectrumProcessingScansToAverageGet(long spectrumProcessingFeatureID, int *errorCode);
219  unsigned char spectrumProcessingBoxcarWidthGet(long spectrumProcessingFeatureID, int *errorCode);
220  void spectrumProcessingBoxcarWidthSet(long featureID, int *errorCode, unsigned char boxcarWidth);
221  void spectrumProcessingScansToAverageSet(long featureID, int *errorCode, unsigned short int scansToAverage);
222 
223  /* Get one or more optical bench features */
224  int getNumberOfOpticalBenchFeatures();
225  int getOpticalBenchFeatures(long *buffer, int maxFeatures);
226  unsigned short int opticalBenchGetFiberDiameterMicrons(long opticalBenchFeatureID, int *errorCode);
227  unsigned short int opticalBenchGetSlitWidthMicrons(long opticalBenchFeatureID, int *errorCode);
228  int opticalBenchGetID(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
229  int opticalBenchGetSerialNumber(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
230  int opticalBenchGetCoating(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
231  int opticalBenchGetFilter(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
232  int opticalBenchGetGrating(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
233 
234 
235  /* Get one or more stray light coefficients features */
236  int getNumberOfStrayLightCoeffsFeatures();
237  int getStrayLightCoeffsFeatures(long *buffer, int maxFeatures);
238  int strayLightCoeffsGet(long featureID, int *errorCode,
239  double *buffer, int bufferLength);
240 
241  /* Get one or more data buffer features */
242  int getNumberOfDataBufferFeatures();
243  int getDataBufferFeatures(long *buffer, int maxFeatures);
244  void dataBufferClear(long featureID, int *errorCode);
245  unsigned long dataBufferGetNumberOfElements(long featureID, int *errorCode);
246  unsigned long dataBufferGetBufferCapacity(long featureID, int *errorCode);
247  unsigned long dataBufferGetBufferCapacityMaximum(long featureID, int *errorCode);
248  unsigned long dataBufferGetBufferCapacityMinimum(long featureID, int *errorCode);
249  void dataBufferSetBufferCapacity(long featureID, int *errorCode, unsigned long capacity);
250 
251  /* Get one or more acquisition delay features */
252  int getNumberOfAcquisitionDelayFeatures();
253  int getAcquisitionDelayFeatures(long *buffer, int maxFeatures);
254  void acquisitionDelaySetDelayMicroseconds(long featureID, int *errorCode,
255  unsigned long delay_usec);
256  unsigned long acquisitionDelayGetDelayMicroseconds(long featureID, int *errorCode);
257  unsigned long acquisitionDelayGetDelayIncrementMicroseconds(long featureID, int *errorCode);
258  unsigned long acquisitionDelayGetDelayMaximumMicroseconds(long featureID, int *errorCode);
259  unsigned long acquisitionDelayGetDelayMinimumMicroseconds(long featureID, int *errorCode);
260 
261  protected:
262  unsigned long instanceID;
263  seabreeze::Device *device;
264  std::vector<RawUSBBusAccessFeatureAdapter *> rawUSBBusAccessFeatures;
265  std::vector<SerialNumberFeatureAdapter *> serialNumberFeatures;
266  std::vector<SpectrometerFeatureAdapter *> spectrometerFeatures;
267  std::vector<ThermoElectricCoolerFeatureAdapter *> tecFeatures;
268  std::vector<IrradCalFeatureAdapter *> irradCalFeatures;
269  std::vector<EEPROMFeatureAdapter *> eepromFeatures;
270  std::vector<LightSourceFeatureAdapter *> lightSourceFeatures;
271  std::vector<StrobeLampFeatureAdapter *> strobeLampFeatures;
272  std::vector<ContinuousStrobeFeatureAdapter *> continuousStrobeFeatures;
273  std::vector<ShutterFeatureAdapter *> shutterFeatures;
274  std::vector<NonlinearityCoeffsFeatureAdapter *> nonlinearityFeatures;
275  std::vector<TemperatureFeatureAdapter *> temperatureFeatures;
276  std::vector<RevisionFeatureAdapter *> revisionFeatures;
277  std::vector<OpticalBenchFeatureAdapter *> opticalBenchFeatures;
278  std::vector<SpectrumProcessingFeatureAdapter *> spectrumProcessingFeatures;
279  std::vector<StrayLightCoeffsFeatureAdapter *> strayLightFeatures;
280  std::vector<PixelBinningFeatureAdapter *> pixelBinningFeatures;
281  std::vector<DataBufferFeatureAdapter *> dataBufferFeatures;
282  std::vector<AcquisitionDelayFeatureAdapter *> acquisitionDelayFeatures;
283 
284  RawUSBBusAccessFeatureAdapter *getRawUSBBusAccessFeatureByID(long featureID);
285  SerialNumberFeatureAdapter *getSerialNumberFeatureByID(long featureID);
286  SpectrometerFeatureAdapter *getSpectrometerFeatureByID(long featureID);
287  ThermoElectricCoolerFeatureAdapter *getTECFeatureByID(long featureID);
288  IrradCalFeatureAdapter *getIrradCalFeatureByID(long featureID);
289  EEPROMFeatureAdapter *getEEPROMFeatureByID(long featureID);
290  LightSourceFeatureAdapter *getLightSourceFeatureByID(long featureID);
291  StrobeLampFeatureAdapter *getStrobeLampFeatureByID(long featureID);
292  ContinuousStrobeFeatureAdapter *getContinuousStrobeFeatureByID(long featureID);
293  ShutterFeatureAdapter *getShutterFeatureByID(long featureID);
294  NonlinearityCoeffsFeatureAdapter *getNonlinearityCoeffsFeatureByID(long featureID);
295  TemperatureFeatureAdapter *getTemperatureFeatureByID(long featureID);
296  RevisionFeatureAdapter *getRevisionFeatureByID(long featureID);
297  OpticalBenchFeatureAdapter *getOpticalBenchFeatureByID(long featureID);
298  SpectrumProcessingFeatureAdapter *getSpectrumProcessingFeatureByID(long featureID);
299  StrayLightCoeffsFeatureAdapter *getStrayLightCoeffsFeatureByID(long featureID);
300  PixelBinningFeatureAdapter *getPixelBinningFeatureByID(long featureID);
301  DataBufferFeatureAdapter *getDataBufferFeatureByID(long featureID);
302  AcquisitionDelayFeatureAdapter *getAcquisitionDelayFeatureByID(long featureID);
303  };
304  }
305 }
306 
307 #endif
308 
Definition: AcquisitionDelayFeatureAdapter.h:42
Definition: RevisionFeatureAdapter.h:42
Definition: RawUSBBusAccessFeatureAdapter.h:42
Definition: NonlinearityCoeffsFeatureAdapter.h:42
Definition: IrradCalFeatureAdapter.h:42
Definition: DeviceLocatorInterface.h:47
Definition: ThermoElectricCoolerFeatureAdapter.h:42
Definition: StrayLightCoeffsFeatureAdapter.h:42
Definition: DeviceAdapter.h:62
Definition: SerialNumberFeatureAdapter.h:42
Definition: SpectrumProcessingFeatureAdapter.h:42
Definition: OpticalBenchFeatureAdapter.h:42
Definition: PixelBinningFeatureAdapter.h:42
Definition: ShutterFeatureAdapter.h:42
Definition: ContinuousStrobeFeatureAdapter.h:42
Definition: EEPROMFeatureAdapter.h:42
Definition: StrobeLampFeatureAdapter.h:42
Definition: TemperatureFeatureAdapter.h:42
Definition: Device.h:64
Encapsulates all SeaBreeze classes.
Definition: DeviceFactory.h:42
Definition: LightSourceFeatureAdapter.h:42
Definition: SpectrometerFeatureAdapter.h:44
Definition: DataBufferFeatureAdapter.h:42