saRestartCtr method
- covariant Rocket sm,
- SamReq req
Handle action RK.saRestartCtr
The covariant keyword is used to inform Dart that sm will be a subclass of
SamModel and not SamModel specifically.
Even though we are in the SamModel.present execution scope we still need to use
sm.flipState() to change the state so that any queued requests will be
handled properly.
Changing the model state to RK.ssWaiting or RK.ssCounting will reactivate the timer in the nap function napStartTimer.
Implementation
void saRestartCtr(covariant Rocket sm,SamReq req) {
int ctr = sm.getHot("ctr") as int;
if (ctr > 10) {
sm.flipState(RK.ssWaiting);
} else {
sm.flipState(RK.ssCounting);
}
}