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