Events.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:92k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*******************************************************************************
- * Filename:
- * ---------
- * Events.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends for protocol/keypad/interrupt event handler .
- *
- * Author:
- * -------
- * -------
- *
- *==============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *==============================================================================
- *******************************************************************************/
- #include "MMI_features.h"
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "GlobalConstants.h"
- #include "DebugInitDef.h"
- #include "PixtelDataTypes.h"
- #include "ProtocolEvents.h"
- #include "FrameworkStruct.h"
- #include "EventsGprot.h"
- #include "WrapperGprot.h"
- #include "KeyBrd.h"
- #include "EventsDcl.h"
- #include "EventsDef.h"
- #include "CustDataProts.h"
- #include "SATGProts.h"
- #include "IdleAppProt.h"
- #include "IdleAppDef.h"
- #include "SubLCDHistoryGprot.h"
- #include "SimDetectionGexdcl.h"
- #include "SimDetectionGprot.h"
- #include "SettingDefs.h"
- #include "SettingsGdcl.h"
- #include "CallManagementGprot.h"
- #ifdef __MMI_VOIP__
- #include "VoIPGProt.h"
- #endif
- #include "VolumeHandler.h"
- #ifdef __MMI_TOUCH_SCREEN__
- #include "wgui_touch_screen.h"
- #endif
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- #include "ThemeManager.h"
- #endif
- #include "l4dr.h"
- #include "MMI_trc.h"
- #include "QuickAccessMenuItem_def.h"
- #ifdef __MMI_WGUI_MINI_TAB_BAR__
- #include "wgui_tab_bars.h"
- #endif
- /* added by MK */
- #ifdef __MMI_EMAIL__
- #include "EmailAppGProt.h"
- #endif // #ifdef __MMI_EMAIL__
- #include "KeyBrd.h"
- #if defined(__MMI_RESOURCE_ENFB_SUPPORT__)
- #include "ResMemMgrGprot.h"
- #endif /* __MMI_RESOURCE_ENFB_SUPPORT__ */
- /*
- * Define
- */
- #define INTERRUPT_EVENT_GREOUP_SIZE (4)
- #define IS_INTERRUPT_EVENT_GROUP(x) (((x)&MMI_INT_EVENT_GROUP_MASK) == MMI_INT_EVENT_GROUP_MASK)
- /* for profiling */
- #if 0
- /* under construction !*/
- #endif
- #define MMI_EVENT_INVALID 0
- /*
- * Data Type
- */
- typedef struct
- {
- U16 groupID;
- U16 eventID[INTERRUPT_EVENT_GREOUP_SIZE];
- } InterruptGroupInfo;
- /*
- * Extern Varibales
- */
- extern pBOOL IsBackHistory;
- extern U8 gIsHelpEnabled;
- extern U8 gInitAllAppFlag;
- extern U8 gInsertSimAppFlag;
- extern U8 gEmerencyNoDialed;
- extern U8 gIsInSATCall;
- FuncPtr currKeyFuncPtrs[MAX_KEYS][MAX_KEY_TYPE]; /* available key func ptrs to current screen */
- hiliteInfo maxHiliteInfo[MAX_HILITE_HANDLER]; /* available hilite func ptrs */
- U8 hintData[MAX_SUB_MENUS][MAX_SUB_MENU_HINT_SIZE];
- U8 subMenuData[MAX_SUB_MENUS][MAX_SUB_MENU_SIZE];
- PU8 subMenuDataPtrs[MAX_SUB_MENUS];
- PU8 hintDataPtrs[MAX_SUB_MENUS];
- U8 processUpRepeatKey = 0;
- U8 pressKey = 0; /* 0- full up, 1- half down, 2- full down */
- /*
- * Local Variables
- */
- /*
- * If we add new interrupt event group id
- * , we fill the table to establish the mapping events table.
- */
- static InterruptGroupInfo interruptGroupEventTable[] =
- {
- {MMI_SMS_INT_EVENT_GROUP,
- {PRT_MSG_ID_MMI_SMS_DELIVER_MSG_IND,
- PRT_MSG_ID_MMI_SMS_STATUS_REPORT_IND,
- PRT_MSG_ID_MMI_SMS_MSG_WAITING_IND,
- 0 /* end at 0 */
- }
- }
- #if defined(__MMI_FILE_MANAGER__)
- ,{MMI_CARD_PLUG_EVENT_GROUP,
- {MSG_ID_FMT_MMI_CARD_PLUG_IN_IND,
- MSG_ID_FMT_MMI_CARD_PLUG_OUT_IND,
- 0 /* end at 0 */
- }
- }
- #endif /* __MMI_FILE_MANAGER__ */
- };
- static U16 currMaxHiliteInfo; /* currently max hilite info */
- static U16 maxProtocolEvent;
- static U16 usedProtocolEvent;
- static U16 maxInterruptEvent;
- static U16 currParentID; /* current parent item id */
- static U16 currKeyCode;
- static U16 currKeyType;
- static U16 currHiliteID;
- static FuncPtr currEntryFuncPtr;
- static U16 currExitScrnID, currTopScrnID; /* curr exit func ptr with scrn id */
- static FuncPtr currExitFuncPtr;
- static PseventInfo protocolEventHandler[MAX_PROTOCOL_EVENT];
- static PsInteventInfo interruptEventHandler[MAX_INTERRUPT_EVENT];
- static MMI_BOOL mmu_frm_execute_scrn_exit_handler = MMI_FALSE;
- /*
- * Local Functions
- */
- static void ExecuteCurrExitHandler(void); /* execute current exit func handler, before execute current event handler */
- static void ExecuteCurrExitHandler_Ext(void); /* execute current exit func handler, before execute current event handler */
- static void SetGenericExitHandler(U16 scrnID, FuncPtr exitFuncPtr, FuncPtr entryFuncPtr);
- static MMI_BOOL QueryInterruptHandler(U16 eventID, PsIntFuncPtr *funcPtr, PsIntFuncPtr *postfuncPtr);
- /* 090404 MTK Calvin removed */
- /* static void SetExitHandler(U16 scrnID, FuncPtr exitFuncPtr); */
- /* 090404 MTK Calvin end */
- /*
- * Global Functions
- */
- extern void EmergencyCallCheck(S16 keyCode, S16 keyType);
- extern void InitKeypadBeforePWRON(void);
- extern U16 GetTotalCallCount(void);
- #ifdef __MMI_SCREEN_SNAPSHOT__
- extern void mmi_camera_scr_snapshot(void);
- #endif
- /*****************************************************************************
- * FUNCTION
- * InitEvents
- * DESCRIPTION
- * Initialization
- *
- * This is used to Initialize event handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void InitEvents(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 keyCode = 0;
- U16 keyType = 0;
- U16 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_INIT));
- for (keyCode = 0; keyCode < MAX_KEYS; keyCode++)
- {
- for (keyType = 0; keyType < MAX_KEY_TYPE; keyType++)
- {
- currKeyFuncPtrs[keyCode][keyType] = NULL;
- }
- }
- currEntryFuncPtr = NULL;
- currExitScrnID = 0;
- currTopScrnID = 0;
- currExitFuncPtr = NULL;
- mmu_frm_execute_scrn_exit_handler = MMI_FALSE;
- /* JL remove to outside init InitHistory(); */
- currMaxHiliteInfo = 0;
- currParentID = 0;
- maxProtocolEvent = 0;
- usedProtocolEvent = 0;
- /* MTK added by JL for PS interrupt */
- maxInterruptEvent = 0;
- /* //////// initilaize the timer, protocol & hardware events with func ptrs /////// */
- for (count = 0; count < MAX_PROTOCOL_EVENT; count++)
- {
- protocolEventHandler[count].eventID = 0;
- protocolEventHandler[count].entryFuncPtr = NULL;
- }
- for (count = 0; count < MAX_HILITE_HANDLER; count++)
- {
- maxHiliteInfo[count].entryFuncPtr = NULL;
- maxHiliteInfo[count].hintFuncPtr = NULL;
- }
- for (count = 0; count < MAX_SUB_MENUS; count++)
- {
- subMenuDataPtrs[count] = subMenuData[count];
- }
- /* MTK added by JL for PS interrupt */
- for (count = 0; count < MAX_INTERRUPT_EVENT; count++)
- {
- interruptEventHandler[count].eventID = (U16) NULL;
- interruptEventHandler[count].entryIntFuncPtr = NULL;
- interruptEventHandler[count].postIntFuncPtr = NULL;
- }
- /* ////////////////////////////////////////////////////////////////////////////////////// */
- }
- /*****************************************************************************
- * FUNCTION
- * DeInitFramework_KeyAndEventHandler
- * DESCRIPTION
- * DeInitialization
- *
- * Deinitialize key and event handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void DeInitFramework_KeyAndEventHandler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 keyCode = 0;
- U16 keyType = 0;
- U16 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT_KEY_EVENT));
- for (keyCode = 0; keyCode < MAX_KEYS; keyCode++)
- {
- for (keyType = 0; keyType < MAX_KEY_TYPE; keyType++)
- {
- currKeyFuncPtrs[keyCode][keyType] = NULL;
- }
- }
- currEntryFuncPtr = NULL;
- currExitScrnID = 0;
- currTopScrnID = 0;
- currExitFuncPtr = NULL;
- currMaxHiliteInfo = 0;
- currParentID = 0;
- maxProtocolEvent = 0;
- usedProtocolEvent = 0;
- /* //////// initilaize the timer, protocol & hardware events with func ptrs /////// */
- for (count = 0; count < MAX_PROTOCOL_EVENT; count++)
- {
- protocolEventHandler[count].eventID = 0;
- protocolEventHandler[count].entryFuncPtr = NULL;
- }
- for (count = 0; count < MAX_HILITE_HANDLER; count++)
- {
- maxHiliteInfo[count].entryFuncPtr = NULL;
- maxHiliteInfo[count].hintFuncPtr = NULL;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * DeInitFramework_History
- * DESCRIPTION
- * DeInitialization
- *
- * Deinitialize History
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void DeInitFramework_History(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT_HISTORY));
- #ifndef MMI_ON_WIN32
- /* to handle key events before finish power off */
- InitKeypadBeforePWRON();
- #endif /* MMI_ON_WIN32 */
- DinitHistory();
- DinitSubLCDHistory();
- }
- /*****************************************************************************
- * FUNCTION
- * DeInitFramework
- * DESCRIPTION
- * DeInitialization
- *
- * This is used to De-initialize history & event handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void DeInitFramework(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT));
- DeInitFramework_KeyAndEventHandler();
- DeInitFramework_History();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_reset_internal_key_contex
- * DESCRIPTION
- * Reset internal key contex
- *
- * This is used to De-initialize history & event handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_reset_internal_key_contex()
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- pressKey = 0;
- processUpRepeatKey = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * ExecuteCurrKeyHandler
- * DESCRIPTION
- * executes current key func handler
- *
- * This is used to executes current key func handler
- * PARAMETERS
- * keyCode [IN]
- * keyType [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ExecuteCurrKeyHandler(S16 keyCode, S16 keyType)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- FuncPtr currFuncPtr = NULL;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_idle_restart_keypad_lock_timer(); /* 2006/01/16 Restart keypad lock timer if any key is pressed in idle screen */
- currKeyCode = keyCode;
- currKeyType = keyType;
- /* Added for Help */
- /*
- * if(gIsHelpEnabled != 0)
- * {
- * StopTimer(HELP_APPLICATION_TIMER);
- * StartTimer(HELP_APPLICATION_TIMER,HELP_APPLICATION_TIMEOUT,ShowHelp);
- * }
- */
- if (!gEmerencyNoDialed)
- {
- if (mmi_kbd_get_concurrent_mode() == MMI_FALSE)
- {
- /* special handling for single-key mode */
- switch (keyType)
- {
- case KEY_HALF_PRESS_DOWN:
- pressKey = 1; /* 0- full up, 1- half down, 2- full down */
- break;
- case KEY_EVENT_DOWN:
- /*
- * The application may call ExecuteCurrKeyHandler() directly
- * MMI framework use KEY_HALF_PRESS_DOWN or KEY_FULL_PRESS_DOWN only
- */
- pressKey = 2; /* 0- full up, 1- half down, 2- full down */
- processUpRepeatKey = 1;
- break;
- case KEY_REPEAT:
- if (!processUpRepeatKey)
- {
- return;
- }
- break;
- case KEY_EVENT_UP:
- if (pressKey == 0)
- {
- /* processUpRepeatKey=0; */
- mmi_frm_reset_internal_key_contex();
- return;
- }
- break;
- }
- }
- currFuncPtr = currKeyFuncPtrs[keyCode][keyType];
- /* MTK Leo add, if there is no handler for center key(KEY_ENTER) registered by APP, use LSK function. */
- if (keyCode == KEY_ENTER && currFuncPtr == NULL)
- {
- /* If any one type of the key eventis registered by APP, we assume APP want to control this key by itself. */
- if (currKeyFuncPtrs[KEY_ENTER][KEY_EVENT_UP] == NULL &&
- currKeyFuncPtrs[KEY_ENTER][KEY_EVENT_DOWN] == NULL &&
- currKeyFuncPtrs[KEY_ENTER][KEY_HALF_PRESS_DOWN] == NULL &&
- currKeyFuncPtrs[KEY_ENTER][KEY_REPEAT] == NULL && currKeyFuncPtrs[KEY_ENTER][KEY_LONG_PRESS] == NULL)
- {
- currFuncPtr = currKeyFuncPtrs[KEY_LSK][keyType];
- }
- }
- /* MTK Leo end. */
- if ((keyType == KEY_REPEAT) && (currFuncPtr == NULL) && (keyCode != KEY_RSK) && (keyCode != KEY_LSK)) /* 20040906 Disable repeat for LSK and RSK */
- {
- currFuncPtr = currKeyFuncPtrs[keyCode][KEY_EVENT_DOWN];
- }
- #ifdef __MMI_WGUI_MINI_TAB_BAR__
- if (wgui_if_mini_tab_bar_enable() == MMI_TRUE && keyCode == KEY_LEFT_ARROW && keyType == KEY_EVENT_DOWN)
- {
- currFuncPtr = wgui_mini_tab_bar_goto_prev;
- }
- if (wgui_if_mini_tab_bar_enable() == MMI_TRUE && keyCode == KEY_RIGHT_ARROW && keyType == KEY_EVENT_DOWN)
- {
- currFuncPtr = wgui_mini_tab_bar_goto_next;
- }
- #endif /* __MMI_WGUI_MINI_TAB_BAR__ */
- #ifdef __MMI_SCREEN_SNAPSHOT__
- if ((keyType == KEY_LONG_PRESS) && (keyCode == KEY_CAMERA) && (currFuncPtr == NULL))
- {
- currFuncPtr = mmi_camera_scr_snapshot;
- }
- #endif /* __MMI_SCREEN_SNAPSHOT__ */
- if (mmi_kbd_get_concurrent_mode() == MMI_FALSE)
- {
- if (keyType == KEY_EVENT_UP)
- {
- /* release the key */
- if (pressKey == 1) /* 0- full up, 1- half down, 2- full down */
- {
- currFuncPtr = currKeyFuncPtrs[keyCode][KEY_HALF_PRESS_UP];
- }
- else if ((pressKey == 2) && (currKeyFuncPtrs[keyCode][KEY_HALF_PRESS_UP] != NULL))
- {
- /* If KEY_EVENT_UP in 2-stage full-pressed key, need call KEY_HALF_PRESS_UP handler first */
- currKeyFuncPtrs[keyCode][KEY_HALF_PRESS_UP] ();
- }
- /* special handling for single-key mode */
- mmi_frm_reset_internal_key_contex();
- }
- }
- if (currFuncPtr)
- {
- #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
- g_mmi_frm_cntx.dump_screen_info.allow_dump_screen_str = MMI_TRUE;
- #endif
- MMI_TRACE( (MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURKEY_KEYCODE_HDLR,currFuncPtr, keyCode, keyType));
- (*currFuncPtr)();
- }
- }
- else
- {
- gEmerencyNoDialed = 0;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ExecuteCurrProtocolHandler
- * DESCRIPTION
- * executes current protocol func handler
- *
- * This is used to executes current protocol func handler
- * PARAMETERS
- * eventID [IN]
- * MsgStruct [IN]
- * mod_src [IN]
- * peerBuf [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ExecuteCurrProtocolHandler(U16 eventID, void *MsgStruct, int mod_src, void *peerBuf)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 count = 0;
- /* PsExtFuncPtr currFuncPtr = NULL; */
- PsExtPeerFuncPtr currFuncPtr = NULL;
- PsIntFuncPtr IntFunc = NULL, PostIntFunc = NULL;
- PsExtPeerIntFuncPtr currInterruptFuncPtr = NULL, currPostInterruptFuncPtr = NULL;
- U8 interrup_result = MMI_FALSE; /* False not handle interrupt, True will handle */
- #if defined (MMI_EVENT_PROFILING)
- kal_uint32 start_tick, end_tick;
- static kal_uint32 accu_ticks = 0;
- static U32 accu_count = 0;
- #endif /* defined (MMI_EVENT_PROFILING) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined (MMI_EVENT_PROFILING)
- kal_get_time(&start_tick);
- #endif
- /* Search events in protocol event handler table */
- for (count = 0; count < maxProtocolEvent; count++)
- {
- if (protocolEventHandler[count].eventID == eventID)
- {
- currFuncPtr = (PsExtPeerFuncPtr) protocolEventHandler[count].entryFuncPtr;
- if (count > 0)
- { /* improve the search efficiently */
- protocolEventHandler[count].eventID = protocolEventHandler[count - 1].eventID;
- protocolEventHandler[count].entryFuncPtr = protocolEventHandler[count - 1].entryFuncPtr;
- protocolEventHandler[count - 1].eventID = eventID;
- protocolEventHandler[count - 1].entryFuncPtr = (PsFuncPtr) currFuncPtr;
- }
- break;
- }
- }
- #if defined (MMI_EVENT_PROFILING)
- PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler count = %d", count));
- accu_count += count;
- #endif /* defined (MMI_EVENT_PROFILING) */
- /* Search events in interrupt event handler table */
- QueryInterruptHandler(eventID, &IntFunc, &PostIntFunc);
- currInterruptFuncPtr = (PsExtPeerIntFuncPtr) IntFunc;
- currPostInterruptFuncPtr = (PsExtPeerIntFuncPtr) PostIntFunc;
- if (currInterruptFuncPtr)
- {
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURPTO_INTP_HDLR, eventID));
- interrup_result = (*currInterruptFuncPtr) (MsgStruct, mod_src, peerBuf);
- }
- /* if(currFuncPtr) */
- if ((currFuncPtr) && (!interrup_result))
- {
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURPTO_HDLR, eventID));
- /* (*currFuncPtr)(MsgStruct,mod_src); */
- (*currFuncPtr) (MsgStruct, mod_src, peerBuf);
- }
- else
- {
- MMI_TRACE((MMI_TRACE_WARNING, MMI_FRM_INFO_EVENT_EXECURPTO_NO_HDLR, eventID));
- }
- if (currPostInterruptFuncPtr)
- {
- (*currPostInterruptFuncPtr) (MsgStruct, mod_src, peerBuf);
- }
- #if defined (MMI_EVENT_PROFILING)
- kal_get_time(&end_tick);
- accu_ticks += (end_tick - start_tick);
- PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler accu_count = %d", accu_count));
- PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler accu_ticks = %d", accu_ticks));
- PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler maxProtocolEvent = %d", maxProtocolEvent));
- #endif /* defined (MMI_EVENT_PROFILING) */
- }
- /*****************************************************************************
- * FUNCTION
- * ExecuteCurrExitHandler
- * DESCRIPTION
- * executes current exit func handler
- *
- * This is used to executes current exit func handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- extern void UI_common_screen_exit(void);
- extern void UI_common_screen_pre_exit(void);
- static void ExecuteCurrExitHandler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MTK added by JL 040115 for create a new function without key clear if need. */
- ExecuteCurrExitHandler_Ext();
- /* it clears all the key handlers, registered by the current screen */
- ClearInputEventHandler(MMI_DEVICE_KEY);
- #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
- mmi_tm_reset_imageid_image_header_pool();
- #ifdef __MMI_DLT_CACHE_SUPPORT__
- mmi_tm_clear_ondemand_cache();
- #endif
- #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
- /* MTK end */
- #if defined(__MMI_RESOURCE_ENFB_SUPPORT__)
- mmi_frm_resmem_reset(MMI_FRM_RESMEM_TYPE_LOD_ON_DEMAND);
- #endif /* __MMI_RESOURCE_ENFB_SUPPORT__ */
- }
- /*****************************************************************************
- * FUNCTION
- * ReplaceNewScreenHandler
- * DESCRIPTION
- * Replace current new screen handler
- *
- * This is used to sets current new screen handlers
- * PARAMETERS
- * scrnID [IN]
- * exitFuncPtr [IN]
- * entryFuncPtr [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ReplaceNewScreenHandler(U16 scrnID, FuncPtr exitFuncPtr, FuncPtr entryFuncPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETEXIT_HDLR, scrnID));
- currExitScrnID = scrnID;
- currExitFuncPtr = exitFuncPtr;
- currEntryFuncPtr = entryFuncPtr;
- }
- /*****************************************************************************
- * FUNCTION
- * EntryNewScreen
- * DESCRIPTION
- * To set the current topest screen ID for entry screen function
- *
- * This is used to executes current exit func handler
- * PARAMETERS
- * newscrnID [IN]
- * newExitHandler [IN]
- * newEntryHandler [IN]
- * peerBuf [IN]
- * RETURNS
- * void
- *****************************************************************************/
- U8 EntryNewScreen(U16 newscrnID, FuncPtr newExitHandler, FuncPtr newEntryHandler, void *peerBuf)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* store the current Top entry screen */
- currTopScrnID = newscrnID;
- /* entry the new screen */
- ExecuteCurrExitHandler();
- /* store the exit current Top entry screen */
- currExitScrnID = newscrnID;
- if ((newExitHandler != NULL) || (newEntryHandler != NULL))
- {
- SetGenericExitHandler(newscrnID, newExitHandler, newEntryHandler);
- }
- return MMI_TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * EntryNewScreen_Ext
- * DESCRIPTION
- * To set the current topest screen ID for entry screen function, without clear keyhandler
- *
- * This is used to executes current exit func handler
- * PARAMETERS
- * newscrnID [IN]
- * newExitHandler [IN]
- * newEntryHandler [IN]
- * peerBuf [IN]
- * RETURNS
- * void
- *****************************************************************************/
- U8 EntryNewScreen_Ext(U16 newscrnID, FuncPtr newExitHandler, FuncPtr newEntryHandler, void *peerBuf)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* store the current Top entry screen */
- currTopScrnID = newscrnID;
- /* entry the new screen */
- ExecuteCurrExitHandler_Ext();
- /* store the exit current Top entry screen */
- currExitScrnID = newscrnID;
- if ((newExitHandler != NULL) || (newEntryHandler != NULL))
- {
- SetGenericExitHandler(newscrnID, newExitHandler, newEntryHandler);
- }
- return MMI_TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * ExecuteCurrExitHandler_Ext
- * DESCRIPTION
- * executes current exit func handler without clear keys
- *
- * This is used to executes current exit func handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- /* MTK added by JL for keypad without clearall requirement */
- void ExecuteCurrExitHandler_Ext(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
- /* Clear g_mmi_frm_cntx.dump_screen_info.backup_string */
- g_mmi_frm_cntx.dump_screen_info.backup_string[0] = 0;
- g_mmi_frm_cntx.dump_screen_info.backup_string[1] = 0;
- g_mmi_frm_cntx.dump_screen_info.allow_dump_screen_str = MMI_TRUE;
- #endif
- /* Failsafe common function before exit screen */
- UI_common_screen_pre_exit();
- for (count = 0; count < MAX_SUB_MENUS; count++)
- {
- subMenuDataPtrs[count] = subMenuData[count];
- }
- if (currEntryFuncPtr || currExitFuncPtr)
- {
- ClearAllInterruptEventHandler();
- }
- /* call GenericExitScreen if currEntryFuncPtr is not NULL */
- if (currEntryFuncPtr)
- {
- GenericExitScreen(currExitScrnID, currEntryFuncPtr);
- }
- if (currExitFuncPtr)
- {
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXIT_HDLR));
- mmu_frm_execute_scrn_exit_handler = MMI_TRUE;
- (*currExitFuncPtr) ();
- mmu_frm_execute_scrn_exit_handler = MMI_FALSE;
- }
- currEntryFuncPtr = NULL;
- currExitFuncPtr = NULL;
- /* Failsafe common screen exit function */
- UI_common_screen_exit();
- /* it clears all the key handlers, registered by the current screen */
- IsBackHistory = FALSE;
- /* To dump the history memory */
- HistoryDump();
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_execute_scrn_exit_func
- * DESCRIPTION
- * check if framework executes the screen's exit handler
- *
- * This is used to executes current exit func handler
- * PARAMETERS
- * void
- * RETURNS
- * MMI_BOOL
- *****************************************************************************/
- MMI_BOOL mmi_execute_scrn_exit_func(void)
- {
- return mmu_frm_execute_scrn_exit_handler;
- }
- /*****************************************************************************
- * FUNCTION
- * ExecuteCurrHiliteHandler
- * DESCRIPTION
- * executes current hilite func handler
- *
- * This is used to executes current hilite func handler
- * PARAMETERS
- * hiliteid [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ExecuteCurrHiliteHandler(S32 hiliteid)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* To avoid the arrow left key to entry unexpected function, while other APP need they shall register again as BY request. */
- ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
- ExecuteCurrHiliteHandler_Ext(hiliteid);
- }
- /*****************************************************************************
- * FUNCTION
- * ExecuteCurrHiliteHandler_Ext
- * DESCRIPTION
- *
- * PARAMETERS
- * hiliteid [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ExecuteCurrHiliteHandler_Ext(S32 hiliteid)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- FuncPtr currFuncPtr = NULL;
- S32 hiliteItemID;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURHILIHTE_HDLR, hiliteid));
- currHiliteID = (U16) hiliteid;
- if (currParentID == 0)
- {
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_ERROR_EVENT_EXECURHILIHTE_HDLR));
- return;
- }
- /* check if menuitem is hidden */
- hiliteItemID = GetSeqItemId_Ext((U16) currParentID, (S16) hiliteid);
- currFuncPtr = maxHiliteInfo[hiliteItemID].entryFuncPtr;
- if (currFuncPtr)
- {
- (*currFuncPtr) ();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * GetCurrHiliteID
- * DESCRIPTION
- * Returns the index of the currently highlighted menu item
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U16 GetCurrHiliteID(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return currHiliteID;
- }
- /*****************************************************************************
- * FUNCTION
- * SetHiliteHandler
- * DESCRIPTION
- * Sets hilite func handlers
- *
- * This is used to set hilite func handlers
- * PARAMETERS
- * itemid [IN]
- * hiliteFuncPtr [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetHiliteHandler(U16 itemid, FuncPtr hiliteFuncPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETCURHILIHTE_HDLR, itemid));
- maxHiliteInfo[itemid].entryFuncPtr = hiliteFuncPtr;
- }
- /*****************************************************************************
- * FUNCTION
- * ClearHiliteHandler
- * DESCRIPTION
- * Clear hilite handler
- *
- * This is used to clear hilite func handlers for a particular menu item
- * PARAMETERS
- * itemid [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ClearHiliteHandler(U16 itemid)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRCURHILIHTE_HDLR, itemid));
- maxHiliteInfo[itemid].entryFuncPtr = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * ConstructHintsList
- * DESCRIPTION
- * Constructs Hint List for a static menu screen
- * PARAMETERS
- * parentID [IN]
- * hintArray [IN]
- * RETURNS
- * void
- *****************************************************************************/
- extern MMI_BOOL mmi_frm_test_menu_item_hide(U16 menu_item_id);
- void ConstructHintsList(U16 parentID, U8 **hintArray)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 i, noOfChild;
- U16 hiliteItemID[MAX_SUB_MENUS];
- U8 idx = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- noOfChild = (U8) GetNumOfChild(parentID);
- for (i = 0; i < noOfChild; i++)
- {
- hiliteItemID[i] = GetSeqItemId((U16) parentID, (S16) i);
- /* check if menuitem is hidden */
- if (!mmi_frm_test_menu_item_hide(hiliteItemID[i])) /* the menuitem is not hidden */
- {
- if (maxHiliteInfo[hiliteItemID[i]].hintFuncPtr)
- {
- (*maxHiliteInfo[hiliteItemID[i]].hintFuncPtr) (idx);
- hintArray[idx] = hintData[idx];
- idx++;
- }
- else
- {
- hintArray[idx++] = NULL;
- }
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * SetHintHandler
- * DESCRIPTION
- * Sets Hint Func Handlers
- * PARAMETERS
- * itemid [IN] FuncPtr hiliteFuncPtr
- * hintFuncPtr [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetHintHandler(U16 itemid, FuncPtrShort hintFuncPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETHINT_HDLR, itemid));
- maxHiliteInfo[itemid].hintFuncPtr = hintFuncPtr;
- }
- /*****************************************************************************
- * FUNCTION
- * ClearHintHandler
- * DESCRIPTION
- * clears hint handlers
- *
- * This is used to clear hint func handlers
- * PARAMETERS
- * itemid [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ClearHintHandler(U16 itemid)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRHINT_HDLR, itemid));
- maxHiliteInfo[itemid].hintFuncPtr = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * SetParentHandler
- * DESCRIPTION
- * sets current parent item id
- *
- * This is used to set current parent item id
- * PARAMETERS
- * parentID [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetParentHandler(U16 parentID)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETPARENT_HDLR, parentID));
- currParentID = parentID;
- }
- /* MTK Brian added for AT+CVIB, 2003/11/23 */
- /*****************************************************************************
- * FUNCTION
- * GetParentHandler
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- U16 GetParentHandler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return currParentID;
- }
- /*****************************************************************************
- * FUNCTION
- * SetKeyHandler
- * DESCRIPTION
- * sets the curent screen key handlers
- *
- * This is used to set the curent screen key handlers
- * PARAMETERS
- * funcPtr [IN]
- * keyCode [IN]
- * keyType [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetKeyHandler(FuncPtr funcPtr, U16 keyCode, U16 keyType)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETKEY_HDLR, keyCode, keyType, funcPtr));
- MMI_ASSERT((keyCode < MAX_KEYS) && (keyType < MAX_KEY_TYPE));
- currKeyFuncPtrs[keyCode][keyType] = funcPtr;
- }
- /*****************************************************************************
- * FUNCTION
- * GetKeyHandler
- * DESCRIPTION
- * return the curent screen key handlers
- *
- * This is used to set the curent screen key handlers
- * PARAMETERS
- * keyCode [IN]
- * keyType [IN]
- * RETURNS
- * void
- *****************************************************************************/
- FuncPtr GetKeyHandler(U16 keyCode, U16 keyType)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT((keyCode < MAX_KEYS) && (keyType < MAX_KEY_TYPE));
- return (currKeyFuncPtrs[keyCode][keyType]);
- }
- /*****************************************************************************
- * FUNCTION
- * SetGroupKeyHandler
- * DESCRIPTION
- * sets the curent screen same key handler to the group pf keycodes
- *
- * This is used to set the same key handler for a group of keycodes.
- * PARAMETERS
- * funcPtr [IN]
- * keyCodes [IN]
- * len [IN]
- * keyType [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetGroupKeyHandler(FuncPtr funcPtr, PU16 keyCodes, U8 len, U16 keyType)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT((len <= MAX_KEYS) && (keyType < MAX_KEY_TYPE));
- for (count = 0; count < len; count++)
- {
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETGROUPKEY_HDLR, keyCodes[count], keyType));
- currKeyFuncPtrs[keyCodes[count]][keyType] = funcPtr;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ClearKeyHandler
- * DESCRIPTION
- * clears the current screen key handlers
- *
- * This is used to clears the current screen key handlers
- * PARAMETERS
- * keyCode [IN]
- * keyType [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ClearKeyHandler(U16 keyCode, U16 keyType)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRKEY_HDLR, keyCode, keyType));
- MMI_ASSERT((keyCode < MAX_KEYS) && (keyType < MAX_KEY_TYPE));
- currKeyFuncPtrs[keyCode][keyType] = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * ClearAllKeyHandler
- * DESCRIPTION
- * clears all the current screen key handlers
- *
- * This is used to clears all the current screen key handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ClearAllKeyHandler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 keyCode = 0;
- U16 keyType = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRALLKEY_HDLR));
- for (keyCode = 0; keyCode < MAX_KEYS; keyCode++)
- {
- for (keyType = 0; keyType < MAX_KEY_TYPE; keyType++)
- {
- currKeyFuncPtrs[keyCode][keyType] = NULL;
- }
- }
- PowerAndEndKeyHandler();
- SetDefaultVolumeKeyHandlers();
- }
- /*****************************************************************************
- * FUNCTION
- * ClearInputEventHandler
- * DESCRIPTION
- * Clear input device event handlers
- *
- * This is used to clear input device event handlers
- * PARAMETERS
- * device [IN] Type
- * RETURNS
- * void
- *****************************************************************************/
- void ClearInputEventHandler(U16 device)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (device & MMI_DEVICE_KEY)
- {
- ClearAllKeyHandler();
- }
- #ifdef __MMI_TOUCH_SCREEN__
- if ( device & MMI_DEVICE_PEN )
- {
- wgui_clear_pen_handlers();
- }
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * PowerAndEndKeyHandler
- * DESCRIPTION
- * sets power key & end key handlers
- *
- * This is used to set power key & end key handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- #if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
- extern BOOL DirectMode;
- extern void CallBackPowerOnAnimationCompleteWrapper(void);
- #endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */
- void PowerAndEndKeyHandler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /**
- * The end key must not be registered to
- * Go to IDle screen in case any call exists on the
- * the phone. This is a temporary solution for fixing the
- * CM bugs
- */
- if (isInCall() && !GetWapCallPresent())
- {
- #ifdef __MMI_VOIP__
- if (GetTotalCallCount() != 0) /* disconnect gsm call */
- {
- currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = HangupAllCalls;
- }
- else if (mmi_voip_app_total_call() != 0) /* disconnect voip call */
- {
- currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = mmi_voip_entry_ans_to_disconn_voip;
- }
- #else
- currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = HangupAllCalls;
- #endif
- }
- else
- {
- if (mmi_bootup_is_in_security_check() == MMI_FALSE)
- {
- /**
- * The end key should end all the existing calls
- * and screen should be the last screen thru call menu.
- */
- #ifdef __MMI_EMAIL__
- if (mmi_email_util_get_stop_cause() == EMAIL_MODULE_ACTIVE_NOW)
- {
- currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = mmi_email_main_goto_idle;
- }
- else if (!gSecuritySetupContext.PINBlocked)
- #else /* __MMI_EMAIL__ */
- if (!gSecuritySetupContext.PINBlocked)
- #endif /* __MMI_EMAIL__ */
- {
- currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = DisplayIdleScreen;
- }
- }
- }
- #if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
- if (DirectMode)
- {
- currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = CallBackPowerOnAnimationCompleteWrapper;
- }
- #endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */
- if (!g_keylock_context.gKeyPadLockFlag)
- {
- mmi_frm_set_default_power_onoff_key();
- }
- }
- /*****************************************************************************
- * FUNCTION
- * SetProtocolEventHandler
- * DESCRIPTION
- * sets protocol event handler
- *
- * This is used to set protocol event handler
- * PARAMETERS
- * funcPtr [IN]
- * eventID [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetProtocolEventHandler(PsFuncPtr funcPtr, U16 eventID)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- static U16 maxUsedInHistory = 0;
- U16 count;
- S16 i, firstNotUsed;
- S16 pos;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT(eventID != 0);
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETPTO_HDLR, eventID, funcPtr, usedProtocolEvent,
- maxProtocolEvent));
- /* serach */
- pos = -1;
- firstNotUsed = -1;
- for (count = 0; count < maxProtocolEvent; count++)
- {
- if (protocolEventHandler[count].eventID == eventID)
- {
- pos = count;
- break;
- }
- /* BTW, find a non-used item */ ;
- if ((firstNotUsed == -1) && (protocolEventHandler[count].eventID == MMI_EVENT_INVALID))
- {
- firstNotUsed = count;
- }
- }
- if (pos != -1)
- {
- /* found */
- if (funcPtr != NULL)
- {
- /* just need to update */
- protocolEventHandler[pos].entryFuncPtr = funcPtr;
- }
- else
- {
- /* reset it */
- protocolEventHandler[pos].eventID = MMI_EVENT_INVALID;
- protocolEventHandler[pos].entryFuncPtr = NULL;
- usedProtocolEvent--;
- }
- }
- else
- {
- /* not found */
- if (funcPtr != NULL)
- {
- /* newly set */
- if (firstNotUsed != -1)
- {
- pos = firstNotUsed;
- }
- else
- {
- /* need to enlarge current searching list */
- pos = maxProtocolEvent;
- maxProtocolEvent++;
- MMI_ASSERT(maxProtocolEvent < MAX_PROTOCOL_EVENT);
- }
- usedProtocolEvent++;
- protocolEventHandler[pos].eventID = eventID;
- protocolEventHandler[pos].entryFuncPtr = funcPtr;
- }
- else
- {
- /* do nothing */
- }
- }
- /* recycle not-used items in the tail of list. It is for searching efficency */
- for (i = (maxProtocolEvent - 1); i >= 0; i--)
- {
- if (protocolEventHandler[i].eventID != MMI_EVENT_INVALID)
- {
- break;
- }
- }
- maxProtocolEvent = i + 1;
- /* record the max value for array size analysis */
- if (maxUsedInHistory < maxProtocolEvent)
- {
- PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "SetProtocolEventHandler old maxUsedInHistory = %d", maxUsedInHistory));
- maxUsedInHistory = maxProtocolEvent;
- PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "SetProtocolEventHandler maxUsedInHistory = %d", maxUsedInHistory));
- }
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETPTO_HDLR, eventID, funcPtr, usedProtocolEvent,
- maxProtocolEvent));
- }
- /*****************************************************************************
- * FUNCTION
- * ClearProtocolEventHandler
- * DESCRIPTION
- * clears protocol event handler
- *
- * This is used to clear protocol event handler
- * PARAMETERS
- * eventID [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ClearProtocolEventHandler(U16 eventID)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRPTO_HDLR, eventID));
- SetProtocolEventHandler(NULL, eventID);
- }
- /*****************************************************************************
- * FUNCTION
- * ClearAllProtocolEventHandler
- * DESCRIPTION
- * clears all the protocol event handler
- *
- * This is used to clear all the protocol event handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ClearAllProtocolEventHandler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRALLPTO_HDLR));
- for (count = 0; count < maxProtocolEvent; count++)
- {
- protocolEventHandler[count].eventID = 0;
- protocolEventHandler[count].entryFuncPtr = NULL;
- }
- usedProtocolEvent = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * SetEntryHandler
- * DESCRIPTION
- * sets current screen entry handlers
- *
- * This is used to sets current screen entry handlers
- * PARAMETERS
- * scrnID [IN]
- * entryFuncPtr [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetEntryHandler(U16 scrnID, FuncPtr entryFuncPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETENTRY_HDLR, scrnID));
- currEntryFuncPtr = entryFuncPtr;
- }
- /*****************************************************************************
- * FUNCTION
- * ClearEntryHandler
- * DESCRIPTION
- * clears current screen entry handlers
- *
- * This is used to clears current screen e1ntry handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ClearEntryHandler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRENTRY_HDLR));
- currEntryFuncPtr = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * SetGenericExitHandler
- * DESCRIPTION
- * Generic function to set exit screen handler.
- * Store current screen id, exit function, and entry function.
- * PARAMETERS
- * scrnID [IN] Screen ID
- * exitFuncPtr [IN] Exit function pointer
- * entryFuncPtr [IN] Entry function pointer
- * RETURNS
- * void
- *****************************************************************************/
- static void SetGenericExitHandler(U16 scrnID, FuncPtr exitFuncPtr, FuncPtr entryFuncPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETGEN_EXIT_HDLR, scrnID));
- currExitScrnID = scrnID;
- currExitFuncPtr = exitFuncPtr;
- currEntryFuncPtr = entryFuncPtr;
- }
- /*****************************************************************************
- * FUNCTION
- * GenericExitInlineScreen
- * DESCRIPTION
- * Generic exit inline editor screen handler.
- * Add screen related data to histoy.
- * PARAMETERS
- * scrnID [IN] Screen ID
- * entryFuncPtr [IN] Entry function pointer
- * RETURNS
- * void
- *****************************************************************************/
- void GenericExitInlineScreen(U16 scrnID, FuncPtr entryFuncPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- U16 inputBufferSize;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CloseCategory57Screen();
- h.scrnID = scrnID;
- h.entryFuncPtr = entryFuncPtr;
- GetCategoryHistory(h.guiBuffer);
- inputBufferSize = (U16) GetCategory57DataSize();
- GetCategory57Data((U8*) h.inputBuffer);
- AddNHistory(h, inputBufferSize);
- }
- /*****************************************************************************
- * FUNCTION
- * GenericExitScreen
- * DESCRIPTION
- * Generic exit screen handler.
- * Add screen related data to histoy.
- * PARAMETERS
- * scrnID [IN] Screen ID
- * entryFuncPtr [IN] Entry function pointer
- * RETURNS
- * void
- *****************************************************************************/
- void GenericExitScreen(U16 scrnID, FuncPtr entryFuncPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- history h;
- U16 nHistory = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXEGEN_EXIT_HDLR, scrnID));
- h.scrnID = scrnID;
- h.entryFuncPtr = entryFuncPtr;
- pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
- GetCategoryHistory(h.guiBuffer);
- AddHistory(h);
- /* mini_tab_bar */
- #ifdef __MMI_WGUI_MINI_TAB_BAR__
- wgui_disable_mini_tab_bar();
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * GetExitScrnID
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- U16 GetExitScrnID(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_GETGEN_EXIT_HDLR));
- return currExitScrnID;
- }
- /*****************************************************************************
- * FUNCTION
- * GetExitScrnID_r
- * DESCRIPTION
- * Thead-safe version of GetExitScrnID()
- * PARAMETERS
- * void
- * RETURNS
- * Current screen ID
- *****************************************************************************/
- U16 GetExitScrnID_r(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* This function should be kept as simple as possible. MMI_TRACE() cannot be used */
- return currExitScrnID;
- }
- /*****************************************************************************
- * FUNCTION
- * ClearExitHandler
- * DESCRIPTION
- * clears current screen exit handlers
- *
- * This is used to clears current screen exit handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ClearExitHandler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLREXIT_HDLR));
- currExitScrnID = 0;
- currExitFuncPtr = NULL;
- currEntryFuncPtr = NULL;
- }
- /*****************************************************************************
- * FUNCTION
- * GetkeyInfo
- * DESCRIPTION
- * gives key code & key type of last key event.
- *
- * This is used to give key code & key type of last key event.
- * PARAMETERS
- * keyCode [OUT] U16 *keyType
- * keyType [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void GetkeyInfo(PU16 keyCode, PU16 keyType)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- *keyCode = currKeyCode;
- *keyType = currKeyType;
- }
- /*****************************************************************************
- * FUNCTION
- * SetkeyInfo
- * DESCRIPTION
- * Set key code & key type of last key event.
- *
- * This is used to temporary set key code & key type of last key event.
- * PARAMETERS
- * keyCode [IN]
- * keyType [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetkeyInfo(U16 keyCode, U16 keyType)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- currKeyCode = keyCode;
- currKeyType = keyType;
- }
- /*****************************************************************************
- * FUNCTION
- * StartTimer
- * DESCRIPTION
- * to set a timer
- *
- * This is used to set a timer
- * PARAMETERS
- * timerid [IN]
- * delay [IN]
- * funcPtr [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void StartTimer(U16 timerid, U32 delay, FuncPtr funcPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- StartMyTimer(timerid, delay, (oslTimerFuncPtr) funcPtr);
- }
- /*****************************************************************************
- * FUNCTION
- * StopTimer
- * DESCRIPTION
- * to reset a timer
- *
- * This is used to reset a timer
- * PARAMETERS
- * timerid [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void StopTimer(U16 timerid)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- StopMyTimer(timerid);
- }
- /*****************************************************************************
- * FUNCTION
- * MaskItems
- * DESCRIPTION
- *
- * PARAMETERS
- * maskList [IN]
- * noOfItems [IN]
- * maskingWord [IN]
- * RETURNS
- * U8
- *****************************************************************************/
- U8 MaskItems(U16 *maskList, U8 noOfItems, U32 maskingWord)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 count = 0, i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < noOfItems; i++)
- if (IsBitSet(maskingWord, i))
- {
- maskList[count++] = maskList[i];
- }
- return (U8) count;
- }
- /*****************************************************************************
- * FUNCTION
- * MaskItemsU8
- * DESCRIPTION
- *
- * PARAMETERS
- * maskList [IN]
- * noOfItems [IN]
- * maskingWord [IN]
- * RETURNS
- * U8
- *****************************************************************************/
- U8 MaskItemsU8(U8 *maskList, U8 noOfItems, U32 maskingWord)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 count = 0, i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < noOfItems; i++)
- if (IsBitSet(maskingWord, i))
- {
- maskList[count++] = maskList[i];
- }
- return (U8) count;
- }
- /*****************************************************************************
- * FUNCTION
- * MaskStringItems
- * DESCRIPTION
- *
- * PARAMETERS
- * maskList [IN]
- * noOfItems [IN]
- * maskingWord [IN]
- * RETURNS
- * U8
- *****************************************************************************/
- U8 MaskStringItems(U8 **maskList, U8 noOfItems, U32 maskingWord)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 count = 0, i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < noOfItems; i++)
- if (IsBitSet(maskingWord, i))
- {
- maskList[count++] = maskList[i];
- }
- return (U8) count;
- }
- /*****************************************************************************
- * FUNCTION
- * MaskHiliteItems
- * DESCRIPTION
- *
- * PARAMETERS
- * parentID [IN]
- * maskingWord [IN]
- * RETURNS
- * U8
- *****************************************************************************/
- U8 MaskHiliteItems(U16 parentID, U32 maskingWord)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 count = 0, noOfChild, i;
- U16 hiliteItemID[32];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- noOfChild = (U8) GetNumOfChild(parentID);
- for (i = 0; i < noOfChild; i++)
- {
- hiliteItemID[i] = GetSeqItemId((U16) parentID, (S16) i);
- }
- for (i = 0; i < noOfChild; i++)
- if (IsBitSet(maskingWord, i))
- {
- maxHiliteInfo[hiliteItemID[count++]].entryFuncPtr = maxHiliteInfo[hiliteItemID[i]].entryFuncPtr;
- }
- return (U8) count;
- }
- /* interrupt handle preprocess */
- /*****************************************************************************
- * FUNCTION
- * IsInInterruptGroupTable
- * DESCRIPTION
- * search interrupt group event id is in interrupt
- * group table and get the index
- * PARAMETERS
- * eventID [IN]
- * index [OUT]
- * RETURNS
- * MMI_BOOL
- *****************************************************************************/
- static MMI_BOOL IsInInterruptGroupTable(U16 eventID, int *index)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < sizeof(interruptGroupEventTable) / sizeof(InterruptGroupInfo); i++)
- {
- if (interruptGroupEventTable[i].groupID == eventID)
- {
- *index = i;
- return MMI_TRUE;
- }
- }
- *index = -1;
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * QueryInterruptHandler
- * DESCRIPTION
- * query interrupt event handler
- * PARAMETERS
- * eventID [IN]
- * funcPtr [OUT]
- * postfuncPtr [OUT]
- * RETURNS
- * MMI_BOOL
- *****************************************************************************/
- static MMI_BOOL QueryInterruptHandler(U16 eventID, PsIntFuncPtr *funcPtr, PsIntFuncPtr *postfuncPtr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- int i, j, index;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < MAX_INTERRUPT_EVENT; i++)
- {
- if (!IS_INTERRUPT_EVENT_GROUP(interruptEventHandler[i].eventID))
- {
- /* General interrupt event */
- if (interruptEventHandler[i].eventID == eventID)
- {
- goto is_found;
- }
- }
- else
- {
- if (IsInInterruptGroupTable(interruptEventHandler[i].eventID, &index))
- {
- /* Interrupt group event */
- j = 0;
- while (interruptGroupEventTable[index].eventID[j] != 0)
- {
- if (interruptGroupEventTable[index].eventID[j] == eventID)
- {
- goto is_found;
- }
- j++;
- MMI_ASSERT(j < INTERRUPT_EVENT_GREOUP_SIZE);
- }
- }
- }
- }
- return MMI_FALSE;
- is_found:
- *funcPtr = (PsIntFuncPtr) interruptEventHandler[i].entryIntFuncPtr;
- *postfuncPtr = (PsIntFuncPtr) interruptEventHandler[i].postIntFuncPtr;
- return MMI_TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * SetInterruptEventHandler
- * DESCRIPTION
- * sets interrupt event handler
- *
- * This is used to set interrupt event handler
- * PARAMETERS
- * funcPtr [IN]
- * postfuncPtr [IN]
- * eventID [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetInterruptEventHandler(PsIntFuncPtr funcPtr, PsIntFuncPtr postfuncPtr, U16 eventID)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 count = 0;
- pBOOL isNewEvent = TRUE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETINTP_HDLR, eventID));
- if (!IS_INTERRUPT_EVENT_GROUP(eventID))
- {
- /* General interrupt event will allocate from the begin */
- for (count = 0; count < maxInterruptEvent; count++)
- {
- if (interruptEventHandler[count].eventID == eventID)
- {
- isNewEvent = FALSE;
- break;
- }
- if (interruptEventHandler[count].eventID == 0)
- {
- break;
- }
- }
- }
- else
- {
- /* Interrupt group event will allocate from the end */
- for (count = MAX_INTERRUPT_EVENT - 1; count >= 0; count--)
- {
- if (interruptEventHandler[count].eventID == eventID)
- {
- isNewEvent = FALSE;
- break;
- }
- if (interruptEventHandler[count].eventID == 0)
- {
- break;
- }
- }
- }
- if (isNewEvent)
- {
- maxInterruptEvent++;
- MMI_ASSERT(maxInterruptEvent < MAX_INTERRUPT_EVENT);
- }
- interruptEventHandler[count].eventID = eventID;
- interruptEventHandler[count].entryIntFuncPtr = funcPtr;
- interruptEventHandler[count].postIntFuncPtr = postfuncPtr;
- }
- /*****************************************************************************
- * FUNCTION
- * SetGroupInterruptEventHandler
- * DESCRIPTION
- * sets the curent screen same group handler to the group pf events
- *
- * This is used to set the same key handler for a group of keycodes.
- * PARAMETERS
- * funcPtr [IN]
- * postfuncPtr [IN]
- * eventsID [IN]
- * len [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetGroupInterruptEventHandler(PsIntFuncPtr funcPtr, PsIntFuncPtr postfuncPtr, PU16 eventsID, U8 len)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 count;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (count = 0; count < len; count++)
- {
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETGRPINTP_HDLR, eventsID[count]));
- SetInterruptEventHandler(funcPtr, postfuncPtr, eventsID[count]);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ClearInterruptEventHandler
- * DESCRIPTION
- * clears interrupt event handler
- *
- * This is used to clear interrupt event handler
- * PARAMETERS
- * eventID [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ClearInterruptEventHandler(U16 eventID)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRINTP_HDLR, eventID));
- SetInterruptEventHandler(NULL, NULL, eventID);
- }
- /*****************************************************************************
- * FUNCTION
- * ClearAllInterruptEventHandler
- * DESCRIPTION
- * clears all the interrupt event handler
- *
- * This is used to clear all the interrupt event handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ClearAllInterruptEventHandler(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 count = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRALLINTP_HDLR));
- for (count = 0; count < maxInterruptEvent; count++)
- {
- interruptEventHandler[count].eventID = 0;
- interruptEventHandler[count].entryIntFuncPtr = NULL;
- interruptEventHandler[count].postIntFuncPtr = NULL;
- }
- maxInterruptEvent = 0;
- }
- /*****************************************************************************
- * FUNCTION
- * GetActiveScreenId
- * DESCRIPTION
- * Get current new screen ID
- *
- * This is used to clear all the interrupt event handlers
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U16 GetActiveScreenId(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return currTopScrnID;
- }
- /*****************************************************************************
- * FUNCTION
- * SetActiveScreenId
- * DESCRIPTION
- *
- * PARAMETERS
- * scrnId [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetActiveScreenId(U16 scrnId)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- currTopScrnID = scrnId;
- }
- /*****************************************************************************
- * FUNCTION
- * GetCurrEntryFuncPtr
- * DESCRIPTION
- * Get current entry function
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- FuncPtr GetCurrEntryFuncPtr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return currEntryFuncPtr;
- }
- /*****************************************************************************
- * FUNCTION
- * SetCurrEntryFuncPtr
- * DESCRIPTION
- * Sets current entry function
- * PARAMETERS
- * ptr [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetCurrEntryFuncPtr(FuncPtr ptr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- currEntryFuncPtr = ptr;
- }
- /*****************************************************************************
- * FUNCTION
- * GetCurrExitFuncPtr
- * DESCRIPTION
- * Get current exit function
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- FuncPtr GetCurrExitFuncPtr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return currExitFuncPtr;
- }
- /*****************************************************************************
- * FUNCTION
- * SetCurrExitFuncPtr
- * DESCRIPTION
- * Sets current exit function
- * PARAMETERS
- * ptr [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void SetCurrExitFuncPtr(FuncPtr ptr)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- currExitFuncPtr = ptr;
- }
- /*****************************************************************************
- * FUNCTION
- * ExecuteItemHiliteHandler
- * DESCRIPTION
- * Execute the hilite handler of specified menu item
- * PARAMETERS
- * hiliteItemID [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void ExecuteItemHiliteHandler(U16 hiliteItemID)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (maxHiliteInfo[hiliteItemID].entryFuncPtr != NULL)
- {
- maxHiliteInfo[hiliteItemID].entryFuncPtr();
- }
- }