39 #ifdef WASATCHVCPPLIB_EXPORTS
40 #define DLL_API __declspec(dllexport)
42 #define DLL_API __declspec(dllimport)
54#define WP_ERROR_INVALID_SPECTROMETER -2
55#define WP_ERROR_INSUFFICIENT_STORAGE -3
56#define WP_ERROR_NO_LASER -4
57#define WP_ERROR_NOT_INGAAS -5
58#define WP_ERROR_INVALID_GAIN -256
59#define WP_ERROR_INVALID_TEMPERATURE -999
60#define WP_ERROR_INVALID_OFFSET -32768
63#define WP_LOG_LEVEL_DEBUG 0
64#define WP_LOG_LEVEL_INFO 1
65#define WP_LOG_LEVEL_ERROR 2
66#define WP_LOG_LEVEL_NEVER 3
104 DLL_API
int wp_get_vignetted_spectrum_length(
int specIndex);
106 DLL_API
int wp_apply_raman_intensity_factors(
int specIndex,
double* spectrum,
int spectrum_len,
double* factors,
int factors_len,
int start_pixel,
int end_pixel);
108 DLL_API
int wp_has_srm_calibration(
int specIndex);
110 DLL_API
int wp_get_raman_intensity_factors(
int specIndex,
double* factors,
int factorsLen);
220 DLL_API
int wp_get_eeprom(
int specIndex,
const char** names,
const char** values,
int len);
232 DLL_API
int wp_write_eeprom_page(
int specIndex,
int pageIndex,
unsigned char* data,
int dataLen);
268 DLL_API
int wp_get_model(
int specIndex,
char* value,
int len);
605 unsigned char bRequest,
636 unsigned char bRequest,
669#ifndef WASATCHVCPPLIB_EXPORTS
725 spectrumBuf.resize(
pixels);
750 bool success =
false;
800 bool setLaserPowerPerc(
float value)
805 bool setLaserPowermW(
float value)
867 int sendControlMsg(uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint8_t* data,
int len)
892 return std::string(buf);
900 return std::string(buf);
912 std::vector<double> result;
915 result = spectrumBuf;
923 std::vector<uint8_t> result;
924 uint8_t buf[len] = { 0 };
930 for (
int i = 0; i < len; i++)
938 char buf[64] = { 0 };
940 return std::string();
941 return std::string(buf);
947 std::vector<float> v;
948 for (
int i = 0; i < 5; i++)
949 v.push_back(std::stof(
eepromFields[
"wavecalCoeffs[" + std::to_string(i) +
"]"]));
954 bool readEEPROMFields()
960 const char** names = (
const char**)malloc(count *
sizeof(
const char*));
961 const char** values = (
const char**)malloc(count *
sizeof(
const char*));
970 for (
int i = 0; i < count; i++)
971 eepromFields.insert(std::make_pair(std::string(names[i]), std::string(values[i])));
977 std::vector<double> spectrumBuf;
1010 return std::string(buf);
1016 spectrometers.clear();
1019 if (enumeratedCount <= 0)
1023 for (
int index = 0; index < enumeratedCount; index++)
1029 spectrometers.insert(std::make_pair(validCount, spec));
1045 auto iter = spectrometers.find(index);
1046 if (iter == spectrometers.end())
1049 return iter->second;
1058 for (
auto iter = spectrometers.begin(); iter != spectrometers.end(); iter++)
1060 delete iter->second;
1061 iter->second =
nullptr;
1063 spectrometers.clear();
1088 std::map<int, Spectrometer*> spectrometers;
DLL_API int wp_set_detector_gain(int specIndex, float value)
Set detector gain.
Definition: WasatchVCPPWrapper.cpp:466
DLL_API int wp_get_model(int specIndex, char *value, int len)
Get the selected spectrometer's model.
Definition: WasatchVCPPWrapper.cpp:121
DLL_API int wp_open_all_spectrometers()
Connects to and initializes all enumerated USB spectrometers.
Definition: WasatchVCPPWrapper.cpp:75
DLL_API long wp_get_integration_time_ms(int specIndex)
Get the curent integration time.
Definition: WasatchVCPPWrapper.cpp:585
DLL_API int wp_get_detector_offset(int specIndex)
Get the current detector offset (on InGaAs, even pixels only).
Definition: WasatchVCPPWrapper.cpp:621
DLL_API int wp_get_max_timeout_ms(int specIndex)
Get the maximum internal timeout when waiting on blocking USB operations.
Definition: WasatchVCPPWrapper.cpp:685
DLL_API int wp_set_detector_offset(int specIndex, int value)
Set detector offset.
Definition: WasatchVCPPWrapper.cpp:490
DLL_API int wp_get_eeprom_field_count(int specIndex)
This is provided so the caller can correctly size the 'names' and 'values' arrays for a call to wp_ge...
Definition: WasatchVCPPWrapper.cpp:260
DLL_API int wp_get_detector_tec_enable(int specIndex)
Reports whether the detector TEC is enabled.
Definition: WasatchVCPPWrapper.cpp:639
DLL_API int wp_set_laser_power_mW(int specIndex, float power)
Sets laser power as a mW value.
Definition: WasatchVCPPWrapper.cpp:452
DLL_API int wp_get_spectrum(int specIndex, double *spectrum, int len)
Read one spectrum from the selected spectrometer.
Definition: WasatchVCPPWrapper.cpp:203
DLL_API int wp_set_detector_tec_enable(int specIndex, int value)
Turn the detector TEC on or off.
Definition: WasatchVCPPWrapper.cpp:514
DLL_API int wp_get_firmware_version(int specIndex, char *value, int len)
Get the firmware version of the microcontroller (FX2 or ARM).
Definition: WasatchVCPPWrapper.cpp:550
DLL_API int wp_get_detector_tec_setpoint_deg_c(int specIndex)
Get the current detector TEC setpoint in degrees Celsius.
Definition: WasatchVCPPWrapper.cpp:648
DLL_API int wp_get_wavenumbers(int specIndex, double *wavenumbers, int len)
Get the selected spectrometer's calibrated x-axis in wavenumbers (1/cm)
Definition: WasatchVCPPWrapper.cpp:167
DLL_API int wp_set_detector_gain_odd(int specIndex, float value)
On InGaAs spectrometers, configures the gain for odd-numbered pixels.
Definition: WasatchVCPPWrapper.cpp:478
DLL_API int wp_get_wavenumbers_float(int specIndex, float *wavenumbers, int len)
Get the selected spectrometer's calibrated x-axis in wavenumbers (1/cm) as float.
Definition: WasatchVCPPWrapper.cpp:185
DLL_API int wp_close_all_spectrometers()
Closes all connected spectrometers.
Definition: WasatchVCPPWrapper.cpp:89
#define WP_SUCCESS
the function completed successfully
Definition: WasatchVCPP.h:52
DLL_API int wp_read_control_msg(int specIndex, unsigned char bRequest, unsigned int wIndex, unsigned char *data, int len)
Provide direct access to reading spectrometer opcodes via USB setup packets (endpoint 0 control.
Definition: WasatchVCPPWrapper.cpp:734
DLL_API int wp_get_eeprom_field(int specIndex, const char *name, char *value, int len)
Read one stringified EEPROM field by name.
Definition: WasatchVCPPWrapper.cpp:310
DLL_API int wp_get_eeprom_field_name(int specIndex, int index, char *value, int len)
Obtain the nth ordered EEPROM field name.
Definition: WasatchVCPPWrapper.cpp:269
DLL_API void wp_destroy_driver()
Permanently releases all objects from memory.
Definition: WasatchVCPPWrapper.cpp:94
DLL_API int wp_get_eeprom_page(int specIndex, int page, unsigned char *buf, int len)
Read one page of the EEPROM in raw binary form.
DLL_API int wp_log_debug(const char *msg, int len)
Allows calling code (and wrappers) to inject lines into the library's log.
Definition: WasatchVCPPWrapper.cpp:403
DLL_API int wp_get_spectrum_float(int specIndex, float *spectrum, int len)
Read one spectrum from the selected spectrometer as float.
Definition: WasatchVCPPWrapper.cpp:231
DLL_API int wp_get_number_of_spectrometers()
Returns number of spectrometers previously opened.
Definition: WasatchVCPPWrapper.cpp:108
DLL_API int wp_get_laser_enable(int specIndex)
Reports whether laser is currently enabled (firing, or configured to do so).
Definition: WasatchVCPPWrapper.cpp:594
DLL_API int wp_set_integration_time_ms(int specIndex, unsigned long ms)
Set the spectrometer's integration time in milliseconds.
Definition: WasatchVCPPWrapper.cpp:415
DLL_API int wp_get_fpga_version(int specIndex, char *value, int len)
Get the version of the FPGA.
Definition: WasatchVCPPWrapper.cpp:563
DLL_API float wp_get_detector_gain(int specIndex)
Get the current detector gain (on InGaAs, even pixels only).
Definition: WasatchVCPPWrapper.cpp:603
DLL_API int wp_set_log_level(int level)
Sets driver log level.
Definition: WasatchVCPPWrapper.cpp:392
DLL_API int wp_get_serial_number(int specIndex, char *value, int len)
Get the selected spectrometer's serial number.
Definition: WasatchVCPPWrapper.cpp:129
DLL_API int wp_set_detector_offset_odd(int specIndex, int value)
On InGaAs spectrometers, configures the offset for odd-numbered pixels.
Definition: WasatchVCPPWrapper.cpp:502
DLL_API int wp_set_high_gain_mode_enable(int specIndex, int value)
Enable or disable "high gain" mode on InGaAs detectors.
Definition: WasatchVCPPWrapper.cpp:538
DLL_API int wp_set_laser_power_perc(int specIndex, float percent)
Sets laser power as a percentage of max power.
Definition: WasatchVCPPWrapper.cpp:439
DLL_API int wp_get_eeprom(int specIndex, const char **names, const char **values, int len)
Read a table of all EEPROM fields, as strings.
Definition: WasatchVCPPWrapper.cpp:287
DLL_API int wp_cancel_operation(int specIndex, int blocking)
If an acquisition is currently in progress, cancel it.
Definition: WasatchVCPPWrapper.cpp:666
DLL_API int wp_get_high_gain_mode_enable(int specIndex)
Reports whether "high-gain mode" is currently enabled on InGaAs detectors.
Definition: WasatchVCPPWrapper.cpp:657
DLL_API int wp_get_pixels(int specIndex)
Returns the number of pixels in the selected spectrometer.o.
Definition: WasatchVCPPWrapper.cpp:113
DLL_API int wp_set_logfile_path(const char *pathname, int len)
Sets a pathname for WasatchVCPP to write a debug logfile.
Definition: WasatchVCPPWrapper.cpp:380
DLL_API float wp_get_detector_gain_odd(int specIndex)
Get the current detector gain for odd InGaAs pixels.
Definition: WasatchVCPPWrapper.cpp:612
DLL_API int wp_send_control_msg(int specIndex, unsigned char bRequest, unsigned int wValue, unsigned int wIndex, unsigned char *data, int len)
Provide direct access to writing spectrometer opcodes via USB setup packets (endpoint 0 control.
Definition: WasatchVCPPWrapper.cpp:724
DLL_API int wp_get_wavelengths_float(int specIndex, float *wavelengths, int len)
Get the selected spectrometer's calibrated wavelength x-axis in nanometers as float.
Definition: WasatchVCPPWrapper.cpp:152
DLL_API int wp_set_laser_enable(int specIndex, int value)
Turns the laser on or off.
Definition: WasatchVCPPWrapper.cpp:427
DLL_API float wp_get_detector_temperature_deg_c(int specIndex)
Get the detector temperature.
Definition: WasatchVCPPWrapper.cpp:576
DLL_API int wp_get_wavelengths(int specIndex, double *wavelengths, int len)
Get the selected spectrometer's calibrated wavelength x-axis in nanometers.
Definition: WasatchVCPPWrapper.cpp:137
DLL_API int wp_get_detector_offset_odd(int specIndex)
Get the current detector offset for odd InGaAs pixels.
Definition: WasatchVCPPWrapper.cpp:630
DLL_API int wp_set_max_timeout_ms(int specIndex, int maxTimeoutMS)
Configure the maximum internal timeout when waiting on blocking USB operations.
Definition: WasatchVCPPWrapper.cpp:675
DLL_API int wp_close_spectrometer(int specIndex)
Closes the specified spectrometer.
Definition: WasatchVCPPWrapper.cpp:80
DLL_API int wp_set_detector_tec_setpoint_deg_c(int specIndex, int value)
Set the detector TEC setpoint.
Definition: WasatchVCPPWrapper.cpp:526
DLL_API int wp_get_library_version(char *value, int len)
Obtains the version number of the WasatchVCPP library itself.
Definition: WasatchVCPPWrapper.cpp:103
A proxy customer-facing class providing an object-oriented / STL-based interface to command and contr...
Definition: WasatchVCPP.h:989
void destroy()
Definition: WasatchVCPP.h:1069
bool setLogLevel(int level)
Definition: WasatchVCPP.h:1002
Spectrometer * getSpectrometer(int index)
Retrieve a handle to one Spectrometer.
Definition: WasatchVCPP.h:1043
bool closeAllSpectrometers()
Definition: WasatchVCPP.h:1056
std::string getLibraryVersion()
Definition: WasatchVCPP.h:1006
int openAllSpectrometers()
Definition: WasatchVCPP.h:1014
bool setLogfile(const std::string &pathname)
Definition: WasatchVCPP.h:998
int numberOfSpectrometers
number of spectrometers found (set by openAllSpectrometers)
Definition: WasatchVCPP.h:1081
Driver()
Instantiate a Proxy::Driver.
Definition: WasatchVCPP.h:995
A proxy customer-facing class providing an object-oriented / STL-based interface to command and contr...
Definition: WasatchVCPP.h:707
bool getDetectorTECEnable()
Definition: WasatchVCPP.h:857
int sendControlMsg(uint8_t bRequest, uint16_t wValue, uint16_t wIndex, uint8_t *data, int len)
Definition: WasatchVCPP.h:867
int getDetectorTECSetpointDegC()
Definition: WasatchVCPP.h:860
bool setDetectorGain(float value)
Definition: WasatchVCPP.h:797
float getDetectorGain()
Definition: WasatchVCPP.h:845
Spectrometer(int specIndex)
instantiated by WasatchVCPP::Proxy::openAllSpectrometers
Definition: WasatchVCPP.h:714
int pixels
number of pixels
Definition: WasatchVCPP.h:769
std::vector< double > getSpectrum()
Retrieve one spectrum from the spectrometer.
Definition: WasatchVCPP.h:910
bool getLaserEnable()
Definition: WasatchVCPP.h:842
int getDetectorOffsetOdd()
Definition: WasatchVCPP.h:854
bool setIntegrationTimeMS(unsigned long ms)
set integration time
Definition: WasatchVCPP.h:787
std::string getEEPROMFieldName(int index)
Definition: WasatchVCPP.h:936
std::map< std::string, std::string > eepromFields
a dictionary of EEPROM name-value pairs rendered as strings
Definition: WasatchVCPP.h:774
std::vector< double > wavelengths
expanded wavecal in nm
Definition: WasatchVCPP.h:776
bool setMaxTimeoutMS(int maxTimeoutMS)
Definition: WasatchVCPP.h:876
std::vector< uint8_t > getEEPROMPage(int page)
Definition: WasatchVCPP.h:920
bool setLaserEnable(bool flag)
set laser firing state
Definition: WasatchVCPP.h:793
bool setHighGainMode(bool flag)
Definition: WasatchVCPP.h:831
bool cancelOperation(bool blocking=false)
Definition: WasatchVCPP.h:884
int readControlMsg(uint8_t bRequest, uint16_t wIndex, uint8_t *data, int len)
Definition: WasatchVCPP.h:872
float excitationNM
configured laser excitation wavelength (Raman-only)
Definition: WasatchVCPP.h:778
bool setDetectorTECSetpointDegC(int value)
Definition: WasatchVCPP.h:827
bool setDetectorTECEnable(bool flag)
Definition: WasatchVCPP.h:823
std::string serialNumber
serial number
Definition: WasatchVCPP.h:771
std::string getFirmwareVersion()
Definition: WasatchVCPP.h:888
std::string getFPGAVersion()
Definition: WasatchVCPP.h:896
int specIndex
index of this spectrometer
Definition: WasatchVCPP.h:768
bool setDetectorOffset(int16_t value)
Definition: WasatchVCPP.h:815
float getDetectorTemperatureDegC()
Definition: WasatchVCPP.h:835
bool setDetectorGainOdd(float value)
Definition: WasatchVCPP.h:811
float getDetectorGainOdd()
Definition: WasatchVCPP.h:848
bool setDetectorOffsetOdd(int16_t value)
Definition: WasatchVCPP.h:819
int getMaxTimeoutMS()
Definition: WasatchVCPP.h:880
long getIntegrationTimeMS()
Definition: WasatchVCPP.h:839
std::vector< double > wavenumbers
expanded wavecal in 1/cm (Raman-only)
Definition: WasatchVCPP.h:777
bool getHighGainModeEnable()
Definition: WasatchVCPP.h:863
bool close()
release resources associated with this spectrometer
Definition: WasatchVCPP.h:748
std::string model
model name
Definition: WasatchVCPP.h:770
int getDetectorOffset()
Definition: WasatchVCPP.h:851
std::vector< float > getWavecalCoeffs()
convenience accessor
Definition: WasatchVCPP.h:945
Namespace encapsulating the internal implementation of WasatchVCPP; customers would not normally acce...
Definition: Driver.h:26