This repository has been archived on 2024-06-03. You can view files and clone it, but cannot push or open issues or pull requests.
app/headers/speedtimer.h

53 lines
1 KiB
C++

#ifndef SPEEDTIMER_H
#define SPEEDTIMER_H
#include <QObject>
#include <QDateTime>
#include <QEventLoop>
#include <QTimer>
#include <QDebug>
class SpeedTimer : public QObject
{
Q_OBJECT
public:
explicit SpeedTimer(QObject *parent = nullptr);
enum timerState { IDLE, STARTING, RUNNING, STOPPED };
timerState state;
// variables for capturing the time
double startTime;
double stopTime;
double stoppedTime;
double reactionTime;
bool remoteControlled;
signals:
void stateChanged(timerState newState);
void startCanceled(bool falseStart);
public slots:
void start();
void stop(QString type);
void reset();
void setState(timerState newState);
QString getState();
double getCurrTime();
//void handleStartpadTrigger();
//void handleToppadTrigger();
//helper functions
void delay(int mSecs);
timerState stateFromString(QString state);
private:
QDateTime *date;
};
extern SpeedTimer * pGlobalSpeedTimer;
#endif // SPEEDTIMER_H