进一步完善采集流程,数据帧的生成以及传输完成度0.7

This commit is contained in:
2021-12-06 17:50:39 +08:00
parent 34451f2910
commit 3de7eb3da7
48 changed files with 486 additions and 135 deletions

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_02 10:09:27,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_02 10:11:07,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_02 10:11:20,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_02 10:13:36,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_02 10:14:30,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_02 10:15:41,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 01:50:36,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 01:51:49,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 01:52:15,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:09:45,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:15:37,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:22:22,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:22:54,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:25:26,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:26:51,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:27:30,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:28:30,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:29:07,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:29:49,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:31:39,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:32:27,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:37:08,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:41:27,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 02:43:54,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:01:57,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:02:53,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:03:49,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:05:13,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:18:04,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:19:02,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:19:11,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:19:28,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:26:01,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:27:02,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:27:45,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +0,0 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_03 03:30:48,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -1 +1 @@
EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_02 10:08:00,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110, EnvironmentalContext,CaseHumidity,,CaseTemperature,,GPS_Altitude,50,GPS_Latitude,118,GPS_Longtitude,117,GPS_North,on,Location,beijing,UTCDateTime,2021_12_06 09:17:15,DownlaodAddress,http://www.iris-rs.cn,DownloadUserID,newuser,HTTPServer,,InstallationTime,2021-11-18,NameOfMaintenanceStaff,renlixin,PhoneNumberOfMaintenanceStaff,110110110,

View File

@ -7,7 +7,10 @@ UID=QEP02975
[FS1] [FS1]
Model=OSIFBeta Model=OSIFBeta
Port=-1 Port=-1
UID=FLMS15814 UID=FLMS15815
AEMax=0.85
AEMin=0.75
Depth=65535
[FS2] [FS2]
Model=Null Model=Null
[LINEAR SHUTTER] [LINEAR SHUTTER]

View File

@ -30,12 +30,13 @@ int main(int argc, char *argv[])
testdp.SetEnvironmentContex(testEC); testdp.SetEnvironmentContex(testEC);
testdp.SetManmadeEnviromentalContext(testMEC); testdp.SetManmadeEnviromentalContext(testMEC);
testdp.WriteDataFile(); //testdp.WriteDataFile();
//////////////////////////////////////////////////////////////////////////test //////////////////////////////////////////////////////////////////////////test
using namespace ZZ_MISCDEF::ZZ_RUNPARAMS; using namespace ZZ_MISCDEF::ZZ_RUNPARAMS;
CMainDataGrabber testDG; CMainDataGrabber testDG;
QThread* m_pqDataGrabberThreadHolder = new QThread(); QThread* m_pqDataGrabberThreadHolder = new QThread();
testDG.moveToThread(m_pqDataGrabberThreadHolder); testDG.moveToThread(m_pqDataGrabberThreadHolder);
testDG.SetGrabberFileProcessor(testdp);
testDG.SetGrabberParams(testp); testDG.SetGrabberParams(testp);
testDG.InitThreadStatus(); testDG.InitThreadStatus();
testDG.InitializeWorkers(); testDG.InitializeWorkers();

View File

@ -9,6 +9,8 @@ class CIrisFSBase
public: public:
//CIrisFSBase(); //CIrisFSBase();
//virtual ~CIrisFSBase()= 0; //virtual ~CIrisFSBase()= 0;
private:
//int m_iMaxDepth = 65535;
public: public:
//<2F><>ʼ<EFBFBD><CABC><EFBFBD> //<2F><>ʼ<EFBFBD><CABC><EFBFBD>
//<2F>˴<EFBFBD>stringΪָ<CEAA><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD>ocean<61><6E><EFBFBD><EFBFBD><EFBFBD>ǵIJ<C7B5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>c/c++<2B><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD> //<2F>˴<EFBFBD>stringΪָ<CEAA><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD>ocean<61><6E><EFBFBD><EFBFBD><EFBFBD>ǵIJ<C7B5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>и<EFBFBD><D0B8><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>c/c++<2B><>׼<EFBFBD><D7BC><EFBFBD><EFBFBD>

View File

