void i51PortOnNewSms(void) { if(l_InI51){ i51KernelSendEvent( i51_MSG_PAUSE, 0 ); gui_start_timer( 20, i51NewSmsAfter ); } }
static void i51EntryI51Check(void) { // author : Miki // since : 2011.12.2 // (C) PKIG Tech. Co., Ltd. #if( I51_MTK_VS == VS_11B_1224 ) if( GetActiveScreenId() != SCR_ID_ALERT_0 ) #else if( GetActiveScreenId() != SCR_CONFIRM_SCREEN ) #endif { gui_cancel_timer( i51EntryI51Check ); } else if( i51KernelGetInitStatus() == i51_KERNEL_INIT_SUCCEED ) { gui_cancel_timer(i51EntryI51Check); if(l_EntyMenuFnPtr) l_EntyMenuFnPtr(); } else { if(i51KernelGetInitStatus() == i51_KERNEL_INIT_FAILED && l_BootWaited ) i51KernelInit(0); gui_start_timer( 1000, i51EntryI51Check ); } }
static void i51ExitSreen (void) { // author : Miki // since : 2011.8.30 // (C) PKIG Tech. Co., Ltd. i51AdeOsLog( i51_LOG_SC, "PORT : ExitSreen S, Front app run = %d", l_InI51 ); if(l_InI51)//comforn no by call after release front end i51KernelSendEvent(i51_MSG_PAUSE, 0); gui_start_timer( 1, i51CheckPlatQuit ); #ifdef __MTK_TARGET__ #ifdef __MMI_AUDIO_PLAYER__ mdi_audio_resume_background_play(); #endif #endif #ifdef __MMI_TOUCH_SCREEN__ mmi_pen_config_sampling_period(MMI_PEN_SAMPLING_PERIOD_1, MMI_PEN_SAMPLING_PERIOD_2); #endif i51AdeOsLog( i51_LOG_SC, "PORT : ExitSreen , E"); }
/** * @brief 启动一个定时器 * @param idTimer - IN 定时器ID * @param nExpiredTime - IN 以毫秒为单位的定时时间 * @param bOnceOrPeriod - IN YSTrue 表示定时器只有效一次,YSFalse 表示按指定间隔反复发出信号 */ void SFTimer_Start(SFTIMER_ID idTimer,SFInt nExpiredTime,SFBool bOnce,ISFApplication*pHandler) { g_kernal.iTimerInfo.bOnce=bOnce; g_kernal.iTimerInfo.iExpiredTime=nExpiredTime; g_kernal.iTimerInfo.iTimerId=idTimer; g_kernal.iTimerInfo.pHandler=pHandler; gui_start_timer(nExpiredTime,SFTimer_Callback); }
static void i51CheckPlatQuit(void) { // author : Miki // since : 2011.8.30 // (C) PKIG Tech. Co., Ltd. #if( I51_MTK_VS >= VS_11B_1212 ) MMI_ID ParentScreen,Currentscreen; mmi_frm_get_active_scrn_id(&ParentScreen,&Currentscreen); if (Currentscreen != I51_SCREEN_ID ) { if(!mmi_frm_group_is_present(I51_GROUP_ID))//!mmi_frm_scrn_is_present(I51_GROUP_ID,I51_SCREEN_ID,MMI_FRM_NODE_EXCLUDE_ACTIVE_SCRN_FLAG) )//!IsScreenPresent (I51_SCREEN_ID) )//2??úàúê·?á???D { if(l_InI51) { i51AdeOsLog( 0, "PORT : i51CheckPlatQuit , check find NoneScreen's i51"); i51KernelExit( i51_KERNEL_EXIT_DAP ); } } else { gui_start_timer( 100, i51CheckPlatQuit ); } } #else if ( GetActiveScreenId() != I51_SCREEN_ID )//不是当前屏幕 { if( !IsScreenPresent (I51_SCREEN_ID) )//不在历史屏幕中 { if(l_InI51) { i51AdeOsLog( 0, "PORT : i51CheckPlatQuit , check find NoneScreen's i51"); i51KernelExit( i51_KERNEL_EXIT_DAP ); } } else { gui_start_timer( 100, i51CheckPlatQuit ); } } #endif }
iBOOL i51NeedWaitEntry( void (*EntyMenuFnPtr)(void) ) { // author : Miki // since : 2011.12.2 // (C) PKIG Tech. Co., Ltd. if ( i51KernelGetInitStatus() != i51_KERNEL_INIT_SUCCEED ) { l_EntyMenuFnPtr = EntyMenuFnPtr; gui_start_timer(1000, i51EntryI51Check); DisplayConfirm(0, 0, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, (UI_string_type)l_WaitPrompt, IMG_GLOBAL_PROGRESS, 0); SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP); return iTRUE; }else return iFALSE; }
/***************************************************************************** * FUNCTION * wgui_horizontal_tab_bar_start_restore_offset_timer * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ static void wgui_horizontal_tab_bar_start_restore_offset_timer(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (MMI_horizontal_tab_bar_first_displayed_before_pen_down >= 0) { gui_start_timer(WGUI_TAB_BAR_RESTORE_DISPLAY_TIME, wgui_horizontal_tab_bar_restore_offset_timer_hdlr); gui_add_cleanup_hook(wgui_horizontal_tab_bar_abort_restore_offset_timer); } }
static void SFTimer_Callback(void) { ISFApplication*pHandler=g_kernal.iTimerInfo.pHandler; SFLPARAM idTimer=(SFLPARAM)g_kernal.iTimerInfo.iTimerId; if(g_kernal.iTimerInfo.bOnce) { g_kernal.iTimerInfo.pHandler=SFNull; g_kernal.iTimerInfo.iTimerId=0; //gui_cancel_timer(SFTimer_Callback); } else { gui_start_timer(g_kernal.iTimerInfo.iExpiredTime,SFTimer_Callback); } //call the handler pHandler->pfnEvtHandler(pHandler,EVT_TIMER,idTimer,(SFWPARAM)0); //g_bRotate90 = (SFNesEmuApp_GetStatus() == NESEMU_STATUS_GAMER90); }
/***************************************************************************** * FUNCTION * gui_panel_repeat_timer * DESCRIPTION * Timer handler for repeat events * PARAMETERS * void * RETURNS * void *****************************************************************************/ static void gui_panel_repeat_timer(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ gui_panel_element_struct *e; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (!g_curr_active_panel) { return; } e = &g_curr_active_panel->elements[g_curr_active_panel->element_focus_index]; /* Upper applications may use GetKeyInfo() to detect the event, though it's not a good design */ SetkeyInfo(e->keycode, KEY_EVENT_REPEAT); e->repeat_event_callback(); gui_start_timer(g_curr_active_panel->repeat_period, gui_panel_repeat_timer); }
/***************************************************************************** * FUNCTION * mmi_sample_drawing_start_animation * DESCRIPTION * * PARAMETERS * void * RETURNS * void *****************************************************************************/ void mmi_sample_drawing_start_animation(void) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ S32 image_width; S32 image_height; S32 offset_x; S32 offset_y; GDI_RESULT ret; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ /* clear base layer as black */ gdi_layer_clear(GDI_COLOR_BLACK); /* get image size */ ret = gdi_image_get_dimension_id(IMG_ID_DEVAPP_1, &image_width, &image_height); if (ret < 0) { /* error handling */ } /* align at center */ offset_x = (UI_device_width - image_width) >> 1; offset_y = (UI_device_width - image_height) >> 1; sample_drawing_p->anim_handle = 0; ret = gdi_image_draw_animation_id(offset_x, offset_y, IMG_ID_DEVAPP_1, &sample_drawing_p->anim_handle); /* >= 0 means no error */ if (ret >= 0) { gui_start_timer(1000, mmi_sample_drawing_stop_animation); } }
static void mdi_motion_shake_data_hdlr(void *msg_ptr) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ S32 threshold; mdi_motion_msg_struct *msg_data_ptr; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (g_mdi_motion_cntx.state != MOTION_STATE_LISTENING) { g_mdi_motion_cntx.is_msg_send = FALSE; return; } if (g_mdi_motion_cntx.shake_callback == NULL) { g_mdi_motion_cntx.is_msg_send = FALSE; return; } if (g_mdi_motion_cntx.is_mute == TRUE) { /* is mute, flush data */ motion_sensor_flush_buff(); g_mdi_motion_cntx.is_msg_send = FALSE; return; } msg_data_ptr = (mdi_motion_msg_struct*) msg_ptr; if (msg_data_ptr->data_state == MOTION_DATA_EPMTY) { return; } switch (g_mdi_motion_cntx.sensitve) { case MDI_MOTION_SENSITIVE_HIGH: threshold = MOTION_SHAKE_THRESHOLD_HIGH; break; case MDI_MOTION_SENSITIVE_NORMAL: threshold = MOTION_SHAKE_THRESHOLD_NORMAL; break; case MDI_MOTION_SENSITIVE_LOW: threshold = MOTION_SHAKE_THRESHOLD_LOW; break; } /* if has buffer, get data and text if pass threshold or not */ if ((msg_data_ptr->data_state == MOTION_DATA_EXIST) || (msg_data_ptr->data_state == MOTION_DATA_FULL)) { motion_sensor_flush_buff(); g_mdi_motion_cntx.shake_callback(); g_mdi_motion_cntx.is_mute = TRUE; switch (g_mdi_motion_cntx.sensitve) { case MDI_MOTION_SENSITIVE_HIGH: gui_start_timer(MOTION_THRESHOLD_HIGH_MUTE_DURATION, mdi_motion_disable_mute_timeout); break; case MDI_MOTION_SENSITIVE_NORMAL: gui_start_timer(MOTION_THRESHOLD_NORMAL_MUTE_DURATION, mdi_motion_disable_mute_timeout); break; case MDI_MOTION_SENSITIVE_LOW: gui_start_timer(MOTION_THRESHOLD_LOW_MUTE_DURATION, mdi_motion_disable_mute_timeout); break; } } /* set this flag false, allows next messge */ g_mdi_motion_cntx.is_msg_send = FALSE; }
/***************************************************************************** * FUNCTION * gui_panel_translate_pen_event * DESCRIPTION * Pen event handler in GUI panel component * PARAMETERS * panel [IN/OUT] * pen_event [IN] * x [IN] * y [IN] * RETURNS * MMI_TRUE if the pen event is handled by panel. * If pen_event != MMI_PEN_EVENT_DOWN, always return MMI_TRUE. *****************************************************************************/ MMI_BOOL gui_panel_translate_pen_event( gui_panel_struct *panel, mmi_pen_event_type_enum pen_event, S16 x, S16 y) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ MMI_BOOL ret; S32 i; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ if (!panel || panel->element_count <= 0) { return MMI_FALSE; } /* Return true by default except for Pen Down */ ret = MMI_TRUE; switch (pen_event) { case MMI_PEN_EVENT_DOWN: ret = MMI_FALSE; panel->element_pen_down_index = -1; for (i = 0; i < panel->element_count; i++) { gui_panel_element_struct *e = &panel->elements[i]; if (e->disabled_state) { continue; } if (PEN_CHECK_BOUND(x, y, e->x1, e->y1, e->x2 - e->x1 + 1, e->y2 - e->y1 + 1)) { ret = MMI_TRUE; if (panel->element_focus_index != i && panel->display_focus) { gui_panel_show_element( panel, &panel->elements[panel->element_focus_index], GUI_PANEL_ELEM_STATE_NORMAL, MMI_FALSE); } panel->element_pen_down_index = i; panel->element_focus_index = i; gui_panel_show_element(panel, e, GUI_PANEL_ELEM_STATE_DOWN, MMI_FALSE); e->down_state = 1; /* Upper applications may use GetKeyInfo() to detect the event, though it's not a good design */ SetkeyInfo(e->keycode, KEY_EVENT_DOWN); /* Invoke callback */ e->down_event_callback(); /* repeat timer */ g_curr_active_panel = panel; gui_start_timer(panel->repeat_period, gui_panel_repeat_timer); break; } } break; case MMI_PEN_EVENT_UP: if (g_curr_active_panel == panel && panel->element_pen_down_index >= 0) { gui_panel_element_struct *e = &panel->elements[panel->element_pen_down_index]; if (e->down_state) /* If pen was inside the region */ { gui_panel_show_element( panel, e, panel->display_focus ? GUI_PANEL_ELEM_STATE_FOCUSSED : GUI_PANEL_ELEM_STATE_NORMAL, MMI_FALSE); e->down_state = 0; } /* Upper applications may use GetKeyInfo() to detect the event, though it's not a good design */ SetkeyInfo(e->keycode, KEY_EVENT_UP); /* Invoke callback no matter pen was inside the element or not */ e->up_event_callback(); /* repeat timer */ g_curr_active_panel = NULL; gui_cancel_timer(gui_panel_repeat_timer); } break; case MMI_PEN_EVENT_MOVE: if (g_curr_active_panel == panel && panel->element_pen_down_index >= 0) { gui_panel_element_struct *e = &panel->elements[panel->element_pen_down_index]; MMI_BOOL point_inside = PEN_CHECK_BOUND(x, y, e->x1, e->y1, e->x2 - e->x1 + 1, e->y2 - e->y1 + 1); if (e->down_state && !point_inside) /* If pen was inside the region */ { gui_panel_show_element( panel, e, panel->display_focus ? GUI_PANEL_ELEM_STATE_FOCUSSED : GUI_PANEL_ELEM_STATE_NORMAL, MMI_FALSE); e->down_state = 0; gui_cancel_timer(gui_panel_repeat_timer); } else if (!e->down_state && point_inside) { gui_panel_show_element( panel, e, panel->display_focus ? GUI_PANEL_ELEM_STATE_FOCUSSED : GUI_PANEL_ELEM_STATE_NORMAL, MMI_FALSE); e->down_state = 1; gui_start_timer(panel->repeat_period, gui_panel_repeat_timer); } } break; case MMI_PEN_EVENT_LONG_TAP: case MMI_PEN_EVENT_REPEAT: break; case MMI_PEN_EVENT_ABORT: g_curr_active_panel = NULL; break; default: MMI_ASSERT(0); } return ret; }
/***************************************************************************** * FUNCTION * gui_panel_general_key_handler * DESCRIPTION * General key handler for panel elements * PARAMETERS * panel [IN/OUT] panel * keycode [IN] key code * state [IN] key type * RETURNS * void *****************************************************************************/ void gui_panel_general_key_handler(gui_panel_struct *panel, U16 keycode, U16 keytype) { /*----------------------------------------------------------------*/ /* Local Variables */ /*----------------------------------------------------------------*/ S32 i; /*----------------------------------------------------------------*/ /* Code Body */ /*----------------------------------------------------------------*/ for (i = 0; i < panel->element_count; i++) { gui_panel_element_struct *e = &panel->elements[i]; if (e->keycode == keycode) { if (e->disabled_state) { continue; } switch (keytype) { case KEY_EVENT_DOWN: if (panel->element_focus_index != i && panel->display_focus) { gui_panel_show_element( panel, &panel->elements[panel->element_focus_index], GUI_PANEL_ELEM_STATE_NORMAL, MMI_FALSE); } panel->element_focus_index = i; gui_panel_show_element( panel, e, GUI_PANEL_ELEM_STATE_DOWN, MMI_FALSE); e->down_state = 1; /* Invoke callback */ e->down_event_callback(); /* repeat timer */ g_curr_active_panel = panel; gui_start_timer(panel->repeat_period, gui_panel_repeat_timer); break; case KEY_EVENT_UP: gui_panel_show_element( panel, e, panel->display_focus ? GUI_PANEL_ELEM_STATE_FOCUSSED : GUI_PANEL_ELEM_STATE_NORMAL, MMI_FALSE); /* Invoke callback */ if (e->down_state == 1) { e->up_event_callback(); } e->down_state = 0; /* repeat timer */ g_curr_active_panel = NULL; gui_cancel_timer(gui_panel_repeat_timer); break; default: break; } break; } } }