예제 #1
0
// @(/1/0/3/1/3/1) ...........................................................
QP::QState Pelican::pedsWalk(Pelican * const me, QP::QEvt const * const e) {
    QP::QState status_;
    switch (e->sig) {
        // @(/1/0/3/1/3/1)
        case Q_ENTRY_SIG: {
            BSP_showState("pedsWalk");
            BSP_signalPeds(PEDS_WALK);
            me->m_timeout.postIn(me, PEDS_WALK_TOUT);
            status_ = Q_HANDLED();
            break;
        }
        // @(/1/0/3/1/3/1)
        case Q_EXIT_SIG: {
            me->m_timeout.disarm();
            status_ = Q_HANDLED();
            break;
        }
        // @(/1/0/3/1/3/1/0)
        case TIMEOUT_SIG: {
            status_ = Q_TRAN(&Pelican::pedsFlash);
            break;
        }
        default: {
            status_ = Q_SUPER(&Pelican::pedsEnabled);
            break;
        }
    }
    return status_;
}
예제 #2
0
// @(/1/0/3/1/2/1/1) .........................................................
QP::QState Pelican::carsGreenNoPed(Pelican * const me, QP::QEvt const * const e) {
    QP::QState status_;
    switch (e->sig) {
        // @(/1/0/3/1/2/1/1)
        case Q_ENTRY_SIG: {
            BSP_showState("carsGreenNoPed");
            status_ = Q_HANDLED();
            break;
        }
        // @(/1/0/3/1/2/1/1/0)
        case PEDS_WAITING_SIG: {
            status_ = Q_TRAN(&Pelican::carsGreenPedWait);
            break;
        }
        // @(/1/0/3/1/2/1/1/1)
        case TIMEOUT_SIG: {
            status_ = Q_TRAN(&Pelican::carsGreenInt);
            break;
        }
        default: {
            status_ = Q_SUPER(&Pelican::carsGreen);
            break;
        }
    }
    return status_;
}
예제 #3
0
// @(/1/0/3/1/2/2) ...........................................................
QP::QState Pelican::carsYellow(Pelican * const me, QP::QEvt const * const e) {
    QP::QState status_;
    switch (e->sig) {
        // @(/1/0/3/1/2/2)
        case Q_ENTRY_SIG: {
            BSP_showState("carsYellow");
            BSP_signalCars(CARS_YELLOW);
            me->m_timeout.postIn(me, CARS_YELLOW_TOUT);
            status_ = Q_HANDLED();
            break;
        }
        // @(/1/0/3/1/2/2)
        case Q_EXIT_SIG: {
            me->m_timeout.disarm();
            status_ = Q_HANDLED();
            break;
        }
        // @(/1/0/3/1/2/2/0)
        case TIMEOUT_SIG: {
            status_ = Q_TRAN(&Pelican::pedsEnabled);
            break;
        }
        default: {
            status_ = Q_SUPER(&Pelican::carsEnabled);
            break;
        }
    }
    return status_;
}
예제 #4
0
/*..........................................................................*/
QState Ped_wait(Ped *me) {
    switch (Q_SIG(me)) {
        case Q_ENTRY_SIG: {
            BSP_showState(me->super.prio, "wait");
            me->retryCtr = N_ATTEMPTS;
            QActive_arm((QActive *)me, WAIT_TOUT);
            return Q_HANDLED();
        }
        case Q_TIMEOUT_SIG: {
            if ((--me->retryCtr) != 0) {
                QActive_arm((QActive *)me, WAIT_TOUT);
                QActive_post((QActive *)&AO_Pelican, PEDS_WAITING_SIG, 0);
            }
            else {
                return Q_TRAN(&Ped_off);
            }
            return Q_HANDLED();
        }
        case TERMINATE_SIG: {
            QF_stop();
            return Q_HANDLED();
        }
    }
    return Q_SUPER(&QHsm_top);
}
예제 #5
0
// @(/1/0/3/2) ...............................................................
QP::QState Pelican::offline(Pelican * const me, QP::QEvt const * const e) {
    QP::QState status_;
    switch (e->sig) {
        // @(/1/0/3/2)
        case Q_ENTRY_SIG: {
            BSP_showState("offline");
            me->m_timeout.postEvery(me, OFF_FLASH_TOUT);
            me->m_flashCtr = 0;
            status_ = Q_HANDLED();
            break;
        }
        // @(/1/0/3/2)
        case Q_EXIT_SIG: {
            me->m_timeout.disarm();
            status_ = Q_HANDLED();
            break;
        }
        // @(/1/0/3/2/0)
        case TIMEOUT_SIG: {
            me->m_flashCtr ^= 1;
            // @(/1/0/3/2/0/0)
            if ((me->m_flashCtr & 1) == 0) {
                BSP_signalCars(CARS_RED);
                BSP_signalPeds(PEDS_DONT_WALK);
                status_ = Q_HANDLED();
            }
            // @(/1/0/3/2/0/1)
            else {
                BSP_signalCars(CARS_BLANK);
                BSP_signalPeds(PEDS_BLANK);
                status_ = Q_HANDLED();
            }
            break;
        }
        // @(/1/0/3/2/1)
        case ON_SIG: {
            status_ = Q_TRAN(&Pelican::operational);
            break;
        }
        default: {
            status_ = Q_SUPER(&QHsm::top);
            break;
        }
    }
    return status_;
}
예제 #6
0
// @(/1/0/3/1/3/2) ...........................................................
QP::QState Pelican::pedsFlash(Pelican * const me, QP::QEvt const * const e) {
    QP::QState status_;
    switch (e->sig) {
        // @(/1/0/3/1/3/2)
        case Q_ENTRY_SIG: {
            BSP_showState("pedsWalk");
            me->m_timeout.postEvery(me, PEDS_FLASH_TOUT);
            me->m_flashCtr = PEDS_FLASH_NUM*2 + 1;
            status_ = Q_HANDLED();
            break;
        }
        // @(/1/0/3/1/3/2)
        case Q_EXIT_SIG: {
            me->m_timeout.disarm();
            status_ = Q_HANDLED();
            break;
        }
        // @(/1/0/3/1/3/2/0)
        case TIMEOUT_SIG: {
            // @(/1/0/3/1/3/2/0/0)
            if (me->m_flashCtr != 0) {
                --me->m_flashCtr;
                // @(/1/0/3/1/3/2/0/0/0)
                if ((me->m_flashCtr & 1) == 0) {
                    BSP_signalPeds(PEDS_DONT_WALK);
                    status_ = Q_HANDLED();
                }
                // @(/1/0/3/1/3/2/0/0/1)
                else {
                    BSP_signalPeds(PEDS_BLANK);
                    status_ = Q_HANDLED();
                }
            }
            // @(/1/0/3/1/3/2/0/1)
            else {
                status_ = Q_TRAN(&Pelican::carsEnabled);
            }
            break;
        }
        default: {
            status_ = Q_SUPER(&Pelican::pedsEnabled);
            break;
        }
    }
    return status_;
}
예제 #7
0
/*..........................................................................*/
QState Ped_off(Ped *me) {
    switch (Q_SIG(me)) {
        case Q_ENTRY_SIG: {
            BSP_showState(me->super.prio, "off");
            QActive_arm((QActive *)me, OFF_TOUT);
            QActive_post((QActive *)&AO_Pelican, OFF_SIG, 0);
            return Q_HANDLED();
        }
        case Q_TIMEOUT_SIG: {
            QActive_post((QActive *)&AO_Pelican, ON_SIG, 0);
            return Q_TRAN(&Ped_wait);
        }
        case TERMINATE_SIG: {
            QF_stop();
            return Q_HANDLED();
        }
    }
    return Q_SUPER(&QHsm_top);
}
예제 #8
0
/* @(/1/0/1/2) .............................................................*/
static QState Pelican_offline_e(Pelican * const me) {
    BSP_showState(me->super.prio, "offline");
    QActive_armX(&me->super, 0U, OFF_FLASH_TOUT);
    me->flashCtr = 0U;
    return QM_ENTRY(&Pelican_offline_s);
}
예제 #9
0
/* @(/1/0/1/1/3/2) .........................................................*/
static QState Pelican_pedsFlash_e(Pelican * const me) {
    BSP_showState(me->super.prio, "pedsFlash");
    QActive_armX(&me->super, 0U, PEDS_FLASH_TOUT);
    me->flashCtr = (PEDS_FLASH_NUM * 2U) + 1U;
    return QM_ENTRY(&Pelican_pedsFlash_s);
}
예제 #10
0
/* @(/1/0/1/1/3/1) .........................................................*/
static QState Pelican_pedsWalk_e(Pelican * const me) {
    BSP_showState(me->super.prio, "pedsWalk");
    BSP_signalPeds(PEDS_WALK);
    QActive_armX(&me->super, 0U, PEDS_WALK_TOUT);
    return QM_ENTRY(&Pelican_pedsWalk_s);
}
예제 #11
0
/* @(/1/0/1/1/2/2) .........................................................*/
static QState Pelican_carsYellow_e(Pelican * const me) {
    BSP_showState(me->super.prio, "carsYellow");
    BSP_signalCars(CARS_YELLOW);
    QActive_armX(&me->super, 0U, CARS_YELLOW_TOUT);
    return QM_ENTRY(&Pelican_carsYellow_s);
}
예제 #12
0
/* @(/1/0/1/1/2/1/3) .......................................................*/
static QState Pelican_carsGreenPedWait_e(Pelican * const me) {
    BSP_showState(me->super.prio, "carsGreenPedWait");
    return QM_ENTRY(&Pelican_carsGreenPedWait_s);
}