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

Last change on this file since 31 was 31, checked in by sgosseli, 12 years ago

Huge commit: use the new includes style in all the files, add the license header in all the headers, and in some cpp.

File size: 799 bytes
Line 
1/**
2 *
3 * Distributed under the UTC Heudiascy Pacpus License, Version 1.0.
4 * Copyright (c) UTC Heudiasyc 2010 - 2013. All rights reserved.
5 *
6 * See the LICENSE file for more information or a copy at:
7 * http://www.hds.utc.fr/~kurdejma/LICENSE_1_0.txt
8 *
9 */
10
11// Includes, pacpus.
12#include <PacpusTools/PeriodicWorker.h>
13
14// Includes, qt.
15#include <QTimer>
16
17using namespace pacpus;
18
19PeriodicWorker::PeriodicWorker()
20 : AsyncWorkerBase()
21 , mHeartbeat(NULL)
22{
23 mHeartbeat = new QTimer(this);
24}
25
26PeriodicWorker::~PeriodicWorker()
27{
28}
29
30void
31PeriodicWorker::startWork(int msec)
32{
33 mHeartbeat->start(msec);
34 connect(mHeartbeat, SIGNAL(timeout()), this, SLOT(doWork()));
35
36 this->start();
37}
38
39void
40PeriodicWorker::stopWork()
41{
42 disconnect(mHeartbeat, SIGNAL(timeout()), this, SLOT(doWork()));
43}
Note: See TracBrowser for help on using the repository browser.