• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Q_HANDLED函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Q_HANDLED函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_HANDLED函数的具体用法?C++ Q_HANDLED怎么用?C++ Q_HANDLED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Q_HANDLED函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: QHsmTst_s

/*${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_;
}
开发者ID:KnightSch,项目名称:qpc,代码行数:54,代码来源:qhsmtst.c


示例2: QGprs_polling

/* @(/1/8/23/1/7) ..........................................................*/
static QState QGprs_polling(QGprs * const me, QEvt const * const e) {
    QState status_;
    switch (e->sig) {
        /* @(/1/8/23/1/7) */
        case Q_ENTRY_SIG: {
            QTimeEvt_postEvery(&me->m_retrieveTimer, &me->super, TIMEOUT_RETRIEVE);
            status_ = Q_HANDLED();
            break;
        }
        /* @(/1/8/23/1/7) */
        case Q_EXIT_SIG: {
            QTimeEvt_disarm(&me->m_retrieveTimer);
            status_ = Q_HANDLED();
            break;
        }
        /* @(/1/8/23/1/7/0) */
        case Q_INIT_SIG: {
            status_ = Q_TRAN(&QGprs_initialing);
            break;
        }
        /* @(/1/8/23/1/7/1) */
        case GPRS_RETRIEVE_TIMEOUT_SIG: {
            //接收串口提取
            GPRS_doRetrieveFrame(0, 0);
            status_ = Q_HANDLED();
            break;
        }
        /* @(/1/8/23/1/7/2) */
        case AT_DATAREADY_SIG: {
            //延迟消息到达提取
            me->m_deferedDataReady ++;

            #if 0
            ATMsgEvt* pe = (ATMsgEvt*)e;

            //接收串口提取
            GPRS_doRetrieveFrame(pe->begin, pe->end);

            #endif

            //接收串口提取
            //GPRS_doRetrieveFrame(0, 0);

            status_ = Q_HANDLED();
            break;
        }
        default: {
            status_ = Q_SUPER(&QGprs_serving);
            break;
        }
    }
    return status_;
}
开发者ID:chalot,项目名称:BWRecorder,代码行数:54,代码来源:qgprs.c


示例3: QHsmTst_s2

/*${HSMs::QHsmTst::SM::s::s2} ..............................................*/
static QState QHsmTst_s2(QHsmTst * const me, QEvt const * const e) {
    QState status_;
    switch (e->sig) {
        /* ${HSMs::QHsmTst::SM::s::s2} */
        case Q_ENTRY_SIG: {
            BSP_display("s2-ENTRY;");
            status_ = Q_HANDLED();
            break;
        }
        /* ${HSMs::QHsmTst::SM::s::s2} */
        case Q_EXIT_SIG: {
            BSP_display("s2-EXIT;");
            status_ = Q_HANDLED();
            break;
        }
        /* ${HSMs::QHsmTst::SM::s::s2::initial} */
        case Q_INIT_SIG: {
            BSP_display("s2-INIT;");
            status_ = Q_TRAN(&QHsmTst_s211);
            break;
        }
        /* ${HSMs::QHsmTst::SM::s::s2::I} */
        case I_SIG: {
            /* ${HSMs::QHsmTst::SM::s::s2::I::[!me->foo]} */
            if (!me->foo) {
                me->foo = 1U;
                BSP_display("s2-I;");
                status_ = Q_HANDLED();
            }
            else {
                status_ = Q_UNHANDLED();
            }
            break;
        }
        /* ${HSMs::QHsmTst::SM::s::s2::F} */
        case F_SIG: {
            BSP_display("s2-F;");
            status_ = Q_TRAN(&QHsmTst_s11);
            break;
        }
        /* ${HSMs::QHsmTst::SM::s::s2::C} */
        case C_SIG: {
            BSP_display("s2-C;");
            status_ = Q_TRAN(&QHsmTst_s1);
            break;
        }
        default: {
            status_ = Q_SUPER(&QHsmTst_s);
            break;
        }
    }
    return status_;
}
开发者ID:KnightSch,项目名称:qpc,代码行数:54,代码来源:qhsmtst.c


示例4: AlarmClock_timekeeping

