source: pacpusframework/trunk/src/PacpusTools/src/PeriodicWorker.cpp

Last change on this file was 162, checked in by Marek Kurdej, 11 years ago

Update: merged changes from trunk.

  • Property svn:executable set to *
File size: 769 bytes
Line 
1// %pacpus:license{
2// This file is part of the PACPUS framework distributed under the
3// CECILL-C License, Version 1.0.
4/// @author Samuel Gosselin <firstname.surname@utc.fr>
5/// @date December, 2012
6// %pacpus:license}
7
8#include <Pacpus/PacpusTools/PeriodicWorker.h>
9
10#include <QTimer>
11
12using namespace pacpus;
13
14PeriodicWorker::PeriodicWorker()
15 : AsyncWorkerBase()
16 , mHeartbeat(NULL)
17{
18 mHeartbeat = new QTimer(this);
19}
20
21PeriodicWorker::~PeriodicWorker()
22{
23}
24
25void
26PeriodicWorker::startWork(int msec)
27{
28 mHeartbeat->start(msec);
29 connect(mHeartbeat, SIGNAL(timeout()), this, SLOT(doWork()));
30
31 this->start();
32}
33
34void
35PeriodicWorker::stopWork()
36{
37 disconnect(mHeartbeat, SIGNAL(timeout()), this, SLOT(doWork()));
38}
Note: See TracBrowser for help on using the repository browser.