qavrg 0.0.28
qavrgacquisitionthread.cpp
Go to the documentation of this file.
00001 #include "qavrgacquisitionthread.h"
00002 
00003 #include "qavrgacquisition.h"
00004 
00005 QavrgAcquisitionThread::QavrgAcquisitionThread(QavrgApplication *app)
00006   : QThread(),
00007     m_Application(app),
00008     m_Acquisition(NULL)
00009 {
00010   m_Acquisition = new QavrgAcquisition(this, app, NULL);
00011   m_Acquisition -> moveToThread(this);
00012 }
00013 
00014 QavrgAcquisitionThread::~QavrgAcquisitionThread()
00015 {
00016   shutdown();
00017 
00018   delete m_Acquisition;
00019 }
00020 
00021 void QavrgAcquisitionThread::shutdown()
00022 {
00023   double integ = m_Acquisition -> get_IntegrationTime();
00024 
00025   m_Acquisition -> acquireCancel();
00026 
00027   exit();
00028 
00029   wait(integ*1000+500);
00030 }
00031 
00032 QavrgAcquisition *QavrgAcquisitionThread::acquisition()
00033 {
00034   return m_Acquisition;
00035 }
00036 
00037 void QavrgAcquisitionThread::run()
00038 {
00039   m_Acquisition -> initialize();
00040 
00041   exec();
00042 }
00043 
00044 void QavrgAcquisitionThread::sleepFor(double secs)
00045 {
00046   msleep(secs*1000);
00047 }