/*..........................................................................*/
QState AlarmClock_timekeeping(AlarmClock * const me) {
    QState status;
    switch (Q_SIG(me)) {
        case Q_ENTRY_SIG: {
            /* timeout in one second and every second */
            QActive_armX(&me->super, 0U,
                         BSP_TICKS_PER_SEC, BSP_TICKS_PER_SEC);
            status = Q_HANDLED();
            break;
        }
        case Q_EXIT_SIG: {
            QActive_disarmX(&me->super, 0U);
            status = Q_HANDLED();
            break;
        }
        case Q_INIT_SIG: {
            status = Q_TRAN(&AlarmClock_mode24hr);
            break;
        }
        case CLOCK_12H_SIG: {
            status = Q_TRAN(&AlarmClock_mode12hr);
            break;
        }
        case CLOCK_24H_SIG: {
            status = Q_TRAN(&AlarmClock_mode24hr);
            break;
        }
        case ALARM_SIG: {
            printf("Wake up!!!\n");
            status = Q_HANDLED();
            break;
        }
        case ALARM_SET_SIG:
        case ALARM_ON_SIG:
        case ALARM_OFF_SIG: {
            /* synchronously dispatch to the orthogonal component */
            Q_SIG(&me->alarm) = Q_SIG(me);
            Q_PAR(&me->alarm) = Q_PAR(me);
            QHSM_DISPATCH(&me->alarm.super);
            status = Q_HANDLED();
            break;
        }
        case TERMINATE_SIG: {
            status = Q_TRAN(&AlarmClock_final);
            break;
        }
        default: {
            status = Q_SUPER(&QHsm_top);
            break;
        }
    }
    return status;
}
开发者ID:QuantumLeaps,项目名称:qpn,代码行数:54,代码来源:comp.c


示例5: SerialMgr_Idle

