diff --git a/ScStwLibraries/headers/ScStw.hpp b/ScStwLibraries/headers/ScStw.hpp index a05be82..46aba53 100644 --- a/ScStwLibraries/headers/ScStw.hpp +++ b/ScStwLibraries/headers/ScStw.hpp @@ -81,6 +81,7 @@ public: StopRaceCommand = 1001, ResetRaceCommand = 1002, CancelRaceCommand = 1003, + SetTimerDisabled = 1004, GetRaceStateCommand = 2000, GetRaceDetailsCommand = 2001, @@ -120,6 +121,7 @@ public: CurrentStateNotVaildForOperationError = 403, AccessDeniedError = 401, NoSessionActiveError = 408, + ItemNotFoundError = 409, UpdateFailedError = 500, diff --git a/ScStwLibraries/headers/scstwrace.h b/ScStwLibraries/headers/scstwrace.h index 9b513dc..97cb53b 100644 --- a/ScStwLibraries/headers/scstwrace.h +++ b/ScStwLibraries/headers/scstwrace.h @@ -117,6 +117,8 @@ public slots: virtual ScStw::StatusCode reset(); virtual ScStw::StatusCode cancel(); + virtual ScStw::StatusCode setTimerDisabled(int id, bool disabled); + virtual bool addTimer(ScStwTimer *timer); // getters diff --git a/ScStwLibraries/sources/scstwrace.cpp b/ScStwLibraries/sources/scstwrace.cpp index 6f7b30f..954c0f0 100644 --- a/ScStwLibraries/sources/scstwrace.cpp +++ b/ScStwLibraries/sources/scstwrace.cpp @@ -153,6 +153,18 @@ ScStw::StatusCode ScStwRace::cancel() { 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) { if(!this->competitionMode || this->state == IDLE || this->state == STOPPED || this->state == INCIDENT )