@ -6,6 +6,7 @@ OceanOptics_lib::OceanOptics_lib()
{ {
m_iSpectralmeterHandle = -100; m_iSpectralmeterHandle = -100;
} }
OceanOptics_lib::~OceanOptics_lib() OceanOptics_lib::~OceanOptics_lib()
{ {
@ -22,49 +23,68 @@ int OceanOptics_lib::Initialize(bool bIsUSBMode, ZZ_U8 ucPortNumber, std::string
for (i = 0; i < SEABREEZE_MAX_DEVICES; i++) for (i = 0; i < SEABREEZE_MAX_DEVICES; i++)
{ {
//printf("\nOpening spectrometer %d.\n", i); // printf("\nOpening spectrometer %d.\n", i);
flag = seabreeze_open_spectrometer(i, &error); flag = seabreeze_open_spectrometer(i, &error);
//printf("Open spectrometer result is (%d) [%s]\n", flag, get_error_string(error)); // printf("Open spectrometer result is (%d) [%s]\n", flag, get_error_string(error));
if (0 == flag) if (0 == flag)
{ {
device_count++; device_count++;
} }
else
{
continue;
}
string sn = GetSerialNumber(i); string sn = GetSerialNumber(i);
if (strcmp(sn.c_str(), strDeviceName.c_str()) == 0) if (strcmp(sn.c_str(), strDeviceName.c_str()) == 0)
{ {
m_iSpectralmeterHandle = i; m_iSpectralmeterHandle = i;
//printf("\nfind!!!!!!!!!!!!\n"); // printf("\nfind!!!!!!!!!!!!\n");
break; break;
} }
else else
{ {
//printf("\nClosing spectrometer %d.\n", i); // printf("\nClosing spectrometer %d.\n", i);
flag = seabreeze_close_spectrometer(i, &error); flag = seabreeze_close_spectrometer(i, &error);
//printf("Close spectrometer result is (%d) [%s]\n", flag, get_error_string(error)); // printf("Close spectrometer result is (%d) [%s]\n", flag, get_error_string(error));
} }
} }
if (m_iSpectralmeterHandle == -100) if (m_iSpectralmeterHandle == -100)
{ {
//printf("\nNo!!!!!!!!!!!!\n"); // printf("\nNo!!!!!!!!!!!!\n");
return 1; return 1;
} }
seabreeze_set_trigger_mode(m_iSpectralmeterHandle, &error, 0);
//<2F><><EFBFBD>ó<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> long test = seabreeze_get_buffer_capacity_minimum(m_iSpectralmeterHandle, &error);
seabreeze_set_buffer_capacity(m_iSpectralmeterHandle, &error, test);
//seabreeze_set_trigger_mode(m_iSpectralmeterHandle, &error, 0);
//seabreeze_set_trigger_mode(m_iSpectralmeterHandle, &error, 0);
// printf("seabreeze_set_trigger_mode: Result is [%s]\n", get_error_string(error));
//<2F><><EFBFBD>ó<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
long minimum_time; long minimum_time;
minimum_time = seabreeze_get_min_integration_time_microsec(m_iSpectralmeterHandle, &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)); //printf("...Minimum is %ld microseconds, result is [%s]\n", minimum_time, get_error_string(error));
bool ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
// printf("\n-------------------û<>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
return 1;
}
if (minimum_time < 0) { if (minimum_time < 0) {
/* If there was an error, reset to a time that is supported widely. */ /* If there was an error, reset to a time that is supported widely. */
minimum_time = 15000; minimum_time = 15000;
return 1; return 1;
} }
//SetExposureTime(minimum_time); SetExposureTime(minimum_time / 1000);
return 0; return 0;
} }
@ -80,7 +100,7 @@ int OceanOptics_lib::Initialize()
for (i = 0; i < SEABREEZE_MAX_DEVICES; i++) for (i = 0; i < SEABREEZE_MAX_DEVICES; i++)
{ {
//printf("\nOpening spectrometer %d.\n", i); printf("\nOpening spectrometer %d.\n", i);
flag = seabreeze_open_spectrometer(i, &error); flag = seabreeze_open_spectrometer(i, &error);
//printf("Open spectrometer result is (%d) [%s]\n", flag, get_error_string(error)); //printf("Open spectrometer result is (%d) [%s]\n", flag, get_error_string(error));
if (0 == flag) if (0 == flag)
@ -88,25 +108,42 @@ int OceanOptics_lib::Initialize()
m_iSpectralmeterHandle = i; m_iSpectralmeterHandle = i;
break; break;
} }
else
{
continue;
}
} }
if (m_iSpectralmeterHandle == -100) if (m_iSpectralmeterHandle == -100)
{ {
//printf("\nNo!!!!!!!!!!!!\n"); printf("\nNo!!!!!!!!!!!!\n");
return 1; return 1;
} }
//<2F><><EFBFBD>ó<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1> seabreeze_set_trigger_mode(m_iSpectralmeterHandle, &error, 0);
seabreeze_set_trigger_mode(m_iSpectralmeterHandle, &error, 0);
seabreeze_set_trigger_mode(m_iSpectralmeterHandle, &error, 0);
// printf("seabreeze_set_trigger_mode: Result is [%s]\n", get_error_string(error));
//<2F><><EFBFBD>ó<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
long minimum_time; long minimum_time;
minimum_time = seabreeze_get_min_integration_time_microsec(m_iSpectralmeterHandle, &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)); //printf("...Minimum is %ld microseconds, result is [%s]\n", minimum_time, get_error_string(error));
bool ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
// printf("\n-------------------û<>ɹ<EFBFBD><C9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>\n");
return 1;
}
if (minimum_time < 0) { if (minimum_time < 0) {
/* If there was an error, reset to a time that is supported widely. */ /* If there was an error, reset to a time that is supported widely. */
minimum_time = 15000; minimum_time = 15000;
return 1;
} }
SetExposureTime(minimum_time); SetExposureTime(minimum_time / 1000);
return 0; return 0;
} }
@ -197,7 +234,7 @@ void OceanOptics_lib::Close()
int error; int error;
flag = seabreeze_close_spectrometer(m_iSpectralmeterHandle, &error); flag = seabreeze_close_spectrometer(m_iSpectralmeterHandle, &error);
//printf("Close spectrometer result is (%d) [%s]\n", flag, get_error_string(error)); // printf("Close spectrometer result is (%d) [%s]\n", flag, get_error_string(error));
} }
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲɼ<DDB2> //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲɼ<DDB2>
@ -205,7 +242,7 @@ int OceanOptics_lib::SingleShot(DataFrame &dfData)
{ {
if (m_iSpectralmeterHandle == -100) if (m_iSpectralmeterHandle == -100)
{ {
//printf("\nNo!!!!!!!!!!!!\n"); printf("\nNo!!!!!!!!!!!!\n");
return 1; return 1;
} }
@ -213,19 +250,38 @@ int OceanOptics_lib::SingleShot(DataFrame &dfData)
int flag; int flag;
int spec_length; int spec_length;
double *spectrum = 0; double *spectrum = 0;
bool ret;
//printf("\n\nGetting formatted spectrum length.\n"); // printf("\n\nGetting formatted spectrum length.\n");
spec_length = seabreeze_get_formatted_spectrum_length(m_iSpectralmeterHandle, &error); spec_length = seabreeze_get_formatted_spectrum_length(m_iSpectralmeterHandle, &error);
//printf("Get formatted spectrum_length result is (%d) [%s]\n", spec_length, get_error_string(error)); //printf("Get formatted spectrum_length result is (%d) [%s]\n", spec_length, get_error_string(error));
ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
return 1;
}
if (spec_length > 0) if (spec_length > 0)
{ {
spectrum = (double *)calloc((size_t)spec_length, sizeof(double)); spectrum = (double *)calloc((size_t)spec_length, sizeof(double));
//printf("\nGetting a formatted spectrum.\n");
seabreeze_clear_buffer(m_iSpectralmeterHandle, &error);
printf("\nGetting a formatted spectrum.\n");
flag = seabreeze_get_formatted_spectrum(m_iSpectralmeterHandle, &error, spectrum, spec_length); flag = seabreeze_get_formatted_spectrum(m_iSpectralmeterHandle, &error, spectrum, spec_length);
//printf("Get formatted spectrum result is (%d) [%s]\n", flag, get_error_string(error)); printf("\nGetting a formatted spectrum------------------------------.\n");
//printf("\tPixel value 20 is %1.2f\n", spectrum[20]); // printf("Get formatted spectrum result is (%d) [%s]\n", flag, get_error_string(error));
// printf("\tPixel value 20 is %1.2f\n", spectrum[20]);
ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
return 1;
}
for (int tmp = 0; tmp < spec_length; tmp++) for (int tmp = 0; tmp < spec_length; tmp++)
{ {
@ -249,20 +305,40 @@ int OceanOptics_lib::SingleShot(DataFrame &dfData)
//<2F><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1> //<2F><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1>
int OceanOptics_lib::SetExposureTime(int iExposureTimeInMS) int OceanOptics_lib::SetExposureTime(int iExposureTimeInMS)
{ {
iExposureTimeInMS = iExposureTimeInMS * 1000;
if (m_iSpectralmeterHandle == -100) if (m_iSpectralmeterHandle == -100)
{ {
//printf("\nNo!!!!!!!!!!!!\n"); printf("\nNo!!!!!!!!!!!!\n");
return 1; return 1;
} }
int error; int error;
seabreeze_set_integration_time_microsec(m_iSpectralmeterHandle, &error, iExposureTimeInMS); seabreeze_set_integration_time_microsec(m_iSpectralmeterHandle, &error, iExposureTimeInMS * 1000);
//printf("Set integration time result is [%s]\n", get_error_string(error)); printf("Set integration time result is [%s]\n", get_error_string(error));
bool ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
return 1;
}
m_iExposureTime = iExposureTimeInMS; m_iExposureTime = iExposureTimeInMS;
// //----------------------------------------------------------------------------------------------------------------
// int error;
// long *spectrometer_ids;
// int number_of_spectrometers;
//
// number_of_spectrometers = sbapi_get_number_of_spectrometer_features(m_iSpectralmeterHandle, &error);
// printf("\t\t\tResult is %d [%s]\n", number_of_spectrometers, sbapi_get_error_string(error));
// spectrometer_ids = (long *)calloc(number_of_spectrometers, sizeof(long));
// number_of_spectrometers = sbapi_get_spectrometer_features(m_iSpectralmeterHandle, &error, spectrometer_ids, number_of_spectrometers);
// printf("\t\t\tResult is %d [%s]\n", number_of_spectrometers, sbapi_get_error_string(error));
//
// sbapi_spectrometer_set_integration_time_micros(m_iSpectralmeterHandle, spectrometer_ids[0], &error, iExposureTimeInMS*1000);
// printf("\t\t\t\tResult is [%s]\n", sbapi_get_error_string(error));
return 0; return 0;
} }
@ -271,7 +347,7 @@ int OceanOptics_lib::GetExposureTime(int &iExposureTimeInMS)
{ {
if (m_iSpectralmeterHandle == -100) if (m_iSpectralmeterHandle == -100)
{ {
//printf("\nNo!!!!!!!!!!!!\n"); printf("\nNo!!!!!!!!!!!!\n");
return 1; return 1;
} }
@ -283,21 +359,34 @@ int OceanOptics_lib::GetExposureTime(int &iExposureTimeInMS)
//<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD> //<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>
int OceanOptics_lib::SetDeviceTemperature(float fTemperature) int OceanOptics_lib::SetDeviceTemperature(float fTemperature)
{ {
bool ret;
if (m_iSpectralmeterHandle == -100) if (m_iSpectralmeterHandle == -100)
{ {
//printf("\nNo!!!!!!!!!!!!\n"); printf("\nNo!!!!!!!!!!!!\n");
return 1; return 1;
} }
int error; int error;
//printf("\nSetting TEC temperature to -5C\n"); // printf("\nSetting TEC temperature to -5C\n");
seabreeze_set_tec_temperature(m_iSpectralmeterHandle, &error, fTemperature); seabreeze_set_tec_temperature(m_iSpectralmeterHandle, &error, fTemperature);
//printf("Set tec temperature result is [%s]\n", get_error_string(error)); // printf("Set tec temperature result is [%s]\n", get_error_string(error));
ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
return 1;
}
//printf("\nSetting TEC enable to true\n");
// printf("\nSetting TEC enable to true\n");
seabreeze_set_tec_enable(m_iSpectralmeterHandle, &error, 1); seabreeze_set_tec_enable(m_iSpectralmeterHandle, &error, 1);
//printf("Set tec enable result is [%s]\n", get_error_string(error)); // printf("Set tec enable result is [%s]\n", get_error_string(error));
ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
return 1;
}
return 0; return 0;
} }
@ -307,7 +396,7 @@ int OceanOptics_lib::GetDeviceTemperature(float &fTemperature)
{ {
if (m_iSpectralmeterHandle == -100) if (m_iSpectralmeterHandle == -100)
{ {
//printf("\nNo!!!!!!!!!!!!\n"); printf("\nNo!!!!!!!!!!!!\n");
return 1; return 1;
} }
@ -315,9 +404,14 @@ int OceanOptics_lib::GetDeviceTemperature(float &fTemperature)
int error; int error;
// usleep(1000000); // usleep(1000000);
//printf("\nGetting TEC temperature\n"); // printf("\nGetting TEC temperature\n");
temp = seabreeze_read_tec_temperature(m_iSpectralmeterHandle, &error); temp = seabreeze_read_tec_temperature(m_iSpectralmeterHandle, &error);
//printf("Read tec temperature result is %1.2f C [%s]\n", temp, get_error_string(error)); // printf("Read tec temperature result is %1.2f C [%s]\n", temp, get_error_string(error));
bool ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
return 1;
}
fTemperature = temp; fTemperature = temp;
@ -329,7 +423,7 @@ int OceanOptics_lib::GetDeviceInfo(DeviceInfo &Info)
{ {
if (m_iSpectralmeterHandle == -100) if (m_iSpectralmeterHandle == -100)
{ {
//printf("\nNo!!!!!!!!!!!!\n"); printf("\nNo!!!!!!!!!!!!\n");
return 1; return 1;
} }
@ -347,7 +441,7 @@ int OceanOptics_lib::GetDeviceAttribute(DeviceAttribute &Attr)
{ {
if (m_iSpectralmeterHandle == -100) if (m_iSpectralmeterHandle == -100)
{ {
//printf("\nNo!!!!!!!!!!!!\n"); printf("\nNo!!!!!!!!!!!!\n");
return 1; return 1;
} }
@ -356,21 +450,34 @@ int OceanOptics_lib::GetDeviceAttribute(DeviceAttribute &Attr)
int spec_length; int spec_length;
double *wls = 0; double *wls = 0;
//printf("\n\nGetting formatted spectrum length.\n"); // printf("\n\nGetting formatted spectrum length.\n");
spec_length = seabreeze_get_formatted_spectrum_length(m_iSpectralmeterHandle, &error); spec_length = seabreeze_get_formatted_spectrum_length(m_iSpectralmeterHandle, &error);
//printf("Get formatted spectrum length result is (%d) [%s]\n", spec_length, get_error_string(error)); // printf("Get formatted spectrum length result is (%d) [%s]\n", spec_length, get_error_string(error));
bool ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
return 1;
}
Attr.iPixels = spec_length; Attr.iPixels = spec_length;
Attr.iMinIntegrationTimeInMS = 0;
long minimum_time;
minimum_time = seabreeze_get_min_integration_time_microsec(m_iSpectralmeterHandle, &error);
Attr.iMinIntegrationTimeInMS = minimum_time;
Attr.iMaxIntegrationTimeInMS = 60000; Attr.iMaxIntegrationTimeInMS = 60000;
if (spec_length > 0) { if (spec_length > 0) {
wls = (double *)calloc((size_t)spec_length, sizeof(double)); wls = (double *)calloc((size_t)spec_length, sizeof(double));
//printf("\nGetting wavelengths.\n"); // printf("\nGetting wavelengths.\n");
flag = seabreeze_get_wavelengths(m_iSpectralmeterHandle, &error, wls, spec_length); flag = seabreeze_get_wavelengths(m_iSpectralmeterHandle, &error, wls, spec_length);
//printf("Get wavelengths result is (%d) [%s]\n", flag, get_error_string(error)); // printf("Get wavelengths result is (%d) [%s]\n", flag, get_error_string(error));
//printf("\tPixel 20 is wavelength %1.2f nm\n", wls[20]); // printf("\tPixel 20 is wavelength %1.2f nm\n", wls[20]);
bool ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
return 1;
}
for (int tmp = 0; tmp < spec_length; tmp++) for (int tmp = 0; tmp < spec_length; tmp++)
{ {
@ -387,15 +494,16 @@ bool OceanOptics_lib::isSuccess(char* resultStr)
{ {
if (strstr(resultStr, "Success") == NULL)//<2F><>a<EFBFBD>в<EFBFBD><D0B2><EFBFBD>b<EFBFBD><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD> if (strstr(resultStr, "Success") == NULL)//<2F><>a<EFBFBD>в<EFBFBD><D0B2><EFBFBD>b<EFBFBD><62><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڣ<EFBFBD>
{ {
cout << "not found\n";//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //cout << "not found\n";//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return true; return false;
} }
else//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD> else//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>
{ {
cout << "found\n"; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> //cout <<"found\n"; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return false; return true;
} }
} }
const char* OceanOptics_lib::get_error_string(int error) const char* OceanOptics_lib::get_error_string(int error)
{ {
static char buffer[32]; static char buffer[32];
@ -409,7 +517,13 @@ string OceanOptics_lib::GetDeviceType(int index)
int error; int error;
seabreeze_get_model(index, &error, type, sizeof(type)); seabreeze_get_model(index, &error, type, sizeof(type));
//printf("...Result is (%s) [%s]\n", type, get_error_string(error)); // printf("...Result is (%s) [%s]\n", type, get_error_string(error));
bool ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
return "";
}
type[15] = '\0'; type[15] = '\0';
string deviceType = type; string deviceType = type;
@ -423,12 +537,18 @@ string OceanOptics_lib::GetSerialNumber(int index)
int flag; int flag;
int error; int error;
//printf("\n\nGetting serial number.\n"); // printf("\n\nGetting serial number.\n");
flag = seabreeze_get_serial_number(index, &error, serial_number, 32); flag = seabreeze_get_serial_number(index, &error, serial_number, 32);
//printf("Get serial number result is (%d) [%s]\n", flag, get_error_string(error)); // printf("Get serial number result is (%d) [%s]\n", flag, get_error_string(error));
bool ret = isSuccess((char*)get_error_string(error));
if (!ret)
{
return "";
}
serial_number[31] = '\0'; serial_number[31] = '\0';
if (flag > 0) { if (flag > 0) {
//printf("\tSerial number: [%s]\n", serial_number); printf("\tSerial number: [%s]\n", serial_number);
} }
string sn = serial_number; string sn = serial_number;

Binary file not shown.

View File

@ -173,6 +173,9 @@ namespace ZZ_MISCDEF
ZZ_U8 ucDeviceModel[MAX_DEVICENUMBER_FS]; ZZ_U8 ucDeviceModel[MAX_DEVICENUMBER_FS];
int iInterface[MAX_DEVICENUMBER_FS]; int iInterface[MAX_DEVICENUMBER_FS];
std::string strSN[MAX_DEVICENUMBER_FS]; std::string strSN[MAX_DEVICENUMBER_FS];
long lDepth[MAX_DEVICENUMBER_FS];
float fMinFactor[MAX_DEVICENUMBER_FS];
float fMaxFactor[MAX_DEVICENUMBER_FS];
}FSContext; }FSContext;
typedef struct tagLinearShutterContext typedef struct tagLinearShutterContext

View File

@ -48,6 +48,15 @@
qstrTemp = m_qsDeviceConfig->value(QString("FS%1/UID").arg(i + 1), "Null").toString(); qstrTemp = m_qsDeviceConfig->value(QString("FS%1/UID").arg(i + 1), "Null").toString();
m_struDeviceContext.strSN[i] = qstrTemp.toStdString(); m_struDeviceContext.strSN[i] = qstrTemp.toStdString();
float fAEMax= m_qsDeviceConfig->value(QString("FS%1/AEMax").arg(i + 1), 0.9).toFloat();
m_struDeviceContext.fMaxFactor[i] = fAEMax;
float fAEMin = m_qsDeviceConfig->value(QString("FS%1/AEMin").arg(i + 1), 0.8).toFloat();
m_struDeviceContext.fMinFactor[i] = fAEMin;
long lDepth = m_qsDeviceConfig->value(QString("FS%1/Depth").arg(i + 1), 63219).toInt();
m_struDeviceContext.lDepth[i] = lDepth;
} }
m_struAcqPosition.iTotalPosition = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/TotalPosition"), -1).toInt(); m_struAcqPosition.iTotalPosition = m_qsDeviceConfig->value(QString("LINEAR SHUTTER/TotalPosition"), -1).toInt();

View File

@ -1,8 +1,11 @@
#include "AbstractFSController.h" #include "AbstractFSController.h"
#include "ZZ_Math_HDRONLY.h"
CAbstractFSController::CAbstractFSController(QObject* parent /*= nullptr*/) CAbstractFSController::CAbstractFSController(QObject* parent /*= nullptr*/)
{ {
m_pFSCtrl = NULL; m_pFSCtrl = NULL;
m_iThreadID = -1; m_iThreadID = -1;
m_vecDataFrameDark.clear();
m_vecDataFrameSignal.clear();
} }
CAbstractFSController::~CAbstractFSController() CAbstractFSController::~CAbstractFSController()
@ -42,11 +45,11 @@ int CAbstractFSController::InitializeFSControl()
break; break;
case DeviceModel::OSIFBeta: case DeviceModel::OSIFBeta:
m_pFSCtrl = new OceanOptics_lib; m_pFSCtrl = new OceanOptics_lib;
// if (m_pFSCtrl->Initialize(false, m_fsInfo.iInterface, m_fsInfo.strSN) !=0) if (m_pFSCtrl->Initialize(false, m_fsInfo.iInterface, m_fsInfo.strSN) !=0)
// { {
// qDebug() << "OSIFBeta Not Opened"; qDebug() << "OSIFBeta Not Opened";
// return 2; return 2;
// } }
break; break;
case DeviceModel::ISIF: case DeviceModel::ISIF:
m_pFSCtrl = new ZZ_ATPControl_Serial_Qt; m_pFSCtrl = new ZZ_ATPControl_Serial_Qt;
@ -78,36 +81,202 @@ int CAbstractFSController::InitializeFSControl()
default: default:
break; break;
} }
int iRes = m_pFSCtrl->GetDeviceAttribute(m_daDeviceAttr);
if (iRes !=0 )
{
qDebug() << "GetDeviceAttribute Failed"<< iRes;
return 4;
}
return 0; return 0;
} }
int CAbstractFSController::PerformAutoExposure() int CAbstractFSController::PerformAutoExposure()
{ {
qDebug() << "Starting PerformAutoExposure" << " Thread ID:" << m_iThreadID; qDebug() << "--------------------------Starting PerformAutoExposure" << " Thread ID:" << m_iThreadID;
QThread::msleep(5000); using namespace ZZ_MATH;
qDebug() << "Stop PerformAutoExposure" << " Thread ID:" << m_iThreadID; float fPredictedExposureTime;
int iDeviceDepth = (int)m_fsInfo.lDepth;
bool bFlagIsOverTrying = false;
bool bFlagIsLowerMinExposureTime = false;
bool bFlagIsOverMaxExposureTime = false;
bool bFlagIsAutoExposureOK = false;
bool bFlagIsAutoExposureFailed = false;
bool bIsValueOverflow = false;
bool bIsLastValueOverflow = false;
int iExposureTime = 0;
float fTempExposureTime = 0;
double fLastExposureTime = 0.1;
int iRepeatCount = 0;
//int iRes = m_pFSCtrl->SetExposureTime(1000);//need change to load from files
int iRes = 0;
if (iRes != 0)
{
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:1";
return 1;
}
while (!bFlagIsAutoExposureOK && !bFlagIsAutoExposureFailed)
{
DataFrame dfTemp;
if (iRepeatCount++ > 30)
{
bFlagIsAutoExposureFailed = true;
bFlagIsOverTrying = true;
break;
}
//m_pFSCtrl->SetExposureTime(5000);
m_pFSCtrl->GetExposureTime(iExposureTime);
//m_pFSCtrl->SetExposureTime(2500);
//fExposureTime = (float)m_daDeviceAttr.iMinIntegrationTimeInMS;
fTempExposureTime = iExposureTime;
iRes = m_pFSCtrl->SingleShot(dfTemp);
//iRes = m_pFSCtrl->SingleShot(dfTemp);
if (iRes != 0)
{
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:2";
return 2;
}
HeapSort(dfTemp.usData, m_daDeviceAttr.iPixels);
double dSum = 0;
int iCount = m_daDeviceAttr.iPixels / 100;
for (int i = 0; i < iCount; i++)
{
dSum += dfTemp.usData[i];
}
double dTemp = dSum / iCount;
if (dTemp >= iDeviceDepth * 0.99)
{
bIsValueOverflow = true;
if (!bIsLastValueOverflow)
{
iExposureTime = (float)(fLastExposureTime + iExposureTime) / 2;
}
else
{
iExposureTime = iExposureTime / 2;
}
}
else if (iDeviceDepth * m_fsInfo.fMaxFactor >= dTemp && dTemp >= iDeviceDepth * m_fsInfo.fMinFactor)
{
bFlagIsAutoExposureOK = 1;
}
else if (dTemp > iDeviceDepth * m_fsInfo.fMaxFactor)
{
bIsValueOverflow = true;
if (!bIsLastValueOverflow)
{
iExposureTime = (float)(fLastExposureTime + iExposureTime) / 2;
}
else
{
iExposureTime = iExposureTime * 3 / 4;
}
}
else if (dTemp < iDeviceDepth * m_fsInfo.fMinFactor)
{
bIsValueOverflow = false;
if (bIsLastValueOverflow)
{
iExposureTime = (float)(fLastExposureTime + iExposureTime) / 2;
}
else
{
double dFactor;
dFactor = dTemp / (iDeviceDepth * m_fsInfo.fMaxFactor);
iExposureTime = (float)(iExposureTime / dFactor);
}
if (/*fExposureTime > 100 || */iExposureTime < 10)
{
bFlagIsAutoExposureOK = false;
bFlagIsAutoExposureFailed = true;
bFlagIsLowerMinExposureTime = true;
}
}
bIsLastValueOverflow = bIsValueOverflow;
fLastExposureTime = fTempExposureTime;
if (iExposureTime > 30000)
{
bFlagIsAutoExposureOK = false;
bFlagIsAutoExposureFailed = true;
float fPredictedExposureTime = 30000;
iRes = m_pFSCtrl->SetExposureTime(30000);
if (iRes != 0)
{
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:3";
return 3;
}
bFlagIsOverMaxExposureTime = true;
break;
}
iRes = m_pFSCtrl->SetExposureTime((int)iExposureTime);
if (iRes != 0)
{
qDebug() << "Err:PerformAutoExposure Failed.Exit Code:4";
return 3;
}
else
{
qDebug() << "Success:PerformAutoExposure. Value"<< iExposureTime;
}
}
fPredictedExposureTime = iExposureTime;
qDebug() << "--------------------------Stop PerformAutoExposure" << " Thread ID:" << m_iThreadID;
//emit SignalAcqFinished(m_iThreadID, 1); //emit SignalAcqFinished(m_iThreadID, 1);
return 0; return 0;
} }
int CAbstractFSController::TakeDarkFrame() int CAbstractFSController::TakeDarkFrame()
{ {
qDebug() << "Starting TakeDarkFrame" << " Thread ID:" << m_iThreadID; qDebug() << "Starting TakeDarkFrame" << " Thread ID:" << m_iThreadID;
QThread::msleep(1000);
m_vecDataFrameDark.push_back(TakeOneFrame());
qDebug() << "Stop TakeDarkFrame" << " Thread ID:" << m_iThreadID; qDebug() << "Stop TakeDarkFrame" << " Thread ID:" << m_iThreadID;
//emit SignalAcqFinished(m_iThreadID, 1); //emit SignalAcqFinished(m_iThreadID, 1);
return 0; return 0;
} }
int CAbstractFSController::TakeSignal() int CAbstractFSController::TakeSignalFrame()
{ {
qDebug() << "Starting TakeSignal" << " Thread ID:" << m_iThreadID; qDebug() << "Starting TakeSignal" << " Thread ID:" << m_iThreadID;
QThread::msleep(5000);
m_vecDataFrameSignal.push_back(TakeOneFrame());
qDebug() << "Stop TakeSignal" << " Thread ID:" << m_iThreadID; qDebug() << "Stop TakeSignal" << " Thread ID:" << m_iThreadID;
//emit SignalAcqFinished(m_iThreadID, 1); //emit SignalAcqFinished(m_iThreadID, 1);
return 0; return 0;
} }
DataFrame CAbstractFSController::TakeOneFrame()
{
DataFrame dfTemp;
int iRes = m_pFSCtrl->SingleShot(dfTemp);
if (iRes != 0)
{
qDebug() << "Err. SingleShot" << " Thread ID:" << m_iThreadID;
}
return dfTemp;
}
int CAbstractFSController::SaveDataFile() int CAbstractFSController::SaveDataFile()
{ {
return 0; return 0;
@ -123,7 +292,7 @@ int CAbstractFSController::StartAcquisitionSignal()
// m_pFSCtrl->GetExposureTime(iii); // m_pFSCtrl->GetExposureTime(iii);
// m_pFSCtrl->SingleShot(struDF); // m_pFSCtrl->SingleShot(struDF);
PerformAutoExposure(); PerformAutoExposure();
TakeSignal(); TakeSignalFrame();
qDebug() << "Stop acq Signal" << " Thread ID:" << m_iThreadID; qDebug() << "Stop acq Signal" << " Thread ID:" << m_iThreadID;
emit SignalAcqFinished_Signal(m_iThreadID, 1); emit SignalAcqFinished_Signal(m_iThreadID, 1);
@ -145,5 +314,17 @@ int CAbstractFSController::StopAcquisition()
return 0; return 0;
} }
int CAbstractFSController::ClearBuffer()
{
m_vecDataFrameDark.clear();
m_vecDataFrameSignal.clear();
return 0;
}
int CAbstractFSController::GetBuffer(std::vector<DataFrame> *pvecDataFrameDark, std::vector<DataFrame> *pvecDataFrameSignal)
{
pvecDataFrameDark = &m_vecDataFrameDark;
pvecDataFrameSignal = &m_vecDataFrameSignal;
return 0;
}

View File

@ -3,12 +3,16 @@
#include "ATPControl_Serial_QT.h" #include "ATPControl_Serial_QT.h"
#include "OControl_USB.h" #include "OControl_USB.h"
#include <atomic> #include <atomic>
#include <vector>
typedef struct tagFSInfo typedef struct tagFSInfo
{ {
ZZ_U8 ucDeviceModel; ZZ_U8 ucDeviceModel;
int iInterface; int iInterface;
std::string strSN; std::string strSN;
long lDepth;
float fMinFactor;
float fMaxFactor;
}FSInfo; }FSInfo;
class CAbstractFSController :public QObject class CAbstractFSController :public QObject
@ -30,18 +34,24 @@ private:
CIrisFSBase *m_pFSCtrl; CIrisFSBase *m_pFSCtrl;
int m_iThreadID; int m_iThreadID;
FSInfo m_fsInfo; FSInfo m_fsInfo;
DataFrame m_dfDark,m_dfSignal; //DataFrame m_dfDark,m_dfSignal;
std::vector<DataFrame> m_vecDataFrameDark, m_vecDataFrameSignal;
DeviceAttribute m_daDeviceAttr;
private: private:
int PerformAutoExposure(); int PerformAutoExposure();
int TakeDarkFrame(); int TakeDarkFrame();
int TakeSignal(); int TakeSignalFrame();
DataFrame TakeOneFrame();
int SaveDataFile(); int SaveDataFile();
public slots: public slots:
virtual int StartAcquisitionSignal(); virtual int StartAcquisitionSignal();
virtual int StartAcquisitionDark(); virtual int StartAcquisitionDark();
virtual int StopAcquisition(); virtual int StopAcquisition();
virtual int ClearBuffer();
virtual int GetBuffer(std::vector<DataFrame> *pvecDataFrameDark, std::vector<DataFrame> *pvecDataFrameSignal);
signals: signals:
void SignalAcqStarted(); void SignalAcqStarted();

View File

@ -59,6 +59,12 @@ int CMainDataGrabber::SetGrabberParams(RunTimeGrabberParams struGrabberRTParams)
return 0; return 0;
} }
int CMainDataGrabber::SetGrabberFileProcessor(DataFileProcessor &dfpSaver)
{
m_pdfpSaver = &dfpSaver;
return 0;
}
int CMainDataGrabber::InitThreadStatus() int CMainDataGrabber::InitThreadStatus()
{ {
if (m_piFlagCaptureThreadStatus_Signal!=NULL) if (m_piFlagCaptureThreadStatus_Signal!=NULL)
@ -95,6 +101,9 @@ int CMainDataGrabber::InitializeWorkers()
fsInfo.iInterface = m_struDeviceContext.iInterface[i]; fsInfo.iInterface = m_struDeviceContext.iInterface[i];
fsInfo.ucDeviceModel = m_struDeviceContext.ucDeviceModel[i]; fsInfo.ucDeviceModel = m_struDeviceContext.ucDeviceModel[i];
fsInfo.strSN = m_struDeviceContext.strSN[i]; fsInfo.strSN = m_struDeviceContext.strSN[i];
fsInfo.fMaxFactor = m_struDeviceContext.fMaxFactor[i];
fsInfo.fMinFactor = m_struDeviceContext.fMinFactor[i];
fsInfo.lDepth = m_struDeviceContext.lDepth[i];
CAbstractFSController* m_pWorkThread = new CAbstractFSController; CAbstractFSController* m_pWorkThread = new CAbstractFSController;
m_pWorkThread->SetRunParas(i, fsInfo); m_pWorkThread->SetRunParas(i, fsInfo);
@ -282,40 +291,86 @@ int CMainDataGrabber::GrabOnceFinished()
int CMainDataGrabber::OnTimeCounter() int CMainDataGrabber::OnTimeCounter()
{ {
if (m_iFlagIsCapturing)
if (m_iFlagIsCapturing) {
{ qDebug() << "Fatal Thread Err.";
qDebug() << "-------------------------------------------busy"; return 1000;
return 0; }
} m_iFlagIsCapturing = 1;
m_iFlagIsCapturing = 1;
m_struAcqPosSetting.iTotalPosition = 2;
//m_pdfpSaver->WriteDataFile();
for (ZZ_U8 i = 0; i < m_struDeviceContext.ucDeviceNumber; i++)
{
m_pControlThread[i]->ClearBuffer();
}
for (int i=0;i< m_struAcqPosSetting.iTotalPosition-1;i++)
{
////move to
m_struAcqPosSetting.iPosition[i + 1];
m_iFlagIsCapturing_Signal = 1;
emit SignalStartGrabOnce_Signal();
while (m_iFlagIsCapturing_Signal)
{
Delay_MSec(1000);
}
////move to
m_struAcqPosSetting.iPosition[0];
m_iFlagIsCapturing_Dark = 1;
emit SignalStartGrabOnce_Dark();
while (m_iFlagIsCapturing_Dark)
{
Delay_MSec(1000);
}
}
std::vector<DataFrame> test,test1;
for (ZZ_U8 i = 0; i < m_struDeviceContext.ucDeviceNumber; i++)
{
m_pControlThread[i]->GetBuffer(&test, &test1);
}
// qDebug() << "-------------------------------------------busy" << QTime::currentTime().toString();
// QThread::msleep(5000);
// return 0;
// if (m_iFlagIsCapturing)
// {
//
// }
// m_iFlagIsCapturing = 1;
//qDebug() << "-------------------------------------------return"; //qDebug() << "-------------------------------------------return";
//return 1; //return 1;
for (int i = 0; i < 5; i++) // for (int i = 0; i < 5; i++)
{ // {
m_iFlagIsCapturing_Signal = 1; // m_iFlagIsCapturing_Signal = 1;
emit SignalStartGrabOnce_Signal(); // emit SignalStartGrabOnce_Signal();
while (m_iFlagIsCapturing_Signal) // while (m_iFlagIsCapturing_Signal)
{ // {
Delay_MSec(1000); // //Delay_MSec(1000);
//QThread::msleep(1000); // QThread::msleep(100);
qDebug() << "msleep" << 1000; // QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
} // //qDebug() << "msleep" << 1000;
// }
m_iFlagIsCapturing_Dark = 1; //
emit SignalStartGrabOnce_Dark(); // m_iFlagIsCapturing_Dark = 1;
while (m_iFlagIsCapturing_Dark) // emit SignalStartGrabOnce_Dark();
{ // while (m_iFlagIsCapturing_Dark)
Delay_MSec(1000); // {
//QThread::msleep(1000); // Delay_MSec(1000);
qDebug() << "msleep" << 1000; // QThread::msleep(100);
} // QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
// //qDebug() << "msleep" << 1000;
} // }
qDebug() << "for quit"; //
// }
// qDebug() << "for quit";
emit SignalGrabOnceFinished(); //
//
// emit SignalGrabOnceFinished();
return 0; return 0;
} }

View File

@ -2,6 +2,7 @@
#include"pch.h" #include"pch.h"
#include <vector> #include <vector>
#include "AbstractFSController.h" #include "AbstractFSController.h"
#include "DataFileProcessor.h"
using namespace std; using namespace std;
using namespace ZZ_MISCDEF::ZZ_RUNPARAMS; using namespace ZZ_MISCDEF::ZZ_RUNPARAMS;
@ -26,7 +27,8 @@ private:
int m_iFlagIsCapturing_Signal; int m_iFlagIsCapturing_Signal;
int m_iFlagIsCapturing_Dark; int m_iFlagIsCapturing_Dark;
DataFileProcessor* m_pdfpSaver;
FSContext m_struDeviceContext; FSContext m_struDeviceContext;
LSContext m_struLinearShutterContext; LSContext m_struLinearShutterContext;
AcqPosSettings m_struAcqPosSetting; AcqPosSettings m_struAcqPosSetting;
@ -39,6 +41,7 @@ private:
public: public:
//Call this first //Call this first
int SetGrabberParams(RunTimeGrabberParams struGrabberRTParams); int SetGrabberParams(RunTimeGrabberParams struGrabberRTParams);
int SetGrabberFileProcessor(DataFileProcessor &dfpSaver);
int InitThreadStatus(); int InitThreadStatus();
int InitializeWorkers(); int InitializeWorkers();