added command to disable and enable a timer
This commit is contained in:
parent
ce22916e92
commit
9bd3e53fae
3 changed files with 16 additions and 0 deletions
|
@ -81,6 +81,7 @@ public:
|
||||||
StopRaceCommand = 1001,
|
StopRaceCommand = 1001,
|
||||||
ResetRaceCommand = 1002,
|
ResetRaceCommand = 1002,
|
||||||
CancelRaceCommand = 1003,
|
CancelRaceCommand = 1003,
|
||||||
|
SetTimerDisabled = 1004,
|
||||||
|
|
||||||
GetRaceStateCommand = 2000,
|
GetRaceStateCommand = 2000,
|
||||||
GetRaceDetailsCommand = 2001,
|
GetRaceDetailsCommand = 2001,
|
||||||
|
@ -120,6 +121,7 @@ public:
|
||||||
CurrentStateNotVaildForOperationError = 403,
|
CurrentStateNotVaildForOperationError = 403,
|
||||||
AccessDeniedError = 401,
|
AccessDeniedError = 401,
|
||||||
NoSessionActiveError = 408,
|
NoSessionActiveError = 408,
|
||||||
|
ItemNotFoundError = 409,
|
||||||
|
|
||||||
UpdateFailedError = 500,
|
UpdateFailedError = 500,
|
||||||
|
|
||||||
|
|
|
@ -117,6 +117,8 @@ public slots:
|
||||||
virtual ScStw::StatusCode reset();
|
virtual ScStw::StatusCode reset();
|
||||||
virtual ScStw::StatusCode cancel();
|
virtual ScStw::StatusCode cancel();
|
||||||
|
|
||||||
|
virtual ScStw::StatusCode setTimerDisabled(int id, bool disabled);
|
||||||
|
|
||||||
virtual bool addTimer(ScStwTimer *timer);
|
virtual bool addTimer(ScStwTimer *timer);
|
||||||
|
|
||||||
// getters
|
// getters
|
||||||
|
|
|
@ -153,6 +153,18 @@ ScStw::StatusCode ScStwRace::cancel() {
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ScStw::StatusCode ScStwRace::setTimerDisabled(int timerId, bool disabled) {
|
||||||
|
if(this->state != IDLE && this->state != WAITING)
|
||||||
|
return ScStw::CurrentStateNotVaildForOperationError;
|
||||||
|
|
||||||
|
if(timerId < 0 || timerId - 1 > this->timers.length())
|
||||||
|
return ScStw::ItemNotFoundError;
|
||||||
|
|
||||||
|
this->timers[timerId]->setDisabled(disabled);
|
||||||
|
|
||||||
|
return ScStw::Success;
|
||||||
|
}
|
||||||
|
|
||||||
void ScStwRace::handleTimerReadyStateChange(ScStwTimer::ReadyState readyState) {
|
void ScStwRace::handleTimerReadyStateChange(ScStwTimer::ReadyState readyState) {
|
||||||
|
|
||||||
if(!this->competitionMode || this->state == IDLE || this->state == STOPPED || this->state == INCIDENT )
|
if(!this->competitionMode || this->state == IDLE || this->state == STOPPED || this->state == INCIDENT )
|
||||||
|
|
Reference in a new issue