SeaBreeze
SeaBreezeWrapper.h
Go to the documentation of this file.
1 /***************************************************/
36 #ifndef SEABREEZE_WRAPPER_H
37 #define SEABREEZE_WRAPPER_H
38 
39 #define SEABREEZE_API_VERSION "3.0.11"
40 #define SEABREEZE_MAX_DEVICES 32
41 
42 #include "api/DllDecl.h"
43 
44 #ifdef __cplusplus
45 
49 namespace seabreeze {
50  class Device;
51 }
52 
57 class DLL_DECL SeaBreezeWrapper {
58 public:
59 
61  static SeaBreezeWrapper *getInstance();
62 
64  static void shutdown();
65 
66  // lifecycle
67  int openSpectrometer (int index, int *errorCode);
68  int closeSpectrometer (int index, int *errorCode);
69 
70  // metadata
71  int getModel (int index, int *errorCode, char *buf, int len);
72  int getSerialNumber (int index, int *errorCode, char *buf, int len);
73 
74  // basic acquisitions
75  void setIntegrationTimeMicrosec(int index, int *errorCode, unsigned long integration_time_micros);
76  int getWavelengths (int index, int *errorCode, double *wavelengths, int length);
77  int getFormattedSpectrum (int index, int *errorCode, double* buffer, int buffer_length);
78  int getUnformattedSpectrum (int index, int *errorCode, unsigned char *buffer, int buffer_length);
79  int getFormattedSpectrumLength(int index, int *errorCode);
80  int getUnformattedSpectrumLength(int index, int *errorCode);
81  long getMinIntegrationTimeMicrosec(int index, int *errorCode);
82  long getMaxIntegrationTimeMicrosec(int index, int *errorCode);
83  int getMaximumIntensity(int index, int *errorCode);
84 
85  // advanced features
86  int getElectricDarkPixelIndices(int index, int *errorCode, int *indices, int length);
87  void setTriggerMode (int index, int *errorCode, int mode);
88  void setStrobeEnable (int index, int *errorCode, unsigned char strobe_enable);
89  void setShutterOpen (int index, int *errorCode, unsigned char opened);
90  void setContinuousStrobePeriodMicrosec(int index, int *errorCode, unsigned short strobe_id, unsigned long period_usec);
91  void setAcquisitionDelayMicrosec(int index, int *errorCode, unsigned long delay_usec);
92 
93  // Buffering features
94  void clearBuffer (int index, int *errorCode);
95  unsigned long getBufferElementCount(int index, int *errorCode);
96  unsigned long getBufferCapacity (int index, int *errorCode);
97  unsigned long getBufferCapacityMaximum(int index, int *errorCode);
98  unsigned long getBufferCapacityMinimum(int index, int *errorCode);
99  void setBufferCapacity (int index, int *errorCode, unsigned long capacity);
100 
101  // EEPROM access
102  int readEEPROMSlot (int index, int *errorCode, int slot_number, unsigned char *buffer, int buffer_length);
103  int writeEEPROMSlot (int index, int *errorCode, int slot_number, unsigned char *buffer, int buffer_length);
104 
105  // irradiance calibration
106  int readIrradCalibration (int index, int *errorCode, float *buffer, int buffer_length);
107  int writeIrradCalibration (int index, int *errorCode, float *buffer, int buffer_length);
108  int hasIrradCollectionArea (int index, int *errorCode);
109  float readIrradCollectionArea (int index, int *errorCode);
110  void writeIrradCollectionArea (int index, int *errorCode, float area);
111 
112  // thermal-electric cooler
113  double readTECTemperature (int index, int *errorCode);
114  void setTECTemperature (int index, int *errorCode, double temperature_degrees_celsius);
115  void setTECEnable (int index, int *errorCode, unsigned char tec_enable);
116  void setTECFanEnable (int index, int *errorCode, unsigned char tec_fan_enable);
117 
118  // Wrapper features
119  void setVerbose (bool flag);
120  void setLogfile (char *path, int length);
121  int getAPIVersionString (char *buffer, int length);
122  int getErrorString (int errorCode, char *buffer, int buffer_length);
123 
124  // raw USB access
125  int writeUSB (int index, int *errorCode, unsigned char endpoint, unsigned char *buffer, unsigned int length);
126  int readUSB (int index, int *errorCode, unsigned char endpoint, unsigned char *buffer, unsigned int length);
127  int getUSBDescriptorString (int index, int *errorCode, int id, unsigned char *buffer, int length);
128 
129  // light sources (JAZ?)
130  int getLightSourceCount (int index, int *errorCode);
131  void setLightSourceEnable (int index, int *errorCode, int lightIndex, unsigned char enable);
132  void setLightSourceIntensity (int index, int *errorCode, int lightIndex, double intensity);
133 
134 private:
136  virtual ~SeaBreezeWrapper();
137 
139  static SeaBreezeWrapper *instance;
140 
143 };
144 
145 extern "C" {
146 #endif /* __cplusplus */
147 
148  /* All of these C functions start with seabreeze_ to prevent namespace
149  * collisions.
150  */
151 
169  DLL_DECL int
170  seabreeze_open_spectrometer(int index, int *error_code);
171 
180  DLL_DECL int
181  seabreeze_close_spectrometer(int index, int *error_code);
182 
195  DLL_DECL int
196  seabreeze_get_error_string(int error_code, char *buffer, int buffer_length);
197 
231  DLL_DECL int
232  seabreeze_get_model(int index, int *error_code, char *buffer, int buffer_length);
233 
245  DLL_DECL void
246  seabreeze_set_trigger_mode(int index, int *error_code, int mode);
247 
260  DLL_DECL void
261  seabreeze_set_integration_time_microsec(int index, int *error_code,
262  unsigned long integration_time_micros);
263 
273  DLL_DECL long
274  seabreeze_get_min_integration_time_microsec(int index, int *error_code);
275 
286  DLL_DECL void
287  seabreeze_set_shutter_open(int index, int *error_code, unsigned char opened);
288 
309  DLL_DECL void
310  seabreeze_set_strobe_enable(int index, int *error_code, unsigned char strobe_enable);
311 
320  DLL_DECL int
321  seabreeze_get_light_source_count(int index, int *error_code);
322 
337  DLL_DECL void
338  seabreeze_set_light_source_enable(int index, int *error_code,
339  int light_index, unsigned char enable);
340 
362  DLL_DECL void
363  seabreeze_set_light_source_intensity(int index, int *error_code,
364  int light_index, double intensity);
365 
383  DLL_DECL int
384  seabreeze_read_eeprom_slot(int index, int *error_code, int slot_number, unsigned char *buffer,
385  int buffer_length);
386 
402  DLL_DECL int
403  seabreeze_write_eeprom_slot(int index, int *error_code, int slot_number, unsigned char *buffer,
404  int buffer_length);
405 
416  DLL_DECL int
417  seabreeze_read_irrad_calibration(int index, int *error_code, float *buffer,
418  int buffer_length);
419 
430  DLL_DECL int
431  seabreeze_write_irrad_calibration(int index, int *error_code, float *buffer,
432  int buffer_length);
433 
442  DLL_DECL int
443  seabreeze_has_irrad_collection_area(int index, int *error_code);
444 
453  DLL_DECL float
454  seabreeze_read_irrad_collection_area(int index, int *error_code);
455 
464  DLL_DECL void
465  seabreeze_write_irrad_collection_area(int index, int *error_code, float area);
466 
475  DLL_DECL double
476  seabreeze_read_tec_temperature(int index, int *error_code);
477 
486  DLL_DECL void
487  seabreeze_set_tec_temperature(int index, int *error_code,
488  double temperature_degrees_celsius);
489 
499  DLL_DECL void
500  seabreeze_set_tec_enable(int index, int *error_code, unsigned char tec_enable);
501 
511  DLL_DECL void
512  seabreeze_set_tec_fan_enable(int index, int *error_code, unsigned char tec_fan_enable);
513 
531  DLL_DECL int
532  seabreeze_get_unformatted_spectrum(int index, int *error_code,
533  unsigned char *buffer, int buffer_length);
534 
552  DLL_DECL int
553  seabreeze_get_formatted_spectrum(int index, int *error_code,
554  double* buffer, int buffer_length);
555 
567  DLL_DECL int
568  seabreeze_get_unformatted_spectrum_length(int index, int *error_code);
569 
578  DLL_DECL int
579  seabreeze_get_formatted_spectrum_length(int index, int *error_code);
580 
594  DLL_DECL int
595  seabreeze_get_wavelengths(int index, int *error_code, double *wavelengths, int length);
596 
611  DLL_DECL int
612  seabreeze_get_serial_number(int index, int *error_code, char *buffer, int buffer_length);
613 
630  DLL_DECL int
631  seabreeze_get_electric_dark_pixel_indices(int index, int *error_code,
632  int *indices, int length);
633 
642  DLL_DECL void
644 
716  DLL_DECL int
717  seabreeze_write_usb(int index, int *errorCode, unsigned char endpoint, unsigned char* buffer, unsigned int length);
718 
741  DLL_DECL int
742  seabreeze_read_usb(int index, int *errorCode, unsigned char endpoint, unsigned char* buffer, unsigned int length);
743 
751  DLL_DECL int
752  seabreeze_get_api_version_string(char *buffer, int len);
753 
764  DLL_DECL int
765  seabreeze_get_usb_descriptor_string(int index, int *errorCode, int id, unsigned char *buffer, int len);
766 
777  DLL_DECL void
778  seabreeze_set_continuous_strobe_period_microsec(int index, int *errorCode,
779  unsigned short strobe_id, unsigned long period_usec);
780 
787  DLL_DECL void
789  int *errorCode, unsigned long delay_usec);
790 
796  DLL_DECL void
797  seabreeze_clear_buffer(int index, int *error_code);
798 
805  DLL_DECL unsigned long
806  seabreeze_get_buffer_element_count(int index, int *error_code);
807 
814  DLL_DECL unsigned long
815  seabreeze_get_buffer_capacity(int index, int *error_code);
816 
823  DLL_DECL unsigned long
824  seabreeze_get_buffer_capacity_maximum(int index, int *error_code);
825 
832  DLL_DECL unsigned long
833  seabreeze_get_buffer_capacity_minimum(int index, int *error_code);
834 
843  DLL_DECL void
844  seabreeze_set_buffer_capacity(int index, int *error_code, unsigned long capacity);
845 
850  DLL_DECL void
851  seabreeze_set_verbose(int flag);
852 
857  DLL_DECL void
858  seabreeze_set_logfile(char* pathname, int len);
859 
860 #ifdef __cplusplus
861 };
862 #endif /* __cplusplus */
863 
864 #endif /* SEABREEZE_WRAPPER_H */
DLL_DECL int seabreeze_get_unformatted_spectrum_length(int index, int *error_code)
This returns an integer denoting the length of a raw spectrum (as returned by get_unformatted_spectru...
DLL_DECL int seabreeze_get_serial_number(int index, int *error_code, char *buffer, int buffer_length)
This reads the device's serial number and fills the provided array (up to the given length) with it...
DLL_DECL unsigned long seabreeze_get_buffer_capacity(int index, int *error_code)
Get the currently configured size of the data buffer (if equipped)
DLL_DECL void seabreeze_set_tec_enable(int index, int *error_code, unsigned char tec_enable)
This function enables the TEC feature on the spectrometer.
DLL_DECL int seabreeze_get_formatted_spectrum(int index, int *error_code, double *buffer, int buffer_length)
This acquires a spectrum and returns the answer in formatted floats. In this mode, auto-nulling should be automatically performed for devices that support it.
DLL_DECL int seabreeze_write_irrad_calibration(int index, int *error_code, float *buffer, int buffer_length)
This function writes an irradiance calibration to the spectrometer's internal memory if that feature ...
DLL_DECL int seabreeze_open_spectrometer(int index, int *error_code)
This function opens a device attached to the system.
DLL_DECL void seabreeze_set_strobe_enable(int index, int *error_code, unsigned char strobe_enable)
This function sets the strobe enable on the spectrometer. Note that this refers to a particular set o...
DLL_DECL void seabreeze_set_shutter_open(int index, int *error_code, unsigned char opened)
This function sets the shutter state on the spectrometer.
DLL_DECL unsigned long seabreeze_get_buffer_element_count(int index, int *error_code)
Get the number of spectra presently in the buffer (if equipped)
DLL_DECL int seabreeze_get_usb_descriptor_string(int index, int *errorCode, int id, unsigned char *buffer, int len)
Get a USB descriptor string by number.
Definition: SeaBreezeWrapper.h:57
DLL_DECL unsigned long seabreeze_get_buffer_capacity_minimum(int index, int *error_code)
Get the minimum possible configurable size for the data buffer (if equipped)
DLL_DECL void seabreeze_write_irrad_collection_area(int index, int *error_code, float area)
This function writes an irradiance collection area to the spectrometer's internal memory if that feat...
DLL_DECL void seabreeze_shutdown()
Shutdown SeaBreeze completely, releasing all resources and destroying any cached device handles...
DLL_DECL void seabreeze_set_acquisition_delay_microsec(int index, int *errorCode, unsigned long delay_usec)
Set the acquisition delay (trigger delay) in microseconds. This controls the amount of time between a...
DLL_DECL void seabreeze_set_continuous_strobe_period_microsec(int index, int *errorCode, unsigned short strobe_id, unsigned long period_usec)
Set the continuous strobe period in microseconds.
DLL_DECL int seabreeze_write_eeprom_slot(int index, int *error_code, int slot_number, unsigned char *buffer, int buffer_length)
This function writes a string to a spectrometer's EEPROM slot.
DLL_DECL void seabreeze_clear_buffer(int index, int *error_code)
Clear the spectrum buffer (if equipped)
DLL_DECL int seabreeze_get_unformatted_spectrum(int index, int *error_code, unsigned char *buffer, int buffer_length)
This acquires a spectrum and returns the answer in raw, unformatted bytes.
DLL_DECL void seabreeze_set_integration_time_microsec(int index, int *error_code, unsigned long integration_time_micros)
This function sets the integration time for the specified device.
DLL_DECL int seabreeze_get_light_source_count(int index, int *error_code)
This function gets the number of attached light sources that can be programmatically controlled...
DLL_DECL double seabreeze_read_tec_temperature(int index, int *error_code)
This function reads the value of the TEC and returns the value in degrees celsius.
DLL_DECL int seabreeze_get_model(int index, int *error_code, char *buffer, int buffer_length)
This function returns a string denoting the type of the device.
DLL_DECL int seabreeze_get_error_string(int error_code, char *buffer, int buffer_length)
This function returns a description of the error denoted by error_code.
DLL_DECL void seabreeze_set_light_source_intensity(int index, int *error_code, int light_index, double intensity)
This function sets the intensity of a connected light source.
DLL_DECL void seabreeze_set_verbose(int flag)
Programmatically enable debug outputs to stderr.
DLL_DECL float seabreeze_read_irrad_collection_area(int index, int *error_code)
This function reads an irradiance collection area from the spectrometer's internal memory if that fea...
DLL_DECL int seabreeze_read_usb(int index, int *errorCode, unsigned char endpoint, unsigned char *buffer, unsigned int length)
Read a raw array of bytes from a USB spectrometer.
DLL_DECL void seabreeze_set_light_source_enable(int index, int *error_code, int light_index, unsigned char enable)
This function sets the enable status on a connected light source.
DLL_DECL void seabreeze_set_trigger_mode(int index, int *error_code, int mode)
This function sets the trigger mode for the specified device.
DLL_DECL int seabreeze_read_eeprom_slot(int index, int *error_code, int slot_number, unsigned char *buffer, int buffer_length)
This function reads a string out of the spectrometer's EEPROM slot and returns the result...
DLL_DECL unsigned long seabreeze_get_buffer_capacity_maximum(int index, int *error_code)
Get the maximum possible configurable size for the data buffer (if equipped)
DLL_DECL void seabreeze_set_buffer_capacity(int index, int *error_code, unsigned long capacity)
Set the number of spectra that the buffer should keep.
DLL_DECL int seabreeze_get_wavelengths(int index, int *error_code, double *wavelengths, int length)
This computes the wavelengths for the spectrometer and fills in the provided array (up to the given l...
#define SEABREEZE_MAX_DEVICES
how many different spectrometer types we support
Definition: SeaBreezeWrapper.h:40
DLL_DECL int seabreeze_has_irrad_collection_area(int index, int *error_code)
This function checks for an irradiance collection area in the spectrometer's internal memory if that ...
DLL_DECL int seabreeze_get_electric_dark_pixel_indices(int index, int *error_code, int *indices, int length)
This fills in the provided array (up to the given length) with the indices of the pixels that are ele...
DLL_DECL int seabreeze_get_formatted_spectrum_length(int index, int *error_code)
This returns an integer denoting the number of pixels in a formatted spectrum (as returned by get_for...
Definition: Device.h:64
Encapsulates all SeaBreeze classes.
Definition: DeviceFactory.h:42
DLL_DECL int seabreeze_write_usb(int index, int *errorCode, unsigned char endpoint, unsigned char *buffer, unsigned int length)
Write a raw array of bytes to a USB spectrometer.
DLL_DECL int seabreeze_close_spectrometer(int index, int *error_code)
This function closes the spectrometer attached to the system.
DLL_DECL int seabreeze_get_api_version_string(char *buffer, int len)
Get the SeaBreeze library's internal version identifier.
DLL_DECL void seabreeze_set_tec_temperature(int index, int *error_code, double temperature_degrees_celsius)
This function sets the TEC temperature.
DLL_DECL void seabreeze_set_tec_fan_enable(int index, int *error_code, unsigned char tec_fan_enable)
This function enables the TEC Fan on the spectrometer.
DLL_DECL void seabreeze_set_logfile(char *pathname, int len)
redirect verbose logging to named file
DLL_DECL int seabreeze_read_irrad_calibration(int index, int *error_code, float *buffer, int buffer_length)
This function reads out an irradiance calibration from the spectrometer's internal memory if that fea...
DLL_DECL long seabreeze_get_min_integration_time_microsec(int index, int *error_code)
This function returns the smallest integration time setting, in microseconds, that is valid for the s...