mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-18 11:29:43 +08:00
Merge remote-tracking branch 'origin/zhangzhuo'
This commit is contained in:
@ -13,7 +13,7 @@ file(GLOB_RECURSE HDR_LIST "source/*.h")
|
||||
file(GLOB_RECURSE SRC_LIST "source/*.cpp")
|
||||
|
||||
include_directories("source")
|
||||
include_directories("source/ATP")
|
||||
include_directories("source/FS")
|
||||
include_directories("source/Logger")
|
||||
include_directories("source/ZZ_SDK")
|
||||
include_directories("source/Settings")
|
||||
|
1
config/config.json
Normal file
1
config/config.json
Normal file
@ -0,0 +1 @@
|
||||
{"BeginTime":"16:43","IntervalTime":"10","EndTime":"16:45","Location":"beijing","GPS_Longtitude":"117","GPS_Latitude":"118","GPS_Altitude":"50","GPS_North":"on","InstallationTime":"2021-11-18","ISIFCalibrationTime":"2021-11-26","IS1CalibrationTime":"2021-11-19","NameOfMaintenanceStaff":"renlixin","PhoneNumberOfMaintenanceStaff":"110110110","DownloadUserID":"newuser","DownlaodAddress":"http:\/\/www.iris-rs.cn","SIFUpCalFile":"dat1","SIFDownCalFile1":"dat2","SIFDownCalFile2":"dat2","SIFDownCalFile3":"dat3","IS1UpCalFile":"dat1","IS1DownCalFile1":"sdaf","IS1DownCalFile2":"dat2","IS1DownCalFile3":"asdf","HTTPServer":"192.168.2.1"}
|
6
main.cpp
6
main.cpp
@ -28,10 +28,8 @@ int main(int argc, char *argv[])
|
||||
m_pqDataGrabberThreadHolder = new QThread();
|
||||
m_test.moveToThread(m_pqDataGrabberThreadHolder);
|
||||
m_pqDataGrabberThreadHolder->start();
|
||||
|
||||
|
||||
m_test.StartGrab();
|
||||
|
||||
m_test.TestGrabOnce();
|
||||
//m_test.StartGrabCall();
|
||||
//QThread::msleep(5000);
|
||||
|
||||
//m_test.StopTestGrab();
|
||||
|
@ -18,14 +18,14 @@ ZZ_ATPControl_Serial_Qt::~ZZ_ATPControl_Serial_Qt()
|
||||
|
||||
}
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::SetBaudRate(int iBaud)
|
||||
{
|
||||
m_iBaudRate = iBaud;
|
||||
return 0;
|
||||
}
|
||||
// int ZZ_ATPControl_Serial_Qt::SetBaudRate(int iBaud)
|
||||
// {
|
||||
// m_iBaudRate = iBaud;
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::ATPInitialize(ZZ_U8 ucPortNumber)
|
||||
int ZZ_ATPControl_Serial_Qt::Initialize(bool bIsUSBMode, ZZ_U8 ucPortNumber, std::string strDeviceName)
|
||||
{
|
||||
QString qstrPortName = QString("COM%1").arg(ucPortNumber);
|
||||
|
||||
@ -50,13 +50,11 @@ int ZZ_ATPControl_Serial_Qt::ATPInitialize(ZZ_U8 ucPortNumber)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::ATPClose()
|
||||
void ZZ_ATPControl_Serial_Qt::Close()
|
||||
{
|
||||
m_pSerialPort->close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
int ZZ_ATPControl_Serial_Qt::GetDeviceInfo()
|
||||
int ZZ_ATPControl_Serial_Qt::GetDeviceInfo(DeviceInfo &Info)
|
||||
{
|
||||
QByteArray qbSend, qbRecv;
|
||||
|
||||
@ -81,7 +79,7 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceInfo()
|
||||
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
return 1;
|
||||
}
|
||||
m_adiDeviceInfo.strPN = qbRecv.data();
|
||||
m_diDeviceInfo.strPN = qbRecv.data();
|
||||
|
||||
qbSend.clear();
|
||||
qbRecv.clear();
|
||||
@ -104,13 +102,14 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceInfo()
|
||||
qDebug() << "Err:GetDeviceInfo Failed,Communication error.Exit Code:1";
|
||||
return 1;
|
||||
}
|
||||
m_adiDeviceInfo.strSN = qbRecv.data();
|
||||
m_diDeviceInfo.strSN = qbRecv.data();
|
||||
|
||||
|
||||
Info = m_diDeviceInfo;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute()
|
||||
int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute(DeviceAttribute &Attr)
|
||||
{
|
||||
QByteArray qbSend, qbRecv;
|
||||
|
||||
@ -135,7 +134,7 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute()
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
return 1;
|
||||
}
|
||||
m_adaDeviceAttr.iMinIntegrationTime = (ZZ_U8)qbRecv[1] + (ZZ_U8)qbRecv[0] * 256;
|
||||
m_daDeviceAttr.iMinIntegrationTimeInMS = (ZZ_U8)qbRecv[1] + (ZZ_U8)qbRecv[0] * 256;
|
||||
|
||||
qbSend.clear();
|
||||
qbRecv.clear();
|
||||
@ -158,16 +157,16 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute()
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Communication error.Exit Code:1";
|
||||
return 1;
|
||||
}
|
||||
m_adaDeviceAttr.iMaxIntegrationTime = (ZZ_U8)qbRecv[1] + (ZZ_U8)qbRecv[0] * 256;
|
||||
m_daDeviceAttr.iMaxIntegrationTimeInMS = (ZZ_U8)qbRecv[1] + (ZZ_U8)qbRecv[0] * 256;
|
||||
|
||||
|
||||
iRes = SetExposureTime(m_adaDeviceAttr.iMinIntegrationTime);
|
||||
iRes = SetExposureTime(m_daDeviceAttr.iMinIntegrationTimeInMS);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Call SetExposureTime error.Exit Code:2";
|
||||
return 2;
|
||||
}
|
||||
iRes = SingleShot(m_adaDeviceAttr.iPixels);
|
||||
iRes = SingleShot(m_daDeviceAttr.iPixels);
|
||||
if (iRes != 0)
|
||||
{
|
||||
qDebug() << "Err:GetDeviceAttribute Failed,Call SingleShot error.Exit Code:3";
|
||||
@ -201,10 +200,18 @@ int ZZ_ATPControl_Serial_Qt::GetDeviceAttribute()
|
||||
}
|
||||
float fWaveLengthCoef[4];
|
||||
memcpy(fWaveLengthCoef, qbRecv.data()+16, 4 * sizeof(float));
|
||||
for (int i=0;i< m_adaDeviceAttr.iPixels;i++)
|
||||
for (int i=0;i< m_daDeviceAttr.iPixels;i++)
|
||||
{
|
||||
m_adaDeviceAttr.fWaveLength[i] = fWaveLengthCoef[0] * i*i*i + fWaveLengthCoef[1] * i*i + fWaveLengthCoef[2] * i + fWaveLengthCoef[3];
|
||||
m_daDeviceAttr.fWaveLengthInNM[i] = fWaveLengthCoef[0] * i*i*i + fWaveLengthCoef[1] * i*i + fWaveLengthCoef[2] * i + fWaveLengthCoef[3];
|
||||
}
|
||||
|
||||
Attr = m_daDeviceAttr;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::SetDeviceTemperature(float fTemperature)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -340,7 +347,7 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
||||
|
||||
while (!bFlagIsAutoExposureOK && !bFlagIsAutoExposureFailed)
|
||||
{
|
||||
ATPDataFrame dfTemp;
|
||||
DataFrame dfTemp;
|
||||
|
||||
if (iRepeatCount++ > 30)
|
||||
{
|
||||
@ -349,7 +356,7 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
||||
break;
|
||||
}
|
||||
|
||||
fExposureTime = (float)m_adaDeviceAttr.iMinIntegrationTime;
|
||||
fExposureTime = (float)m_daDeviceAttr.iMinIntegrationTimeInMS;
|
||||
fTempExposureTime = fExposureTime;
|
||||
|
||||
iRes = SingleShot(dfTemp);
|
||||
@ -359,10 +366,10 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
||||
return 2;
|
||||
}
|
||||
|
||||
HeapSort(dfTemp.usData, m_adaDeviceAttr.iPixels);
|
||||
HeapSort(dfTemp.usData, m_daDeviceAttr.iPixels);
|
||||
|
||||
double dSum = 0;
|
||||
int iCount = m_adaDeviceAttr.iPixels / 100;
|
||||
int iCount = m_daDeviceAttr.iPixels / 100;
|
||||
for (int i = 0; i < iCount; i++)
|
||||
{
|
||||
dSum += dfTemp.usData[i];
|
||||
@ -449,11 +456,11 @@ int ZZ_ATPControl_Serial_Qt::PerformAutoExposure(float fMinScaleFactor, float fM
|
||||
|
||||
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::SetExtShutter(int iShutterUP0, int iShutterDOWN1, int iShutterDOWN2, int iShutterDOWN3)
|
||||
{
|
||||
qDebug() << "stub code not implemented";
|
||||
return -1;
|
||||
}
|
||||
// int ZZ_ATPControl_Serial_Qt::SetExtShutter(int iShutterUP0, int iShutterDOWN1, int iShutterDOWN2, int iShutterDOWN3)
|
||||
// {
|
||||
// qDebug() << "stub code not implemented";
|
||||
// return -1;
|
||||
// }
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::SetExposureTime(int iExposureTimeInMS)
|
||||
{
|
||||
@ -476,7 +483,22 @@ int ZZ_ATPControl_Serial_Qt::SetExposureTime(int iExposureTimeInMS)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::SingleShot(ATPDataFrame &dfData)
|
||||
int ZZ_ATPControl_Serial_Qt::GetExposureTime(int &iExposureTimeInMS)
|
||||
{
|
||||
QByteArray qbSend, qbRecv;
|
||||
qbSend.clear();
|
||||
qbRecv.clear();
|
||||
qbSend.append(GET_INTEGRATION_TIME);
|
||||
qbSend.resize(3);
|
||||
qbSend[1] = 0x00;
|
||||
qbSend[2] = 0x01;
|
||||
SendCommand(qbSend);
|
||||
RecvData(qbRecv);
|
||||
ParseData(qbRecv);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::SingleShot(DataFrame &dfData)
|
||||
{
|
||||
QByteArray qbSend, qbRecv;
|
||||
qbSend.clear();
|
||||
@ -530,10 +552,25 @@ int ZZ_ATPControl_Serial_Qt::SingleShot(int &iPixels)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::SingleShotDark(ATPDataFrame &dfData)
|
||||
// int ZZ_ATPControl_Serial_Qt::SingleShotDark(ATPDataFrame &dfData)
|
||||
// {
|
||||
// SetExtShutter(0,0,0,0);
|
||||
// SingleShot(dfData);
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
int ZZ_ATPControl_Serial_Qt::GetDeviceTemperature(float &fTemperature)
|
||||
{
|
||||
SetExtShutter(0,0,0,0);
|
||||
SingleShot(dfData);
|
||||
QByteArray qbSend, qbRecv;
|
||||
qbSend.clear();
|
||||
qbRecv.clear();
|
||||
qbSend.append(GET_TEC_TEMP);
|
||||
qbSend.resize(3);
|
||||
qbSend[1] = 0x00;
|
||||
qbSend[2] = 0x01;
|
||||
SendCommand(qbSend);
|
||||
RecvData(qbRecv);
|
||||
ParseData(qbRecv);
|
||||
return 0;
|
||||
}
|
||||
|
@ -4,12 +4,13 @@
|
||||
#pragma once
|
||||
#include "pch.h"
|
||||
#include "ZZ_Types.h"
|
||||
#include "IrisFiberSpectrometerBase.h"
|
||||
|
||||
using namespace ZZ_MISCDEF;
|
||||
using namespace ZZ_MISCDEF::ATP;
|
||||
using namespace ZZ_MISCDEF::IRIS::FS;
|
||||
|
||||
class QSerialPort;
|
||||
|
||||
class ZZ_ATPControl_Serial_Qt//:public QObject
|
||||
class ZZ_ATPControl_Serial_Qt:public CIrisFSBase
|
||||
{
|
||||
//Q_OBJECT
|
||||
public:
|
||||
@ -18,34 +19,42 @@ public:
|
||||
|
||||
public:
|
||||
//设置波特率
|
||||
int SetBaudRate(int iBaud);
|
||||
|
||||
|
||||
//int SetBaudRate(int iBaud);
|
||||
//初始化设备
|
||||
int ATPInitialize( ZZ_U8 ucPortNumber);
|
||||
int Initialize(bool bIsUSBMode, ZZ_U8 ucPortNumber, std::string strDeviceName);
|
||||
//关闭设备
|
||||
int ATPClose();
|
||||
|
||||
void Close();
|
||||
|
||||
//单次测试采集 用以确认设备像素数
|
||||
int SingleShot(int &iPixels);
|
||||
//单次数据采集
|
||||
int SingleShot(ATPDataFrame &dfData);
|
||||
//单次暗背景采集
|
||||
int SingleShotDark(ATPDataFrame &dfData);
|
||||
int SingleShotDeducted(ATPDataFrame &dfData);
|
||||
|
||||
//单次数据采集
|
||||
int SingleShot(DataFrame &dfData);
|
||||
|
||||
//单次暗背景采集
|
||||
//int SingleShotDark(ATPDataFrame &dfData);
|
||||
|
||||
//int SingleShotDeducted(ATPDataFrame &dfData);
|
||||
//设置曝光时间
|
||||
int SetExposureTime(int iExposureTimeInMS);
|
||||
|
||||
//获取曝光时间设置
|
||||
int GetExposureTime(int &iExposureTimeInMS);
|
||||
|
||||
//int GetWaveLength(float *pfWaveLength);
|
||||
|
||||
//获取设备信息
|
||||
int GetDeviceInfo();
|
||||
int GetDeviceInfo(DeviceInfo &Info);
|
||||
|
||||
//获取设备特征数据
|
||||
int GetDeviceAttribute();
|
||||
int GetDeviceListInfo(); //use type name to enum
|
||||
int GetDeviceAttribute(DeviceAttribute &Attr);
|
||||
|
||||
//int GetDeviceListInfo(); //use type name to enum
|
||||
|
||||
//设置温度
|
||||
int SetDeviceTemperature(float fTemperature);
|
||||
|
||||
//获取温度
|
||||
int GetDeviceTemperature(float &fTemperature);
|
||||
|
||||
//自动曝光
|
||||
@ -61,11 +70,11 @@ private:
|
||||
QSerialPort *m_pSerialPort;
|
||||
|
||||
//ATP
|
||||
ATPDeviceInfo m_adiDeviceInfo;
|
||||
ATPDeviceAttribute m_adaDeviceAttr;
|
||||
DeviceInfo m_diDeviceInfo;
|
||||
DeviceAttribute m_daDeviceAttr;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////shutter control stub code s
|
||||
int SetExtShutter(int iShutterUP0, int iShutterDOWN1,int iShutterDOWN2,int iShutterDOWN3); //0:close 1:open
|
||||
//int SetExtShutter(int iShutterUP0, int iShutterDOWN1,int iShutterDOWN2,int iShutterDOWN3); //0:close 1:open
|
||||
//////////////////////////////////////////////////////////////////////////shutter control stub code e
|
||||
int SendCommand(QByteArray qbCommand);
|
||||
int RecvData(QByteArray &qbData);
|
42
source/FS/IrisFiberSpectrometerBase.h
Normal file
42
source/FS/IrisFiberSpectrometerBase.h
Normal file
@ -0,0 +1,42 @@
|
||||
#include <string>
|
||||
#include "ZZ_Types.h"
|
||||
#pragma once
|
||||
using namespace ZZ_MISCDEF;
|
||||
using namespace ZZ_MISCDEF::IRIS::FS;
|
||||
|
||||
class CIrisFSBase
|
||||
{
|
||||
public:
|
||||
//CIrisFSBase();
|
||||
//virtual ~CIrisFSBase()= 0;
|
||||
public:
|
||||
//<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>
|
||||
//0Ϊ<30><EFBFBD><DEB4><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD>뷵<EFBFBD>ز<EFBFBD>ֵͬ
|
||||
virtual int Initialize(bool bIsUSBMode,ZZ_U8 ucPortNumber,std::string strDeviceName) = 0;
|
||||
|
||||
//<2F>ر<EFBFBD><D8B1>豸
|
||||
virtual void Close() = 0;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݲɼ<DDB2>
|
||||
virtual int SingleShot(DataFrame &dfData) = 0;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
virtual int SetExposureTime(int iExposureTimeInMS) = 0;
|
||||
|
||||
//<2F><>ȡ<EFBFBD>ع<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual int GetExposureTime(int &iExposureTimeInMS) = 0;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>¶<EFBFBD>
|
||||
virtual int SetDeviceTemperature(float fTemperature) = 0;
|
||||
|
||||
//<2F><>ȡ<EFBFBD>¶<EFBFBD><C2B6><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual int GetDeviceTemperature(float &fTemperature) = 0;
|
||||
|
||||
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8>Ϣ
|
||||
virtual int GetDeviceInfo(DeviceInfo &Info) = 0;
|
||||
|
||||
//<2F><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
virtual int GetDeviceAttribute(DeviceAttribute &Attr) = 0;
|
||||
|
||||
};
|
@ -10,6 +10,39 @@ namespace ZZ_MISCDEF
|
||||
typedef unsigned short int ZZ_U16;
|
||||
typedef unsigned long int ZZ_U32;
|
||||
|
||||
|
||||
namespace IRIS
|
||||
{
|
||||
//Fiber Spectrometer
|
||||
namespace FS
|
||||
{
|
||||
typedef struct tagDataFrame
|
||||
{
|
||||
ZZ_U16 usExposureTimeInMS;
|
||||
ZZ_U16 usData[4096];
|
||||
float fTemperature;
|
||||
double dTimes = 0;
|
||||
}DataFrame;
|
||||
|
||||
typedef struct tagDeviceInfo
|
||||
{
|
||||
std::string strPN;
|
||||
std::string strSN;
|
||||
}DeviceInfo;
|
||||
|
||||
typedef struct tagDeviceAttribute
|
||||
{
|
||||
int iPixels;
|
||||
int iMaxIntegrationTimeInMS;
|
||||
int iMinIntegrationTimeInMS;
|
||||
float fWaveLengthInNM[4096];
|
||||
|
||||
}DeviceAttribute;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
//ATPÖ¸ÁîתÒë
|
||||
namespace ATP
|
||||
{
|
@ -3,8 +3,8 @@
|
||||
ZZ_SysConfigger::ZZ_SysConfigger(QObject *parent /*= nullptr*/)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
m_qstrFilePath = QCoreApplication::applicationDirPath() + "home/data/Settings/DeviceSettings.ini";
|
||||
m_qstrJSONConfigFilePath = QCoreApplication::applicationDirPath() + "/home/data/Settings/config.json";
|
||||
m_qstrFilePath = QCoreApplication::applicationDirPath() + "/home/data/Settings/DeviceSettings.ini";
|
||||
m_qstrJSONConfigFilePath = "E:/WorkSpace/TowerOptoSifAndSpectral/config/config.json";
|
||||
#else
|
||||
m_qstrJSONConfigFilePath = ("/home/data/Setting/config.json");
|
||||
#endif // DEBUG
|
||||
@ -69,17 +69,26 @@
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
m_struAcqTime.qtInterval = QTime::fromString(m_qjoJObj.value("IntervalTime").toString(), "ss");
|
||||
if (!m_struAcqTime.qtInterval.isValid())
|
||||
{
|
||||
qDebug() << "Invalid IntervalTime";
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
m_struAcqTime.qtInterval = QTime::fromString(m_qjoJObj.value("IntervalTime").toString(), "mm");
|
||||
if (!m_struAcqTime.qtInterval.isValid())
|
||||
{
|
||||
qDebug() << "Invalid BeginTime";
|
||||
qDebug() << "Invalid IntervalTime";
|
||||
return 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
m_struAcqTime.qtStopTime = QTime::fromString(m_qjoJObj.value("EndTime").toString(), "hh:mm");
|
||||
if (!m_struAcqTime.qtStopTime.isValid())
|
||||
{
|
||||
qDebug() << "Invalid BeginTime";
|
||||
qDebug() << "Invalid EndTime";
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,18 @@ ZZ_DataGrabberThread::ZZ_DataGrabberThread(QObject* parent /*= nullptr*/)
|
||||
{
|
||||
m_GrabTimer = new QTimer(this);
|
||||
m_bFlagIsCollecting = false;
|
||||
|
||||
|
||||
|
||||
ZZ_ATPAbsCtrlThread* m_p1 = new ZZ_iSIFControlThread;
|
||||
m_pControlThread.push_back(m_p1);
|
||||
ZZ_ATPAbsCtrlThread* m_p2 = new ZZ_IS1ControlThread;
|
||||
m_pControlThread.push_back(m_p2);
|
||||
//m_iTotalThreads = 2;
|
||||
|
||||
InitThreadStatus();
|
||||
SetupSignals();
|
||||
StartGrabberThread();
|
||||
|
||||
//m_iTotalThreads = 2;
|
||||
}
|
||||
|
||||
ZZ_DataGrabberThread::~ZZ_DataGrabberThread()
|
||||
@ -17,25 +24,35 @@ ZZ_DataGrabberThread::~ZZ_DataGrabberThread()
|
||||
{
|
||||
delete m_piFlagCaptureThreadStatus;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void ZZ_DataGrabberThread::SetGrabTimer(AcqTimeSettings struAcqTime)
|
||||
void ZZ_DataGrabberThread::SetGrabTimer(AcqTimeSettings struAcqTimer)
|
||||
{
|
||||
m_struAcqTime = struAcqTime;
|
||||
m_struAcqTime = struAcqTimer;
|
||||
}
|
||||
|
||||
int ZZ_DataGrabberThread::SetupSignals()
|
||||
{
|
||||
connect(m_GrabTimer, &QTimer::timeout, this, &ZZ_DataGrabberThread::OnTimeCounter);
|
||||
|
||||
connect(this, &ZZ_DataGrabberThread::SignalStartGrabOnce, &m_tcISIFCtrlThread, &ZZ_iSIFControlThread::StartTestAcquisition);
|
||||
connect(this, &ZZ_DataGrabberThread::SignalStartGrabOnce, &m_tcIS1CtrlThread, &ZZ_IS1ControlThread::StartTestAcquisition);
|
||||
connect(this, &ZZ_DataGrabberThread::SignalStartGrab, this, &ZZ_DataGrabberThread::StartGrab);
|
||||
|
||||
//connect(this, &ZZ_DataGrabberThread::SignalStartGrabOnce, &m_tcISIFCtrlThread, &ZZ_ATPAbsCtrlThread::StartTestAcquisition);
|
||||
//connect(this, &ZZ_DataGrabberThread::SignalStartGrabOnce, &m_tcIS1CtrlThread, &ZZ_ATPAbsCtrlThread::StartTestAcquisition);
|
||||
|
||||
connect(this, &ZZ_DataGrabberThread::SignalStartGrabOnce, m_pControlThread[0], &ZZ_ATPAbsCtrlThread::StartTestAcquisition);
|
||||
connect(this, &ZZ_DataGrabberThread::SignalStartGrabOnce, m_pControlThread[1], &ZZ_ATPAbsCtrlThread::StartTestAcquisition);
|
||||
|
||||
//connect(this, &ZZ_DataGrabberThread::SignalStopGrab, &m_tcISIFCtrlThread, &ZZ_iSIFControlThread::StopTestAcquisition, Qt::DirectConnection);
|
||||
//connect(this, &ZZ_DataGrabberThread::SignalStopGrab, &m_tcIS1CtrlThread, &ZZ_IS1ControlThread::StopTestAcquisition, Qt::DirectConnection);
|
||||
|
||||
connect(&m_tcISIFCtrlThread, &ZZ_iSIFControlThread::SignalAcqFinished, this, &ZZ_DataGrabberThread::HandleThreadEvent);
|
||||
connect(&m_tcIS1CtrlThread, &ZZ_IS1ControlThread::SignalAcqFinished, this, &ZZ_DataGrabberThread::HandleThreadEvent);
|
||||
//connect(&m_tcISIFCtrlThread, &ZZ_iSIFControlThread::SignalAcqFinished, this, &ZZ_DataGrabberThread::HandleThreadEvent);
|
||||
//connect(&m_tcIS1CtrlThread, &ZZ_IS1ControlThread::SignalAcqFinished, this, &ZZ_DataGrabberThread::HandleThreadEvent);
|
||||
|
||||
connect(m_pControlThread[0], &ZZ_ATPAbsCtrlThread::SignalAcqFinished, this, &ZZ_DataGrabberThread::HandleThreadEvent);
|
||||
connect(m_pControlThread[1], &ZZ_ATPAbsCtrlThread::SignalAcqFinished, this, &ZZ_DataGrabberThread::HandleThreadEvent);
|
||||
|
||||
connect(this, &ZZ_DataGrabberThread::SignalGrabOnceFinished, this, &ZZ_DataGrabberThread::TestGrabOnce);
|
||||
//m_tcISIFCtrlThread.SetWaitCondition(&m_wcWaitISIF,&m_mTestMutex);
|
||||
@ -43,6 +60,12 @@ int ZZ_DataGrabberThread::SetupSignals()
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZZ_DataGrabberThread::StartGrabCall()
|
||||
{
|
||||
emit SignalStartGrab();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ZZ_DataGrabberThread::StartGrab()
|
||||
{
|
||||
m_GrabTimer->start(1000);
|
||||
@ -51,12 +74,21 @@ int ZZ_DataGrabberThread::StartGrab()
|
||||
|
||||
int ZZ_DataGrabberThread::StartGrabberThread()
|
||||
{
|
||||
// m_pqISIFThreadHolder = new QThread();
|
||||
// m_tcISIFCtrlThread.moveToThread(m_pqISIFThreadHolder);
|
||||
// m_pqISIFThreadHolder->start();
|
||||
//
|
||||
// m_pqIS1ThreadHolder = new QThread();
|
||||
// m_tcIS1CtrlThread.moveToThread(m_pqIS1ThreadHolder);
|
||||
// m_pqIS1ThreadHolder->start();
|
||||
|
||||
|
||||
m_pqISIFThreadHolder = new QThread();
|
||||
m_tcISIFCtrlThread.moveToThread(m_pqISIFThreadHolder);
|
||||
m_pControlThread[0]->moveToThread(m_pqISIFThreadHolder);
|
||||
m_pqISIFThreadHolder->start();
|
||||
|
||||
m_pqIS1ThreadHolder = new QThread();
|
||||
m_tcIS1CtrlThread.moveToThread(m_pqIS1ThreadHolder);
|
||||
m_pControlThread[1]->moveToThread(m_pqIS1ThreadHolder);
|
||||
m_pqIS1ThreadHolder->start();
|
||||
//m_stCameraServiceThread.SetController(this);
|
||||
return 0;
|
||||
@ -91,6 +123,7 @@ int ZZ_DataGrabberThread::TestGrab()
|
||||
|
||||
int ZZ_DataGrabberThread::TestGrabOnce()
|
||||
{
|
||||
InitThreadStatus();
|
||||
emit SignalStartGrabOnce();
|
||||
return 0;
|
||||
}
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include"pch.h"
|
||||
#include "ThreadIS1Controller.h"
|
||||
#include "ThreadiSIFController.h"
|
||||
#include <vector>
|
||||
using namespace std;
|
||||
using namespace ZZ_MISCDEF::ZZ_RUNPARAMS;
|
||||
class ZZ_DataGrabberThread :public QObject
|
||||
{
|
||||
@ -17,6 +19,8 @@ public:
|
||||
//QWaitCondition m_wcWaitISIF,m_wcWaitIS1;
|
||||
//QMutex m_mTestMutex;
|
||||
private:
|
||||
vector<ZZ_ATPAbsCtrlThread *> m_pControlThread;
|
||||
|
||||
ZZ_iSIFControlThread m_tcISIFCtrlThread;
|
||||
ZZ_IS1ControlThread m_tcIS1CtrlThread;
|
||||
QThread* m_pqISIFThreadHolder;
|
||||
@ -30,10 +34,10 @@ private:
|
||||
QTimer *m_GrabTimer;
|
||||
AcqTimeSettings m_struAcqTime;
|
||||
public:
|
||||
void SetGrabTimer(AcqTimeSettings struAcqTime);
|
||||
void SetGrabTimer(AcqTimeSettings struAcqTimer);
|
||||
|
||||
int SetupSignals();
|
||||
int StartGrab();
|
||||
int StartGrabCall();
|
||||
|
||||
private:
|
||||
int OnTimeCounter();
|
||||
@ -44,8 +48,10 @@ public slots:
|
||||
int TestGrabOnce();
|
||||
int TestStopGrab();
|
||||
int HandleThreadEvent(int iThreadID, int iFlagStatus);
|
||||
int StartGrab();
|
||||
signals:
|
||||
void SignalStartGrabOnce();
|
||||
void SignalStopGrab();
|
||||
void SignalGrabOnceFinished();
|
||||
void SignalStartGrab();
|
||||
};
|
||||
|
Reference in New Issue
Block a user