使用SeaBreezeWrapper.h完成海洋光学仪器控制类
This commit is contained in:
@ -15,28 +15,28 @@ public:
|
|||||||
//0Ϊ<30><EFBFBD><DEB4><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>뷵<EFBFBD>ز<EFBFBD>ֵͬ
|
//0Ϊ<30><EFBFBD><DEB4><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>뷵<EFBFBD>ز<EFBFBD>ֵͬ
|
||||||
virtual int Initialize(bool bIsUSBMode,ZZ_U8 ucPortNumber,std::string strDeviceName) = 0;
|
virtual int Initialize(bool bIsUSBMode,ZZ_U8 ucPortNumber,std::string strDeviceName) = 0;
|
||||||
|
|
||||||
// //<2F>ر<EFBFBD><D8B1>豸
|
//<2F>ر<EFBFBD><D8B1>豸
|
||||||
// virtual void Close() = 0;
|
virtual void Close() = 0;
|
||||||
//
|
|
||||||
// //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲɼ<DDB2>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲɼ<DDB2>
|
||||||
// virtual int SingleShot(DataFrame &dfData) = 0;
|
virtual int SingleShot(DataFrame &dfData) = 0;
|
||||||
//
|
|
||||||
// //<2F><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1>
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1>
|
||||||
// virtual int SetExposureTime(int iExposureTimeInMS) = 0;
|
virtual int SetExposureTime(int iExposureTimeInMS) = 0;
|
||||||
//
|
|
||||||
// //<2F><>ȡ<EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><>ȡ<EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
// virtual int GetExposureTime(int &iExposureTimeInMS) = 0;
|
virtual int GetExposureTime(int &iExposureTimeInMS) = 0;
|
||||||
//
|
|
||||||
// //<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>¶<EFBFBD>
|
//<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>¶<EFBFBD>
|
||||||
// virtual int SetDeviceTemperature(float fTemperature) = 0;
|
virtual int SetDeviceTemperature(float fTemperature) = 0;
|
||||||
//
|
|
||||||
// //<2F><>ȡ<EFBFBD>¶<EFBFBD><C2B6><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><>ȡ<EFBFBD>¶<EFBFBD><C2B6><EFBFBD><EFBFBD><EFBFBD>
|
||||||
// virtual int GetDeviceTemperature(float &fTemperature) = 0;
|
virtual int GetDeviceTemperature(float &fTemperature) = 0;
|
||||||
//
|
|
||||||
// //<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8>Ϣ
|
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8>Ϣ
|
||||||
// virtual int GetDeviceInfo(DeviceInfo &Info) = 0;
|
virtual int GetDeviceInfo(DeviceInfo &Info) = 0;
|
||||||
//
|
|
||||||
// //<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
// virtual int GetDeviceAttribute(DeviceAttribute &Attr) = 0;
|
virtual int GetDeviceAttribute(DeviceAttribute &Attr) = 0;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -22,12 +22,12 @@ namespace ZZ_MISCDEF
|
|||||||
ZZ_U16 usExposureTimeInMS;
|
ZZ_U16 usExposureTimeInMS;
|
||||||
ZZ_U16 usData[4096];
|
ZZ_U16 usData[4096];
|
||||||
float fTemperature;
|
float fTemperature;
|
||||||
double dTimes = 0;
|
double dTimes = 0;//
|
||||||
}DataFrame;
|
}DataFrame;
|
||||||
|
|
||||||
typedef struct tagDeviceInfo
|
typedef struct tagDeviceInfo
|
||||||
{
|
{
|
||||||
std::string strPN;
|
std::string strPN;//
|
||||||
std::string strSN;
|
std::string strSN;
|
||||||
}DeviceInfo;
|
}DeviceInfo;
|
||||||
|
|
||||||
|
@ -1,79 +1,282 @@
|
|||||||
#include "library.h"
|
#include "library.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
//void hello() {
|
//void hello() {
|
||||||
// std::cout << "Hello, World!" << std::endl;
|
// std::cout << "Hello, World!" << std::endl;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//ʹ<><CAB9>ͷ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>#include "api/SeaBreezeWrapper.h"
|
||||||
int OceanOptics_lib::Initialize(bool bIsUSBMode,ZZ_U8 ucPortNumber,std::string strDeviceName)
|
int OceanOptics_lib::Initialize(bool bIsUSBMode,ZZ_U8 ucPortNumber,std::string strDeviceName)
|
||||||
{
|
{
|
||||||
int number_of_devices;
|
|
||||||
long *device_ids;
|
|
||||||
int i;
|
|
||||||
int flag;
|
int flag;
|
||||||
int error = 0;
|
int error;
|
||||||
char nameBuffer[80];//tangchao
|
char type[16];
|
||||||
|
int device_count = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for(i = 0; i < SEABREEZE_MAX_DEVICES; i++)
|
||||||
|
{
|
||||||
|
printf("\nOpening spectrometer %d.\n", i);
|
||||||
|
flag = seabreeze_open_spectrometer(i, &error);
|
||||||
|
printf("...Result is (%d) [%s]\n", flag, get_error_string(error));
|
||||||
|
if(0 == flag)
|
||||||
|
{
|
||||||
|
device_count++;
|
||||||
|
}
|
||||||
|
string sn = GetSerialNumber(i);
|
||||||
|
|
||||||
/* Give the driver a chance to initialize itself */
|
if(strcmp(sn.c_str(),strDeviceName.c_str())==0)
|
||||||
sbapi_initialize();
|
{
|
||||||
|
m_iSpectralmeterHandle = i;
|
||||||
printf("Probing for devices...\n"); fflush(stdout);
|
printf("\nfind!!!!!!!!!!!!\n");
|
||||||
sbapi_probe_devices();
|
break;
|
||||||
|
}
|
||||||
printf("Getting device count...\n"); fflush(stdout);
|
|
||||||
number_of_devices = sbapi_get_number_of_device_ids();
|
|
||||||
std::cout<<"Device count is "<< number_of_devices <<std::endl;
|
|
||||||
if(0 == number_of_devices) {
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Getting device IDs...\n");
|
// for(i = 0; i < device_count; i++)
|
||||||
device_ids = (long *)calloc(number_of_devices, sizeof(long));
|
// {
|
||||||
number_of_devices = sbapi_get_device_ids(device_ids, number_of_devices);
|
// printf("\nGetting device %d name.\n", i);
|
||||||
printf("Got %d device ID%s.\n", number_of_devices, number_of_devices == 1 ? "" : "s"); fflush(stdout);
|
// seabreeze_get_model(i, &error, type, sizeof(type));
|
||||||
|
// printf("...Result is (%s) [%s]\n", type, get_error_string(error));
|
||||||
|
//
|
||||||
|
// GetSerialNumber(i);
|
||||||
|
// }
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for(i = 0; i < number_of_devices; i++)
|
//ʹ<><CAB9>ͷ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>#include "api/seabreezeapi/SeaBreezeAPI.h"
|
||||||
{
|
//int OceanOptics_lib::Initialize(bool bIsUSBMode,ZZ_U8 ucPortNumber,std::string strDeviceName)
|
||||||
printf("%d: Device 0x%02lX:\n", i, device_ids[i]);
|
//{
|
||||||
printf("\tGetting device type...\n");
|
// int number_of_devices;
|
||||||
flag = sbapi_get_device_type(device_ids[i], &error, nameBuffer, 79);
|
// long *device_ids;
|
||||||
printf("\t\tResult is (%d) [%s]\n", flag, sbapi_get_error_string(error));
|
// int i;
|
||||||
if(flag > 0) {
|
// int flag;
|
||||||
printf("\tDevice type: [%s]\n", nameBuffer);
|
// int error = 0;
|
||||||
|
// char nameBuffer[80];
|
||||||
|
// char *serialNumber;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//// /* Give the driver a chance to initialize itself */
|
||||||
|
//// sbapi_initialize();
|
||||||
|
//
|
||||||
|
// printf("Probing for devices...\n"); fflush(stdout);
|
||||||
|
// sbapi_probe_devices();
|
||||||
|
//
|
||||||
|
// printf("Getting device count...\n"); fflush(stdout);
|
||||||
|
// number_of_devices = sbapi_get_number_of_device_ids();
|
||||||
|
// std::cout<<"Device count is "<< number_of_devices <<std::endl;
|
||||||
|
// if(0 == number_of_devices) {
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// printf("Getting device IDs...\n");
|
||||||
|
// device_ids = (long *)calloc(number_of_devices, sizeof(long));
|
||||||
|
// number_of_devices = sbapi_get_device_ids(device_ids, number_of_devices);
|
||||||
|
// printf("Got %d device ID%s.\n", number_of_devices, number_of_devices == 1 ? "" : "s"); fflush(stdout);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// for(i = 0; i < number_of_devices; i++)
|
||||||
|
// {
|
||||||
|
// printf("%d: Device 0x%02lX:\n", i, device_ids[i]);
|
||||||
|
//// printf("\tGetting device type...\n");
|
||||||
|
// flag = sbapi_get_device_type(device_ids[i], &error, nameBuffer, 79);
|
||||||
|
//// printf("\t\tResult is (%d) [%s]\n", flag, sbapi_get_error_string(error));
|
||||||
|
// if(flag > 0) {
|
||||||
|
// printf("\tDevice type: [%s]\n", nameBuffer);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// serialNumber = GetSerialNumber(device_ids[i]);
|
||||||
|
// serialNumber = GetSerialNumber(device_ids[i]);
|
||||||
|
//
|
||||||
|
// printf("\tSerial number tc: [%s]\n", serialNumber);
|
||||||
|
//
|
||||||
|
//// /* Open the device */
|
||||||
|
//// printf("\tAttempting to open:\n");
|
||||||
|
//// flag = sbapi_open_device(device_ids[i], &error);
|
||||||
|
//// printf("\t\tResult is (%d) [%s]\n", flag, sbapi_get_error_string(error));
|
||||||
|
////
|
||||||
|
//// // jump to the next iteration if there was a problem
|
||||||
|
//// if(flag != 0) {
|
||||||
|
//// continue;
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// // log deviations
|
||||||
|
//// unsupportedFeatureCount=0;
|
||||||
|
//// testFailureCount=0;
|
||||||
|
////
|
||||||
|
//// /* Test the device */
|
||||||
|
//// for(test_index = 0; test_index < __test_function_count; test_index++) {
|
||||||
|
//// /* Invoke each of the test functions against this device */
|
||||||
|
//// __test_functions[test_index](device_ids[i], &unsupportedFeatureCount, &testFailureCount);
|
||||||
|
//// }
|
||||||
|
////
|
||||||
|
//// /* Close the device */
|
||||||
|
//// printf("\tAttempting to close:\n");
|
||||||
|
//// sbapi_close_device(device_ids[i], &error);
|
||||||
|
//// printf("\t\tResult is (%d) [%s]\n", flag, sbapi_get_error_string(error));
|
||||||
|
//// printf("%d: Device 0x%02lX: \n\tNumber of unsupported features = %d\n\tNumber of test failures = %d\n", i, device_ids[i], unsupportedFeatureCount, testFailureCount);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// flag = sbapi_get_device_type(device_ids[i], &error, nameBuffer, 79);
|
||||||
|
//
|
||||||
|
// return 1;
|
||||||
|
//}
|
||||||
|
|
||||||
|
//<2F>ر<EFBFBD><D8B1>豸
|
||||||
|
void OceanOptics_lib::Close()
|
||||||
|
{
|
||||||
|
int flag;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
flag = seabreeze_close_spectrometer(m_iSpectralmeterHandle, &error);
|
||||||
|
printf("...Result is (%d) [%s]\n", flag, get_error_string(error));
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲɼ<DDB2>
|
||||||
|
int OceanOptics_lib::SingleShot(DataFrame &dfData)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
int flag;
|
||||||
|
int spec_length;
|
||||||
|
double *spectrum = 0;
|
||||||
|
|
||||||
|
printf("\n\nGetting formatted spectrum length.\n");
|
||||||
|
spec_length = seabreeze_get_formatted_spectrum_length(m_iSpectralmeterHandle, &error);
|
||||||
|
printf("...Result is (%d) [%s]\n", spec_length, get_error_string(error));
|
||||||
|
|
||||||
|
if(spec_length > 0) {
|
||||||
|
spectrum = (double *)calloc((size_t)spec_length, sizeof(double));
|
||||||
|
|
||||||
|
printf("\nGetting a formatted spectrum.\n");
|
||||||
|
flag = seabreeze_get_formatted_spectrum(m_iSpectralmeterHandle, &error, spectrum, spec_length);
|
||||||
|
printf("...Result is (%d) [%s]\n", flag, get_error_string(error));
|
||||||
|
printf("\tPixel value 20 is %1.2f\n", spectrum[20]);
|
||||||
|
|
||||||
|
for(int tmp = 0; tmp<spec_length; tmp++)
|
||||||
|
{
|
||||||
|
dfData.usData[tmp]=spectrum[tmp];
|
||||||
}
|
}
|
||||||
|
|
||||||
// /* Open the device */
|
int exposureTimeInMS;
|
||||||
// printf("\tAttempting to open:\n");
|
GetExposureTime(exposureTimeInMS);
|
||||||
// flag = sbapi_open_device(device_ids[i], &error);
|
dfData.usExposureTimeInMS = exposureTimeInMS;
|
||||||
// printf("\t\tResult is (%d) [%s]\n", flag, sbapi_get_error_string(error));
|
|
||||||
//
|
float temperature;
|
||||||
// // jump to the next iteration if there was a problem
|
GetDeviceTemperature(temperature);
|
||||||
// if(flag != 0) {
|
dfData.fTemperature = temperature;
|
||||||
// continue;
|
|
||||||
// }
|
free(spectrum);
|
||||||
//
|
|
||||||
// // log deviations
|
|
||||||
// unsupportedFeatureCount=0;
|
|
||||||
// testFailureCount=0;
|
|
||||||
//
|
|
||||||
// /* Test the device */
|
|
||||||
// for(test_index = 0; test_index < __test_function_count; test_index++) {
|
|
||||||
// /* Invoke each of the test functions against this device */
|
|
||||||
// __test_functions[test_index](device_ids[i], &unsupportedFeatureCount, &testFailureCount);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /* Close the device */
|
|
||||||
// printf("\tAttempting to close:\n");
|
|
||||||
// sbapi_close_device(device_ids[i], &error);
|
|
||||||
// printf("\t\tResult is (%d) [%s]\n", flag, sbapi_get_error_string(error));
|
|
||||||
// printf("%d: Device 0x%02lX: \n\tNumber of unsupported features = %d\n\tNumber of test failures = %d\n", i, device_ids[i], unsupportedFeatureCount, testFailureCount);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
flag = sbapi_get_device_type(device_ids[i], &error, nameBuffer, 79);
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1>
|
||||||
|
int OceanOptics_lib::SetExposureTime(int iExposureTimeInMS)
|
||||||
|
{
|
||||||
|
int flag;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
seabreeze_set_integration_time_microsec(m_iSpectralmeterHandle, &error, iExposureTimeInMS);
|
||||||
|
printf("...Result is [%s]\n", get_error_string(error));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><>ȡ<EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
int OceanOptics_lib::GetExposureTime(int &iExposureTimeInMS)
|
||||||
|
{
|
||||||
|
long minimum_time;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
minimum_time = seabreeze_get_min_integration_time_microsec(m_iSpectralmeterHandle, &error);
|
||||||
|
printf("...Minimum is %ld microseconds, result is [%s]\n", minimum_time, get_error_string(error));
|
||||||
|
if(minimum_time < 0) {
|
||||||
|
/* If there was an error, reset to a time that is supported widely. */
|
||||||
|
minimum_time = 15000;
|
||||||
|
}
|
||||||
|
|
||||||
|
iExposureTimeInMS = minimum_time;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>¶<EFBFBD>
|
||||||
|
int OceanOptics_lib::SetDeviceTemperature(float fTemperature)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
|
||||||
|
printf("\nSetting TEC temperature to -5C\n");
|
||||||
|
seabreeze_set_tec_temperature(m_iSpectralmeterHandle, &error, fTemperature);
|
||||||
|
printf("...Result is [%s]\n", get_error_string(error));
|
||||||
|
|
||||||
|
printf("\nSetting TEC enable to true\n");
|
||||||
|
seabreeze_set_tec_enable(m_iSpectralmeterHandle, &error, 1);
|
||||||
|
printf("...Result is [%s]\n", get_error_string(error));
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><>ȡ<EFBFBD>¶<EFBFBD><C2B6><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
int OceanOptics_lib::GetDeviceTemperature(float &fTemperature)
|
||||||
|
{
|
||||||
|
double temp;
|
||||||
|
int error;
|
||||||
|
|
||||||
|
// usleep(1000000);
|
||||||
|
printf("\nGetting TEC temperature\n");
|
||||||
|
temp = seabreeze_read_tec_temperature(m_iSpectralmeterHandle, &error);
|
||||||
|
printf("...Result is %1.2f C [%s]\n", temp, get_error_string(error));
|
||||||
|
|
||||||
|
fTemperature = temp;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8>Ϣ
|
||||||
|
int OceanOptics_lib::GetDeviceInfo(DeviceInfo &Info)
|
||||||
|
{
|
||||||
|
string sn = GetSerialNumber(m_iSpectralmeterHandle);
|
||||||
|
Info.strSN = sn;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
|
int OceanOptics_lib::GetDeviceAttribute(DeviceAttribute &Attr)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
int flag;
|
||||||
|
int spec_length;
|
||||||
|
double *wls = 0;
|
||||||
|
|
||||||
|
printf("\n\nGetting formatted spectrum length.\n");
|
||||||
|
spec_length = seabreeze_get_formatted_spectrum_length(m_iSpectralmeterHandle, &error);
|
||||||
|
printf("...Result is (%d) [%s]\n", spec_length, get_error_string(error));
|
||||||
|
|
||||||
|
Attr.iPixels = spec_length;
|
||||||
|
Attr.iMinIntegrationTimeInMS = 0;
|
||||||
|
Attr.iMaxIntegrationTimeInMS = 60000;
|
||||||
|
|
||||||
|
if(spec_length > 0) {
|
||||||
|
wls = (double *)calloc((size_t)spec_length, sizeof(double));
|
||||||
|
|
||||||
|
printf("\nGetting wavelengths.\n");
|
||||||
|
flag = seabreeze_get_wavelengths(m_iSpectralmeterHandle, &error, wls, spec_length);
|
||||||
|
printf("...Result is (%d) [%s]\n", flag, get_error_string(error));
|
||||||
|
printf("\tPixel 20 is wavelength %1.2f nm\n", wls[20]);
|
||||||
|
|
||||||
|
for(int tmp = 0; tmp<spec_length; tmp++)
|
||||||
|
{
|
||||||
|
Attr.fWaveLengthInNM[tmp]=wls[tmp];
|
||||||
|
}
|
||||||
|
|
||||||
|
free(wls);
|
||||||
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -85,9 +288,9 @@ const char* OceanOptics_lib::get_error_string(int error)
|
|||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OceanOptics_lib::read_serial_number_test(int index)
|
string OceanOptics_lib::GetSerialNumber(int index)
|
||||||
{
|
{
|
||||||
char serial_number[32];
|
static char serial_number[32];//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>static<69><63><EFBFBD>˱<EFBFBD><CBB1><EFBFBD><EFBFBD>ᶨ<EFBFBD><E1B6A8><EFBFBD><EFBFBD>stack<63><6B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>غ<D8BA><F3A3ACBE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
int flag;
|
int flag;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
@ -98,4 +301,8 @@ void OceanOptics_lib::read_serial_number_test(int index)
|
|||||||
if(flag > 0) {
|
if(flag > 0) {
|
||||||
printf("\tSerial number: [%s]\n", serial_number);
|
printf("\tSerial number: [%s]\n", serial_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string sn = serial_number;
|
||||||
|
|
||||||
|
return sn;
|
||||||
}
|
}
|
||||||
|
@ -1,53 +1,59 @@
|
|||||||
#ifndef OCEAN_LIB_LIBRARY_H
|
#ifndef OCEAN_LIB_LIBRARY_H
|
||||||
#define OCEAN_LIB_LIBRARY_H
|
#define OCEAN_LIB_LIBRARY_H
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <cstdio>
|
||||||
#include <stdlib.h>
|
#include <cstdlib>
|
||||||
#include <sys/time.h>
|
#include <ctime>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "api/SeaBreezeWrapper.h"
|
#include "api/SeaBreezeWrapper.h"
|
||||||
|
|
||||||
#include "IrisFiberSpectrometerBase.h"
|
#include "IrisFiberSpectrometerBase.h"
|
||||||
#include "api/seabreezeapi/SeaBreezeAPI.h"
|
//#include "api/seabreezeapi/SeaBreezeAPI.h"
|
||||||
|
|
||||||
|
|
||||||
//void hello();
|
//void hello();
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
class OceanOptics_lib:public CIrisFSBase
|
class OceanOptics_lib:public CIrisFSBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private:
|
||||||
|
int m_iSpectralmeterHandle;
|
||||||
|
DeviceInfo m_deviceInfo;
|
||||||
public:
|
public:
|
||||||
//初始化设备
|
//初始化设备
|
||||||
//此处string为指明连接哪个ocean光谱仪的参数,可自行更换为其他c/c++标准类型
|
//此处string为指明连接哪个ocean光谱仪的参数,可自行更换为其他c/c++标准类型
|
||||||
//0为无错误,不同错误请返回不同值
|
//0为无错误,不同错误请返回不同值
|
||||||
int Initialize(bool bIsUSBMode,ZZ_U8 ucPortNumber,std::string strDeviceName);
|
int Initialize(bool bIsUSBMode,ZZ_U8 ucPortNumber,std::string strDeviceName);
|
||||||
//
|
|
||||||
// //关闭设备
|
//关闭设备
|
||||||
// void Close();
|
void Close();
|
||||||
//
|
|
||||||
// //单次数据采集
|
//单次数据采集
|
||||||
// int SingleShot(DataFrame &dfData);
|
int SingleShot(DataFrame &dfData);
|
||||||
//
|
|
||||||
// //设置曝光时间
|
//设置曝光时间
|
||||||
// int SetExposureTime(int iExposureTimeInMS);
|
int SetExposureTime(int iExposureTimeInMS);
|
||||||
//
|
|
||||||
// //获取曝光时间设置
|
//获取曝光时间设置
|
||||||
// int GetExposureTime(int &iExposureTimeInMS);
|
int GetExposureTime(int &iExposureTimeInMS);
|
||||||
//
|
|
||||||
// //设置目标温度
|
//设置目标温度
|
||||||
// int SetDeviceTemperature(float fTemperature);
|
int SetDeviceTemperature(float fTemperature);
|
||||||
//
|
|
||||||
// //获取温度设置
|
//获取温度设置
|
||||||
// int GetDeviceTemperature(float &fTemperature);
|
int GetDeviceTemperature(float &fTemperature);
|
||||||
//
|
|
||||||
// //获取设备信息
|
//获取设备信息
|
||||||
// int GetDeviceInfo(DeviceInfo &Info);
|
int GetDeviceInfo(DeviceInfo &Info);//ok
|
||||||
//
|
|
||||||
// //获取设备特征数据
|
//获取设备特征数据
|
||||||
// int GetDeviceAttribute(DeviceAttribute &Attr);
|
int GetDeviceAttribute(DeviceAttribute &Attr);
|
||||||
|
|
||||||
//tc
|
//tc
|
||||||
static const char* get_error_string(int error);
|
static const char* get_error_string(int error);
|
||||||
void read_serial_number_test(int index);
|
string GetSerialNumber(int index);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user