本文整理汇总了C++中Q_HANDLED函数的典型用法代码示例。如果您正苦于以下问题:C++ Q_HANDLED函数的具体用法?C++ Q_HANDLED怎么用?C++ Q_HANDLED使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Q_HANDLED函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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_;
}
示例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_;
}
示例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_;
}
示例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;
}
示例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_;
}
示例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_;
}
示例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_;
}
示例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);
}
示例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);
}
示例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;
}
示例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_;
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}