Events.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:92k
源码类别:

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*******************************************************************************
  36.  * Filename:
  37.  * ---------
  38.  * Events.c
  39.  *
  40.  * Project:
  41.  * --------
  42.  *   MAUI
  43.  *
  44.  * Description:
  45.  * ------------
  46.  *   This file is intends for protocol/keypad/interrupt event handler .
  47.  *
  48.  * Author:
  49.  * -------
  50.  * -------
  51.  *
  52.  *==============================================================================
  53.  *             HISTORY
  54.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  55.  *------------------------------------------------------------------------------
  56.  * removed!
  57.  *
  58.  * removed!
  59.  * removed!
  60.  * removed!
  61.  *
  62.  * removed!
  63.  * removed!
  64.  * removed!
  65.  *
  66.  * removed!
  67.  * removed!
  68.  * removed!
  69.  *
  70.  * removed!
  71.  * removed!
  72.  * removed!
  73.  *
  74.  * removed!
  75.  * removed!
  76.  * removed!
  77.  *
  78.  * removed!
  79.  * removed!
  80.  * removed!
  81.  *
  82.  * removed!
  83.  * removed!
  84.  * removed!
  85.  *
  86.  * removed!
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  * removed!
  103.  *
  104.  * removed!
  105.  * removed!
  106.  * removed!
  107.  *
  108.  * removed!
  109.  * removed!
  110.  * removed!
  111.  *
  112.  * removed!
  113.  * removed!
  114.  * removed!
  115.  *
  116.  * removed!
  117.  * removed!
  118.  * removed!
  119.  *
  120.  * removed!
  121.  * removed!
  122.  * removed!
  123.  *
  124.  * removed!
  125.  * removed!
  126.  * removed!
  127.  *
  128.  * removed!
  129.  * removed!
  130.  * removed!
  131.  *
  132.  * removed!
  133.  * removed!
  134.  * removed!
  135.  * removed!
  136.  * removed!
  137.  *
  138.  * removed!
  139.  * removed!
  140.  * removed!
  141.  *
  142.  * removed!
  143.  * removed!
  144.  * removed!
  145.  *
  146.  * removed!
  147.  * removed!
  148.  * removed!
  149.  *
  150.  * removed!
  151.  * removed!
  152.  * removed!
  153.  *
  154.  * removed!
  155.  * removed!
  156.  * removed!
  157.  *
  158.  * removed!
  159.  * removed!
  160.  * removed!
  161.  *
  162.  * removed!
  163.  * removed!
  164.  * removed!
  165.  *
  166.  * removed!
  167.  * removed!
  168.  * removed!
  169.  *
  170.  * removed!
  171.  * removed!
  172.  * removed!
  173.  *
  174.  * removed!
  175.  * removed!
  176.  * removed!
  177.  *
  178.  * removed!
  179.  * removed!
  180.  * removed!
  181.  *
  182.  * removed!
  183.  * removed!
  184.  * removed!
  185.  *
  186.  * removed!
  187.  * removed!
  188.  * removed!
  189.  *
  190.  * removed!
  191.  * removed!
  192.  * removed!
  193.  *
  194.  * removed!
  195.  * removed!
  196.  * removed!
  197.  *
  198.  * removed!
  199.  * removed!
  200.  * removed!
  201.  * removed!
  202.  * removed!
  203.  * removed!
  204.  * removed!
  205.  * removed!
  206.  * removed!
  207.  * removed!
  208.  * removed!
  209.  * removed!
  210.  * removed!
  211.  * removed!
  212.  * removed!
  213.  * removed!
  214.  * removed!
  215.  * removed!
  216.  * removed!
  217.  * removed!
  218.  * removed!
  219.  *
  220.  * removed!
  221.  * removed!
  222.  * removed!
  223.  *
  224.  * removed!
  225.  * removed!
  226.  * removed!
  227.  *
  228.  * removed!
  229.  * removed!
  230.  * removed!
  231.  *
  232.  * removed!
  233.  * removed!
  234.  * removed!
  235.  *
  236.  * removed!
  237.  * removed!
  238.  * removed!
  239.  *
  240.  * removed!
  241.  * removed!
  242.  * removed!
  243.  *
  244.  * removed!
  245.  * removed!
  246.  * removed!
  247.  *
  248.  * removed!
  249.  * removed!
  250.  * removed!
  251.  *
  252.  * removed!
  253.  * removed!
  254.  * removed!
  255.  *
  256.  * removed!
  257.  * removed!
  258.  * removed!
  259.  *
  260.  * removed!
  261.  * removed!
  262.  * removed!
  263.  *
  264.  * removed!
  265.  * removed!
  266.  * removed!
  267.  *
  268.  * removed!
  269.  * removed!
  270.  * removed!
  271.  *
  272.  * removed!
  273.  * removed!
  274.  * removed!
  275.  *
  276.  * removed!
  277.  * removed!
  278.  * removed!
  279.  *
  280.  * removed!
  281.  * removed!
  282.  * removed!
  283.  *
  284.  *------------------------------------------------------------------------------
  285.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  286.  *==============================================================================
  287.  *******************************************************************************/
  288. #include "MMI_features.h"
  289. #include "stdC.h"
  290. #include "L4Dr1.h"
  291. #include "GlobalConstants.h"
  292. #include "DebugInitDef.h"
  293. #include "PixtelDataTypes.h"
  294. #include "ProtocolEvents.h"
  295. #include "FrameworkStruct.h"
  296. #include "EventsGprot.h"
  297. #include "WrapperGprot.h"
  298. #include "KeyBrd.h"
  299. #include "EventsDcl.h"
  300. #include "EventsDef.h"
  301. #include "CustDataProts.h"
  302. #include "SATGProts.h"
  303. #include "IdleAppProt.h"
  304. #include "IdleAppDef.h"
  305. #include "SubLCDHistoryGprot.h"
  306. #include "SimDetectionGexdcl.h"
  307. #include "SimDetectionGprot.h"
  308. #include "SettingDefs.h"
  309. #include "SettingsGdcl.h"
  310. #include "CallManagementGprot.h"
  311. #ifdef __MMI_VOIP__
  312. #include "VoIPGProt.h"
  313. #endif
  314. #include "VolumeHandler.h"
  315. #ifdef __MMI_TOUCH_SCREEN__
  316. #include "wgui_touch_screen.h"
  317. #endif 
  318. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  319. #include "ThemeManager.h"
  320. #endif 
  321. #include "l4dr.h"
  322. #include "MMI_trc.h"
  323. #include "QuickAccessMenuItem_def.h"
  324. #ifdef __MMI_WGUI_MINI_TAB_BAR__
  325. #include "wgui_tab_bars.h"
  326. #endif 
  327. /* added by MK */
  328. #ifdef __MMI_EMAIL__
  329. #include "EmailAppGProt.h"
  330. #endif // #ifdef __MMI_EMAIL__
  331. #include "KeyBrd.h"
  332. #if defined(__MMI_RESOURCE_ENFB_SUPPORT__)
  333. #include "ResMemMgrGprot.h"
  334. #endif /* __MMI_RESOURCE_ENFB_SUPPORT__ */
  335. /*
  336.  * Define
  337.  */
  338. #define INTERRUPT_EVENT_GREOUP_SIZE     (4)
  339. #define IS_INTERRUPT_EVENT_GROUP(x)    (((x)&MMI_INT_EVENT_GROUP_MASK) == MMI_INT_EVENT_GROUP_MASK)
  340. /* for profiling */
  341. #if 0
  342. /* under construction !*/
  343. #endif
  344. #define MMI_EVENT_INVALID  0
  345. /*
  346.  * Data Type
  347.  */
  348. typedef struct
  349. {
  350.     U16 groupID;
  351.     U16 eventID[INTERRUPT_EVENT_GREOUP_SIZE];
  352. } InterruptGroupInfo;
  353. /* 
  354.  *   Extern Varibales 
  355.  */
  356. extern pBOOL IsBackHistory;
  357. extern U8 gIsHelpEnabled;
  358. extern U8 gInitAllAppFlag;
  359. extern U8 gInsertSimAppFlag;
  360. extern U8 gEmerencyNoDialed;
  361. extern U8 gIsInSATCall;
  362. FuncPtr currKeyFuncPtrs[MAX_KEYS][MAX_KEY_TYPE];    /* available key func ptrs to current screen  */
  363. hiliteInfo maxHiliteInfo[MAX_HILITE_HANDLER];       /* available hilite func ptrs  */
  364. U8 hintData[MAX_SUB_MENUS][MAX_SUB_MENU_HINT_SIZE];
  365. U8 subMenuData[MAX_SUB_MENUS][MAX_SUB_MENU_SIZE];
  366. PU8 subMenuDataPtrs[MAX_SUB_MENUS];
  367. PU8 hintDataPtrs[MAX_SUB_MENUS];
  368. U8 processUpRepeatKey = 0;
  369. U8 pressKey = 0;                                    /* 0- full up, 1- half down, 2- full down */
  370. /* 
  371.  *   Local Variables 
  372.  */
  373. /*
  374.  * If we add new interrupt event group id
  375.  * , we fill the table to establish the mapping events table.
  376.  */
  377. static InterruptGroupInfo interruptGroupEventTable[] = 
  378. {
  379.     {MMI_SMS_INT_EVENT_GROUP,
  380.      {PRT_MSG_ID_MMI_SMS_DELIVER_MSG_IND,
  381.       PRT_MSG_ID_MMI_SMS_STATUS_REPORT_IND,
  382.       PRT_MSG_ID_MMI_SMS_MSG_WAITING_IND,
  383.       0 /* end at 0 */
  384.       }
  385.      }
  386. #if defined(__MMI_FILE_MANAGER__)
  387.     ,{MMI_CARD_PLUG_EVENT_GROUP,
  388.      {MSG_ID_FMT_MMI_CARD_PLUG_IN_IND,
  389.       MSG_ID_FMT_MMI_CARD_PLUG_OUT_IND,
  390.       0 /* end at 0 */
  391.       }
  392.      }
  393. #endif /* __MMI_FILE_MANAGER__ */
  394. };
  395. static U16 currMaxHiliteInfo;               /* currently max hilite info */
  396. static U16 maxProtocolEvent;
  397. static U16 usedProtocolEvent;
  398. static U16 maxInterruptEvent;
  399. static U16 currParentID;                    /* current parent item id */
  400. static U16 currKeyCode;
  401. static U16 currKeyType;
  402. static U16 currHiliteID;
  403. static FuncPtr currEntryFuncPtr;
  404. static U16 currExitScrnID, currTopScrnID;   /* curr exit func ptr with scrn id */
  405. static FuncPtr currExitFuncPtr;
  406. static PseventInfo protocolEventHandler[MAX_PROTOCOL_EVENT];
  407. static PsInteventInfo interruptEventHandler[MAX_INTERRUPT_EVENT];
  408. static MMI_BOOL mmu_frm_execute_scrn_exit_handler = MMI_FALSE;
  409. /* 
  410.  *   Local Functions 
  411.  */
  412. static void ExecuteCurrExitHandler(void);       /* execute current exit func handler, before execute current event handler */
  413. static void ExecuteCurrExitHandler_Ext(void);   /* execute current exit func handler, before execute current event handler */
  414. static void SetGenericExitHandler(U16 scrnID, FuncPtr exitFuncPtr, FuncPtr entryFuncPtr);
  415. static MMI_BOOL QueryInterruptHandler(U16 eventID, PsIntFuncPtr *funcPtr, PsIntFuncPtr *postfuncPtr);
  416. /* 090404 MTK Calvin removed */
  417. /* static void SetExitHandler(U16 scrnID, FuncPtr exitFuncPtr); */
  418. /* 090404 MTK Calvin end */
  419. /* 
  420.  *   Global Functions 
  421.  */
  422. extern void EmergencyCallCheck(S16 keyCode, S16 keyType);
  423. extern void InitKeypadBeforePWRON(void);
  424. extern U16 GetTotalCallCount(void);
  425. #ifdef __MMI_SCREEN_SNAPSHOT__
  426. extern void mmi_camera_scr_snapshot(void);
  427. #endif 
  428. /*****************************************************************************
  429.  * FUNCTION
  430.  *  InitEvents
  431.  * DESCRIPTION
  432.  *  Initialization
  433.  *  
  434.  *  This is used to Initialize event handlers
  435.  * PARAMETERS
  436.  *  void
  437.  * RETURNS
  438.  *  void
  439.  *****************************************************************************/
  440. void InitEvents(void)
  441. {
  442.     /*----------------------------------------------------------------*/
  443.     /* Local Variables                                                */
  444.     /*----------------------------------------------------------------*/
  445.     U16 keyCode = 0;
  446.     U16 keyType = 0;
  447.     U16 count = 0;
  448.     /*----------------------------------------------------------------*/
  449.     /* Code Body                                                      */
  450.     /*----------------------------------------------------------------*/
  451.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_INIT));
  452.     for (keyCode = 0; keyCode < MAX_KEYS; keyCode++)
  453.     {
  454.         for (keyType = 0; keyType < MAX_KEY_TYPE; keyType++)
  455.         {
  456.             currKeyFuncPtrs[keyCode][keyType] = NULL;
  457.         }
  458.     }
  459.     currEntryFuncPtr = NULL;
  460.     currExitScrnID = 0;
  461.     currTopScrnID = 0;
  462.     currExitFuncPtr = NULL;
  463. mmu_frm_execute_scrn_exit_handler = MMI_FALSE;
  464.     /* JL remove to outside init InitHistory(); */
  465.     currMaxHiliteInfo = 0;
  466.     currParentID = 0;
  467.     maxProtocolEvent = 0;
  468.     usedProtocolEvent = 0;
  469.     /* MTK added by JL for PS interrupt */
  470.     maxInterruptEvent = 0;
  471.     /* //////// initilaize the timer, protocol & hardware events with func ptrs /////// */
  472.     for (count = 0; count < MAX_PROTOCOL_EVENT; count++)
  473.     {
  474.         protocolEventHandler[count].eventID = 0;
  475.         protocolEventHandler[count].entryFuncPtr = NULL;
  476.     }
  477.     for (count = 0; count < MAX_HILITE_HANDLER; count++)
  478.     {
  479.         maxHiliteInfo[count].entryFuncPtr = NULL;
  480.         maxHiliteInfo[count].hintFuncPtr = NULL;
  481.     }
  482.     for (count = 0; count < MAX_SUB_MENUS; count++)
  483.     {
  484.         subMenuDataPtrs[count] = subMenuData[count];
  485.     }
  486.     /* MTK added by JL for PS interrupt */
  487.     for (count = 0; count < MAX_INTERRUPT_EVENT; count++)
  488.     {
  489.         interruptEventHandler[count].eventID = (U16) NULL;
  490.         interruptEventHandler[count].entryIntFuncPtr = NULL;
  491.         interruptEventHandler[count].postIntFuncPtr = NULL;
  492.     }
  493.     /* ////////////////////////////////////////////////////////////////////////////////////// */
  494. }
  495. /*****************************************************************************
  496.  * FUNCTION
  497.  *  DeInitFramework_KeyAndEventHandler
  498.  * DESCRIPTION
  499.  *  DeInitialization
  500.  *  
  501.  *  Deinitialize key and event handlers
  502.  * PARAMETERS
  503.  *  void
  504.  * RETURNS
  505.  *  void
  506.  *****************************************************************************/
  507. void DeInitFramework_KeyAndEventHandler(void)
  508. {
  509.     /*----------------------------------------------------------------*/
  510.     /* Local Variables                                                */
  511.     /*----------------------------------------------------------------*/
  512.     U16 keyCode = 0;
  513.     U16 keyType = 0;
  514.     U16 count = 0;
  515.     /*----------------------------------------------------------------*/
  516.     /* Code Body                                                      */
  517.     /*----------------------------------------------------------------*/
  518.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT_KEY_EVENT));
  519.     for (keyCode = 0; keyCode < MAX_KEYS; keyCode++)
  520.     {
  521.         for (keyType = 0; keyType < MAX_KEY_TYPE; keyType++)
  522.         {
  523.             currKeyFuncPtrs[keyCode][keyType] = NULL;
  524.         }
  525.     }
  526.     currEntryFuncPtr = NULL;
  527.     currExitScrnID = 0;
  528.     currTopScrnID = 0;
  529.     currExitFuncPtr = NULL;
  530.     currMaxHiliteInfo = 0;
  531.     currParentID = 0;
  532.     maxProtocolEvent = 0;
  533.     usedProtocolEvent = 0;
  534.     /* //////// initilaize the timer, protocol & hardware events with func ptrs /////// */
  535.     for (count = 0; count < MAX_PROTOCOL_EVENT; count++)
  536.     {
  537.         protocolEventHandler[count].eventID = 0;
  538.         protocolEventHandler[count].entryFuncPtr = NULL;
  539.     }
  540.     for (count = 0; count < MAX_HILITE_HANDLER; count++)
  541.     {
  542.         maxHiliteInfo[count].entryFuncPtr = NULL;
  543.         maxHiliteInfo[count].hintFuncPtr = NULL;
  544.     }
  545. }
  546. /*****************************************************************************
  547.  * FUNCTION
  548.  *  DeInitFramework_History
  549.  * DESCRIPTION
  550.  *  DeInitialization
  551.  *  
  552.  *  Deinitialize History
  553.  * PARAMETERS
  554.  *  void
  555.  * RETURNS
  556.  *  void
  557.  *****************************************************************************/
  558. void DeInitFramework_History(void)
  559. {
  560.     /*----------------------------------------------------------------*/
  561.     /* Local Variables                                                */
  562.     /*----------------------------------------------------------------*/
  563.     /*----------------------------------------------------------------*/
  564.     /* Code Body                                                      */
  565.     /*----------------------------------------------------------------*/
  566.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT_HISTORY));
  567. #ifndef MMI_ON_WIN32
  568.     /* to handle key events before finish power off */
  569.     InitKeypadBeforePWRON();
  570. #endif /* MMI_ON_WIN32 */ 
  571.     DinitHistory();
  572.     DinitSubLCDHistory();
  573. }
  574. /*****************************************************************************
  575.  * FUNCTION
  576.  *  DeInitFramework
  577.  * DESCRIPTION
  578.  *  DeInitialization
  579.  *  
  580.  *  This is used to De-initialize history & event handlers
  581.  * PARAMETERS
  582.  *  void
  583.  * RETURNS
  584.  *  void
  585.  *****************************************************************************/
  586. void DeInitFramework(void)
  587. {
  588.     /*----------------------------------------------------------------*/
  589.     /* Local Variables                                                */
  590.     /*----------------------------------------------------------------*/
  591.     /*----------------------------------------------------------------*/
  592.     /* Code Body                                                      */
  593.     /*----------------------------------------------------------------*/
  594.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT));
  595.     DeInitFramework_KeyAndEventHandler();
  596.     DeInitFramework_History();
  597. }
  598. /*****************************************************************************
  599.  * FUNCTION
  600.  *  mmi_frm_reset_internal_key_contex
  601.  * DESCRIPTION
  602.  *  Reset internal key contex
  603.  *  
  604.  *  This is used to De-initialize history & event handlers
  605.  * PARAMETERS
  606.  *  void
  607.  * RETURNS
  608.  *  void
  609.  *****************************************************************************/
  610. void mmi_frm_reset_internal_key_contex()
  611. {
  612.     /*----------------------------------------------------------------*/
  613.     /* Local Variables                                                */
  614.     /*----------------------------------------------------------------*/
  615.     /*----------------------------------------------------------------*/
  616.     /* Code Body                                                      */
  617.     /*----------------------------------------------------------------*/
  618.     pressKey = 0;
  619.     processUpRepeatKey = 0;
  620. }
  621. /*****************************************************************************
  622.  * FUNCTION
  623.  *  ExecuteCurrKeyHandler
  624.  * DESCRIPTION
  625.  *  executes current key func handler
  626.  *  
  627.  *  This is used to executes current key func handler
  628.  * PARAMETERS
  629.  *  keyCode     [IN]        
  630.  *  keyType     [IN]        
  631.  * RETURNS
  632.  *  void
  633.  *****************************************************************************/
  634. void ExecuteCurrKeyHandler(S16 keyCode, S16 keyType)
  635. {
  636.     /*----------------------------------------------------------------*/
  637.     /* Local Variables                                                */
  638.     /*----------------------------------------------------------------*/
  639.     FuncPtr currFuncPtr = NULL;
  640.     /*----------------------------------------------------------------*/
  641.     /* Code Body                                                      */
  642.     /*----------------------------------------------------------------*/
  643.     mmi_idle_restart_keypad_lock_timer();   /* 2006/01/16 Restart keypad lock timer if any key is pressed in idle screen */
  644.     currKeyCode = keyCode;
  645.     currKeyType = keyType;
  646.     /* Added for Help */
  647.     /*
  648.      * if(gIsHelpEnabled != 0)
  649.      * {
  650.      * StopTimer(HELP_APPLICATION_TIMER);
  651.      * StartTimer(HELP_APPLICATION_TIMER,HELP_APPLICATION_TIMEOUT,ShowHelp);
  652.      * }
  653.      */
  654.     if (!gEmerencyNoDialed)
  655.     {
  656.         if (mmi_kbd_get_concurrent_mode() == MMI_FALSE)
  657.         {
  658.             /* special handling for single-key mode */
  659.             switch (keyType)
  660.             {
  661.                 case KEY_HALF_PRESS_DOWN:
  662.                     pressKey = 1;   /* 0- full up, 1- half down, 2- full down */
  663.                     break;
  664.                 case KEY_EVENT_DOWN:
  665.                     /* 
  666.                      * The application may call ExecuteCurrKeyHandler() directly 
  667.                      * MMI framework use KEY_HALF_PRESS_DOWN or KEY_FULL_PRESS_DOWN only
  668.                      */
  669.                     pressKey = 2;   /* 0- full up, 1- half down, 2- full down */
  670.                     processUpRepeatKey = 1;
  671.                     break;
  672.                 case KEY_REPEAT:
  673.                     if (!processUpRepeatKey)
  674.                     {
  675.                         return;
  676.                     }
  677.                     break;
  678.                 case KEY_EVENT_UP:
  679.                     if (pressKey == 0)
  680.                     {
  681.                         /* processUpRepeatKey=0; */
  682.                         mmi_frm_reset_internal_key_contex();
  683.                         return;
  684.                     }
  685.                     break;
  686.             }
  687.         }
  688.         currFuncPtr = currKeyFuncPtrs[keyCode][keyType];
  689.         /* MTK Leo add, if there is no handler for center key(KEY_ENTER) registered by APP, use LSK function. */
  690.         if (keyCode == KEY_ENTER && currFuncPtr == NULL)
  691.         {
  692.             /* If any one type of the key eventis registered by APP, we assume APP want to control this key by itself. */
  693.             if (currKeyFuncPtrs[KEY_ENTER][KEY_EVENT_UP] == NULL &&
  694.                 currKeyFuncPtrs[KEY_ENTER][KEY_EVENT_DOWN] == NULL &&
  695.                 currKeyFuncPtrs[KEY_ENTER][KEY_HALF_PRESS_DOWN] == NULL &&
  696.                 currKeyFuncPtrs[KEY_ENTER][KEY_REPEAT] == NULL && currKeyFuncPtrs[KEY_ENTER][KEY_LONG_PRESS] == NULL)
  697.             {
  698.                 currFuncPtr = currKeyFuncPtrs[KEY_LSK][keyType];
  699.             }
  700.         }
  701.         /* MTK Leo end. */
  702.         if ((keyType == KEY_REPEAT) && (currFuncPtr == NULL) && (keyCode != KEY_RSK) && (keyCode != KEY_LSK))   /* 20040906 Disable repeat for LSK and RSK */
  703.         {
  704.             currFuncPtr = currKeyFuncPtrs[keyCode][KEY_EVENT_DOWN];
  705.         }
  706.     #ifdef __MMI_WGUI_MINI_TAB_BAR__
  707.         if (wgui_if_mini_tab_bar_enable() == MMI_TRUE && keyCode == KEY_LEFT_ARROW && keyType == KEY_EVENT_DOWN)
  708.         {
  709.             currFuncPtr = wgui_mini_tab_bar_goto_prev;
  710.         }
  711.         if (wgui_if_mini_tab_bar_enable() == MMI_TRUE && keyCode == KEY_RIGHT_ARROW && keyType == KEY_EVENT_DOWN)
  712.         {
  713.             currFuncPtr = wgui_mini_tab_bar_goto_next;
  714.         }
  715.     #endif /* __MMI_WGUI_MINI_TAB_BAR__ */ 
  716.     #ifdef __MMI_SCREEN_SNAPSHOT__
  717.         if ((keyType == KEY_LONG_PRESS) && (keyCode == KEY_CAMERA) && (currFuncPtr == NULL))
  718.         {
  719.             currFuncPtr = mmi_camera_scr_snapshot;
  720.         }
  721.     #endif /* __MMI_SCREEN_SNAPSHOT__ */ 
  722.         if (mmi_kbd_get_concurrent_mode() == MMI_FALSE)
  723.         {
  724.             if (keyType == KEY_EVENT_UP)
  725.             {
  726.                 /* release the key */
  727.                 if (pressKey == 1)  /* 0- full up, 1- half down, 2- full down */
  728.                 {
  729.                     currFuncPtr = currKeyFuncPtrs[keyCode][KEY_HALF_PRESS_UP];
  730.                 }
  731.                 else if ((pressKey == 2) && (currKeyFuncPtrs[keyCode][KEY_HALF_PRESS_UP] != NULL))
  732.                 {
  733.                     /* If KEY_EVENT_UP in 2-stage full-pressed key, need call KEY_HALF_PRESS_UP handler first */
  734.                     currKeyFuncPtrs[keyCode][KEY_HALF_PRESS_UP] ();
  735.                 }
  736.                 /* special handling for single-key mode */
  737.                 mmi_frm_reset_internal_key_contex();
  738.             }
  739.         }
  740.         if (currFuncPtr)
  741.         {
  742.         #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
  743.             g_mmi_frm_cntx.dump_screen_info.allow_dump_screen_str = MMI_TRUE;
  744.         #endif
  745. MMI_TRACE( (MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURKEY_KEYCODE_HDLR,currFuncPtr, keyCode, keyType));
  746. (*currFuncPtr)();
  747.         }
  748.     }
  749.     else
  750.     {
  751.         gEmerencyNoDialed = 0;
  752.     }
  753. }
  754. /*****************************************************************************
  755.  * FUNCTION
  756.  *  ExecuteCurrProtocolHandler
  757.  * DESCRIPTION
  758.  *  executes current protocol func handler
  759.  *  
  760.  *  This is used to executes current protocol func handler
  761.  * PARAMETERS
  762.  *  eventID         [IN]        
  763.  *  MsgStruct       [IN]        
  764.  *  mod_src         [IN]        
  765.  *  peerBuf         [IN]         
  766.  * RETURNS
  767.  *  void
  768.  *****************************************************************************/
  769. void ExecuteCurrProtocolHandler(U16 eventID, void *MsgStruct, int mod_src, void *peerBuf)
  770. {
  771.     /*----------------------------------------------------------------*/
  772.     /* Local Variables                                                */
  773.     /*----------------------------------------------------------------*/
  774.     U16 count = 0;
  775.     /* PsExtFuncPtr currFuncPtr = NULL; */
  776.     PsExtPeerFuncPtr currFuncPtr = NULL;
  777.     PsIntFuncPtr IntFunc = NULL, PostIntFunc = NULL;
  778.     PsExtPeerIntFuncPtr currInterruptFuncPtr = NULL, currPostInterruptFuncPtr = NULL;
  779.     U8 interrup_result = MMI_FALSE; /* False not handle interrupt, True will handle */
  780. #if defined (MMI_EVENT_PROFILING)
  781.     kal_uint32 start_tick, end_tick;
  782.     static kal_uint32 accu_ticks = 0;
  783.     static U32 accu_count = 0;
  784. #endif /* defined (MMI_EVENT_PROFILING) */ 
  785.     /*----------------------------------------------------------------*/
  786.     /* Code Body                                                      */
  787.     /*----------------------------------------------------------------*/
  788. #if defined (MMI_EVENT_PROFILING)
  789.     kal_get_time(&start_tick);
  790. #endif 
  791.     /* Search events in protocol event handler table */
  792.     for (count = 0; count < maxProtocolEvent; count++)
  793.     {
  794.         if (protocolEventHandler[count].eventID == eventID)
  795.         {
  796.             currFuncPtr = (PsExtPeerFuncPtr) protocolEventHandler[count].entryFuncPtr;
  797.             if (count > 0)
  798.             {   /* improve the search efficiently */
  799.                 protocolEventHandler[count].eventID = protocolEventHandler[count - 1].eventID;
  800.                 protocolEventHandler[count].entryFuncPtr = protocolEventHandler[count - 1].entryFuncPtr;
  801.                 protocolEventHandler[count - 1].eventID = eventID;
  802.                 protocolEventHandler[count - 1].entryFuncPtr = (PsFuncPtr) currFuncPtr;
  803.             }
  804.             break;
  805.         }
  806.     }
  807. #if defined (MMI_EVENT_PROFILING)
  808.     PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler count = %d", count));
  809.     accu_count += count;
  810. #endif /* defined (MMI_EVENT_PROFILING) */ 
  811.     /* Search events in interrupt event handler table */
  812.     QueryInterruptHandler(eventID, &IntFunc, &PostIntFunc);
  813.     currInterruptFuncPtr = (PsExtPeerIntFuncPtr) IntFunc;
  814.     currPostInterruptFuncPtr = (PsExtPeerIntFuncPtr) PostIntFunc;
  815.     if (currInterruptFuncPtr)
  816.     {
  817.         MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURPTO_INTP_HDLR, eventID));
  818.         interrup_result = (*currInterruptFuncPtr) (MsgStruct, mod_src, peerBuf);
  819.     }
  820.     /* if(currFuncPtr) */
  821.     if ((currFuncPtr) && (!interrup_result))
  822.     {
  823.         MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURPTO_HDLR, eventID));
  824.         /* (*currFuncPtr)(MsgStruct,mod_src); */
  825.         (*currFuncPtr) (MsgStruct, mod_src, peerBuf);
  826.     }
  827.     else
  828.     {
  829.         MMI_TRACE((MMI_TRACE_WARNING, MMI_FRM_INFO_EVENT_EXECURPTO_NO_HDLR, eventID));
  830.     }
  831.     if (currPostInterruptFuncPtr)
  832.     {
  833.         (*currPostInterruptFuncPtr) (MsgStruct, mod_src, peerBuf);
  834.     }
  835. #if defined (MMI_EVENT_PROFILING)
  836.     kal_get_time(&end_tick);
  837.     accu_ticks += (end_tick - start_tick);
  838.     PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler accu_count = %d", accu_count));
  839.     PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler accu_ticks = %d", accu_ticks));
  840.     PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler maxProtocolEvent = %d", maxProtocolEvent));
  841. #endif /* defined (MMI_EVENT_PROFILING) */ 
  842. }
  843. /*****************************************************************************
  844.  * FUNCTION
  845.  *  ExecuteCurrExitHandler
  846.  * DESCRIPTION
  847.  *  executes current exit func handler
  848.  *  
  849.  *  This is used to executes current exit func handler
  850.  * PARAMETERS
  851.  *  void
  852.  * RETURNS
  853.  *  void
  854.  *****************************************************************************/
  855. extern void UI_common_screen_exit(void);
  856. extern void UI_common_screen_pre_exit(void);
  857. static void ExecuteCurrExitHandler(void)
  858. {
  859.     /*----------------------------------------------------------------*/
  860.     /* Local Variables                                                */
  861.     /*----------------------------------------------------------------*/
  862.     /*----------------------------------------------------------------*/
  863.     /* Code Body                                                      */
  864.     /*----------------------------------------------------------------*/
  865.     /* MTK added by JL 040115 for create a new function without key clear if need. */
  866.     ExecuteCurrExitHandler_Ext();
  867.     /* it clears all the key handlers, registered by the current screen */
  868.     ClearInputEventHandler(MMI_DEVICE_KEY);
  869. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  870.     mmi_tm_reset_imageid_image_header_pool();
  871. #ifdef __MMI_DLT_CACHE_SUPPORT__
  872.     mmi_tm_clear_ondemand_cache();
  873. #endif 
  874. #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */ 
  875.     /* MTK end */
  876. #if defined(__MMI_RESOURCE_ENFB_SUPPORT__)
  877. mmi_frm_resmem_reset(MMI_FRM_RESMEM_TYPE_LOD_ON_DEMAND);
  878. #endif /* __MMI_RESOURCE_ENFB_SUPPORT__ */
  879. }
  880. /*****************************************************************************
  881.  * FUNCTION
  882.  *  ReplaceNewScreenHandler
  883.  * DESCRIPTION
  884.  *  Replace current new screen handler
  885.  *  
  886.  *  This is used to sets current new screen handlers
  887.  * PARAMETERS
  888.  *  scrnID              [IN]        
  889.  *  exitFuncPtr         [IN]        
  890.  *  entryFuncPtr        [IN]        
  891.  * RETURNS
  892.  *  void
  893.  *****************************************************************************/
  894. void ReplaceNewScreenHandler(U16 scrnID, FuncPtr exitFuncPtr, FuncPtr entryFuncPtr)
  895. {
  896.     /*----------------------------------------------------------------*/
  897.     /* Local Variables                                                */
  898.     /*----------------------------------------------------------------*/
  899.     /*----------------------------------------------------------------*/
  900.     /* Code Body                                                      */
  901.     /*----------------------------------------------------------------*/
  902.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETEXIT_HDLR, scrnID));
  903.     currExitScrnID = scrnID;
  904.     currExitFuncPtr = exitFuncPtr;
  905.     currEntryFuncPtr = entryFuncPtr;
  906. }
  907. /*****************************************************************************
  908.  * FUNCTION
  909.  *  EntryNewScreen
  910.  * DESCRIPTION
  911.  *  To set the current topest screen ID for entry screen function
  912.  *  
  913.  *  This is used to executes current exit func handler
  914.  * PARAMETERS
  915.  *  newscrnID           [IN]        
  916.  *  newExitHandler      [IN]        
  917.  *  newEntryHandler     [IN]        
  918.  *  peerBuf             [IN]         
  919.  * RETURNS
  920.  *  void
  921.  *****************************************************************************/
  922. U8 EntryNewScreen(U16 newscrnID, FuncPtr newExitHandler, FuncPtr newEntryHandler, void *peerBuf)
  923. {
  924.     /*----------------------------------------------------------------*/
  925.     /* Local Variables                                                */
  926.     /*----------------------------------------------------------------*/
  927.     /*----------------------------------------------------------------*/
  928.     /* Code Body                                                      */
  929.     /*----------------------------------------------------------------*/
  930.     /* store the current Top entry screen */
  931.     currTopScrnID = newscrnID;
  932.     /* entry the new screen */
  933.     ExecuteCurrExitHandler();
  934.     /* store the exit current Top entry screen */
  935.     currExitScrnID = newscrnID;
  936.     if ((newExitHandler != NULL) || (newEntryHandler != NULL))
  937.     {
  938.         SetGenericExitHandler(newscrnID, newExitHandler, newEntryHandler);
  939.     }
  940.     return MMI_TRUE;
  941. }
  942. /*****************************************************************************
  943.  * FUNCTION
  944.  *  EntryNewScreen_Ext
  945.  * DESCRIPTION
  946.  *  To set the current topest screen ID for entry screen function, without clear keyhandler
  947.  *  
  948.  *  This is used to executes current exit func handler
  949.  * PARAMETERS
  950.  *  newscrnID           [IN]        
  951.  *  newExitHandler      [IN]        
  952.  *  newEntryHandler     [IN]        
  953.  *  peerBuf             [IN]         
  954.  * RETURNS
  955.  *  void
  956.  *****************************************************************************/
  957. U8 EntryNewScreen_Ext(U16 newscrnID, FuncPtr newExitHandler, FuncPtr newEntryHandler, void *peerBuf)
  958. {
  959.     /*----------------------------------------------------------------*/
  960.     /* Local Variables                                                */
  961.     /*----------------------------------------------------------------*/
  962.     /*----------------------------------------------------------------*/
  963.     /* Code Body                                                      */
  964.     /*----------------------------------------------------------------*/
  965.     /* store the current Top entry screen */
  966.     currTopScrnID = newscrnID;
  967.     /* entry the new screen */
  968.     ExecuteCurrExitHandler_Ext();
  969.     /* store the exit current Top entry screen */
  970.     currExitScrnID = newscrnID;
  971.     if ((newExitHandler != NULL) || (newEntryHandler != NULL))
  972.     {
  973.         SetGenericExitHandler(newscrnID, newExitHandler, newEntryHandler);
  974.     }
  975.     return MMI_TRUE;
  976. }
  977. /*****************************************************************************
  978.  * FUNCTION
  979.  *  ExecuteCurrExitHandler_Ext
  980.  * DESCRIPTION
  981.  *  executes current exit func handler without clear keys
  982.  *  
  983.  *  This is used to executes current exit func handler
  984.  * PARAMETERS
  985.  *  void
  986.  * RETURNS
  987.  *  void
  988.  *****************************************************************************/
  989. /* MTK added by JL for keypad without clearall requirement */
  990. void ExecuteCurrExitHandler_Ext(void)
  991. {
  992.     /*----------------------------------------------------------------*/
  993.     /* Local Variables                                                */
  994.     /*----------------------------------------------------------------*/
  995.     U8 count = 0;
  996.     /*----------------------------------------------------------------*/
  997.     /* Code Body                                                      */
  998.     /*----------------------------------------------------------------*/
  999. #ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
  1000.     /* Clear g_mmi_frm_cntx.dump_screen_info.backup_string */
  1001.     g_mmi_frm_cntx.dump_screen_info.backup_string[0] = 0;
  1002.     g_mmi_frm_cntx.dump_screen_info.backup_string[1] = 0;
  1003.     g_mmi_frm_cntx.dump_screen_info.allow_dump_screen_str = MMI_TRUE;
  1004. #endif
  1005.     /* Failsafe common function before exit screen */
  1006.     UI_common_screen_pre_exit();
  1007.     for (count = 0; count < MAX_SUB_MENUS; count++)
  1008.     {
  1009.         subMenuDataPtrs[count] = subMenuData[count];
  1010.     }
  1011.     if (currEntryFuncPtr || currExitFuncPtr)
  1012.     {
  1013.         ClearAllInterruptEventHandler();
  1014.     }
  1015.     /* call GenericExitScreen if currEntryFuncPtr is not NULL */
  1016.     if (currEntryFuncPtr)
  1017.     {
  1018.         GenericExitScreen(currExitScrnID, currEntryFuncPtr);
  1019.     }
  1020.     if (currExitFuncPtr)
  1021.     {
  1022.         MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXIT_HDLR));
  1023.         mmu_frm_execute_scrn_exit_handler = MMI_TRUE;
  1024.         (*currExitFuncPtr) ();
  1025.         mmu_frm_execute_scrn_exit_handler = MMI_FALSE;
  1026.     }
  1027.     currEntryFuncPtr = NULL;
  1028.     currExitFuncPtr = NULL;
  1029.     /* Failsafe common screen exit function   */
  1030.     UI_common_screen_exit();
  1031.     /* it clears all the key handlers, registered by the current screen */
  1032.     IsBackHistory = FALSE;
  1033.     /* To dump the history memory */
  1034.     HistoryDump();
  1035. }
  1036. /*****************************************************************************
  1037.  * FUNCTION
  1038.  *  mmi_execute_scrn_exit_func
  1039.  * DESCRIPTION
  1040.  *  check if framework executes the screen's exit handler
  1041.  *  
  1042.  *  This is used to executes current exit func handler
  1043.  * PARAMETERS
  1044.  *  void
  1045.  * RETURNS
  1046.  *  MMI_BOOL
  1047.  *****************************************************************************/
  1048. MMI_BOOL mmi_execute_scrn_exit_func(void)
  1049. {
  1050.     return mmu_frm_execute_scrn_exit_handler;
  1051. }
  1052. /*****************************************************************************
  1053.  * FUNCTION
  1054.  *  ExecuteCurrHiliteHandler
  1055.  * DESCRIPTION
  1056.  *  executes current hilite func handler
  1057.  *  
  1058.  *  This is used to executes current hilite func handler
  1059.  * PARAMETERS
  1060.  *  hiliteid        [IN]        
  1061.  * RETURNS
  1062.  *  void
  1063.  *****************************************************************************/
  1064. void ExecuteCurrHiliteHandler(S32 hiliteid)
  1065. {
  1066.     /*----------------------------------------------------------------*/
  1067.     /* Local Variables                                                */
  1068.     /*----------------------------------------------------------------*/
  1069.     /*----------------------------------------------------------------*/
  1070.     /* Code Body                                                      */
  1071.     /*----------------------------------------------------------------*/
  1072.     /* To avoid the arrow left key to entry unexpected function, while other APP need they shall register again as BY request. */
  1073.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1074.     ExecuteCurrHiliteHandler_Ext(hiliteid);
  1075. }
  1076. /*****************************************************************************
  1077.  * FUNCTION
  1078.  *  ExecuteCurrHiliteHandler_Ext
  1079.  * DESCRIPTION
  1080.  *  
  1081.  * PARAMETERS
  1082.  *  hiliteid        [IN]        
  1083.  * RETURNS
  1084.  *  void
  1085.  *****************************************************************************/
  1086. void ExecuteCurrHiliteHandler_Ext(S32 hiliteid)
  1087. {
  1088.     /*----------------------------------------------------------------*/
  1089.     /* Local Variables                                                */
  1090.     /*----------------------------------------------------------------*/
  1091.     FuncPtr currFuncPtr = NULL;
  1092.     S32 hiliteItemID;
  1093.     /*----------------------------------------------------------------*/
  1094.     /* Code Body                                                      */
  1095.     /*----------------------------------------------------------------*/
  1096.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURHILIHTE_HDLR, hiliteid));
  1097.     currHiliteID = (U16) hiliteid;
  1098.     if (currParentID == 0)
  1099.     {
  1100.         MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_ERROR_EVENT_EXECURHILIHTE_HDLR));
  1101.         return;
  1102.     }
  1103.     /* check if menuitem is hidden */
  1104.     hiliteItemID = GetSeqItemId_Ext((U16) currParentID, (S16) hiliteid);
  1105.     currFuncPtr = maxHiliteInfo[hiliteItemID].entryFuncPtr;
  1106.     if (currFuncPtr)
  1107.     {
  1108.         (*currFuncPtr) ();
  1109.     }
  1110. }
  1111. /*****************************************************************************
  1112.  * FUNCTION
  1113.  *  GetCurrHiliteID
  1114.  * DESCRIPTION
  1115.  *  Returns the index of the currently highlighted menu item
  1116.  * PARAMETERS
  1117.  *  void
  1118.  * RETURNS
  1119.  *  void
  1120.  *****************************************************************************/
  1121. U16 GetCurrHiliteID(void)
  1122. {
  1123.     /*----------------------------------------------------------------*/
  1124.     /* Local Variables                                                */
  1125.     /*----------------------------------------------------------------*/
  1126.     /*----------------------------------------------------------------*/
  1127.     /* Code Body                                                      */
  1128.     /*----------------------------------------------------------------*/
  1129.     return currHiliteID;
  1130. }
  1131. /*****************************************************************************
  1132.  * FUNCTION
  1133.  *  SetHiliteHandler
  1134.  * DESCRIPTION
  1135.  *  Sets hilite func handlers
  1136.  *  
  1137.  *  This is used to set hilite func handlers
  1138.  * PARAMETERS
  1139.  *  itemid              [IN]        
  1140.  *  hiliteFuncPtr       [IN]        
  1141.  * RETURNS
  1142.  *  void
  1143.  *****************************************************************************/
  1144. void SetHiliteHandler(U16 itemid, FuncPtr hiliteFuncPtr)
  1145. {
  1146.     /*----------------------------------------------------------------*/
  1147.     /* Local Variables                                                */
  1148.     /*----------------------------------------------------------------*/
  1149.     /*----------------------------------------------------------------*/
  1150.     /* Code Body                                                      */
  1151.     /*----------------------------------------------------------------*/
  1152.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETCURHILIHTE_HDLR, itemid));
  1153.     maxHiliteInfo[itemid].entryFuncPtr = hiliteFuncPtr;
  1154. }
  1155. /*****************************************************************************
  1156.  * FUNCTION
  1157.  *  ClearHiliteHandler
  1158.  * DESCRIPTION
  1159.  *  Clear hilite handler
  1160.  *  
  1161.  *  This is used to clear hilite func handlers for a particular menu item
  1162.  * PARAMETERS
  1163.  *  itemid      [IN]        
  1164.  * RETURNS
  1165.  *  void
  1166.  *****************************************************************************/
  1167. void ClearHiliteHandler(U16 itemid)
  1168. {
  1169.     /*----------------------------------------------------------------*/
  1170.     /* Local Variables                                                */
  1171.     /*----------------------------------------------------------------*/
  1172.     /*----------------------------------------------------------------*/
  1173.     /* Code Body                                                      */
  1174.     /*----------------------------------------------------------------*/
  1175.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRCURHILIHTE_HDLR, itemid));
  1176.     maxHiliteInfo[itemid].entryFuncPtr = NULL;
  1177. }
  1178. /*****************************************************************************
  1179.  * FUNCTION
  1180.  *  ConstructHintsList
  1181.  * DESCRIPTION
  1182.  *  Constructs Hint List for a static menu screen
  1183.  * PARAMETERS
  1184.  *  parentID        [IN]        
  1185.  *  hintArray       [IN]        
  1186.  * RETURNS
  1187.  *  void
  1188.  *****************************************************************************/
  1189. extern MMI_BOOL mmi_frm_test_menu_item_hide(U16 menu_item_id);
  1190. void ConstructHintsList(U16 parentID, U8 **hintArray)
  1191. {
  1192.     /*----------------------------------------------------------------*/
  1193.     /* Local Variables                                                */
  1194.     /*----------------------------------------------------------------*/
  1195.     U8 i, noOfChild;
  1196.     U16 hiliteItemID[MAX_SUB_MENUS];
  1197.     U8 idx = 0;
  1198.     /*----------------------------------------------------------------*/
  1199.     /* Code Body                                                      */
  1200.     /*----------------------------------------------------------------*/
  1201.     noOfChild = (U8) GetNumOfChild(parentID);
  1202.     for (i = 0; i < noOfChild; i++)
  1203.     {
  1204.         hiliteItemID[i] = GetSeqItemId((U16) parentID, (S16) i);
  1205.         /* check if menuitem is hidden */
  1206.         if (!mmi_frm_test_menu_item_hide(hiliteItemID[i]))  /* the menuitem is not hidden */
  1207.         {
  1208.             if (maxHiliteInfo[hiliteItemID[i]].hintFuncPtr)
  1209.             {
  1210.                 (*maxHiliteInfo[hiliteItemID[i]].hintFuncPtr) (idx);
  1211.                 hintArray[idx] = hintData[idx];
  1212.                 idx++;
  1213.             }
  1214.             else
  1215.             {
  1216.                 hintArray[idx++] = NULL;
  1217.             }
  1218.         }
  1219.     }
  1220. }
  1221. /*****************************************************************************
  1222.  * FUNCTION
  1223.  *  SetHintHandler
  1224.  * DESCRIPTION
  1225.  *  Sets Hint Func Handlers
  1226.  * PARAMETERS
  1227.  *  itemid          [IN]        FuncPtr hiliteFuncPtr
  1228.  *  hintFuncPtr     [IN]        
  1229.  * RETURNS
  1230.  *  void
  1231.  *****************************************************************************/
  1232. void SetHintHandler(U16 itemid, FuncPtrShort hintFuncPtr)
  1233. {
  1234.     /*----------------------------------------------------------------*/
  1235.     /* Local Variables                                                */
  1236.     /*----------------------------------------------------------------*/
  1237.     /*----------------------------------------------------------------*/
  1238.     /* Code Body                                                      */
  1239.     /*----------------------------------------------------------------*/
  1240.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETHINT_HDLR, itemid));
  1241.     maxHiliteInfo[itemid].hintFuncPtr = hintFuncPtr;
  1242. }
  1243. /*****************************************************************************
  1244.  * FUNCTION
  1245.  *  ClearHintHandler
  1246.  * DESCRIPTION
  1247.  *  clears hint handlers
  1248.  *  
  1249.  *  This is used to clear hint func handlers
  1250.  * PARAMETERS
  1251.  *  itemid      [IN]        
  1252.  * RETURNS
  1253.  *  void
  1254.  *****************************************************************************/
  1255. void ClearHintHandler(U16 itemid)
  1256. {
  1257.     /*----------------------------------------------------------------*/
  1258.     /* Local Variables                                                */
  1259.     /*----------------------------------------------------------------*/
  1260.     /*----------------------------------------------------------------*/
  1261.     /* Code Body                                                      */
  1262.     /*----------------------------------------------------------------*/
  1263.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRHINT_HDLR, itemid));
  1264.     maxHiliteInfo[itemid].hintFuncPtr = NULL;
  1265. }
  1266. /*****************************************************************************
  1267.  * FUNCTION
  1268.  *  SetParentHandler
  1269.  * DESCRIPTION
  1270.  *  sets current parent item id
  1271.  *  
  1272.  *  This is used to set current parent item id
  1273.  * PARAMETERS
  1274.  *  parentID        [IN]        
  1275.  * RETURNS
  1276.  *  void
  1277.  *****************************************************************************/
  1278. void SetParentHandler(U16 parentID)
  1279. {
  1280.     /*----------------------------------------------------------------*/
  1281.     /* Local Variables                                                */
  1282.     /*----------------------------------------------------------------*/
  1283.     /*----------------------------------------------------------------*/
  1284.     /* Code Body                                                      */
  1285.     /*----------------------------------------------------------------*/
  1286.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETPARENT_HDLR, parentID));
  1287.     currParentID = parentID;
  1288. }
  1289. /* MTK Brian added for AT+CVIB, 2003/11/23 */
  1290. /*****************************************************************************
  1291.  * FUNCTION
  1292.  *  GetParentHandler
  1293.  * DESCRIPTION
  1294.  *  
  1295.  * PARAMETERS
  1296.  *  void
  1297.  * RETURNS
  1298.  *  
  1299.  *****************************************************************************/
  1300. U16 GetParentHandler(void)
  1301. {
  1302.     /*----------------------------------------------------------------*/
  1303.     /* Local Variables                                                */
  1304.     /*----------------------------------------------------------------*/
  1305.     /*----------------------------------------------------------------*/
  1306.     /* Code Body                                                      */
  1307.     /*----------------------------------------------------------------*/
  1308.     return currParentID;
  1309. }
  1310. /*****************************************************************************
  1311.  * FUNCTION
  1312.  *  SetKeyHandler
  1313.  * DESCRIPTION
  1314.  *  sets the curent screen key handlers
  1315.  *  
  1316.  *  This is used to set the curent screen key handlers
  1317.  * PARAMETERS
  1318.  *  funcPtr     [IN]        
  1319.  *  keyCode     [IN]        
  1320.  *  keyType     [IN]        
  1321.  * RETURNS
  1322.  *  void
  1323.  *****************************************************************************/
  1324. void SetKeyHandler(FuncPtr funcPtr, U16 keyCode, U16 keyType)
  1325. {
  1326.     /*----------------------------------------------------------------*/
  1327.     /* Local Variables                                                */
  1328.     /*----------------------------------------------------------------*/
  1329.     /*----------------------------------------------------------------*/
  1330.     /* Code Body                                                      */
  1331.     /*----------------------------------------------------------------*/
  1332.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETKEY_HDLR, keyCode, keyType, funcPtr));
  1333.     MMI_ASSERT((keyCode < MAX_KEYS) && (keyType < MAX_KEY_TYPE));
  1334.     currKeyFuncPtrs[keyCode][keyType] = funcPtr;
  1335. }
  1336. /*****************************************************************************
  1337.  * FUNCTION
  1338.  *  GetKeyHandler
  1339.  * DESCRIPTION
  1340.  *  return the curent screen key handlers
  1341.  *  
  1342.  *  This is used to set the curent screen key handlers
  1343.  * PARAMETERS
  1344.  *  keyCode     [IN]        
  1345.  *  keyType     [IN]        
  1346.  * RETURNS
  1347.  *  void
  1348.  *****************************************************************************/
  1349. FuncPtr GetKeyHandler(U16 keyCode, U16 keyType)
  1350. {
  1351.     /*----------------------------------------------------------------*/
  1352.     /* Local Variables                                                */
  1353.     /*----------------------------------------------------------------*/
  1354.     /*----------------------------------------------------------------*/
  1355.     /* Code Body                                                      */
  1356.     /*----------------------------------------------------------------*/
  1357.     MMI_ASSERT((keyCode < MAX_KEYS) && (keyType < MAX_KEY_TYPE));
  1358.     return (currKeyFuncPtrs[keyCode][keyType]);
  1359. }
  1360. /*****************************************************************************
  1361.  * FUNCTION
  1362.  *  SetGroupKeyHandler
  1363.  * DESCRIPTION
  1364.  *  sets the curent screen same key handler to the group pf keycodes
  1365.  *  
  1366.  *  This is used to set the same key handler for a group of keycodes.
  1367.  * PARAMETERS
  1368.  *  funcPtr         [IN]        
  1369.  *  keyCodes        [IN]        
  1370.  *  len             [IN]        
  1371.  *  keyType         [IN]        
  1372.  * RETURNS
  1373.  *  void
  1374.  *****************************************************************************/
  1375. void SetGroupKeyHandler(FuncPtr funcPtr, PU16 keyCodes, U8 len, U16 keyType)
  1376. {
  1377.     /*----------------------------------------------------------------*/
  1378.     /* Local Variables                                                */
  1379.     /*----------------------------------------------------------------*/
  1380.     U8 count;
  1381.     /*----------------------------------------------------------------*/
  1382.     /* Code Body                                                      */
  1383.     /*----------------------------------------------------------------*/
  1384.     MMI_ASSERT((len <= MAX_KEYS) && (keyType < MAX_KEY_TYPE));
  1385.     for (count = 0; count < len; count++)
  1386.     {
  1387.         MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETGROUPKEY_HDLR, keyCodes[count], keyType));
  1388.         currKeyFuncPtrs[keyCodes[count]][keyType] = funcPtr;
  1389.     }
  1390. }
  1391. /*****************************************************************************
  1392.  * FUNCTION
  1393.  *  ClearKeyHandler
  1394.  * DESCRIPTION
  1395.  *  clears the current screen key handlers
  1396.  *  
  1397.  *  This is used to clears the current screen key handlers
  1398.  * PARAMETERS
  1399.  *  keyCode     [IN]        
  1400.  *  keyType     [IN]        
  1401.  * RETURNS
  1402.  *  void
  1403.  *****************************************************************************/
  1404. void ClearKeyHandler(U16 keyCode, U16 keyType)
  1405. {
  1406.     /*----------------------------------------------------------------*/
  1407.     /* Local Variables                                                */
  1408.     /*----------------------------------------------------------------*/
  1409.     /*----------------------------------------------------------------*/
  1410.     /* Code Body                                                      */
  1411.     /*----------------------------------------------------------------*/
  1412.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRKEY_HDLR, keyCode, keyType));
  1413.     MMI_ASSERT((keyCode < MAX_KEYS) && (keyType < MAX_KEY_TYPE));
  1414.     currKeyFuncPtrs[keyCode][keyType] = NULL;
  1415. }
  1416. /*****************************************************************************
  1417.  * FUNCTION
  1418.  *  ClearAllKeyHandler
  1419.  * DESCRIPTION
  1420.  *  clears all the current screen key handlers
  1421.  *  
  1422.  *  This is used to clears all the current screen key handlers
  1423.  * PARAMETERS
  1424.  *  void
  1425.  * RETURNS
  1426.  *  void
  1427.  *****************************************************************************/
  1428. void ClearAllKeyHandler(void)
  1429. {
  1430.     /*----------------------------------------------------------------*/
  1431.     /* Local Variables                                                */
  1432.     /*----------------------------------------------------------------*/
  1433.     U16 keyCode = 0;
  1434.     U16 keyType = 0;
  1435.     /*----------------------------------------------------------------*/
  1436.     /* Code Body                                                      */
  1437.     /*----------------------------------------------------------------*/
  1438.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRALLKEY_HDLR));
  1439.     for (keyCode = 0; keyCode < MAX_KEYS; keyCode++)
  1440.     {
  1441.         for (keyType = 0; keyType < MAX_KEY_TYPE; keyType++)
  1442.         {
  1443.             currKeyFuncPtrs[keyCode][keyType] = NULL;
  1444.         }
  1445.     }
  1446.     PowerAndEndKeyHandler();
  1447.     SetDefaultVolumeKeyHandlers();
  1448. }
  1449. /*****************************************************************************
  1450.  * FUNCTION
  1451.  *  ClearInputEventHandler
  1452.  * DESCRIPTION
  1453.  *  Clear input device event handlers
  1454.  *  
  1455.  *  This is used to clear input device event handlers
  1456.  * PARAMETERS
  1457.  *  device      [IN]        Type
  1458.  * RETURNS
  1459.  *  void
  1460.  *****************************************************************************/
  1461. void ClearInputEventHandler(U16 device)
  1462. {
  1463.     /*----------------------------------------------------------------*/
  1464.     /* Local Variables                                                */
  1465.     /*----------------------------------------------------------------*/
  1466.     /*----------------------------------------------------------------*/
  1467.     /* Code Body                                                      */
  1468.     /*----------------------------------------------------------------*/
  1469.     if (device & MMI_DEVICE_KEY)
  1470.     {
  1471.         ClearAllKeyHandler();
  1472.     }
  1473. #ifdef  __MMI_TOUCH_SCREEN__
  1474. if ( device & MMI_DEVICE_PEN )
  1475. {
  1476. wgui_clear_pen_handlers();
  1477. }
  1478. #endif
  1479. }
  1480. /*****************************************************************************
  1481.  * FUNCTION
  1482.  *  PowerAndEndKeyHandler
  1483.  * DESCRIPTION
  1484.  *  sets power key & end key handlers
  1485.  *  
  1486.  *  This is used to set power key & end key handlers
  1487.  * PARAMETERS
  1488.  *  void
  1489.  * RETURNS
  1490.  *  void
  1491.  *****************************************************************************/
  1492. #if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
  1493. extern BOOL DirectMode;
  1494. extern void CallBackPowerOnAnimationCompleteWrapper(void);
  1495. #endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */ 
  1496. void PowerAndEndKeyHandler(void)
  1497. {
  1498.     /*----------------------------------------------------------------*/
  1499.     /* Local Variables                                                */
  1500.     /*----------------------------------------------------------------*/
  1501.     /*----------------------------------------------------------------*/
  1502.     /* Code Body                                                      */
  1503.     /*----------------------------------------------------------------*/
  1504.    /**
  1505.     * The end key must not be registered to
  1506.     * Go to IDle screen in case any call exists on the
  1507.     * the phone. This is a temporary solution for fixing the
  1508.     * CM bugs
  1509.     */
  1510.     if (isInCall() && !GetWapCallPresent())
  1511.     {
  1512. #ifdef __MMI_VOIP__
  1513.         if (GetTotalCallCount() != 0) /* disconnect gsm call */
  1514.         {
  1515.             currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = HangupAllCalls;
  1516.         }
  1517.         else if (mmi_voip_app_total_call() != 0) /* disconnect voip call */
  1518.         {
  1519.             currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = mmi_voip_entry_ans_to_disconn_voip;
  1520.         }
  1521. #else
  1522.         currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = HangupAllCalls;
  1523. #endif
  1524.     }
  1525.     else
  1526.     {
  1527.         if (mmi_bootup_is_in_security_check() == MMI_FALSE)
  1528.         {
  1529.             /**
  1530.             * The end key should end all the existing calls
  1531.             *  and screen should be the last screen thru call menu.
  1532.             */
  1533.             #ifdef __MMI_EMAIL__
  1534.                 if (mmi_email_util_get_stop_cause() == EMAIL_MODULE_ACTIVE_NOW)
  1535.                 {
  1536.                     currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = mmi_email_main_goto_idle;
  1537.                 }
  1538.                 else if (!gSecuritySetupContext.PINBlocked)
  1539.             #else /* __MMI_EMAIL__ */ 
  1540.                 if (!gSecuritySetupContext.PINBlocked)
  1541.             #endif /* __MMI_EMAIL__ */ 
  1542.                 {
  1543.                     currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = DisplayIdleScreen;
  1544.                 }
  1545.         }
  1546.     }
  1547. #if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
  1548.     if (DirectMode)
  1549.     {
  1550.         currKeyFuncPtrs[KEY_END][KEY_EVENT_DOWN] = CallBackPowerOnAnimationCompleteWrapper;
  1551.     }
  1552. #endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */ 
  1553.     if (!g_keylock_context.gKeyPadLockFlag)
  1554.     {
  1555.         mmi_frm_set_default_power_onoff_key();
  1556.     }
  1557. }
  1558. /*****************************************************************************
  1559.  * FUNCTION
  1560.  *  SetProtocolEventHandler
  1561.  * DESCRIPTION
  1562.  *  sets protocol event handler
  1563.  *  
  1564.  *  This is used to set protocol event handler
  1565.  * PARAMETERS
  1566.  *  funcPtr     [IN]        
  1567.  *  eventID     [IN]        
  1568.  * RETURNS
  1569.  *  void
  1570.  *****************************************************************************/
  1571. void SetProtocolEventHandler(PsFuncPtr funcPtr, U16 eventID)
  1572. {
  1573.     /*----------------------------------------------------------------*/
  1574.     /* Local Variables                                                */
  1575.     /*----------------------------------------------------------------*/
  1576.     static U16 maxUsedInHistory = 0;
  1577.     U16 count;
  1578.     S16 i, firstNotUsed;
  1579.     S16 pos;
  1580.     /*----------------------------------------------------------------*/
  1581.     /* Code Body                                                      */
  1582.     /*----------------------------------------------------------------*/
  1583.     MMI_ASSERT(eventID != 0);
  1584.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETPTO_HDLR, eventID, funcPtr, usedProtocolEvent,
  1585.                maxProtocolEvent));
  1586.     /* serach */
  1587.     pos = -1;
  1588.     firstNotUsed = -1;
  1589.     for (count = 0; count < maxProtocolEvent; count++)
  1590.     {
  1591.         if (protocolEventHandler[count].eventID == eventID)
  1592.         {
  1593.             pos = count;
  1594.             break;
  1595.         }
  1596.         /* BTW, find a non-used item */ ;
  1597.         if ((firstNotUsed == -1) && (protocolEventHandler[count].eventID == MMI_EVENT_INVALID))
  1598.         {
  1599.             firstNotUsed = count;
  1600.         }
  1601.     }
  1602.     if (pos != -1)
  1603.     {
  1604.         /* found */
  1605.         if (funcPtr != NULL)
  1606.         {
  1607.             /* just need to update */
  1608.             protocolEventHandler[pos].entryFuncPtr = funcPtr;
  1609.         }
  1610.         else
  1611.         {
  1612.             /* reset it */
  1613.             protocolEventHandler[pos].eventID = MMI_EVENT_INVALID;
  1614.             protocolEventHandler[pos].entryFuncPtr = NULL;
  1615.             usedProtocolEvent--;
  1616.         }
  1617.     }
  1618.     else
  1619.     {
  1620.         /* not found */
  1621.         if (funcPtr != NULL)
  1622.         {
  1623.             /* newly set */
  1624.             if (firstNotUsed != -1)
  1625.             {
  1626.                 pos = firstNotUsed;
  1627.             }
  1628.             else
  1629.             {
  1630.                 /* need to enlarge current searching list */
  1631.                 pos = maxProtocolEvent;
  1632.                 maxProtocolEvent++;
  1633.                 MMI_ASSERT(maxProtocolEvent < MAX_PROTOCOL_EVENT);
  1634.             }
  1635.             usedProtocolEvent++;
  1636.             protocolEventHandler[pos].eventID = eventID;
  1637.             protocolEventHandler[pos].entryFuncPtr = funcPtr;
  1638.         }
  1639.         else
  1640.         {
  1641.             /* do nothing */
  1642.         }
  1643.     }
  1644.     /* recycle not-used items in the tail of list. It is for searching efficency */
  1645.     for (i = (maxProtocolEvent - 1); i >= 0; i--)
  1646.     {
  1647.         if (protocolEventHandler[i].eventID != MMI_EVENT_INVALID)
  1648.         {
  1649.             break;
  1650.         }
  1651.     }
  1652.     maxProtocolEvent = i + 1;
  1653.     /* record the max value for array size analysis */
  1654.     if (maxUsedInHistory < maxProtocolEvent)
  1655.     {
  1656.         PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "SetProtocolEventHandler old maxUsedInHistory = %d", maxUsedInHistory));
  1657.         maxUsedInHistory = maxProtocolEvent;
  1658.         PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "SetProtocolEventHandler maxUsedInHistory = %d", maxUsedInHistory));
  1659.     }
  1660.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETPTO_HDLR, eventID, funcPtr, usedProtocolEvent,
  1661.                maxProtocolEvent));
  1662. }
  1663. /*****************************************************************************
  1664.  * FUNCTION
  1665.  *  ClearProtocolEventHandler
  1666.  * DESCRIPTION
  1667.  *  clears protocol event handler
  1668.  *  
  1669.  *  This is used to clear protocol event handler
  1670.  * PARAMETERS
  1671.  *  eventID     [IN]        
  1672.  * RETURNS
  1673.  *  void
  1674.  *****************************************************************************/
  1675. void ClearProtocolEventHandler(U16 eventID)
  1676. {
  1677.     /*----------------------------------------------------------------*/
  1678.     /* Local Variables                                                */
  1679.     /*----------------------------------------------------------------*/
  1680.     /*----------------------------------------------------------------*/
  1681.     /* Code Body                                                      */
  1682.     /*----------------------------------------------------------------*/
  1683.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRPTO_HDLR, eventID));
  1684.     SetProtocolEventHandler(NULL, eventID);
  1685. }
  1686. /*****************************************************************************
  1687.  * FUNCTION
  1688.  *  ClearAllProtocolEventHandler
  1689.  * DESCRIPTION
  1690.  *  clears all the protocol event handler
  1691.  *  
  1692.  *  This is used to clear all the protocol event handlers
  1693.  * PARAMETERS
  1694.  *  void
  1695.  * RETURNS
  1696.  *  void
  1697.  *****************************************************************************/
  1698. void ClearAllProtocolEventHandler(void)
  1699. {
  1700.     /*----------------------------------------------------------------*/
  1701.     /* Local Variables                                                */
  1702.     /*----------------------------------------------------------------*/
  1703.     U16 count = 0;
  1704.     /*----------------------------------------------------------------*/
  1705.     /* Code Body                                                      */
  1706.     /*----------------------------------------------------------------*/
  1707.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRALLPTO_HDLR));
  1708.     for (count = 0; count < maxProtocolEvent; count++)
  1709.     {
  1710.         protocolEventHandler[count].eventID = 0;
  1711.         protocolEventHandler[count].entryFuncPtr = NULL;
  1712.     }
  1713.     usedProtocolEvent = 0;
  1714. }
  1715. /*****************************************************************************
  1716.  * FUNCTION
  1717.  *  SetEntryHandler
  1718.  * DESCRIPTION
  1719.  *  sets current screen entry handlers
  1720.  *  
  1721.  *  This is used to sets current screen entry handlers
  1722.  * PARAMETERS
  1723.  *  scrnID              [IN]        
  1724.  *  entryFuncPtr        [IN]        
  1725.  * RETURNS
  1726.  *  void
  1727.  *****************************************************************************/
  1728. void SetEntryHandler(U16 scrnID, FuncPtr entryFuncPtr)
  1729. {
  1730.     /*----------------------------------------------------------------*/
  1731.     /* Local Variables                                                */
  1732.     /*----------------------------------------------------------------*/
  1733.     /*----------------------------------------------------------------*/
  1734.     /* Code Body                                                      */
  1735.     /*----------------------------------------------------------------*/
  1736.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETENTRY_HDLR, scrnID));
  1737.     currEntryFuncPtr = entryFuncPtr;
  1738. }
  1739. /*****************************************************************************
  1740.  * FUNCTION
  1741.  *  ClearEntryHandler
  1742.  * DESCRIPTION
  1743.  *  clears current screen entry handlers
  1744.  *  
  1745.  *  This is used to clears current screen e1ntry handlers
  1746.  * PARAMETERS
  1747.  *  void
  1748.  * RETURNS
  1749.  *  void
  1750.  *****************************************************************************/
  1751. void ClearEntryHandler(void)
  1752. {
  1753.     /*----------------------------------------------------------------*/
  1754.     /* Local Variables                                                */
  1755.     /*----------------------------------------------------------------*/
  1756.     /*----------------------------------------------------------------*/
  1757.     /* Code Body                                                      */
  1758.     /*----------------------------------------------------------------*/
  1759.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRENTRY_HDLR));
  1760.     currEntryFuncPtr = NULL;
  1761. }
  1762. /*****************************************************************************
  1763.  * FUNCTION
  1764.  *  SetGenericExitHandler
  1765.  * DESCRIPTION
  1766.  *  Generic function to set exit screen handler.
  1767.  *  Store current screen id, exit function, and entry function.
  1768.  * PARAMETERS
  1769.  *  scrnID              [IN]        Screen ID
  1770.  *  exitFuncPtr         [IN]        Exit function pointer
  1771.  *  entryFuncPtr        [IN]        Entry function pointer
  1772.  * RETURNS
  1773.  *  void
  1774.  *****************************************************************************/
  1775. static void SetGenericExitHandler(U16 scrnID, FuncPtr exitFuncPtr, FuncPtr entryFuncPtr)
  1776. {
  1777.     /*----------------------------------------------------------------*/
  1778.     /* Local Variables                                                */
  1779.     /*----------------------------------------------------------------*/
  1780.     /*----------------------------------------------------------------*/
  1781.     /* Code Body                                                      */
  1782.     /*----------------------------------------------------------------*/
  1783.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETGEN_EXIT_HDLR, scrnID));
  1784.     currExitScrnID = scrnID;
  1785.     currExitFuncPtr = exitFuncPtr;
  1786.     currEntryFuncPtr = entryFuncPtr;
  1787. }
  1788. /*****************************************************************************
  1789.  * FUNCTION
  1790.  *  GenericExitInlineScreen
  1791.  * DESCRIPTION
  1792.  *  Generic exit inline editor screen handler.
  1793.  *  Add screen related data to histoy.
  1794.  * PARAMETERS
  1795.  *  scrnID              [IN]        Screen ID
  1796.  *  entryFuncPtr        [IN]        Entry function pointer
  1797.  * RETURNS
  1798.  *  void
  1799.  *****************************************************************************/
  1800. void GenericExitInlineScreen(U16 scrnID, FuncPtr entryFuncPtr)
  1801. {
  1802.     /*----------------------------------------------------------------*/
  1803.     /* Local Variables                                                */
  1804.     /*----------------------------------------------------------------*/
  1805.     history h;
  1806.     U16 inputBufferSize;
  1807.     /*----------------------------------------------------------------*/
  1808.     /* Code Body                                                      */
  1809.     /*----------------------------------------------------------------*/
  1810.     CloseCategory57Screen();
  1811.     h.scrnID = scrnID;
  1812.     h.entryFuncPtr = entryFuncPtr;
  1813.     GetCategoryHistory(h.guiBuffer);
  1814.     inputBufferSize = (U16) GetCategory57DataSize();
  1815.     GetCategory57Data((U8*) h.inputBuffer);
  1816.     AddNHistory(h, inputBufferSize);
  1817. }
  1818. /*****************************************************************************
  1819.  * FUNCTION
  1820.  *  GenericExitScreen
  1821.  * DESCRIPTION
  1822.  *  Generic exit screen handler.
  1823.  *  Add screen related data to histoy.
  1824.  * PARAMETERS
  1825.  *  scrnID              [IN]        Screen ID
  1826.  *  entryFuncPtr        [IN]        Entry function pointer
  1827.  * RETURNS
  1828.  *  void
  1829.  *****************************************************************************/
  1830. void GenericExitScreen(U16 scrnID, FuncPtr entryFuncPtr)
  1831. {
  1832.     /*----------------------------------------------------------------*/
  1833.     /* Local Variables                                                */
  1834.     /*----------------------------------------------------------------*/
  1835.     history h;
  1836.     U16 nHistory = 0;
  1837.     /*----------------------------------------------------------------*/
  1838.     /* Code Body                                                      */
  1839.     /*----------------------------------------------------------------*/
  1840.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXEGEN_EXIT_HDLR, scrnID));
  1841.     h.scrnID = scrnID;
  1842.     h.entryFuncPtr = entryFuncPtr;
  1843.     pfnUnicodeStrcpy((S8*) h.inputBuffer, (S8*) & nHistory);
  1844.     GetCategoryHistory(h.guiBuffer);
  1845.     AddHistory(h);
  1846.     /* mini_tab_bar */
  1847. #ifdef __MMI_WGUI_MINI_TAB_BAR__
  1848.     wgui_disable_mini_tab_bar();
  1849. #endif 
  1850. }
  1851. /*****************************************************************************
  1852.  * FUNCTION
  1853.  *  GetExitScrnID
  1854.  * DESCRIPTION
  1855.  *  
  1856.  * PARAMETERS
  1857.  *  void
  1858.  * RETURNS
  1859.  *  
  1860.  *****************************************************************************/
  1861. U16 GetExitScrnID(void)
  1862. {
  1863.     /*----------------------------------------------------------------*/
  1864.     /* Local Variables                                                */
  1865.     /*----------------------------------------------------------------*/
  1866.     /*----------------------------------------------------------------*/
  1867.     /* Code Body                                                      */
  1868.     /*----------------------------------------------------------------*/
  1869.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_GETGEN_EXIT_HDLR));
  1870.     return currExitScrnID;
  1871. }
  1872. /*****************************************************************************
  1873.  * FUNCTION
  1874.  *  GetExitScrnID_r
  1875.  * DESCRIPTION
  1876.  *  Thead-safe version of GetExitScrnID()
  1877.  * PARAMETERS
  1878.  *  void
  1879.  * RETURNS
  1880.  *  Current screen ID
  1881.  *****************************************************************************/
  1882. U16 GetExitScrnID_r(void)
  1883. {
  1884.     /*----------------------------------------------------------------*/
  1885.     /* Local Variables                                                */
  1886.     /*----------------------------------------------------------------*/
  1887.     /*----------------------------------------------------------------*/
  1888.     /* Code Body                                                      */
  1889.     /*----------------------------------------------------------------*/
  1890.     /* This function should be kept as simple as possible. MMI_TRACE() cannot be used */
  1891.     return currExitScrnID;
  1892. }
  1893. /*****************************************************************************
  1894.  * FUNCTION
  1895.  *  ClearExitHandler
  1896.  * DESCRIPTION
  1897.  *  clears current screen exit handlers
  1898.  *  
  1899.  *  This is used to clears current screen exit handlers
  1900.  * PARAMETERS
  1901.  *  void
  1902.  * RETURNS
  1903.  *  void
  1904.  *****************************************************************************/
  1905. void ClearExitHandler(void)
  1906. {
  1907.     /*----------------------------------------------------------------*/
  1908.     /* Local Variables                                                */
  1909.     /*----------------------------------------------------------------*/
  1910.     /*----------------------------------------------------------------*/
  1911.     /* Code Body                                                      */
  1912.     /*----------------------------------------------------------------*/
  1913.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLREXIT_HDLR));
  1914.     currExitScrnID = 0;
  1915.     currExitFuncPtr = NULL;
  1916.     currEntryFuncPtr = NULL;
  1917. }
  1918. /*****************************************************************************
  1919.  * FUNCTION
  1920.  *  GetkeyInfo
  1921.  * DESCRIPTION
  1922.  *  gives key code & key type of last key event.
  1923.  *  
  1924.  *  This is used to give key code & key type of last key event.
  1925.  * PARAMETERS
  1926.  *  keyCode     [OUT]       U16 *keyType
  1927.  *  keyType     [IN]        
  1928.  * RETURNS
  1929.  *  void
  1930.  *****************************************************************************/
  1931. void GetkeyInfo(PU16 keyCode, PU16 keyType)
  1932. {
  1933.     /*----------------------------------------------------------------*/
  1934.     /* Local Variables                                                */
  1935.     /*----------------------------------------------------------------*/
  1936.     /*----------------------------------------------------------------*/
  1937.     /* Code Body                                                      */
  1938.     /*----------------------------------------------------------------*/
  1939.     *keyCode = currKeyCode;
  1940.     *keyType = currKeyType;
  1941. }
  1942. /*****************************************************************************
  1943.  * FUNCTION
  1944.  *  SetkeyInfo
  1945.  * DESCRIPTION
  1946.  *  Set key code & key type of last key event.
  1947.  *  
  1948.  *  This is used to temporary set key code & key type of last key event.
  1949.  * PARAMETERS
  1950.  *  keyCode     [IN]        
  1951.  *  keyType     [IN]        
  1952.  * RETURNS
  1953.  *  void
  1954.  *****************************************************************************/
  1955. void SetkeyInfo(U16 keyCode, U16 keyType)
  1956. {
  1957.     /*----------------------------------------------------------------*/
  1958.     /* Local Variables                                                */
  1959.     /*----------------------------------------------------------------*/
  1960.     /*----------------------------------------------------------------*/
  1961.     /* Code Body                                                      */
  1962.     /*----------------------------------------------------------------*/
  1963.     currKeyCode = keyCode;
  1964.     currKeyType = keyType;
  1965. }
  1966. /*****************************************************************************
  1967.  * FUNCTION
  1968.  *  StartTimer
  1969.  * DESCRIPTION
  1970.  *  to set a timer
  1971.  *  
  1972.  *  This is used to set a timer
  1973.  * PARAMETERS
  1974.  *  timerid     [IN]        
  1975.  *  delay       [IN]        
  1976.  *  funcPtr     [IN]        
  1977.  * RETURNS
  1978.  *  void
  1979.  *****************************************************************************/
  1980. void StartTimer(U16 timerid, U32 delay, FuncPtr funcPtr)
  1981. {
  1982.     /*----------------------------------------------------------------*/
  1983.     /* Local Variables                                                */
  1984.     /*----------------------------------------------------------------*/
  1985.     /*----------------------------------------------------------------*/
  1986.     /* Code Body                                                      */
  1987.     /*----------------------------------------------------------------*/
  1988.     StartMyTimer(timerid, delay, (oslTimerFuncPtr) funcPtr);
  1989. }
  1990. /*****************************************************************************
  1991.  * FUNCTION
  1992.  *  StopTimer
  1993.  * DESCRIPTION
  1994.  *  to reset a timer
  1995.  *  
  1996.  *  This is used to reset a timer
  1997.  * PARAMETERS
  1998.  *  timerid     [IN]        
  1999.  * RETURNS
  2000.  *  void
  2001.  *****************************************************************************/
  2002. void StopTimer(U16 timerid)
  2003. {
  2004.     /*----------------------------------------------------------------*/
  2005.     /* Local Variables                                                */
  2006.     /*----------------------------------------------------------------*/
  2007.     /*----------------------------------------------------------------*/
  2008.     /* Code Body                                                      */
  2009.     /*----------------------------------------------------------------*/
  2010.     StopMyTimer(timerid);
  2011. }
  2012. /*****************************************************************************
  2013.  * FUNCTION
  2014.  *  MaskItems
  2015.  * DESCRIPTION
  2016.  *  
  2017.  * PARAMETERS
  2018.  *  maskList        [IN]        
  2019.  *  noOfItems       [IN]        
  2020.  *  maskingWord     [IN]        
  2021.  * RETURNS
  2022.  *  U8
  2023.  *****************************************************************************/
  2024. U8 MaskItems(U16 *maskList, U8 noOfItems, U32 maskingWord)
  2025. {
  2026.     /*----------------------------------------------------------------*/
  2027.     /* Local Variables                                                */
  2028.     /*----------------------------------------------------------------*/
  2029.     U32 count = 0, i;
  2030.     /*----------------------------------------------------------------*/
  2031.     /* Code Body                                                      */
  2032.     /*----------------------------------------------------------------*/
  2033.     for (i = 0; i < noOfItems; i++)
  2034.         if (IsBitSet(maskingWord, i))
  2035.         {
  2036.             maskList[count++] = maskList[i];
  2037.         }
  2038.     return (U8) count;
  2039. }
  2040. /*****************************************************************************
  2041.  * FUNCTION
  2042.  *  MaskItemsU8
  2043.  * DESCRIPTION
  2044.  *  
  2045.  * PARAMETERS
  2046.  *  maskList        [IN]        
  2047.  *  noOfItems       [IN]        
  2048.  *  maskingWord     [IN]        
  2049.  * RETURNS
  2050.  *  U8
  2051.  *****************************************************************************/
  2052. U8 MaskItemsU8(U8 *maskList, U8 noOfItems, U32 maskingWord)
  2053. {
  2054.     /*----------------------------------------------------------------*/
  2055.     /* Local Variables                                                */
  2056.     /*----------------------------------------------------------------*/
  2057.     U32 count = 0, i;
  2058.     /*----------------------------------------------------------------*/
  2059.     /* Code Body                                                      */
  2060.     /*----------------------------------------------------------------*/
  2061.     for (i = 0; i < noOfItems; i++)
  2062.         if (IsBitSet(maskingWord, i))
  2063.         {
  2064.             maskList[count++] = maskList[i];
  2065.         }
  2066.     return (U8) count;
  2067. }
  2068. /*****************************************************************************
  2069.  * FUNCTION
  2070.  *  MaskStringItems
  2071.  * DESCRIPTION
  2072.  *  
  2073.  * PARAMETERS
  2074.  *  maskList        [IN]        
  2075.  *  noOfItems       [IN]        
  2076.  *  maskingWord     [IN]        
  2077.  * RETURNS
  2078.  *  U8
  2079.  *****************************************************************************/
  2080. U8 MaskStringItems(U8 **maskList, U8 noOfItems, U32 maskingWord)
  2081. {
  2082.     /*----------------------------------------------------------------*/
  2083.     /* Local Variables                                                */
  2084.     /*----------------------------------------------------------------*/
  2085.     U32 count = 0, i;
  2086.     /*----------------------------------------------------------------*/
  2087.     /* Code Body                                                      */
  2088.     /*----------------------------------------------------------------*/
  2089.     for (i = 0; i < noOfItems; i++)
  2090.         if (IsBitSet(maskingWord, i))
  2091.         {
  2092.             maskList[count++] = maskList[i];
  2093.         }
  2094.     return (U8) count;
  2095. }
  2096. /*****************************************************************************
  2097.  * FUNCTION
  2098.  *  MaskHiliteItems
  2099.  * DESCRIPTION
  2100.  *  
  2101.  * PARAMETERS
  2102.  *  parentID        [IN]        
  2103.  *  maskingWord     [IN]        
  2104.  * RETURNS
  2105.  *  U8
  2106.  *****************************************************************************/
  2107. U8 MaskHiliteItems(U16 parentID, U32 maskingWord)
  2108. {
  2109.     /*----------------------------------------------------------------*/
  2110.     /* Local Variables                                                */
  2111.     /*----------------------------------------------------------------*/
  2112.     U8 count = 0, noOfChild, i;
  2113.     U16 hiliteItemID[32];
  2114.     /*----------------------------------------------------------------*/
  2115.     /* Code Body                                                      */
  2116.     /*----------------------------------------------------------------*/
  2117.     noOfChild = (U8) GetNumOfChild(parentID);
  2118.     for (i = 0; i < noOfChild; i++)
  2119.     {
  2120.         hiliteItemID[i] = GetSeqItemId((U16) parentID, (S16) i);
  2121.     }
  2122.     for (i = 0; i < noOfChild; i++)
  2123.         if (IsBitSet(maskingWord, i))
  2124.         {
  2125.             maxHiliteInfo[hiliteItemID[count++]].entryFuncPtr = maxHiliteInfo[hiliteItemID[i]].entryFuncPtr;
  2126.         }
  2127.     return (U8) count;
  2128. }
  2129. /* interrupt handle preprocess */
  2130. /*****************************************************************************
  2131.  * FUNCTION
  2132.  *  IsInInterruptGroupTable
  2133.  * DESCRIPTION
  2134.  *  search interrupt group event id is in interrupt
  2135.  *  group table and get the index
  2136.  * PARAMETERS
  2137.  *  eventID     [IN]        
  2138.  *  index       [OUT]       
  2139.  * RETURNS
  2140.  *  MMI_BOOL
  2141.  *****************************************************************************/
  2142. static MMI_BOOL IsInInterruptGroupTable(U16 eventID, int *index)
  2143. {
  2144.     /*----------------------------------------------------------------*/
  2145.     /* Local Variables                                                */
  2146.     /*----------------------------------------------------------------*/
  2147.     int i;
  2148.     /*----------------------------------------------------------------*/
  2149.     /* Code Body                                                      */
  2150.     /*----------------------------------------------------------------*/
  2151.     for (i = 0; i < sizeof(interruptGroupEventTable) / sizeof(InterruptGroupInfo); i++)
  2152.     {
  2153.         if (interruptGroupEventTable[i].groupID == eventID)
  2154.         {
  2155.             *index = i;
  2156.             return MMI_TRUE;
  2157.         }
  2158.     }
  2159.     *index = -1;
  2160.     return MMI_FALSE;
  2161. }
  2162. /*****************************************************************************
  2163.  * FUNCTION
  2164.  *  QueryInterruptHandler
  2165.  * DESCRIPTION
  2166.  *  query interrupt event handler
  2167.  * PARAMETERS
  2168.  *  eventID         [IN]        
  2169.  *  funcPtr         [OUT]       
  2170.  *  postfuncPtr     [OUT]         
  2171.  * RETURNS
  2172.  *  MMI_BOOL
  2173.  *****************************************************************************/
  2174. static MMI_BOOL QueryInterruptHandler(U16 eventID, PsIntFuncPtr *funcPtr, PsIntFuncPtr *postfuncPtr)
  2175. {
  2176.     /*----------------------------------------------------------------*/
  2177.     /* Local Variables                                                */
  2178.     /*----------------------------------------------------------------*/
  2179.     int i, j, index;
  2180.     /*----------------------------------------------------------------*/
  2181.     /* Code Body                                                      */
  2182.     /*----------------------------------------------------------------*/
  2183.     for (i = 0; i < MAX_INTERRUPT_EVENT; i++)
  2184.     {
  2185.         if (!IS_INTERRUPT_EVENT_GROUP(interruptEventHandler[i].eventID))
  2186.         {
  2187.             /* General interrupt event */
  2188.             if (interruptEventHandler[i].eventID == eventID)
  2189.             {
  2190.                 goto is_found;
  2191.             }
  2192.         }
  2193.         else
  2194.         {
  2195.             if (IsInInterruptGroupTable(interruptEventHandler[i].eventID, &index))
  2196.             {
  2197.                 /* Interrupt group event */
  2198.                 j = 0;
  2199.                 while (interruptGroupEventTable[index].eventID[j] != 0)
  2200.                 {
  2201.                     if (interruptGroupEventTable[index].eventID[j] == eventID)
  2202.                     {
  2203.                         goto is_found;
  2204.                     }
  2205.                     j++;
  2206.                     MMI_ASSERT(j < INTERRUPT_EVENT_GREOUP_SIZE);
  2207.                 }
  2208.             }
  2209.         }
  2210.     }
  2211.     return MMI_FALSE;
  2212.   is_found:
  2213.     *funcPtr = (PsIntFuncPtr) interruptEventHandler[i].entryIntFuncPtr;
  2214.     *postfuncPtr = (PsIntFuncPtr) interruptEventHandler[i].postIntFuncPtr;
  2215.     return MMI_TRUE;
  2216. }
  2217. /*****************************************************************************
  2218.  * FUNCTION
  2219.  *  SetInterruptEventHandler
  2220.  * DESCRIPTION
  2221.  *  sets interrupt event handler
  2222.  *  
  2223.  *  This is used to set interrupt event handler
  2224.  * PARAMETERS
  2225.  *  funcPtr         [IN]        
  2226.  *  postfuncPtr     [IN]        
  2227.  *  eventID         [IN]        
  2228.  * RETURNS
  2229.  *  void
  2230.  *****************************************************************************/
  2231. void SetInterruptEventHandler(PsIntFuncPtr funcPtr, PsIntFuncPtr postfuncPtr, U16 eventID)
  2232. {
  2233.     /*----------------------------------------------------------------*/
  2234.     /* Local Variables                                                */
  2235.     /*----------------------------------------------------------------*/
  2236.     S16 count = 0;
  2237.     pBOOL isNewEvent = TRUE;
  2238.     /*----------------------------------------------------------------*/
  2239.     /* Code Body                                                      */
  2240.     /*----------------------------------------------------------------*/
  2241.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETINTP_HDLR, eventID));
  2242.     if (!IS_INTERRUPT_EVENT_GROUP(eventID))
  2243.     {
  2244.         /* General interrupt event will allocate from the begin */
  2245.         for (count = 0; count < maxInterruptEvent; count++)
  2246.         {
  2247.             if (interruptEventHandler[count].eventID == eventID)
  2248.             {
  2249.                 isNewEvent = FALSE;
  2250.                 break;
  2251.             }
  2252.             if (interruptEventHandler[count].eventID == 0)
  2253.             {
  2254.                 break;
  2255.             }
  2256.         }
  2257.     }
  2258.     else
  2259.     {
  2260.         /* Interrupt group event will allocate from the end */
  2261.         for (count = MAX_INTERRUPT_EVENT - 1; count >= 0; count--)
  2262.         {
  2263.             if (interruptEventHandler[count].eventID == eventID)
  2264.             {
  2265.                 isNewEvent = FALSE;
  2266.                 break;
  2267.             }
  2268.             if (interruptEventHandler[count].eventID == 0)
  2269.             {
  2270.                 break;
  2271.             }
  2272.         }
  2273.     }
  2274.     if (isNewEvent)
  2275.     {
  2276.         maxInterruptEvent++;
  2277.         MMI_ASSERT(maxInterruptEvent < MAX_INTERRUPT_EVENT);
  2278.     }
  2279.     interruptEventHandler[count].eventID = eventID;
  2280.     interruptEventHandler[count].entryIntFuncPtr = funcPtr;
  2281.     interruptEventHandler[count].postIntFuncPtr = postfuncPtr;
  2282. }
  2283. /*****************************************************************************
  2284.  * FUNCTION
  2285.  *  SetGroupInterruptEventHandler
  2286.  * DESCRIPTION
  2287.  *  sets the curent screen same group handler to the group pf events
  2288.  *  
  2289.  *  This is used to set the same key handler for a group of keycodes.
  2290.  * PARAMETERS
  2291.  *  funcPtr         [IN]        
  2292.  *  postfuncPtr     [IN]        
  2293.  *  eventsID        [IN]        
  2294.  *  len             [IN]        
  2295.  * RETURNS
  2296.  *  void
  2297.  *****************************************************************************/
  2298. void SetGroupInterruptEventHandler(PsIntFuncPtr funcPtr, PsIntFuncPtr postfuncPtr, PU16 eventsID, U8 len)
  2299. {
  2300.     /*----------------------------------------------------------------*/
  2301.     /* Local Variables                                                */
  2302.     /*----------------------------------------------------------------*/
  2303.     U8 count;
  2304.     /*----------------------------------------------------------------*/
  2305.     /* Code Body                                                      */
  2306.     /*----------------------------------------------------------------*/
  2307.     for (count = 0; count < len; count++)
  2308.     {
  2309.         MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETGRPINTP_HDLR, eventsID[count]));
  2310.         SetInterruptEventHandler(funcPtr, postfuncPtr, eventsID[count]);
  2311.     }
  2312. }
  2313. /*****************************************************************************
  2314.  * FUNCTION
  2315.  *  ClearInterruptEventHandler
  2316.  * DESCRIPTION
  2317.  *  clears interrupt event handler
  2318.  *  
  2319.  *  This is used to clear interrupt event handler
  2320.  * PARAMETERS
  2321.  *  eventID     [IN]        
  2322.  * RETURNS
  2323.  *  void
  2324.  *****************************************************************************/
  2325. void ClearInterruptEventHandler(U16 eventID)
  2326. {
  2327.     /*----------------------------------------------------------------*/
  2328.     /* Local Variables                                                */
  2329.     /*----------------------------------------------------------------*/
  2330.     /*----------------------------------------------------------------*/
  2331.     /* Code Body                                                      */
  2332.     /*----------------------------------------------------------------*/
  2333.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRINTP_HDLR, eventID));
  2334.     SetInterruptEventHandler(NULL, NULL, eventID);
  2335. }
  2336. /*****************************************************************************
  2337.  * FUNCTION
  2338.  *  ClearAllInterruptEventHandler
  2339.  * DESCRIPTION
  2340.  *  clears all the interrupt event handler
  2341.  *  
  2342.  *  This is used to clear all the interrupt event handlers
  2343.  * PARAMETERS
  2344.  *  void
  2345.  * RETURNS
  2346.  *  void
  2347.  *****************************************************************************/
  2348. void ClearAllInterruptEventHandler(void)
  2349. {
  2350.     /*----------------------------------------------------------------*/
  2351.     /* Local Variables                                                */
  2352.     /*----------------------------------------------------------------*/
  2353.     U16 count = 0;
  2354.     /*----------------------------------------------------------------*/
  2355.     /* Code Body                                                      */
  2356.     /*----------------------------------------------------------------*/
  2357.     MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_CLRALLINTP_HDLR));
  2358.     for (count = 0; count < maxInterruptEvent; count++)
  2359.     {
  2360.         interruptEventHandler[count].eventID = 0;
  2361.         interruptEventHandler[count].entryIntFuncPtr = NULL;
  2362.         interruptEventHandler[count].postIntFuncPtr = NULL;
  2363.     }
  2364.     maxInterruptEvent = 0;
  2365. }
  2366. /*****************************************************************************
  2367.  * FUNCTION
  2368.  *  GetActiveScreenId
  2369.  * DESCRIPTION
  2370.  *  Get current new screen ID
  2371.  *  
  2372.  *  This is used to clear all the interrupt event handlers
  2373.  * PARAMETERS
  2374.  *  void
  2375.  * RETURNS
  2376.  *  void
  2377.  *****************************************************************************/
  2378. U16 GetActiveScreenId(void)
  2379. {
  2380.     /*----------------------------------------------------------------*/
  2381.     /* Local Variables                                                */
  2382.     /*----------------------------------------------------------------*/
  2383.     /*----------------------------------------------------------------*/
  2384.     /* Code Body                                                      */
  2385.     /*----------------------------------------------------------------*/
  2386.     return currTopScrnID;
  2387. }
  2388. /*****************************************************************************
  2389.  * FUNCTION
  2390.  *  SetActiveScreenId
  2391.  * DESCRIPTION
  2392.  *  
  2393.  * PARAMETERS
  2394.  *  scrnId      [IN]        
  2395.  * RETURNS
  2396.  *  void
  2397.  *****************************************************************************/
  2398. void SetActiveScreenId(U16 scrnId)
  2399. {
  2400.     /*----------------------------------------------------------------*/
  2401.     /* Local Variables                                                */
  2402.     /*----------------------------------------------------------------*/
  2403.     /*----------------------------------------------------------------*/
  2404.     /* Code Body                                                      */
  2405.     /*----------------------------------------------------------------*/
  2406.     currTopScrnID = scrnId;
  2407. }
  2408. /*****************************************************************************
  2409.  * FUNCTION
  2410.  *  GetCurrEntryFuncPtr
  2411.  * DESCRIPTION
  2412.  *  Get current entry function
  2413.  * PARAMETERS
  2414.  *  void
  2415.  * RETURNS
  2416.  *  void
  2417.  *****************************************************************************/
  2418. FuncPtr GetCurrEntryFuncPtr(void)
  2419. {
  2420.     /*----------------------------------------------------------------*/
  2421.     /* Local Variables                                                */
  2422.     /*----------------------------------------------------------------*/
  2423.     /*----------------------------------------------------------------*/
  2424.     /* Code Body                                                      */
  2425.     /*----------------------------------------------------------------*/
  2426.     return currEntryFuncPtr;
  2427. }
  2428. /*****************************************************************************
  2429.  * FUNCTION
  2430.  *  SetCurrEntryFuncPtr
  2431.  * DESCRIPTION
  2432.  *  Sets current entry function
  2433.  * PARAMETERS
  2434.  *  ptr     [IN]        
  2435.  * RETURNS
  2436.  *  void
  2437.  *****************************************************************************/
  2438. void SetCurrEntryFuncPtr(FuncPtr ptr)
  2439. {
  2440.     /*----------------------------------------------------------------*/
  2441.     /* Local Variables                                                */
  2442.     /*----------------------------------------------------------------*/
  2443.     /*----------------------------------------------------------------*/
  2444.     /* Code Body                                                      */
  2445.     /*----------------------------------------------------------------*/
  2446.     currEntryFuncPtr = ptr;
  2447. }
  2448. /*****************************************************************************
  2449.  * FUNCTION
  2450.  *  GetCurrExitFuncPtr
  2451.  * DESCRIPTION
  2452.  *  Get current exit function
  2453.  * PARAMETERS
  2454.  *  void
  2455.  * RETURNS
  2456.  *  void
  2457.  *****************************************************************************/
  2458. FuncPtr GetCurrExitFuncPtr(void)
  2459. {
  2460.     /*----------------------------------------------------------------*/
  2461.     /* Local Variables                                                */
  2462.     /*----------------------------------------------------------------*/
  2463.     /*----------------------------------------------------------------*/
  2464.     /* Code Body                                                      */
  2465.     /*----------------------------------------------------------------*/
  2466.     return currExitFuncPtr;
  2467. }
  2468. /*****************************************************************************
  2469.  * FUNCTION
  2470.  *  SetCurrExitFuncPtr
  2471.  * DESCRIPTION
  2472.  *  Sets current exit function
  2473.  * PARAMETERS
  2474.  *  ptr     [IN]        
  2475.  * RETURNS
  2476.  *  void
  2477.  *****************************************************************************/
  2478. void SetCurrExitFuncPtr(FuncPtr ptr)
  2479. {
  2480.     /*----------------------------------------------------------------*/
  2481.     /* Local Variables                                                */
  2482.     /*----------------------------------------------------------------*/
  2483.     /*----------------------------------------------------------------*/
  2484.     /* Code Body                                                      */
  2485.     /*----------------------------------------------------------------*/
  2486.     currExitFuncPtr = ptr;
  2487. }
  2488. /*****************************************************************************
  2489.  * FUNCTION
  2490.  *  ExecuteItemHiliteHandler
  2491.  * DESCRIPTION
  2492.  *  Execute the hilite handler of specified menu item
  2493.  * PARAMETERS
  2494.  *  hiliteItemID        [IN]        
  2495.  * RETURNS
  2496.  *  void
  2497.  *****************************************************************************/
  2498. void ExecuteItemHiliteHandler(U16 hiliteItemID)
  2499. {
  2500.     /*----------------------------------------------------------------*/
  2501.     /* Local Variables                                                */
  2502.     /*----------------------------------------------------------------*/
  2503.     /*----------------------------------------------------------------*/
  2504.     /* Code Body                                                      */
  2505.     /*----------------------------------------------------------------*/
  2506.     if (maxHiliteInfo[hiliteItemID].entryFuncPtr != NULL)
  2507.     {
  2508.         maxHiliteInfo[hiliteItemID].entryFuncPtr();
  2509.     }
  2510. }