mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-18 19:39:43 +08:00
64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
#include "Scheduler.h"
|
|
|
|
Scheduler::Scheduler(QObject* parent /*= nullptr*/)
|
|
{
|
|
m_GrabTimer = new QTimer(this);
|
|
connect(m_GrabTimer, &QTimer::timeout, this, &Scheduler::OnTimeCounter);
|
|
connect(this, &Scheduler::SignalSelfStart, this, &Scheduler::StartAsPlanned);
|
|
}
|
|
|
|
Scheduler::~Scheduler()
|
|
{
|
|
if (m_GrabTimer != NULL)
|
|
{
|
|
m_GrabTimer->stop();
|
|
delete m_GrabTimer;
|
|
}
|
|
}
|
|
|
|
void Scheduler::SetAcqTimeParams(AcqTimeSettings struAcqTime)
|
|
{
|
|
m_struAcqTime = struAcqTime;
|
|
}
|
|
|
|
void Scheduler::Preheating()
|
|
{
|
|
qDebug() << "Start Preheating";
|
|
#ifdef _DEBUG
|
|
QThread::msleep(5000);
|
|
#else
|
|
QThread::msleep(1000*60*5);
|
|
#endif
|
|
qDebug() << "Preheating Finished";
|
|
}
|
|
|
|
void Scheduler::SelfStart()
|
|
{
|
|
emit SignalSelfStart();
|
|
}
|
|
|
|
void Scheduler::StartAsPlanned()
|
|
{
|
|
bool bStopWait = false;
|
|
QTime qtTime = QTime::currentTime();
|
|
while (!bStopWait)
|
|
{
|
|
QThread::msleep(100);
|
|
if (m_struAcqTime.qtStartTime >= qtTime && qtTime < m_struAcqTime.qtStopTime)
|
|
{
|
|
bStopWait = true;
|
|
}
|
|
}
|
|
|
|
|
|
int iIntervalInMS = m_struAcqTime.qtInterval.hour() * 3600 * 1000 + m_struAcqTime.qtInterval.minute() * 60 * 1000 + m_struAcqTime.qtInterval.second() * 1000;
|
|
|
|
m_GrabTimer->start(3000);
|
|
}
|
|
|
|
int Scheduler::OnTimeCounter()
|
|
{
|
|
emit SignalGrabOnce();
|
|
return 0;
|
|
}
|