124 lines
3.3 KiB
C++
124 lines
3.3 KiB
C++
//
|
||
// Created by tangchao on 2021/11/29.
|
||
//
|
||
|
||
#include "api/seabreezeapi/SeaBreezeAPI.h"
|
||
|
||
|
||
#include <iostream>
|
||
#include "library.h"
|
||
|
||
int main()
|
||
{
|
||
std::cout << "Hello, World!" << std::endl;
|
||
OceanOptics_lib fiberImager;
|
||
fiberImager.Initialize(true,10,"FLMS15814");//QEP02975 FLMS15814
|
||
|
||
fiberImager.SetExposureTime(5000);
|
||
|
||
int exposureTime;
|
||
fiberImager.GetExposureTime(exposureTime);
|
||
std::cout << "获取的曝光时间为:" << exposureTime << std::endl;
|
||
|
||
|
||
fiberImager.SetDeviceTemperature(-8);
|
||
|
||
float fTemperature;
|
||
fiberImager.GetDeviceTemperature(fTemperature);
|
||
std::cout << "获取的仪器温度为:" << fTemperature << std::endl;
|
||
|
||
DeviceInfo Info;
|
||
fiberImager.GetDeviceInfo(Info);
|
||
std::cout << "获取的仪器类型为:" << Info.strPN << std::endl;
|
||
std::cout << "获取的仪器SN为:" << Info.strSN << std::endl;
|
||
|
||
|
||
DeviceAttribute Attr;
|
||
fiberImager.GetDeviceAttribute(Attr);
|
||
std::cout << "获取的波长个数为:" << Attr.iPixels << std::endl;
|
||
std::cout << "获取的波长为:" << std::endl;
|
||
for(int i=0;i<Attr.iPixels;i++)
|
||
{
|
||
std::cout << Attr.fWaveLengthInNM[i] << ",";
|
||
}
|
||
std::cout << std::endl;
|
||
std::cout << "获取的波长为:" << Attr.fWaveLengthInNM << std::endl;
|
||
std::cout << "获取的最大曝光时间为:" << Attr.iMaxIntegrationTimeInMS << std::endl;
|
||
std::cout << "获取的最小曝光时间为:" << Attr.iMinIntegrationTimeInMS << std::endl;
|
||
|
||
|
||
|
||
DataFrame dfData;
|
||
fiberImager.SingleShot(dfData);
|
||
std::cout << "获取的一条光谱为:" << std::endl;
|
||
for(int i=0;i<Attr.iPixels;i++)
|
||
{
|
||
std::cout << dfData.usData[i] << ",";
|
||
}
|
||
std::cout << std::endl;
|
||
std::cout << "获取的温度为:" << dfData.fTemperature << std::endl;
|
||
std::cout << "获取的曝光时间为:" << dfData.usExposureTimeInMS << std::endl;
|
||
|
||
|
||
fiberImager.Close();
|
||
|
||
return 0;
|
||
}
|
||
|
||
|
||
//int main()
|
||
//{
|
||
// int number_of_devices;
|
||
// long *device_ids;
|
||
// int i;
|
||
// int test_index;
|
||
// int flag;
|
||
// int unsupportedFeatureCount;
|
||
// int testFailureCount;
|
||
// int error = 0;
|
||
// char nameBuffer[80];
|
||
// int number_of_spectrometers;
|
||
// long *spectrometer_ids = 0;
|
||
//
|
||
//
|
||
// sbapi_initialize();
|
||
// sbapi_probe_devices();
|
||
//
|
||
// printf("Getting device count...\n"); fflush(stdout);
|
||
// number_of_devices = sbapi_get_number_of_device_ids();
|
||
//
|
||
// printf("Device count is %d\n", number_of_devices);
|
||
// if(0 == number_of_devices) {
|
||
// return 0;
|
||
// }
|
||
//
|
||
// printf("Getting device IDs...\n");
|
||
// device_ids = (long *)calloc(number_of_devices, sizeof(long));
|
||
//
|
||
// std::cout<<"ssss"<<device_ids[0];
|
||
//
|
||
// number_of_devices = sbapi_get_device_ids(device_ids, number_of_devices);
|
||
//
|
||
// flag = sbapi_open_device(device_ids[0], &error);
|
||
//
|
||
//
|
||
// number_of_spectrometers = sbapi_get_number_of_spectrometer_features(device_ids[0], &error);
|
||
//
|
||
// spectrometer_ids = (long *)calloc(10, sizeof(long));
|
||
//
|
||
// number_of_spectrometers = sbapi_get_spectrometer_features(2, &error,
|
||
// spectrometer_ids, 10);
|
||
//
|
||
// for(int i=0;i<10;i++)
|
||
// {
|
||
// std::cout<<std::endl;
|
||
// std::cout<<"ssss:"<<spectrometer_ids[i]<<std::endl;
|
||
// }
|
||
//
|
||
// printf("\t\t\tResult is %d [%s]\n", number_of_spectrometers,
|
||
// sbapi_get_error_string(error));
|
||
//
|
||
//
|
||
// std::cout<<"ssss:"<<error<<std::endl;
|
||
//}
|