OceanDirect  1.30.1-rc.4
OceanDirect C++/C API
DeviceAdapter.h
1 /*****************************************************
2  * @file DeviceAdapter.h
3  * @date March 2022
4  * @author Ocean Insight, Inc.
5  *
6  * This is a wrapper that allows
7  * access to OceanDirect Device instances.
8  */
9  /************************************************************************
10  *
11  * OCEAN INSIGHT CONFIDENTIAL
12  * __________________
13  *
14  * [2018] - [2022] Ocean Insight Incorporated
15  * All Rights Reserved.
16  *
17  * NOTICE: All information contained herein is, and remains
18  * the property of Ocean Insight Incorporated and its suppliers,
19  * if any. The intellectual and technical concepts contained
20  * herein are proprietary to Ocean Insight Incorporated
21  * and its suppliers and may be covered by U.S. and Foreign Patents,
22  * patents in process, and are protected by trade secret or copyright law.
23  * Dissemination of this information or reproduction of this material
24  * is strictly forbidden unless prior written permission is obtained
25  * from Ocean Insight Incorporated.
26  *
27  **************************************************************************/
28 
29 #ifndef DEVICE_ADAPTER_H
30 #define DEVICE_ADAPTER_H
31 
32 #include <cstring>
33 #include <vector>
34 #include "api/OceanProcess.h"
35 #include "common/public/SpectrumWithMetadata.h"
36 #include "common/devices/Device.h"
37 
38 using namespace oceandirect;
39 
40 namespace oceandirect {
41 
42  class DeviceLocatorInterface;
43 
44  namespace api {
45 
46  class RawBusAccessFeatureAdapter;
47  class SerialNumberFeatureAdapter;
48  class SpectrometerFeatureAdapter;
49  class ThermoElectricCoolerFeatureAdapter;
50  class IrradCalFeatureAdapter;
51  class EEPROMFeatureAdapter;
52  class LightSourceFeatureAdapter;
53  class StrobeLampFeatureAdapter;
54  class ContinuousStrobeFeatureAdapter;
55  class SingleStrobeFeatureAdapter;
56  class GpioFeatureAdapter;
57  class NonlinearityCoeffsFeatureAdapter;
58  class TemperatureFeatureAdapter;
59  class RevisionFeatureAdapter;
60  class OpticalBenchFeatureAdapter;
61  class StrayLightCoeffsFeatureAdapter;
62  class PixelBinningFeatureAdapter;
63  class DataBufferFeatureAdapter;
64  class BackToBackFeatureAdapter;
65  class AcquisitionDelayFeatureAdapter;
66  class QueryStatusFeatureAdapter;
67  class LedActivityFeatureAdapter;
68  class TimeFeatureAdapter;
69  class AnalogInFeatureAdapter;
70  class AnalogOutFeatureAdapter;
71  class DHCPServerConfigurationFeatureAdapter;
72  class PixelFeatureAdapter;
73  class AutoNullingFeatureAdapter;
74  class UserStringFeatureAdapter;
75  class DeviceInformationFeatureAdapter;
76  class DeviceAliasFeatureAdapter;
77  class SerialPortFeatureAdapter;
78  class Ipv4AddressFeatureAdapter;
79  class SpectrumAcquisitionControlFeatureAdapter;
80 
81  class DeviceAdapter {
82  public:
83  DeviceAdapter(Device *dev, unsigned long id);
84  ~DeviceAdapter();
85 
86  int open(int *errorCode);
87  void close();
88 
89  DeviceLocatorInterface *getLocation();
91  //get number pixels
92  public:
93  std::string spectrometerSerialNumber;
94  std::string spectrometerType;
95  bool initialized = false;
96  bool useNLC = true;
97  bool useEDC = true;
98  int numPixels = 0;
99  int numActivePixels;
100  int firstActivePixel = 0;
101  int lastActivePixel = 0;
102  double maximumIntensity = 65535.0;
103  unsigned long currentIntegrationTime = 0;
104  unsigned long minIntegrationTime = 1000;
105  unsigned long maxIntegrationTime = 60000;
106  std::vector<int> elecDarkLoc;
107  //get electric dark pixel indices
108  std::vector<int> electricDarkPixelIndices;
109  //get number active pixels
110  std::vector<double> nonlinCoeffs;
111  //get wavelength coefficients
112  std::vector<double> wavelengths;
113  std::vector<double> irradCalFile;
114  double irradCalCollectionArea = 1.0;
115  //smoothTypeEnum smoothType = smoothTypeEnum::None;
116  int smoothFactor = 0;
117  bool stabilityScanNeeded = false;
118 
119  } deviceConfig;
120  /* An for weak association to this object */
121  unsigned long getID();
122 
123  Device *getDevice();
124 
125  /* Get a string that describes the type of device */
126  int getDeviceType(int *errorCode, char *buffer, unsigned int maxLength);
127 
128  /* Get a usb endpoint for the device according to the enumerator */
129  /* endpointType. A 0 is returned if the endpoint requested is not in use. */
130  unsigned char getDeviceEndpoint(int *errorCode, usbEndpointType anEndpointType);
131 
132  /* check an array for saturation and set a warning code if saturated*/
133  int checkArrayForSaturation(std::vector<double> arrayToCheck, int *errorCode);
134 
135  /* Get initial immutable properties of the spectrometer to save for future requests*/
136  int getDeviceConfiguration(int *errorCode);
137  int GetDeviceConfigNumPixels();
138  const std::vector<int>& GetDeviceConfigElecDarkPixels();
139  int ApplyDeviceConfigElecDarkPixels(int *errorCode, double *sample, int sampleSize);
140  const std::vector<double>& GetDeviceConfigNonlinearityCoeffs();
141  int ApplyDeviceConfigNonlinearityCoeffs(int *errorCode, double *sample, int sampleSize);
142  void ApplyDeviceConfigBoxcarWidth(int* errorCode, double* sample, int sampleSize);
143  std::vector<double> GetDeviceConfigWavelengths();
144  std::vector<double> GetDeviceConfigIrradCalFile();
145  double GetDeviceConfigIrradCollectionArea();
146 
147  //smoothTypeEnum GetDeviceConfigSmoothType();
148  int GetDeviceConfigSmoothFactor();
149  unsigned long GetDeviceConfigMinIntegrationTime();
150  unsigned long GetDeviceConfigMaxIntegrationTime();
151 
152  /* Get one or more raw bus access features */
153  int getNumberOfRawBusAccessFeatures();
154  int getRawBusAccessFeatures(long *buffer, int maxFeatures);
155  std::string getStringDescriptor(long featureID, int *errorCode, int index);
156  int rawBusAccessRead(long featureID, int *errorCode, unsigned char *buffer, unsigned int bufferLength, unsigned char endpoint);
157  int rawBusAccessWrite(long featureID, int *errorCode, unsigned char *buffer, unsigned int bufferLength, unsigned char endpoint);
158  int rawBusAccessRead(long featureID, int *errorCode, unsigned char *buffer, unsigned int bufferLength);
159  int rawBusAccessWrite(long featureID, int *errorCode, unsigned char *buffer, unsigned int bufferLength);
160 
161  /* Get one or more serial number features */
162  int getNumberOfSerialNumberFeatures();
163  int getSerialNumberFeatures(long *buffer, int maxFeatures);
164  int getSerialNumber(long featureID, int *errorCode, char *buffer, int bufferLength);
165  void setSerialNumber(long featureID, int *errorCode, char *buffer, int bufferLength);
166  unsigned char getSerialNumberMaximumLength(long featureID, int *errorCode);
167 
168  /* Get and set time features */
169  long long int getTime(long featureID, int *errorCode);
170  void setTime(long featureID, int *errorCode, long long int timeInMicroseconds);
171 
172  /* Get one or more spectrometer acquisition features */
173  int getNumberOfSpectrometerFeatures();
174  int getSpectrometerFeatures(long *buffer, int maxFeatures);
175  void spectrometerSetTriggerMode(long featureID, int *errorCode, int mode);
176  int spectrometerGetTriggerMode(long featureID, int *errorCode);
177  void spectrometerSetDelayMicroseconds(long featureID, int* errorCode, unsigned long delayMicroseconds);
178  unsigned long spectrometerGetDelayMicroseconds(long featureID, int* errorCode);
179  unsigned long spectrometerGetDelayIncrementMicroseconds(long featureID, int* errorCode);
180  unsigned long spectrometerGetDelayMaximumMicroseconds(long featureID, int* errorCode);
181  unsigned long spectrometerGetDelayMinimumMicroseconds(long featureID, int* errorCode);
182 
183  void spectrometerSetIntegrationTimeMicros(long spectrometerFeatureID, int *errorCode, unsigned long integrationTimeMicros);
184  unsigned long spectrometerGetIntegrationTimeMicros(long spectrometerFeatureID, int *errorCode);
185 
186  unsigned long spectrometerGetMinimumIntegrationTimeMicros(long spectrometerFeatureID, int *errorCode);
187  unsigned long spectrometerGetMinimumAveragingIntegrationTimeMicros(long spectrometerFeatureID, int* errorCode);
188  unsigned long spectrometerGetMaximumIntegrationTimeMicros(long spectrometerFeatureID, int *errorCode);
189  double spectrometerGetMaximumIntensity(long spectrometerFeatureID, int *errorCode);
190  int spectrometerGetUnformattedSpectrumLength(long spectrometerFeatureID, int *errorCode);
191  int spectrometerGetUnformattedSpectrum(long spectrometerFeatureID,int *errorCode, unsigned char *buffer, int bufferLength);
192  int spectrometerGetFormattedSpectrumLength(long spectrometerFeatureID, int *errorCode);
193  int spectrometerGetFormattedSpectrum(long spectrometerFeatureID, int *errorCode, double *buffer, int bufferLength);
194  int spectrometerGetFormattedSpectrumWithMetadata(long spectrometerFeatureID, int *errorCode, SpectrumWithMetadata *buffer, int bufferLength, bool apply_ec = true);
195 
196  void spectrometerSetStoredDarkSpectrum(long spectrometerFeatureID, int* errorCode, double* darkSpectrum, int darkSpectrumLength);
197  int spectrometerGetStoredDarkSpectrum(long spectrometerFeatureID, int* errorCode, double* darkSpectrum, int darkSpectrumLength);
198  int spectrometerGetDarkCorrectedSpectrum(long spectrometerFeatureID, int* errorCode, double* darkSpectrum, int darkSpectrumLength,
199  double* darkCorrectedSpectrum, int darkCorrectedSpectrumLength);
200  int spectrometerDarkCorrectSpectrum(long spectrometerFeatureID, int* errorCode, double* illuminatedSpectrum, int illuminatedSpectrumLength,
201  double* darkCorrectedSpectrum, int darkCorrectedSpectrumLength);
202  int spectrometerGetDarkCorrectedSpectrum(long spectrometerFeatureID, int* errorCode, double* darkCorrectedSpectrum, int darkCorrectedSpectrumLength);
203  int spectrometerDarkCorrectSpectrum(long spectrometerFeatureID, int* errorCode, double* darkSpectrum, int darkSpectrumLength, double* illuminatedSpectrum,
204  int illuminatedSpectrumLength, double* darkCorrectedSpectrum, int darkCorrectedSpectrumLength);
205 
206  int spectrometerGetNonlinearityCorrectedSpectrum(long spectrometerFeatureID, int* errorCode, double* darkSpectrum, int darkSpectrumLength,
207  double* nonlinearityCorrectedSpectrum, int nonlinearityCorrectedSpectrumLength);
208  int spectrometerNonlinearityCorrectSpectrum(long spectrometerFeatureID, int* errorCode, double* illuminatedSpectrum,
209  int illuminatedSpectrumLength, double* nonlinearityCorrectedSpectrum, int nonlinearityCorrectedSpectrumLength);
210  int spectrometerGetNonlinearityCorrectedSpectrum(long spectrometerFeatureID, int* errorCode, double* nonlinearityCorrectedSpectrum,
211  int nonlinearityCorrectedSpectrumLength);
212  int spectrometerNonlinearityCorrectSpectrum(long spectrometerFeatureID, int* errorCode, double* darkSpectrum, int darkSpectrumLength, double* illuminatedSpectrum,
213  int illuminatedSpectrumLength, double* nonlinearityCorrectedSpectrum, int nonlinearityCorrectedSpectrumLength);
214 
215  int spectrometerGetWavelengths(long spectrometerFeatureID, int *errorCode, double *wavelengths, int length);
216  int spectrometerGetWavelengthCoefficients(long spectrometerFeatureID, int *errorCode, double *coeff, int length);
217  void spectrometerSetWavelengthCoefficients(long spectrometerFeatureID, int *errorCode, double *coeff, int length);
218  int spectrometerGetElectricDarkPixelCount(long spectrometerFeatureID, int *errorCode);
219  int spectrometerGetElectricDarkPixelIndices(long spectrometerFeatureID, int *errorCode, int *indices, int length);
220  unsigned short int spectrometerGetScansToAverage(long spectrometerFeatureID, int* errorCode);
221  unsigned short int spectrometerGetBoxcarWidth(long spectrometerFeatureID, int* errorCode);
222  void spectrometerSetBoxcarWidth(long spectrometerFeatureID, int* errorCode, unsigned short int newBoxcarWidth);
223  void spectrometerSetScansToAverage(long spectrometerFeatureID, int* errorCode, unsigned short int newScansToAverage);
224 
225  /* Query status features */
226  int getNumberOfStatusFeatures();
227  int getStatusFeatures(long *buffer, int maxFeatures);
228  int statusReadStatus(long statusFeatureId, int *errorCode, unsigned char *buffer, int bufferLength);
229  unsigned long statusGetIntegrationTime(long statusFeatureID, int *errorCode);
230 
231  /* Get one or more pixel binning features */
232  int getNumberOfPixelBinningFeatures();
233  int getPixelBinningFeatures(long *buffer, int maxFeatures);
234  void binningSetPixelBinningFactor(long spectrometerFeatureID, int *errorCode, const unsigned char binningFactor);
235  unsigned char binningGetPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
236  void binningSetDefaultPixelBinningFactor(long spectrometerFeatureID, int *errorCode, const unsigned char binningFactor);
237  void binningSetDefaultPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
238  unsigned char binningGetDefaultPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
239  unsigned char binningGetMaxPixelBinningFactor(long spectrometerFeatureID, int *errorCode);
240 
241  /* Get one or more TEC features */
242  int getNumberOfThermoElectricFeatures();
243  int getThermoElectricFeatures(long *buffer, int maxFeatures);
244  double tecReadTemperatureDegreesC(long featureID, int *errorCode);
245  void tecSetTemperatureSetpointDegreesC(long featureID, int *errorCode, double temperatureDegreesCelsius);
246  void tecSetEnable(long featureID, int *errorCode, bool tecEnable);
247  bool tecGetEnable(long featureID, int *errorCode);
248  float tecGetSetpoint(long featureID, int *errorCode);
249  bool tecGetStable(long featureID, int *errorCode);
250  bool tecGetFanEnable(long featureID, int *errorCode);
251  void tecSetFanEnable(long featureID, int *errorCode, bool enable);
252 
253  /* Get one or more irradiance calibration features */
254  int getNumberOfIrradCalFeatures();
255  int getIrradCalFeatures(long *buffer, int maxFeatures);
256  int irradCalibrationRead(long featureID, int *errorCode, float *buffer, int bufferLength);
257  int irradCalibrationSizeRead(long featureID, int *errorCode);
258  int irradCalibrationWrite(long featureID, int *errorCode, float *buffer, int bufferLength);
259  bool irradCalibrationHasCollectionArea(long featureID, int *errorCode);
260  float irradCalibrationReadCollectionArea(long featureID, int *errorCode);
261  void irradCalibrationWriteCollectionArea(long featureID, int *errorCode, float area);
262 
263  /* Get one or more EEPROM features */
264  int getNumberOfEEPROMFeatures();
265  int getEEPROMFeatures(long *buffer, int maxFeatures);
266  int eepromReadSlot(long featureID, int *errorCode, int slotNumber,
267  unsigned char *buffer, int length);
268 
269  /* Get one or more light source features */
270  int getNumberOfLightSourceFeatures();
271  int getLightSourceFeatures(long *buffer, int maxFeatures);
272  int lightSourceGetCount(long featureID, int *errorCode);
273  bool lightSourceHasEnable(long featureID, int *errorCode, int lightSourceIndex);
274  bool lightSourceIsEnabled(long featureID, int *errorCode, int lightSourceIndex);
275  void lightSourceSetEnable(long featureID, int *errorCode, int lightSourceIndex, bool enable);
276  bool lightSourceHasVariableIntensity(long featureID, int *errorCode, int lightSourceIndex);
277  double lightSourceGetIntensity(long featureID, int *errorCode, int lightSourceIndex);
278  void lightSourceSetIntensity(long featureID, int *errorCode, int lightSourceIndex, double intensity);
279 
280  /* Get one or more strobe lamp enable features */
281  int getNumberOfStrobeLampFeatures();
282  int getStrobeLampFeatures(long *buffer, int maxFeatures);
283  void lampSetStrobeEnable(long featureID, int *errorCode, bool strobeEnable);
284  bool lampGetStrobeEnable(long featureID, int *errorCode);
285 
286  /* Get one or more continuous strobe features */
287  int getNumberOfContinuousStrobeFeatures();
288  int getContinuousStrobeFeatures(long *buffer, int maxFeatures);
289  unsigned long continuousStrobeGetPeriodMicroseconds(long featureID, int *errorCode);
290  bool continuousStrobeGetEnable(long featureID, int *errorCode);
291  unsigned long continuousStrobeGetPeriodMinimumMicroseconds(long featureID, int *errorCode);
292  unsigned long continuousStrobeGetPeriodMaximumMicroseconds(long featureID, int *errorCode);
293  unsigned long continuousStrobeGetPeriodIncrementMicroseconds(long featureID, int *errorCode);
294  unsigned long continuousStrobeGetWidthMicroseconds(long featureID, int *errorCode);
295  void continuousStrobeSetPeriodMicroseconds(long featureID, int *errorCode, unsigned long period_usec);
296  void continuousStrobeSetEnable(long featureID, int *errorCode, bool enable);
297  void continuousStrobeSetWidthMicroseconds(long featureID, int *errorCode, unsigned long strobeWidthMicroseconds);
298 
299  /* Get one or more gpio features */
300  int getNumberOfGpioFeatures();
301  int getGpioFeatures(long *buffer, int maxFeatures);
302  int getGpioCount(long featureID, int *errorCode);
303  void gpioSetOutputEnable(long featureID, int *errorCode, std::uint32_t bitPosition, bool isOutput);
304  void gpioSetOutputEnable(long featureID, int *errorCode, std::uint32_t bits, std::uint32_t bitmask);
305  bool gpioGetOutputEnable(long featureID, int *errorCode, int bit);
306  uint32_t gpioGetOutputEnable(long featureID, int *errorCode);
307  void gpioSetValue(long featureID, int *errorCode, std::uint32_t bitPosition, bool value);
308  void gpioSetValue(long featureID, int *errorCode, uint32_t bitmask);
309  void gpioSetValue(long featureID, int *errorCode, uint32_t bits, uint32_t bitmask);
310  bool gpioGetValue(long featureID, int *errorCode, int bit);
311  uint32_t gpioGetValue(long featureID, int *errorCode);
312  void gpioSetOutputAlternate(long featureID, int *errorCode, int bit, bool isAlternate);
313  void gpioSetOutputAlternate(long featureID, int *errorCode, uint32_t bitMask);
314  bool gpioGetOutputAlternate(long featureID, int *errorCode, int bit);
315  uint32_t gpioGetOutputAlternate(long featureID, int *errorCode);
316 
317  /* Get one or more nonlinearity coefficients features */
318  int getNumberOfNonlinearityCoeffsFeatures();
319  int getNonlinearityCoeffsFeatures(long *buffer, int maxFeatures);
320 
321  int getNonlinearityCoeffsCount(long featureID, int *errorCode);
322  double getNonlinearityCoeffs(long featureID, int *errorCode, int index);
323  void setNonlinearityCoeffs(long featureID, int *errorCode, int index, double coefficient);
324  int nonlinearityCoeffsGet(long featureID, int *errorCode, double *buffer, int bufferLength);
325  int nonlinearityCoeffsSet(long featureID, int *errorCode, double *buffer, int bufferLength);
326 
327  /* Get one or more temperature features */
328  int getNumberOfTemperatureFeatures();
329  int getTemperatureFeatures(long *buffer, int maxFeatures);
330  int temperatureCountGet(long temperatureFeatureID, int *errorCode);
331  double temperatureGet(long temperatureFeatureID, int *errorCode, int index);
332  double getTemperatureExtreme(long temperatureFeatureID, int *errorCode);
333  int getAllTemperatures(long temperatureFeatureID, int *errorCode, double *buffer, int max_length);
334 
335  /* Get one or more revision features */
336  int getNumberOfRevisionFeatures();
337  int getRevisionFeatures(long *buffer, int maxFeatures);
338  int revisionHardwareGet(long featureID, int *errorCode, char *buffer, int bufferLength);
339  int revisionFirmwareGet(long featureID, int *errorCode, char *buffer, int bufferLength);
340  int revisionFPGAGet(long featureID, int *errorCode, char *buffer, int bufferLength);
341 
342  /* Get one or more optical bench features */
343  int getNumberOfOpticalBenchFeatures();
344  int getOpticalBenchFeatures(long *buffer, int maxFeatures);
345  int opticalBenchGetArrayWavelength(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
346  unsigned short int opticalBenchGetSlitWidthMicrons(long opticalBenchFeatureID, int *errorCode);
347  void opticalBenchSetSlitWidthMicrons(long opticalBenchFeatureID, int *errorCode, unsigned short int widthMicrons);
348  int opticalBenchGetSerialNumber(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
349  void opticalBenchSetSerialNumber(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
350  int opticalBenchGetId(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
351  void opticalBenchSetId(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
352  unsigned short int opticalBenchGetFiberDiameter(long opticalBenchFeatureID, int *errorCode);
353  void opticalBenchSetFiberDiameter(long opticalBenchFeatureID, int *errorCode, unsigned short int diameterMicrons);
354  int opticalBenchGetCoating(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
355  void opticalBenchSetCoating(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
356  int opticalBenchGetFilter(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
357  void opticalBenchSetFilter(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
358  int opticalBenchGetGrating(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
359  void opticalBenchSetGrating(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
360  int opticalBenchLensInstalled(long opticalBenchFeatureID, int *errorCode, char *buffer, int bufferLength);
361 
362  /* Get one or more stray light coefficients features */
363  int getNumberOfStrayLightCoeffsFeatures();
364  int getStrayLightCoeffsFeatures(long *buffer, int maxFeatures);
365  int strayLightCoeffsGet(long featureID, int *errorCode, double *buffer, int bufferLength);
366 
367  /* Get one or more data buffer features */
368  int getNumberOfDataBufferFeatures();
369  int getDataBufferFeatures(long *buffer, int maxFeatures);
370  void dataBufferClear(long featureID, int *errorCode);
371  unsigned long dataBufferGetNumberOfElements(long featureID, int *errorCode);
372  unsigned long dataBufferGetBufferCapacity(long featureID, int *errorCode);
373  unsigned long dataBufferGetBufferCapacityMaximum(long featureID, int *errorCode);
374  unsigned long dataBufferGetBufferCapacityMinimum(long featureID, int *errorCode);
375  void dataBufferSetBufferCapacity(long featureID, int *errorCode, unsigned long capacity);
376  void dataBufferSetBufferEnabled(long featureID, int *errorCode, bool enabled);
377  bool dataBufferGetBufferEnabled(long featureID, int *errorCode);
378 
379  /* Spectra control acquisition feature */
380  void abortAcquisition(long featureID, int *errorCode);
381  void acquireSpectraToBuffer(long featureID, int *errorCode);
382  bool getDeviceIdleState(long featureID, int *errorCode);
383 
384  /* Get one or more back-to-back-scans features */
385  int getNumberOfBackToBackFeatures();
386  int getBackToBackFeatures(long *buffer, int maxFeatures);
387  unsigned long backToBackGetNumScans(long featureID, int *errorCode);
388  void backToBackSetNumScans(long featureID, int *errorCode, unsigned long numScans);
389 
390  /* Get one or more acquisition delay features */
391  int getNumberOfAcquisitionDelayFeatures();
392  int getAcquisitionDelayFeatures(long *buffer, int maxFeatures);
393  void acquisitionDelaySetDelayMicroseconds(long featureID, int *errorCode, unsigned long delay_usec);
394  unsigned long acquisitionDelayGetDelayMicroseconds(long featureID, int *errorCode);
395  unsigned long acquisitionDelayGetDelayIncrementMicroseconds(long featureID, int *errorCode);
396  unsigned long acquisitionDelayGetDelayMaximumMicroseconds(long featureID, int *errorCode);
397  unsigned long acquisitionDelayGetDelayMinimumMicroseconds(long featureID, int *errorCode);
398 
399  /* Get one or more single strobe features */
400  int getSingleStrobeFeatures(long *buffer, int maxFeatures);
401  void singleStrobeSetDelayMicroseconds(long featureID, int *errorCode, unsigned long period_usec);
402  void singleStrobeSetWidthMicroseconds(long featureID, int *errorCode, unsigned long period_usec);
403  void singleStrobeSetEnable(long featureID, int *errorCode, bool enable);
404  unsigned long singleStrobeGetDelayMicroseconds(long featureID, int *errorCode);
405  unsigned long singleStrobeGetWidthMicroseconds(long featureID, int *errorCode);
406  bool singleStrobeGetEnable(long featureID, int *errorCode);
407  unsigned long getSingleStrobeDelayMinimumMicroseconds(long featureID, int *errorCode);
408  unsigned long getSingleStrobeDelayMaximumMicroseconds(long featureID, int *errorCode);
409  unsigned long getSingleStrobeWidthMinimumMicroseconds(long featureID, int *errorCode);
410  unsigned long getSingleStrobeWidthMaximumMicroseconds(long featureID, int *errorCode);
411  unsigned long getSingleStrobeCycleMaximumMicroseconds(long featureID, int *errorCode);
412  unsigned long getSingleStrobeDelayIncrementMicroseconds(long featureID, int *errorCode);
413  unsigned long getSingleStrobeWidthIncrementMicroseconds(long featureID, int *errorCode);
414 
415  /* Get one or more activity features */
416  int getNumberOfActivityFeatures();
417  int getActivityFeatures(long *buffer, int maxFeatures);
418  bool ledActivityGetEnable(long featureID, int *errorCode);
419  void ledActivitySetEnable(long featureID, int *errorCode, bool enable);
420 
421  /* Get one or more Analog Input features */
422  int getNumberOfAnalogInFeatures();
423  int getAnalogInFeatures(long *buffer, int maxFeatures);
424  int analogInGetNumberOfInputs(long featureID, int *errorCode);
425  double analogInGetMinimumVolts(long featureID, int *errorCode);
426  double analogInGetMaximumVolts(long featureID, int *errorCode);
427  double analogInGetVoltAtPin(long featureID, int *errorCode, int pin);
428  void analogInSetAltPins(long featureID, int *errorCode, int pinNumber, int pinType);
429 
430  /* Get one or more Analog Output features */
431  int getNumberOfAnalogOutFeatures();
432  int getAnalogOutFeatures(long *buffer, int maxFeatures);
433  int analogOutGetNumberOfOutputs(long featureID, int *errorCode);
434  double analogOutGetMinimumVolts(long featureID, int *errorCode);
435  double analogOutGetMaximumVolts(long featureID, int *errorCode);
436  void analogOutSetAltPins(long featureID, int *errorCode, int pinNumber, int pinType);
437  void analogOutSetDCVoltsAtPin(long featureID, int *errorCode, int pin, double voltage);
438 
439  /* DHCP server configuration */
440  int getDHCPServerFeatures(long *buffer, int maxFeatures);
441  bool isDHCPServerEnabled(long featureID, int *errorCode, unsigned char ifNum);
442  void setDHCPServerEnable(long featureID, int *errorCode, unsigned char ifNum, bool enable);
443  void getDHCPServerAddressRange(long featureID, int *errorCode, unsigned char ifNum,
444  unsigned int *outBaseIpAddress, unsigned int ipAddressArraySize, unsigned int *outNetmask);
445  void setDHCPServerAddressRange(long featureID, int *errorCode, unsigned char ifNum,
446  const unsigned int *baseIpAddress, unsigned int ipAddressArraySize, unsigned int netmask);
447 
448  /* IPv4 Address feature */
449  int getNumberOfIpv4Features();
450  int getIpv4AddressFeatures(long *buffer, int maxFeatures);
451  bool isDHCPEnabled(long featureID, int *errorCode, unsigned char ifNum);
452  void setDHCPEnable(long featureID, int *errorCode, unsigned char ifNum, unsigned char enabled);
453  int getNumberOfIpAddresses(long featureID, int *errorCode, unsigned char ifNum);
454  void readIpAddress(long featureID, int *errorCode, unsigned char ifNum, unsigned char addressIndex,
455  unsigned char *ipAddress, int ipAddressLength, unsigned int *netmask);
456  void addStaticIpAddress(long featureID, int* errorCode, unsigned char ifNum,
457  unsigned char *ipAddress, int ipAddressLength, unsigned int netmask);
458  void deleteStaticIpAddress(long featureID, int* errorCode, unsigned char ifNum, unsigned char addressIndex);
459 
460 
461  /* Get pixel info commands. */
462  int getPixelCount(long deviceID, int *error_code);
463  int getActivePixelRange(long deviceID, int *error_code, int *range, int rangeSize);
464  int getOpticalDarkPixelRange(long deviceID, int *error_code, int *range, int rangeSize);
465  int getTransitionPixelRange(long deviceID, int *error_code, int *range, int rangeSize);
466  int getBadPixelIndices(long deviceID, int *error_code, int *baxPixelIndices, int baxPixelSize);
467  void setBadPixelIndices(long deviceID, int *error_code, int *baxPixelIndices, int baxPixelSize);
468 
469  /* Auto nulling commands */
470  int getMaximumADCCount(long deviceID, int *error_code);
471  int getSaturationLevel(long deviceID, int *error_code);
472  void setSaturationLevel(long deviceID, int *error_code, int level);
473  int getBaselineLevel(long deviceID, int *error_code);
474  void setBaselineLevel(long deviceID, int *error_code, int level);
475 
476  /* User string features */
477  int getUserString(long featureID, int *errorCode, char *buffer, int bufferLength);
478  void setUserString(long featureID, int *errorCode, char *buffer, int bufferLength);
479  int getUserStringCount(long featureID, int *errorCode);
480  int getUserString(long featureID, int *errorCode, int index, char *buffer, int bufferLength);
481  void setUserString(long featureID, int *errorCode, int index, char *buffer, int bufferLength);
482 
483  /* Device alias features */
484  int getDeviceAlias(long featureID, int *errorCode, char *buffer, int bufferLength);
485  void setDeviceAlias(long featureID, int *errorCode, char *buffer, int bufferLength);
486 
487  /* Device information features */
488  void resetDevice(long featureID, int *errorCode);
489  std::uint16_t getOriginalVID(long featureID, int *errorCode);
490  std::uint16_t getOriginalPID(long featureID, int *errorCode);
491  std::uint16_t getVID(long featureID, int *errorCode);
492  void setVID(long featureID, int *errorCode, std::uint16_t vid);
493  std::uint16_t getPID(long featureID, int *errorCode);
494  void setPID(long featureID, int *errorCode, std::uint16_t pid);
495  int getOriginalManufacturerString(long featureID, int *errorCode, char *buffer, int bufferLength);
496  int getOriginalModelString(long featureID, int *errorCode, char *buffer, int bufferLength);
497  int getManufacturerString(long featureID, int *errorCode, char *buffer, int bufferLength);
498  void setManufacturerString(long featureID, int *errorCode, char *buffer, int bufferLength);
499  int getModelString(long featureID, int *errorCode, char *buffer, int bufferLength);
500  void setModelString(long featureID, int *errorCode, char *buffer, int bufferLength);
501 
502  /* Get OBP commands supported by the device. This command only applies to the newer devices with latest version of OBP */
503  int getCommandList(long featureID, int *errorCode, unsigned int *commands, int length);
504  std::uint32_t getIntegrationTimeStepSize(long featureID, int *errorCode);
505 
506  /* Serial port configuration features */
507  int getBaudRate(long featureID, int *errorCode);
508  void setBaudRate(long featureID, int *errorCode, int baudRate);
509  void saveSettingsToFlash(long featureID, int *errorCode);
510 
511  private:
512  std::vector<int> emptyDummyIntVar;
513  std::vector<double> emptyDummyDoubleVar;
514  std::vector<double> correctedSpectra;
515 
516  protected:
517  unsigned long instanceID;
518  oceandirect::Device *device;
519  int scanToAverage; //0/1(single scan), more than 1 (averaging)
520  int boxcarWidth; //software side only.
521 
522  std::vector<RawBusAccessFeatureAdapter *> rawBusAccessFeatures;
523  std::vector<SerialNumberFeatureAdapter *> serialNumberFeatures;
524  std::vector<SpectrometerFeatureAdapter *> spectrometerFeatures;
525  std::vector<ThermoElectricCoolerFeatureAdapter *> tecFeatures;
526  std::vector<IrradCalFeatureAdapter *> irradCalFeatures;
527  std::vector<EEPROMFeatureAdapter *> eepromFeatures;
528  std::vector<LightSourceFeatureAdapter *> lightSourceFeatures;
529  std::vector<StrobeLampFeatureAdapter *> strobeLampFeatures;
530  std::vector<ContinuousStrobeFeatureAdapter *> continuousStrobeFeatures;
531  std::vector<SingleStrobeFeatureAdapter *> singleStrobeFeatures;
532  std::vector<GpioFeatureAdapter *> gpioFeatures;
533  std::vector<NonlinearityCoeffsFeatureAdapter *> nonlinearityFeatures;
534  std::vector<TemperatureFeatureAdapter *> temperatureFeatures;
535  std::vector<RevisionFeatureAdapter *> revisionFeatures;
536  std::vector<OpticalBenchFeatureAdapter *> opticalBenchFeatures;
537  std::vector<StrayLightCoeffsFeatureAdapter *> strayLightFeatures;
538  std::vector<PixelBinningFeatureAdapter *> pixelBinningFeatures;
539  std::vector<DataBufferFeatureAdapter *> dataBufferFeatures;
540  std::vector<BackToBackFeatureAdapter *> backToBackFeatures;
541  std::vector<AcquisitionDelayFeatureAdapter *> acquisitionDelayFeatures;
542  std::vector<QueryStatusFeatureAdapter*> queryStatusFeatures;
543  std::vector<LedActivityFeatureAdapter *> ledActivityFeatures;
544  std::vector<TimeFeatureAdapter *> timeFeatures;
545  std::vector<AnalogInFeatureAdapter *> analogInFeatures;
546  std::vector<AnalogOutFeatureAdapter *> analogOutFeatures;
547  std::vector<DHCPServerConfigurationFeatureAdapter *> dhcpFeatures;
548  std::vector<PixelFeatureAdapter *> pixelFeatures;
549  std::vector<AutoNullingFeatureAdapter *> autoNullingFeatures;
550  std::vector<UserStringFeatureAdapter *> userStringFeatures;
551  std::vector<DeviceInformationFeatureAdapter *> deviceInformationFeatures;
552  std::vector<DeviceAliasFeatureAdapter *> deviceAliasFeatures;
553  std::vector<SerialPortFeatureAdapter *> serialPortFeatures;
554  std::vector<Ipv4AddressFeatureAdapter *> ipv4AddressFeatures;
555  std::vector<SpectrumAcquisitionControlFeatureAdapter *> spectrumAcquisitionControlFeatures;
556 
557  RawBusAccessFeatureAdapter *getRawBusAccessFeatureByID(long featureID);
558  SerialNumberFeatureAdapter *getSerialNumberFeatureByID(long featureID);
559  SpectrometerFeatureAdapter *getSpectrometerFeatureByID(long featureID);
560  ThermoElectricCoolerFeatureAdapter *getTECFeatureByID(long featureID);
561  IrradCalFeatureAdapter *getIrradCalFeatureByID(long featureID);
562  EEPROMFeatureAdapter *getEEPROMFeatureByID(long featureID);
563  LightSourceFeatureAdapter *getLightSourceFeatureByID(long featureID);
564  StrobeLampFeatureAdapter *getStrobeLampFeatureByID(long featureID);
565  ContinuousStrobeFeatureAdapter *getContinuousStrobeFeatureByID(long featureID);
566  SingleStrobeFeatureAdapter *getSingleStrobeFeatureByID(long featureID);
567  GpioFeatureAdapter *getGpioFeatureByID(long featureID);
568  NonlinearityCoeffsFeatureAdapter *getNonlinearityCoeffsFeatureByID(long featureID);
569  TemperatureFeatureAdapter *getTemperatureFeatureByID(long featureID);
570  RevisionFeatureAdapter *getRevisionFeatureByID(long featureID);
571  OpticalBenchFeatureAdapter *getOpticalBenchFeatureByID(long featureID);
572  StrayLightCoeffsFeatureAdapter *getStrayLightCoeffsFeatureByID(long featureID);
573  PixelBinningFeatureAdapter *getPixelBinningFeatureByID(long featureID);
574  DataBufferFeatureAdapter *getDataBufferFeatureByID(long featureID);
575  BackToBackFeatureAdapter *getBackToBackFeatureByID(long featureID);
576  AcquisitionDelayFeatureAdapter *getAcquisitionDelayFeatureByID(long featureID);
577  QueryStatusFeatureAdapter *getQueryStatusFeatureByID(long featureID);
578  LedActivityFeatureAdapter *getActivityFeatureByID(long featureID);
579  TimeFeatureAdapter *getTimeFeatureByID(long featureID);
580  AnalogInFeatureAdapter *getAnalogInByID(long featureID);
581  AnalogOutFeatureAdapter *getAnalogOutByID(long featureID);
582 
583  DHCPServerConfigurationFeatureAdapter *getDHCPFeatureByID(long featureID);
584  Ipv4AddressFeatureAdapter *getIpv4AddressFeatureByID(long featureID);
585  PixelFeatureAdapter *getPixelFeatureByID(long featureID);
586  AutoNullingFeatureAdapter *getAutoNullingFeatureByID(long featureID);
587  UserStringFeatureAdapter *getUserStringFeatureByID(long featureID);
588  DeviceInformationFeatureAdapter *getDeviceInformationFeatureByID(long featureID);
589  DeviceAliasFeatureAdapter *getDeviceAliasFeatureByID(long featureID);
590  SerialPortFeatureAdapter *getSerialPortFeatureByID(long featureID);
591  SpectrumAcquisitionControlFeatureAdapter *getSpectrumAcquisitionControlFeatureByID(long featureID);
592 
593  // Assignments for feature lookups
594  enum class featureId {
595  invalid,
596  serNo,
597  spectrm,
598  tec,
599  iirad,
600  eeprom,
601  strobe,
602  wavecal,
603  nonline,
604  stray,
605  raw,
606  contsrtb,
607  light,
608  temper,
609  optic,
610  revise,
611  process,
612  buffer,
613  delay,
614  binn,
615  gpio,
616  singstrb,
617  status,
618  backToBack,
619  activity,
620  time,
621  volt_in,
622  volt_out,
623  dhcp,
624  ipv4_address,
625  pixel,
626  autonulling,
627  userstring,
628  deviceInfo,
629  deviceAlias,
630  serialPort,
631  spectrumAcquisitionControl
632  };
633  };
634  }
635 }
636 
637 #endif
638 
Definition: AcquisitionDelayFeatureAdapter.h:39
Definition: AnalogInFeatureAdapter.h:37
Definition: AnalogOutFeatureAdapter.h:37
Definition: AutoNullingFeatureAdapter.h:38
Definition: BackToBackFeatureAdapter.h:39
Definition: ContinuousStrobeFeatureAdapter.h:39
Definition: DHCPServerConfigurationFeatureAdapter.h:38
Definition: DataBufferFeatureAdapter.h:38
Definition: DeviceAdapter.h:81
Definition: DeviceAliasFeatureAdapter.h:38
Definition: DeviceInformationFeatureAdapter.h:38
Definition: EEPROMFeatureAdapter.h:39
Definition: GpioFeatureAdapter.h:38
Definition: Ipv4AddressFeatureAdapter.h:38
Definition: IrradCalFeatureAdapter.h:39
Definition: LedActivityFeatureAdapter.h:39
Definition: LightSourceFeatureAdapter.h:39
Definition: NonlinearityCoeffsFeatureAdapter.h:39
Definition: OpticalBenchFeatureAdapter.h:38
Definition: PixelBinningFeatureAdapter.h:39
Definition: PixelFeatureAdapter.h:39
Definition: QueryStatusFeatureAdapter.h:38
Definition: RawBusAccessFeatureAdapter.h:38
Definition: RevisionFeatureAdapter.h:39
Definition: SerialNumberFeatureAdapter.h:39
Definition: SerialPortFeatureAdapter.h:38
Definition: SingleStrobeFeatureAdapter.h:39
Definition: SpectrometerFeatureAdapter.h:42
Definition: SpectrumAcquisitionControlFeatureAdapter.h:38
Definition: StrayLightCoeffsFeatureAdapter.h:39
Definition: StrobeLampFeatureAdapter.h:39
Definition: TemperatureFeatureAdapter.h:39
Definition: ThermoElectricCoolerFeatureAdapter.h:39
Definition: TimeFeatureAdapter.h:38
Definition: UserStringFeatureAdapter.h:39
This is an interface to Advance features of OceanDirect that allow access to less common controls....
Definition: AcquisitionDelayFeatureAdapter.h:35