//............................................................................ QState QHsmTst::s(QHsmTst *me, QEvt const *e) { switch (e->sig) { case Q_ENTRY_SIG: { BSP_display("s-ENTRY;"); return Q_HANDLED(); } case Q_EXIT_SIG: { BSP_display("s-EXIT;"); return Q_HANDLED(); } case Q_INIT_SIG: { BSP_display("s-INIT;"); return Q_TRAN(&QHsmTst::s11); } case E_SIG: { BSP_display("s-E;"); return Q_TRAN(&QHsmTst::s11); } case I_SIG: { // internal transition with a guard if (me->m_foo) { BSP_display("s-I;"); me->m_foo = 0; return Q_HANDLED(); } break; } case TERMINATE_SIG: { BSP_exit(); return Q_HANDLED(); } } return Q_SUPER(&QHsm::top); }
/* @(/1/0/1/1) .............................................................*/ static QState QHsmTst_s(QHsmTst * const me) { QState status_; switch (Q_SIG(me)) { /* @(/1/0/1/1) */ case Q_ENTRY_SIG: { BSP_display("s-ENTRY;"); status_ = Q_HANDLED(); break; } /* @(/1/0/1/1) */ case Q_EXIT_SIG: { BSP_display("s-EXIT;"); status_ = Q_HANDLED(); break; } /* @(/1/0/1/1/0) */ case Q_INIT_SIG: { BSP_display("s-INIT;"); status_ = Q_TRAN(&QHsmTst_s11); break; } /* @(/1/0/1/1/1) */ case I_SIG: { /* @(/1/0/1/1/1/0) */ if (me->foo) { me->foo = 0U; BSP_display("s-I;"); status_ = Q_HANDLED(); } else { status_ = Q_UNHANDLED(); } break; } /* @(/1/0/1/1/2) */ case E_SIG: { BSP_display("s-E;"); status_ = Q_TRAN(&QHsmTst_s11); break; } /* @(/1/0/1/1/3) */ case TERMINATE_SIG: { BSP_exit(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; }
/*${HSMs::QHsmTst::SM::s} ..................................................*/ static QState QHsmTst_s(QHsmTst * const me, QEvt const * const e) { QState status_; switch (e->sig) { /* ${HSMs::QHsmTst::SM::s} */ case Q_ENTRY_SIG: { BSP_display("s-ENTRY;"); status_ = Q_HANDLED(); break; } /* ${HSMs::QHsmTst::SM::s} */ case Q_EXIT_SIG: { BSP_display("s-EXIT;"); status_ = Q_HANDLED(); break; } /* ${HSMs::QHsmTst::SM::s::initial} */ case Q_INIT_SIG: { BSP_display("s-INIT;"); status_ = Q_TRAN(&QHsmTst_s11); break; } /* ${HSMs::QHsmTst::SM::s::I} */ case I_SIG: { /* ${HSMs::QHsmTst::SM::s::I::[me->foo]} */ if (me->foo) { me->foo = 0U; BSP_display("s-I;"); status_ = Q_HANDLED(); } else { status_ = Q_UNHANDLED(); } break; } /* ${HSMs::QHsmTst::SM::s::E} */ case E_SIG: { BSP_display("s-E;"); status_ = Q_TRAN(&QHsmTst_s11); break; } /* ${HSMs::QHsmTst::SM::s::TERMINATE} */ case TERMINATE_SIG: { BSP_exit(); status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; }
/*${SMs::ToastOven::SM::final} .............................................*/ static QState ToastOven_final(ToastOven * const me) { QState status_; switch (Q_SIG(me)) { /*${SMs::ToastOven::SM::final} */ case Q_ENTRY_SIG: { BSP_exit(); /* terminate the application */ status_ = Q_HANDLED(); break; } default: { status_ = Q_SUPER(&QHsm_top); break; } } return status_; }
/*..........................................................................*/ QState Calc_final(Calc * const me, QEvt const * const e) { QState status; switch (e->sig) { case Q_ENTRY_SIG: { BSP_message("final-ENTRY;"); BSP_exit(); status = Q_HANDLED(); break; } default: { status = Q_SUPER(&QHsm_top); break; } } return status; }
static QState QMsmTst_s(QMsmTst * const me, QEvt const * const e) { QState status_; switch (e->sig) { /* @(/1/0/1/1/1) */ case I_SIG: { /* @(/1/0/1/1/1/0) */ if (me->foo) { me->foo = 0U; BSP_display("s-I;"); status_ = QM_HANDLED(); } else { status_ = QM_UNHANDLED(); } break; } /* @(/1/0/1/1/2) */ case E_SIG: { static QActionHandler const act_[] = { Q_ACTION_CAST(&QMsmTst_s1_e), Q_ACTION_CAST(&QMsmTst_s11_e), Q_ACTION_CAST(0) }; BSP_display("s-E;"); status_ = QM_TRAN(&QMsmTst_s11_s, &act_[0]); break; } /* @(/1/0/1/1/3) */ case TERMINATE_SIG: { BSP_exit(); status_ = QM_HANDLED(); break; } default: { status_ = QM_SUPER(); break; } } return status_; }
/* ${SMs::Calc::SM::final} */ static QState Calc_final_e(Calc * const me) { BSP_message("final-ENTRY;"); BSP_exit(); (void)me; /* avoid compiler warning in case 'me' is not used */ return QM_ENTRY(&Calc_final_s); }