58 lines
1.2 KiB
C++
Executable File
58 lines
1.2 KiB
C++
Executable File
/**
|
|
* CES Tartet Timer
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
* Created by Gerlinde Rudolphus, SLTE, 2016-04-14
|
|
*/
|
|
|
|
|
|
#ifndef TARGETTIMER_H
|
|
#define TARGETTIMER_H
|
|
|
|
|
|
#include <QObject>
|
|
#include <QTimer>
|
|
|
|
class TargetTimer: public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
enum TimerState
|
|
{
|
|
NOT_ACTIVE = 0,
|
|
TIMER1_ACTIVE = 1,
|
|
TIMER2_ACTIVE = 2,
|
|
BOTH_EXPIRED = 3
|
|
};
|
|
|
|
TargetTimer(int participantId,
|
|
int targetParticipantId,
|
|
int preWarningInterval,
|
|
int timeToEffectInterval);
|
|
|
|
void startTimer();
|
|
void stopTimer();
|
|
bool isActive() { return timer->isActive();}
|
|
TimerState getTimerState() {return m_timerState;}
|
|
int getTargetParticipantId() {return m_targetParticipantId;}
|
|
public slots:
|
|
void MyTimerSlot();
|
|
|
|
signals:
|
|
void preWarningTimeout(int participantId, int targetParticipantId);
|
|
void timeToEffectTimeout(int participantId, int targetParticipantId);
|
|
private:
|
|
QTimer *timer;
|
|
int m_participantId = 0;
|
|
int m_targetParticipantId = 0;
|
|
int m_preWarningInterval = 0;
|
|
int m_timeToEffectInterval = 0;
|
|
TimerState m_timerState = NOT_ACTIVE; // 0 = NOT ACTIVE
|
|
// 1 = Timer 1 is actice
|
|
// 2 = Timer 2 is active
|
|
// 3 = both timers have expired
|
|
};
|
|
|
|
#endif // TARGETTIMER_H
|