static void ChangeModeHandler(unsigned char Option) { unsigned char Mode = Option & MODE_MASK; tMessage Msg; SetupMessageAndAllocateBuffer(&Msg, ModeChangeIndMsg, (CurrentIdleScreen() << 4) | Mode); Msg.pBuffer[0] = eScUpdateComplete; Msg.Length = 1; RouteMsg(&Msg); PrintStringAndHexByte("- ChgModInd:", Msg.Options); if (Option & MSG_OPT_CHGMOD_IND) return; // ask for current idle page only if (Mode == MUSIC_MODE) SendMessage(&Msg, UpdConnParamMsg, ShortInterval); if (Mode != IDLE_MODE) { PageType = PAGE_TYPE_IDLE; if (ModeTimerId == UNASSIGNED) ModeTimerId = AllocateOneSecondTimer(); SetupOneSecondTimer(ModeTimerId, ModeTimeout[Mode], NO_REPEAT, DISPLAY_QINDEX, ModeTimeoutMsg, Mode); StartOneSecondTimer(ModeTimerId); if (Option & MSG_OPT_UPD_INTERNAL) SendMessage(&Msg, UpdateDisplayMsg, Option); } else { StopOneSecondTimer(ModeTimerId); IdleUpdateHandler(); } CurrentMode = Mode; }
/*! Led Change Handler * * \param tHostMsg* pMsg The message options contain the type of operation that * should be performed on the LED outout. */ static void LedChangeHandler(tMessage* pMsg) { switch (pMsg->Options) { case LED_ON_OPTION: LedOn = 1; ENABLE_LCD_LED(); StartOneSecondTimer(LedTimerId); break; case LED_TOGGLE_OPTION: if ( LedOn ) { LedOn = 0; DISABLE_LCD_LED(); StopOneSecondTimer(LedTimerId); } else { LedOn = 1; ENABLE_LCD_LED(); StartOneSecondTimer(LedTimerId); } break; case LED_START_OFF_TIMER: LedOn = 1; ENABLE_LCD_LED(); StartOneSecondTimer(LedTimerId); break; case LED_OFF_OPTION: default: LedOn = 0; DISABLE_LCD_LED(); StopOneSecondTimer(LedTimerId); break; } }
/*! Led Change Handler * * \param tHostMsg* pMsg The message options contain the type of operation that * should be performed on the LED outout. */ static void LedChangeHandler(tMessage* pMsg) { if (LedTimerId == UNASSIGNED) { LedTimerId = AllocateOneSecondTimer(); SetupOneSecondTimer(LedTimerId, 5, NO_REPEAT, DISPLAY_QINDEX, LedChange, LED_OFF_OPTION); } switch (pMsg->Options) { case LED_ON_OPTION: ENABLE_LCD_LED(); LedOn = 1; StartOneSecondTimer(LedTimerId); break; case LED_TOGGLE_OPTION: if (LedOn) { StopOneSecondTimer(LedTimerId); DISABLE_LCD_LED(); LedOn = 0; } else { ENABLE_LCD_LED(); LedOn = 1; StartOneSecondTimer(LedTimerId); } break; case LED_OFF_OPTION: default: StopOneSecondTimer(LedTimerId); DISABLE_LCD_LED(); LedOn = 0; break; } }
int IdlePageQrCodeExit(void) { StopOneSecondTimer(timerid); DeallocateOneSecondTimer(timerid); timerid = -1; tHostMsg* pOutgoingMsg; /* go back to the normal idle screen */ BPL_AllocMessageBuffer(&pOutgoingMsg); pOutgoingMsg->Type = IdleUpdate; RouteMsg(&pOutgoingMsg); return 0; }
static void SetCallbackTimerHandler(tMessage* pMsg) { tSetCallbackTimerPayload *pPayload = (tSetCallbackTimerPayload *)(pMsg->pBuffer); StopOneSecondTimer(CallbackTimerId); if (pPayload->Repeat) { SetupOneSecondTimer(CallbackTimerId, pPayload->Timeout, pPayload->Repeat, SPP_TASK_QINDEX, CallbackTimeoutMsg, pMsg->Options); StartOneSecondTimer(CallbackTimerId); } }
static void ShowCall(tString *pString, unsigned char Type) { static tString CallerId[15] = ""; static tTimerId NotifyTimerId = UNASSIGNED; tMessage Msg; if (Type == SHOW_NOTIF_CALLER_ID) strcpy(CallerId, pString); if (Type == SHOW_NOTIF_CALLER_NAME && *CallerId) { PrintString3("- Caller:", pString, CR); SetupMessageAndAllocateBuffer(&Msg, SetVibrateMode, MSG_OPT_NONE); *(tSetVibrateModePayload *)Msg.pBuffer = RingTone; RouteMsg(&Msg); PageType = PAGE_TYPE_INFO; CurrentPage[PageType] = CallPage; DrawCallScreen(CallerId, pString); // set a 5s timer for switching back to idle screen if (NotifyTimerId == UNASSIGNED) NotifyTimerId = AllocateOneSecondTimer(); SetupOneSecondTimer(NotifyTimerId, 10, NO_REPEAT, DISPLAY_QINDEX, CallerNameMsg, SHOW_NOTIF_END); StartOneSecondTimer(NotifyTimerId); } else if (Type == SHOW_NOTIF_END || Type == SHOW_NOTIF_REJECT_CALL) { PrintString2("- Call Notif End", CR); *CallerId = NULL; StopOneSecondTimer(NotifyTimerId); PageType = PAGE_TYPE_IDLE; SendMessage(&Msg, UpdateDisplayMsg, CurrentMode | MSG_OPT_UPD_INTERNAL | (CurrentMode == IDLE_MODE ? MSG_OPT_NEWUI : 0)); if (Type == SHOW_NOTIF_REJECT_CALL) SendMessage(&Msg, HfpMsg, MSG_OPT_HFP_HANGUP); } }