/*${AOs::SerialMgr::SM::Active::Idle} ......................................*/
static QState SerialMgr_Idle(SerialMgr * const me, QEvt const * const e) {
    QState status_;
    switch (e->sig) {
        /* ${AOs::SerialMgr::SM::Active::Idle} */
        case Q_ENTRY_SIG: {
            /* recall the request from the private requestQueue */
            QActive_recall(
                (QActive *)me,
                &me->deferredEvtQueue
            );
            status_ = Q_HANDLED();
            break;
        }
        /* ${AOs::SerialMgr::SM::Active::Idle::UART_DMA_START, ~} */
        case UART_DMA_START_SIG: /* intentionally fall through */
        case CLI_SEND_DATA_SIG: /* intentionally fall through */
        case DBG_MENU_SIG: {
            /* Set up the DMA buffer here.  This copies the data from the event to the UART's
             * private buffer as well to avoid someone overwriting it */
            Serial_DMAConfig(
                SERIAL_UART1,
                (char *)((LrgDataEvt const *) e)->dataBuf,
                ((LrgDataEvt const *) e)->dataLen
            );
            status_ = Q_TRAN(&SerialMgr_Busy);
            break;
        }
        /* ${AOs::SerialMgr::SM::Active::Idle::DBG_LOG} */
        case DBG_LOG_SIG: {
            /* ${AOs::SerialMgr::SM::Active::Idle::DBG_LOG::[SerialDbgEnable~} */
            if (DBG_IS_DEVICE_ENABLED( _DC3_DBG_DEV_SER )) {
                /* Set up the DMA buffer here.  This copies the data from the event to the UART's
                 * private buffer as well to avoid someone overwriting it */
                Serial_DMAConfig(
                    SERIAL_UART1,
                    (char *)((LrgDataEvt const *) e)->dataBuf,
                    ((LrgDataEvt const *) e)->dataLen
                );
                status_ = Q_TRAN(&SerialMgr_Busy);
            }
            /* ${AOs::SerialMgr::SM::Active::Idle::DBG_LOG::[else]} */
            else {
                status_ = Q_HANDLED();
            }
            break;
        }
        default: {
            status_ = Q_SUPER(&SerialMgr_Active);
            break;
        }
    }
    return status_;
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:54,代码来源:SerialMgr.c


示例6: ToastOven_doorClosed

/*${SMs::ToastOven::SM::doorClosed} ........................................*/
static QState ToastOven_doorClosed(ToastOven * const me, QEvt const * const e) {
    QState status_;
    switch (e->sig) {
        /* ${SMs::ToastOven::SM::doorClosed} */
        case Q_ENTRY_SIG: {
            printf("door-Closed;");
            status_ = Q_HANDLED();
            break;
        }
        /* ${SMs::ToastOven::SM::doorClosed} */
        case Q_EXIT_SIG: {
            me->his_doorClosed = QHsm_state(me); /* save history */
            status_ = Q_HANDLED();
            break;
        }
        /* ${SMs::ToastOven::SM::doorClosed::initial} */
        case Q_INIT_SIG: {
            status_ = Q_TRAN(&ToastOven_off);
            break;
        }
        /* ${SMs::ToastOven::SM::doorClosed::TERMINATE} */
        case TERMINATE_SIG: {
            status_ = Q_TRAN(&ToastOven_final);
            break;
        }
        /* ${SMs::ToastOven::SM::doorClosed::OPEN} */
        case OPEN_SIG: {
            status_ = Q_TRAN(&ToastOven_doorOpen);
            break;
        }
        /* ${SMs::ToastOven::SM::doorClosed::TOAST} */
        case TOAST_SIG: {
            status_ = Q_TRAN(&ToastOven_toasting);
            break;
        }
        /* ${SMs::ToastOven::SM::doorClosed::BAKE} */
        case BAKE_SIG: {
            status_ = Q_TRAN(&ToastOven_baking);
            break;
        }
        /* ${SMs::ToastOven::SM::doorClosed::OFF} */
        case OFF_SIG: {
            status_ = Q_TRAN(&ToastOven_off);
            break;
        }
        default: {
            status_ = Q_SUPER(&QHsm_top);
            break;
        }
    }
    return status_;
}
开发者ID:sesamemucho,项目名称:qsm_study,代码行数:53,代码来源:history.c


示例7: switch

QP::QState Txr::freeRun(Txr * const me, QP::QEvt const * const e) {
  QP::QState status_;
  switch (e->sig) {
    case Q_ENTRY_SIG: 
    {
      ENC_RED_LED_OFF();
      analogWrite(ENC_GREEN_LED, 15);
      me->mPacket.mode = FREE_MODE;
      status_ = Q_HANDLED();
      break;
    }
    case Q_EXIT_SIG: 
    {
      status_ = Q_HANDLED();
      break;
    }
    case SEND_TIMEOUT_SIG: 
    {
      me->UpdatePosition(me);            
      status_ = Q_HANDLED(); 
      break;
    }
    case POSITION_BUTTON_SIG:
    {
      // only save position if finished flashing from previous save
      if (me->mFlashTimeout.ctr() == 0) {
        me->mPrevPositionButtonPressed = ((PositionButtonEvt*)e)->ButtonNum;
        Q_REQUIRE(me->mPrevPositionButtonPressed < NUM_POSITION_BUTTONS);
        me->mSavedPositions[me->mPrevPositionButtonPressed] = me->mCurPos;
        settings.SetSavedPos((int)me->mCurPos,me->mPrevPositionButtonPressed);
        BSP_TurnOnSpeedLED(me->mPrevPositionButtonPressed);
        me->mFlashTimeout.postIn(me, FLASH_RATE_TOUT);
      }
            
      status_ = Q_HANDLED();
      break;
    }
    case FLASH_RATE_SIG: 
    {
      // turn off flashed LED
      BSP_TurnOffSpeedLED(me->mPrevPositionButtonPressed);
      status_ = Q_HANDLED();
      break;
    }
    default: 
    {
      status_ = Q_SUPER(&calibrated);
      break;
    }
  }
  return status_;
}
开发者ID:MotionDogs,项目名称:Lenzhound-dev-pre-release,代码行数:52,代码来源:ao_Txr.cpp


示例8: UI_help_handler

/*..........................................................................*/
QState UI_help_handler(UI_help *me, QEvt const *e) {
    switch (e->sig) {
        case Q_ENTRY_SIG: {
                                     /* instantiate the state-local objects */
            Video_printStrAt(2, 10, VIDEO_FGND_BLACK,
                "Screen 0: Help                   ");
            Video_clearRect( 0, 11, 35, 23, VIDEO_BGND_BLUE);
            Video_clearRect(35, 11, 80, 23, VIDEO_BGND_BLACK);

            Video_printStrAt(36, 12, VIDEO_FGND_LIGHT_GRAY,
                "Press DOWN-Arrow to scroll down");
            Video_printStrAt(36, 13, VIDEO_FGND_LIGHT_GRAY,
                "Press UP-Arrow   to scroll up");

            Video_printStrAt(36, 20, VIDEO_FGND_WHITE,
                "Press F1         to return to last screen");

            Video_clearRect(HELP_X - 1, HELP_Y,
                HELP_X + HELP_DX + 1, HELP_Y + HELP_DY, VIDEO_BGND_BLACK);
            Video_drawRect (HELP_X - 2, HELP_Y - 1,
                HELP_X + HELP_DX + 2, HELP_Y + HELP_DY + 1,
                VIDEO_FGND_WHITE,2);

            me->help_line = 0;
            printHelp(me->super.help_text + me->help_line);

            return Q_HANDLED();
        }
        case Q_EXIT_SIG: {
                                      /* destroy the state-local objects... */
            return Q_HANDLED();
        }
        case DOWN_SIG: {
            if (me->help_line + HELP_DY < me->super.help_len) {
                ++me->help_line;
            }
            printHelp(me->super.help_text + me->help_line);
            return Q_HANDLED();
        }
        case UP_SIG: {
            if (me->help_line > 0) {
                --me->help_line;
            }
            printHelp(me->super.help_text + me->help_line);
            return Q_HANDLED();
        }
        case HELP_SIG: {
            return Q_TRAN(me->super.history); /* go back to the last screen */
        }
    }
    return Q_SUPER(&UI_top_handler);
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:53,代码来源:ui_help.c


示例9: CoffeeMachineAO_Idle

/**
 * Idle state handler
 */
static QState CoffeeMachineAO_Idle(CoffeeMachineAO *me, QEvent const *e)
{
	 switch ( e->sig )
	 {
		 case Q_INIT_SIG:
		 {
			 DBG("CoffeeMachine Idle: INIT");
			 return Q_HANDLED();
		 }
		 
		 case Q_ENTRY_SIG:
		 {
			 DBG("CoffeeMachine Idle: ENTRY");
			 LED_Out(ALL_LEDS_OFF);
			 return Q_HANDLED();
		 }
		 
		 case ALARM_SIG:
		 {
			 DBG("CoffeeMachine Idle: ALARM");
			 return Q_TRAN(&CoffeeMachineAO_Brewing);
		 }
		 
		 case BREWSTRENGTH_SET_SIG:
		 {
			 int brewStrength;
			 int LEDsToFlash;
			 int i;
			 
			 DBG("CoffeeMachine Idle: BREW STRENGH SET");
			 
			 brewStrength = ((BrewStrengthSetEvt const *)e)->brewStrength; // exptected value: 0, 1 or 2 (weak, medium or strong)
			 brewStrength++; // make sure that value is between 1 and 3
			 LEDsToFlash = brewStrength * LEDS_PER_BREW_STRENGH;
			 
			 LED_Out(ALL_LEDS_OFF);
			 
			 for(i = 0; i < LEDsToFlash; i++)
				LED_On(i);
			
			 return Q_HANDLED();
		 }
		 
		 case Q_EXIT_SIG:
		 {
			 DBG("CoffeeMachine Idle: EXIT");
			 return Q_HANDLED();
		 }
	 }
	 
	 return Q_SUPER(&QHsm_top);
}
开发者ID:roland-wilhelm,项目名称:eds,代码行数:55,代码来源:coffeemachine_ao.c


示例10: Cruncher_processing

/*..........................................................................*/
QState Cruncher_processing(Cruncher * const me, QEvt const * const e) {
    QState status;
    switch (e->sig) {
        case Q_ENTRY_SIG: {
            ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG);
            reminder->iter = 0;
            QACTIVE_POST((QActive *)me, (QEvt const *)reminder, me);
            me->sum = 0.0;
            status = Q_HANDLED();
            break;
        }
        case CRUNCH_SIG: {
            uint32_t i = ((ReminderEvt const *)e)->iter;
            uint32_t n = i;
            i += 100;
            for (; n < i; ++n) {
                if ((n & 1) == 0) {
                    me->sum += 1.0/(2*n + 1);
                }
                else {
                    me->sum -= 1.0/(2*n + 1);
                }
            }
            if (i < 0x07000000) {
                ReminderEvt *reminder = Q_NEW(ReminderEvt, CRUNCH_SIG);
                reminder->iter = i;
                QACTIVE_POST((QActive *)me, (QEvt const *)reminder, me);
                status = Q_HANDLED();
            }
            else {
                printf("pi=%16.14f\n", 4.0*me->sum);
                status = Q_TRAN(&Cruncher_processing);
            }
            break;
        }
        case ECHO_SIG: {
            printf("Echo! pi=%16.14f\n", 4.0*me->sum);
            status = Q_HANDLED();
            break;
        }
        case TERMINATE_SIG: {
            status = Q_TRAN(&Cruncher_final);
            break;
        }
        default: {
            status = Q_SUPER(&QHsm_top);
            break;
        }
    }
    return status;
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:52,代码来源:reminder2.c


示例11: CoffeeAO_setBrewStrength

/* @(/2/0/9/1/2/1) .........................................................*/
QState CoffeeAO_setBrewStrength(CoffeeAO * const me, QEvt const * const e) {
    QState status_;
    switch (e->sig) {
        /* @(/2/0/9/1/2/1) */
        case Q_ENTRY_SIG: {
            lcd_clear();
            set_cursor(0, 0);
            lcd_print("Use AD-Wheel");
            set_cursor(0, 1);
            lcd_print("Use int0 to save");
            printf("Changing brew strength...\n");
            status_ = Q_HANDLED();
            break;
        }
        /* @(/2/0/9/1/2/1) */
        case Q_EXIT_SIG: {
            printf("saved brew strength: %u\n", l_CoffeeAO.current_brew_strength);
            status_ = Q_HANDLED();
            break;
        }
        /* @(/2/0/9/1/2/1/0) */
        case ADWHEEL_SIG: {
            const int led_count = 8;
            int i = 0;
            l_CoffeeAO.current_brew_strength = ((AdEvt*)e)->val * led_count / 1024;
            for(i = 0; i < led_count; i++) {
                if (i <= l_CoffeeAO.current_brew_strength) {
                    LED_On(i);
                } else {
                    LED_Off(i);
                }
            }

            status_ = Q_HANDLED();
            break;
        }
        /* @(/2/0/9/1/2/1/1) */
        case INT_SIG: {
            QF_INT_ENABLE();
            QActive_postFIFO((QActive *)&l_CoffeeAO, Q_NEW(QEvent, GO_BACK_SIG));
            QF_INT_DISABLE();
            status_ = Q_HANDLED();
            break;
        }
        default: {
            status_ = Q_SUPER(&CoffeeAO_submenu);
            break;
        }
    }
    return status_;
}
开发者ID:trampi,项目名称:eds-ss15,代码行数:52,代码来源:coffee.c


示例12: Calc_negated1

/*..........................................................................*/
QState Calc_negated1(Calc * const me, QEvt const * const e) {
    QState status;
    switch (e->sig) {
        case Q_ENTRY_SIG: {
            BSP_message("negated1-ENTRY;");
            BSP_negate();
            status = Q_HANDLED();
            break;
        }
        case Q_EXIT_SIG: {
            BSP_message("negated1-EXIT;");
            status = Q_HANDLED();
            break;
        }
        case OPER_SIG: {
            if (((CalcEvt const *)e)->key_code == KEY_MINUS) {
                ;                                      /* explicitly ignore */
                status = Q_HANDLED();                      /* event handled */
            }
            else {
                status = Q_HANDLED();
            }
            break;
        }
        case CE_SIG: {
            BSP_clear();
            status = Q_TRAN(&Calc_begin);
            break;
        }
        case DIGIT_0_SIG: {
            BSP_insert(((CalcEvt const *)e)->key_code);
            status = Q_TRAN(&Calc_zero1);
            break;
        }
        case DIGIT_1_9_SIG: {
            BSP_insert(((CalcEvt const *)e)->key_code);
            status = Q_TRAN(&Calc_int1);
            break;
        }
        case POINT_SIG: {
            BSP_insert(((CalcEvt const *)e)->key_code);
            status = Q_TRAN(&Calc_frac1);
            break;
        }
        default: {
            status = Q_SUPER(&Calc_on);
            break;
        }
    }
    return status;
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:52,代码来源:calc2.c


示例13: ToasterOven_heating

/*..........................................................................*/
QState ToasterOven_heating(ToasterOven *me, QEvt const *e) {
    (void)me;              /* avoid compiler warning about unused parameter */
    switch (e->sig) {
        case Q_ENTRY_SIG: {
            printf("heater-On;");
            return Q_HANDLED();
        }
        case Q_EXIT_SIG: {
            printf("heater-Off;");
            return Q_HANDLED();
        }
    }
    return Q_SUPER(&ToasterOven_doorClosed);
}
开发者ID:christation,项目名称:STM32491_CPLR,代码行数:15,代码来源:history.c


示例14: NumEntry_fraction

/*..........................................................................*/
QState NumEntry_fraction(NumEntry *me, QEvt const *e) {
    switch (e->sig) {
        case DIGIT_0_SIG:                     /* intentionally fall through */
        case DIGIT_1_9_SIG: {
            NumEntry_insert(me, ((KeyboardEvt const *)e)->key_code);
            return Q_HANDLED();
        }
        case POINT_SIG: {
            ;                                          /* explicitly ignore */
            return Q_HANDLED();
        }
    }
    return Q_SUPER(&NumEntry_top);
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:15,代码来源:num_ent.c


示例15: AlarmMgr_on

/*..........................................................................*/
QState AlarmMgr_on(AlarmMgr *me, QEvt const *e) {
    switch (e->sig) {
        case ALARM_REQUEST_SIG: {
            uint8_t alarm_type = ((AlarmEvt *)e)->alarm_type;

            Q_ASSERT((ALL_ALARMS < alarm_type)
                     && (alarm_type < Q_DIM(l_alarms)));

            if (QPSet8_hasElement(&me->active_alarms, alarm_type)) {
                return Q_HANDLED();
            }
            else {
                QPSet8_insert(&me->active_alarms, alarm_type);
                QPSet8_findMax(&me->active_alarms, alarm_type);
                me->curr_alarm = alarm_type;
                me->curr_note  = 0;            /* start with the first note */
                return Q_TRAN(&AlarmMgr_playing);
            }
        }
        case ALARM_SILENCE_SIG: {
            uint8_t alarm_type = ((AlarmEvt *)e)->alarm_type;

            Q_ASSERT(alarm_type < Q_DIM(l_alarms));

            if (alarm_type == ALL_ALARMS) {
                QPSet8_clear(&me->active_alarms);
                return Q_TRAN(&AlarmMgr_silent);
            }
            else {
                QPSet8_remove(&me->active_alarms, alarm_type);
                if (QPSet8_isEmpty(&me->active_alarms)) {
                    return Q_TRAN(&AlarmMgr_silent);
                }
                else {
                    QPSet8_findMax(&me->active_alarms, alarm_type);
                    if (me->curr_alarm != alarm_type) {
                        me->curr_alarm = alarm_type;
                        me->curr_note = 0;
                        return Q_TRAN(&AlarmMgr_playing);
                    }
                    else {
                        return Q_HANDLED();
                    }
                }
            }
        }
    }
    return Q_SUPER(&QHsm_top);
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:50,代码来源:alarm.c


示例16: Calc_ready

/*..........................................................................*/
QState Calc_ready(Calc * const me, QEvt const * const e) {
    QState status;
    switch (e->sig) {
        case Q_ENTRY_SIG: {
            BSP_message("ready-ENTRY;");
            status = Q_HANDLED();
            break;
        }
        case Q_EXIT_SIG: {
            BSP_message("ready-EXIT;");
            status = Q_HANDLED();
            break;
        }
        case Q_INIT_SIG: {
            BSP_message("ready-INIT;");
            status = Q_TRAN(&Calc_begin);
            break;
        }
        case DIGIT_0_SIG: {
            BSP_clear();
            status = Q_TRAN(&Calc_zero1);
            break;
        }
        case DIGIT_1_9_SIG: {
            BSP_clear();
            BSP_insert(((CalcEvt const *)e)->key_code);
            status = Q_TRAN(&Calc_int1);
            break;
        }
        case POINT_SIG: {
            BSP_clear();
            BSP_insert((int)'0');
            BSP_insert((int)'.');
            status = Q_TRAN(&Calc_frac1);
            break;
        }
        case OPER_SIG: {
            me->operand1 = BSP_get_value();
            me->operator = ((CalcEvt const *)e)->key_code;
            status = Q_TRAN(&Calc_opEntered);
            break;
        }
        default: {
            status = Q_SUPER(&Calc_on);
            break;
        }
    }
    return status;
}
开发者ID:SmartCocktailFactory,项目名称:QP_LWIP_STM32F2xx_eth_DPP_Example,代码行数:50,代码来源:calc2.c


示例17: Segment_idle

/*..........................................................................*/
static QState Segment_idle(Segment *me, QEvent const *e)
{
	switch (e->sig) {
	case TERMINATE_SIG:
		return Q_TRAN(&Segment_final);
		
	case SEG_READ_REQUEST_SIG:
		/* search the LSA dirtory */
		return Q_HANDLED();

	case SEG_WRITE_REQUEST_SIG:
		return Q_HANDLED();
	}
	return Q_SUPER(&QHsm_top);
}
开发者ID:Quenii,项目名称:lsa_raid,代码行数:16,代码来源:segment.c


示例18: buzzerState

static QState buzzerState(struct ExternalBell *me)
{
	switch (Q_SIG(me)) {
	case Q_ENTRY_SIG:
		BSP_buzzer(external_bell_buzz, 8);
		QActive_arm((QActive*)me, 7);
		return Q_HANDLED();
	case Q_TIMEOUT_SIG:
		return Q_TRAN(offState);
	case Q_EXIT_SIG:
		BSP_buzzer(0, 0);
		return Q_HANDLED();
	}
	return Q_SUPER(topState);
}
开发者ID:russells,项目名称:rdoorbell0,代码行数:15,代码来源:external-bell.c


示例19: QHsmSata_linkdown

/*..........................................................................*/
QState QHsmSata_linkdown(QHsmSata *me, QEvent const *e)
{
	switch (e->sig) {
	case Q_ENTRY_SIG: 
		hw_reg_begin (me->port, INTC_LINK);
		hw_reg_update(me->port, C_DATA, 0x1);
		hw_reg_end   (me->port);
		BSP_display("down-ENTRY;");
		return Q_HANDLED();
	case Q_EXIT_SIG:
		BSP_display("down-EXIT;");
		return Q_HANDLED();
	}
	return Q_SUPER(&QHsmSata_top);
}
开发者ID:Quenii,项目名称:ahci_mpi,代码行数:16,代码来源:sata_mpi.c


示例20: switch

// @(/1/0/3/1) ...............................................................
QP::QState Pelican::operational(Pelican * const me, QP::QEvt const * const e) {
    QP::QState status_;
    switch (e->sig) {
        // @(/1/0/3/1)
        case Q_ENTRY_SIG: {
            BSP_signalCars(CARS_RED);
            BSP_signalPeds(PEDS_DONT_WALK);
            status_ = Q_HANDLED();
            break;
        }
        // @(/1/0/3/1/0)
        case Q_INIT_SIG: {
            status_ = Q_TRAN(&Pelican::carsEnabled);
            break;
        }
        // @(/1/0/3/1/1)
        case OFF_SIG: {
            status_ = Q_TRAN(&Pelican::offline);
            break;
        }
        default: {
            status_ = Q_SUPER(&QHsm::top);
            break;
        }
    }
    return status_;
}
开发者ID:ankiys,项目名称:QP_Fraunchpad,代码行数:28,代码来源:ao_pelican.cpp



注:本文中的Q_HANDLED函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Q_INIT_RESOURCE函数代码示例发布时间:2022-05-30
下一篇:
C++ Q_FOREACH函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap