some preperations for start procedure checks (#20)

This commit is contained in:
Dorian Zedler 2020-08-14 17:02:53 +02:00
parent 5275acd0e4
commit d210a75d51
Signed by: dorian
GPG key ID: D3B255CB8BC7CD37
3 changed files with 34 additions and 4 deletions

View file

@ -57,6 +57,7 @@ public:
explicit ScStwRace(QObject *parent = nullptr); explicit ScStwRace(QObject *parent = nullptr);
enum RaceState { IDLE, STARTING, WAITING, RUNNING, STOPPED }; enum RaceState { IDLE, STARTING, WAITING, RUNNING, STOPPED };
// will become IDLE, PREPAIRING, WAITING, STARTING, RUNNING, STOPPED later
Q_ENUM(RaceState) Q_ENUM(RaceState)
enum StartAction { None = -1, AtYourMarks = 0, Ready = 1, Start = 2 }; enum StartAction { None = -1, AtYourMarks = 0, Ready = 1, Start = 2 };

View file

@ -82,6 +82,7 @@ public:
LOST, /*!< Timer has lost */ LOST, /*!< Timer has lost */
FAILED, /*!< A false start occured */ FAILED, /*!< A false start occured */
CANCELLED, /*!< Timer was cancelled */ CANCELLED, /*!< Timer was cancelled */
// INCIDENT, /*!< There was a technical incident */
DISABLED /*!< Timer is disabled */ DISABLED /*!< Timer is disabled */
}; };
Q_ENUM(TimerState); Q_ENUM(TimerState);
@ -90,10 +91,22 @@ public:
* \brief The StopReason enum contains all possible reasons for a stop * \brief The StopReason enum contains all possible reasons for a stop
*/ */
enum StopReason { enum StopReason {
ManualStop, /*!< Timer was stopped manually */ ManualStop, /*!< Timer was stopped manually */
CancelStop, /*!< Timer was cancelled */ CancelStop, /*!< Timer was cancelled */
FailStop, /*!< A false start occured */ FailStop, /*!< A false start occured */
TopPadStop /*!< Timer was stopped by a physical trigger (eg. a ScStwExtension) */ TopPadStop, /*!< Timer was stopped by a physical trigger (eg. a ScStwExtension) */
TechnicalIncidentStop /*!< The timer was stopped due to a technical incident */
};
/*!
* \brief The ReadyStatus enum contains all possible reasons for a timer not to be ready (>0) and the case that it is ready (0)
*/
enum ReadyState {
IsReady = 0, /*!< Timer is ready for start */
NotInIdleState, /*!< Timer is not in IDLE state */
IsDisabled, /*!< Timer is disabled */
NotAllExtensionsConnected, /*!< Not all extension of the timer are conneted */
NotAllClimbersReady /*!< The startpad of the timer is not triggered */
}; };
protected: protected:
@ -305,6 +318,12 @@ public slots:
*/ */
bool getWantsToBeDisabled(); bool getWantsToBeDisabled();
/*!
* \brief Function to get the current ready status of a timer
* \return The current ready status
*/
virtual ScStwTimer::ReadyState getReadyState();
protected slots: protected slots:
/*! /*!
@ -373,6 +392,12 @@ signals:
*/ */
void wantsToBeDisabledChanged(ScStwTimer* timer, bool wantsToBeDisabled); void wantsToBeDisabledChanged(ScStwTimer* timer, bool wantsToBeDisabled);
/*!
* \brief Emitted when the ready state of the timer changes
* \param readyState the new ReadyState
*/
void readyStateChanged(ReadyState readyState);
}; };
#endif // SCSTWTIMER_H #endif // SCSTWTIMER_H

View file

@ -157,6 +157,10 @@ bool ScStwTimer::reset(){
return true; return true;
} }
ScStwTimer::ReadyState ScStwTimer::getReadyState() {
return this->state == IDLE ? ScStwTimer::IsReady : ScStwTimer::NotInIdleState;
}
// ------------------------ // ------------------------
// --- helper functions --- // --- helper functions ---
// ------------------------ // ------------------------