mirror of
http://172.16.0.230/r/SIF/TowerOptoSifAndSpectral.git
synced 2025-10-19 11:49:42 +08:00
简单了解了QJson和QNetworkAccessManager相关的使用方法。
尝试了使用QWaitCondition,QMutex同步线程。未能实现,准备改用状态机
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
ZZ_DataGrabberThread::ZZ_DataGrabberThread(QObject* parent /*= nullptr*/)
|
||||
{
|
||||
m_bFlagIsCollecting = false;
|
||||
SetupSignals();
|
||||
StartGrabberThread();
|
||||
}
|
||||
@ -16,9 +17,11 @@ int ZZ_DataGrabberThread::SetupSignals()
|
||||
connect(this, &ZZ_DataGrabberThread::SignalStartGrabOnce, &m_tcISIFCtrlThread, &ZZ_iSIFControlThread::StartTestAcquisition);
|
||||
connect(this, &ZZ_DataGrabberThread::SignalStartGrabOnce, &m_tcIS1CtrlThread, &ZZ_IS1ControlThread::StartTestAcquisition);
|
||||
|
||||
bool bres = connect(this, &ZZ_DataGrabberThread::SignalStopGrab, &m_tcISIFCtrlThread, &ZZ_iSIFControlThread::StopTestAcquisition, Qt::DirectConnection);
|
||||
bres = connect(this, &ZZ_DataGrabberThread::SignalStopGrab, &m_tcIS1CtrlThread, &ZZ_IS1ControlThread::StopTestAcquisition, Qt::DirectConnection);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -37,14 +40,43 @@ int ZZ_DataGrabberThread::StartGrabberThread()
|
||||
|
||||
int ZZ_DataGrabberThread::TestGrab()
|
||||
{
|
||||
emit SignalStartGrabOnce();
|
||||
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::StopTestGrab()
|
||||
int ZZ_DataGrabberThread::TestStopGrab()
|
||||
{
|
||||
emit SignalStopGrab();
|
||||
//m_tcISIFCtrlThread.StopTestAcquisition();
|
||||
//m_tcIS1CtrlThread.StopTestAcquisition();
|
||||
//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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user