mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-18 19:39:43 +08:00
83 lines
2.1 KiB
C++
83 lines
2.1 KiB
C++
#include "ThreadDataGrabber.h"
|
|
|
|
ZZ_DataGrabberThread::ZZ_DataGrabberThread(QObject* parent /*= nullptr*/)
|
|
{
|
|
m_bFlagIsCollecting = false;
|
|
SetupSignals();
|
|
StartGrabberThread();
|
|
}
|
|
|
|
ZZ_DataGrabberThread::~ZZ_DataGrabberThread()
|
|
{
|
|
|
|
}
|
|
|
|
int ZZ_DataGrabberThread::SetupSignals()
|
|
{
|
|
connect(this, &ZZ_DataGrabberThread::SignalStartGrabOnce, &m_tcISIFCtrlThread, &ZZ_iSIFControlThread::StartTestAcquisition);
|
|
connect(this, &ZZ_DataGrabberThread::SignalStartGrabOnce, &m_tcIS1CtrlThread, &ZZ_IS1ControlThread::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);
|
|
|
|
//m_tcISIFCtrlThread.SetWaitCondition(&m_wcWaitISIF,&m_mTestMutex);
|
|
//m_tcIS1CtrlThread.SetWaitCondition(&m_wcWaitIS1, &m_mTestMutex);
|
|
return 0;
|
|
}
|
|
|
|
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_stCameraServiceThread.SetController(this);
|
|
return 0;
|
|
}
|
|
|
|
int ZZ_DataGrabberThread::TestGrab()
|
|
{
|
|
m_bFlagIsCollecting = true;
|
|
while (m_bFlagIsCollecting)
|
|
{
|
|
|
|
emit SignalStartGrabOnce();
|
|
//m_mTestMutex.lock();
|
|
//m_wcWaitISIF.wait(&m_mTestMutex);
|
|
//m_mTestMutex.lock();
|
|
//m_wcWaitIS1.wait(&m_mTestMutex);
|
|
//m_mTestMutex.unlock();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
int ZZ_DataGrabberThread::TestStopGrab()
|
|
{
|
|
//emit SignalStopGrab();
|
|
m_tcISIFCtrlThread.StopTestAcquisition();
|
|
m_tcIS1CtrlThread.StopTestAcquisition();
|
|
|
|
return 0;
|
|
}
|
|
|
|
int ZZ_DataGrabberThread::handleThreadEvent(int x, int value)
|
|
{
|
|
ProcessingThreadAactive[x] = value;
|
|
|
|
// Check if threads are finished
|
|
for (int i = 0; i < numThreads; i++)
|
|
{
|
|
bool finished = true;
|
|
if (ProcessingThreadAactive[i] == true)
|
|
{
|
|
finished = false;
|
|
// Do end actions here
|
|
break;
|
|
}
|
|
}
|
|
}
|