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

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.  *
  37.  * Filename:
  38.  * ---------
  39.  * QuickAccessMenuItem.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is Contains functionality for Quick Access Menu Items
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  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.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  *------------------------------------------------------------------------------
  124.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  125.  *============================================================================
  126.  ****************************************************************************/
  127. /**
  128.  * Copyright Notice
  129.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  130.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  131.  *  (It is illegal to remove this copyright notice from this software or any
  132.  *  portion of it)
  133.  */
  134. /**************************************************************
  135.    FILENAME : QuickAccessMenuItem.c
  136.    PURPOSE     : Contains functionality for Quick Access Menu Items
  137.    REMARKS     :  KeyPad lock is implemented in this file rest
  138.                options are put are under construction    
  139.    AUTHOR      : Manish Vohra,Deepali
  140.    DATE     : Feb 28, 2003
  141. **************************************************************/
  142. #include "stdC.h"
  143. #include "MMI_Features.h"
  144. #include "L4Dr.h"
  145. #include "L4Dr1.h"
  146. #include "GlobalConstants.h"
  147. #include "DebugInitDef.h"
  148. #include "PixtelDataTypes.h"
  149. #include "QuickAccessMenuItem_def.h"
  150. #include "CustDataRes.h"
  151. #include "FrameworkStruct.h"
  152. #include "EventsGprot.h"
  153. #include "HistoryGprot.h"
  154. #include "wgui_categories.h"
  155. #include "wgui_categories_CM.h"
  156. #include "wgui_categories_popup.h"
  157. #include "CustMenuRes.h"
  158. #include "MiscFunctions.h"
  159. #include "wgui_status_icons.h"
  160. #include "Unicodexdcl.h"
  161. #include "DebugInitDef.h"
  162. #include "CallManagementGprot.h"
  163. #include "QuickAccessMenuItemProt.h"
  164. #include "TimerEvents.h"
  165. // #include "QuickAccessMenuItemsGdcl.h"
  166. #include "Globaldefs.h"
  167. #include "QueueGProt.h"
  168. #include "SimDetectionGexdcl.h"
  169. #include "IdleAppDef.h"
  170. #include "KeyBrd.h"
  171. #include "ProfileGprots.h"
  172. #ifdef __MMI_TOUCH_SCREEN__
  173. #include "statusiconres.h"
  174. #endif 
  175. #ifdef __MOD_SMSAL__
  176. #include "MessagesExDcl.h"
  177. #endif 
  178. #include "PhoneBookGprot.h"
  179. #include "SimDetectionGprot.h"
  180. // #include "NvramExdcl.h"
  181. #ifdef MMI_ON_HARDWARE_P
  182. #include "custom_util.h"
  183. #endif
  184. #include "gpioInc.h"
  185. U8 isEmergencyCallDropped = 0;  /* Robin 1217 */
  186. /* not treating as an array of characters these
  187.    two are array of integers so length need not be 
  188.    multiplied by ENCODING LENGTH */
  189. U16 aligned_emgNumberArr[(EMERGENCY_NUMBER_LENGTH + 1) * ENCODING_LENGTH / 2];
  190. S8 *emgNumberArr = (S8 *) & aligned_emgNumberArr;
  191. /* To pass no to call management it is required to pass string */
  192. /* S16 curDigit; */
  193. U8 gEmerencyNoDialed = 0;
  194. /*****************************************************************************
  195.  * FUNCTION
  196.  *  HandlePoundKeyForUnlock
  197.  * DESCRIPTION
  198.  *  This fn handle the press of
  199.  *  Pound key , after RSK has been pressed
  200.  * PARAMETERS
  201.  *  void
  202.  * RETURNS
  203.  *  void
  204.  *****************************************************************************/
  205. void HandlePoundKeyForUnlock(void)
  206. {
  207.     /*----------------------------------------------------------------*/
  208.     /* Local Variables                                                */
  209.     /*----------------------------------------------------------------*/
  210.     /*----------------------------------------------------------------*/
  211.     /* Code Body                                                      */
  212.     /*----------------------------------------------------------------*/
  213.     StopTimer(KEYPADUNLOCKEDMESSAGE_TIMER);
  214.     g_keylock_context.gKeyPadLockFlag = 0;
  215.     /* Lisen 02182005 */
  216. #ifdef __MMI_KEYPADLOCK_WITH_KEYTONE__
  217. #else 
  218.     mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_ENABLED);
  219. #endif 
  220.     playRequestedTone(SUCCESS_TONE);
  221.     EntryScrKeyPadUnlockMessage();
  222. #ifdef __MMI_TOUCH_SCREEN__
  223.     ChangeStatusIconImage(STATUS_ICON_KEYPAD_LOCK, IMG_SI_KEYPAD_UNLOCK);
  224.     UpdateStatusIcons();    /* 101805 ChangeStatusIconImage Calvin: ChangeStatusIconImage will not call UpdateStatusIcon */
  225. #else /* __MMI_TOUCH_SCREEN__ */ 
  226.     IdleResetStatusIcon(STATUS_ICON_KEYPAD_LOCK);
  227. #endif /* __MMI_TOUCH_SCREEN__ */ 
  228.     TurnOnBacklight(1);
  229. }
  230. /*****************************************************************************
  231.  * FUNCTION
  232.  *  EntryScrKeyPadUnlockMessage
  233.  * DESCRIPTION
  234.  *  Entry fn to show that Keypad has been unlocked.
  235.  * PARAMETERS
  236.  *  void
  237.  * RETURNS
  238.  *  void
  239.  *****************************************************************************/
  240. void EntryScrKeyPadUnlockMessage(void)
  241. {
  242.     /*----------------------------------------------------------------*/
  243.     /* Local Variables                                                */
  244.     /*----------------------------------------------------------------*/
  245.     /*----------------------------------------------------------------*/
  246.     /* Code Body                                                      */
  247.     /*----------------------------------------------------------------*/
  248.     EntryNewScreen(KPAD_SCR_UNLOCK_MESSAGE, ExitScrKeyPadUnlockMessage, NULL, NULL);
  249.     ShowCategory64Screen(KPAD_SCR_UNLOCKED_MESSAGE_RUNNING_STR, IMG_KPAD_SCR_UNLOCKED_HELP_MESSAGE, 0);
  250.     /* Start Timer */
  251.     StartTimer(KEYPADUNLOCKEDMESSAGE_TIMER, KEYPAD_UNLOCK_SCR_TIMEOUT, GoBackHistory);
  252.     SetGroupKeyHandler(DisplayIdleScreen, (PU16) PresentAllKeys, (U8) TOTAL_KEYS, (U16) KEY_EVENT_DOWN);
  253.     /* Set the Exit handler , called in case of async events ,when transient screen on display */
  254. }
  255. /*****************************************************************************
  256.  * FUNCTION
  257.  *  ExitScrKeyPadUnlockMessage
  258.  * DESCRIPTION
  259.  *  Exit function Key Pad Unlocked Screen
  260.  * PARAMETERS
  261.  *  void
  262.  * RETURNS
  263.  *  void
  264.  *****************************************************************************/
  265. void ExitScrKeyPadUnlockMessage(void)
  266. {
  267.     /*----------------------------------------------------------------*/
  268.     /* Local Variables                                                */
  269.     /*----------------------------------------------------------------*/
  270.     /*----------------------------------------------------------------*/
  271.     /* Code Body                                                      */
  272.     /*----------------------------------------------------------------*/
  273.     StopTimer(KEYPADUNLOCKEDMESSAGE_TIMER);
  274.     stopRequestedTone(SUCCESS_TONE);
  275. }
  276. /* Leo start 20050731 */
  277. #ifdef __MMI_TOUCH_SCREEN__
  278. /*****************************************************************************
  279.  * FUNCTION
  280.  *  ScrAfterPressingRSKTimeout
  281.  * DESCRIPTION
  282.  *  
  283.  * PARAMETERS
  284.  *  void
  285.  * RETURNS
  286.  *  void
  287.  *****************************************************************************/
  288. void ScrAfterPressingRSKTimeout(void)
  289. {
  290.     /*----------------------------------------------------------------*/
  291.     /* Local Variables                                                */
  292.     /*----------------------------------------------------------------*/
  293.     /*----------------------------------------------------------------*/
  294.     /* Code Body                                                      */
  295.     /*----------------------------------------------------------------*/
  296.     mmi_pen_block();
  297.     GoBackHistory();
  298. }
  299. #endif /* __MMI_TOUCH_SCREEN__ */ 
  300. /* Leo end 20050731 */
  301. /*****************************************************************************
  302.  * FUNCTION
  303.  *  EntryScrAfterPessingRSK
  304.  * DESCRIPTION
  305.  *  shows the screen after pressing RSK indicating
  306.  *  messge " press # to unlock "
  307.  * PARAMETERS
  308.  *  void
  309.  * RETURNS
  310.  *  void
  311.  *****************************************************************************/
  312. void EntryScrAfterPessingRSK(void)
  313. {
  314.     /*----------------------------------------------------------------*/
  315.     /* Local Variables                                                */
  316.     /*----------------------------------------------------------------*/
  317.     /*----------------------------------------------------------------*/
  318.     /* Code Body                                                      */
  319.     /*----------------------------------------------------------------*/
  320.     EntryNewScreen(KPAD_SCR_UNLOCK_HELP_MESSAGE, ExitScrAfterPessingRSK, NULL, NULL);
  321.     /* Leo start 20050731 */
  322. #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //Kp Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
  323.     if (mmi_bootup_get_active_flight_mode() == 1)
  324.     {
  325.         ShowCategory264Screen(
  326.             get_string(TOUCH_SCR_UNLOCKED_HELP_MESSAGE_RUNNING_STR),
  327.             get_image(IMG_TOUCH_SCR_PEN_CLICK_AREA),
  328.             0,
  329.             NULL,
  330.             NULL);
  331.     }
  332.     else
  333.     {
  334.         ShowCategory264Screen(
  335.             get_string(TOUCH_SCR_UNLOCKED_HELP_MESSAGE_RUNNING_STR),
  336.             get_image(IMG_TOUCH_SCR_PEN_CLICK_AREA),
  337.             IMG_CSK_DIAL_ICON,
  338.             NULL,
  339.             NULL);
  340.     }
  341.     /* Start Timer */
  342.     StartTimer(KEYPADUNLOCKEDHELPMESSAGE_TIMER, KEYPADUNLOCK_TIMEOUT, ScrAfterPressingRSKTimeout /* GoBackHistory */ );
  343. #else /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  344. #ifdef __MMI_KEYPAD_LOCK_PATTERN_1__
  345.     ShowCategory64Screen(KPAD_SCR_UNLOCKED_HELP_MESSAGE_RUNNING_STR, IMG_KPAD_SCR_UNLOCKED_HELP_MESSAGE, 0);
  346. //KP Jerry add on 2007-4-24 start
  347. #elif defined(__MMI_KEYPAD_LOCK_PATTERN_4__)
  348.     ShowCategory64Screen(KPAD_SCR_UNLOCKED_HELP_MESSAGE_RUNNING_STR3, IMG_KPAD_SCR_UNLOCKED_HELP_MESSAGE, 0);
  349. //KP Jerry add on 2007-4-24 end
  350. #else 
  351.     ShowCategory64Screen(KPAD_SCR_UNLOCKED_HELP_MESSAGE_RUNNING_STR2, IMG_KPAD_SCR_UNLOCKED_HELP_MESSAGE, 0);
  352. #endif 
  353.     /* Start Timer */
  354.     StartTimer(KEYPADUNLOCKEDHELPMESSAGE_TIMER, KEYPADUNLOCK_TIMEOUT, GoBackHistory);
  355. #endif /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  356.     /* Leo end 20050731 */
  357.     SetGroupKeyHandler(GoBackHistory, (PU16) PresentAllKeys, (U8) TOTAL_KEYS, (U16) KEY_EVENT_DOWN);
  358. #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //Kp Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
  359.     /* SetKeyHandler(EntryScrAfterPessingRSK,KEY_SEND,KEY_EVENT_DOWN); */
  360.     mmi_pen_unblock();
  361. #else /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  362. #ifdef __MMI_KEYPAD_LOCK_PATTERN_1__    /* Robin 1223 */
  363.     /* SetKeyHandler(EntryScrAfterPessingRSK,KEY_RSK,KEY_EVENT_DOWN); */
  364.     SetKeyHandler(HandlePoundKeyForUnlock, KEY_POUND, KEY_EVENT_DOWN);
  365. //KP Jerry disable on 2007-4-23 start
  366. //#ifdef __MMI_SLIDE__    /* diamond, 2005/08/17 keypad lock for slide phone */
  367.     //SetKeyHandler(HandlePoundKeyForUnlock, KEY_LSK, KEY_EVENT_DOWN);
  368. //#endif 
  369. //KP Jerry disable on 2007-4-23 end
  370. //KP Jerry add on 2007-3-26 start
  371. #elif defined(__MMI_KEYPAD_LOCK_PATTERN_3__)    /* Robin 1223 */
  372.     SetKeyHandler(HandlePoundKeyForUnlock, KEY_STAR, KEY_EVENT_DOWN);
  373. //KP Jerry disable on 2007-4-23 start
  374. //#ifdef __MMI_SLIDE__    /* diamond, 2005/08/17 keypad lock for slide phone */
  375.     //SetKeyHandler(HandlePoundKeyForUnlock, KEY_LSK, KEY_EVENT_DOWN);
  376. //#endif 
  377. //KP Jerry disable on 2007-4-23 end
  378. //KP Jerry add on 2007-3-26 end
  379. //KP Jerry add on 2007-4-23 start
  380. #elif defined(__MMI_KEYPAD_LOCK_PATTERN_4__)    /* Robin 1223 */
  381.     SetKeyHandler(HandlePoundKeyForUnlock, KEY_CAMERA, KEY_EVENT_DOWN);
  382. //KP Jerry disable on 2007-4-23 start
  383. //#ifdef __MMI_SLIDE__    /* diamond, 2005/08/17 keypad lock for slide phone */
  384.     //SetKeyHandler(HandlePoundKeyForUnlock, KEY_LSK, KEY_EVENT_DOWN);
  385. //#endif 
  386. //KP Jerry disable on 2007-4-23 end
  387. //KP Jerry add on 2007-4-23 end
  388. #else /* __MMI_KEYPAD_LOCK_PATTERN_1__ */ 
  389.     /* SetKeyHandler(EntryScrAfterPessingRSK,KEY_LSK,KEY_EVENT_DOWN); */
  390.     SetKeyHandler(HandlePoundKeyForUnlock, KEY_STAR, KEY_EVENT_DOWN);
  391. //KP Jerry disable on 2007-4-23 start
  392. //#ifdef __MMI_SLIDE__    /* diamond, 2005/08/17 keypad lock for slide phone */
  393.     //SetKeyHandler(HandlePoundKeyForUnlock, KEY_RSK, KEY_EVENT_DOWN);
  394. //#endif 
  395. //KP Jerry disable on 2007-4-23 end
  396. #endif /* __MMI_KEYPAD_LOCK_PATTERN_1__ */ 
  397. #endif /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  398.     playRequestedTone(SUCCESS_TONE);
  399.     TurnOnBacklight(1);
  400. }
  401. /*****************************************************************************
  402.  * FUNCTION
  403.  *  ExitScrAfterPessingRSK
  404.  * DESCRIPTION
  405.  *  Exit function for the scrren after
  406.  *  that give message messge " press # to unlock "
  407.  * PARAMETERS
  408.  *  void
  409.  * RETURNS
  410.  *  void
  411.  *****************************************************************************/
  412. void ExitScrAfterPessingRSK(void)
  413. {
  414.     /*----------------------------------------------------------------*/
  415.     /* Local Variables                                                */
  416.     /*----------------------------------------------------------------*/
  417.     /*----------------------------------------------------------------*/
  418.     /* Code Body                                                      */
  419.     /*----------------------------------------------------------------*/
  420.     StopTimer(KEYPADUNLOCKEDHELPMESSAGE_TIMER);
  421.     stopRequestedTone(SUCCESS_TONE);
  422. }
  423. #if defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__)
  424. /*****************************************************************************
  425.  * FUNCTION
  426.  *  EntryScrKeyPadLockOnPessingAnyKey
  427.  * DESCRIPTION
  428.  *  shows the screen after pressing any key indicating
  429.  *  messge " press RSK to unlock "
  430.  * PARAMETERS
  431.  *  void
  432.  * RETURNS
  433.  *  void
  434.  *****************************************************************************/
  435. void EntryScrKeyPadLockOnPessingAnyKey(void)
  436. {
  437.     /*----------------------------------------------------------------*/
  438.     /* Local Variables                                                */
  439.     /*----------------------------------------------------------------*/
  440.     /*----------------------------------------------------------------*/
  441.     /* Code Body                                                      */
  442.     /*----------------------------------------------------------------*/
  443.     EntryNewScreen(KPAD_SCR_UNLOCK_FIRST_HELP_MESSAGE, ExitScrKeyPadLockOnPessingAnyKey, NULL, NULL);
  444. #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //KP Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26f __MMI_TOUCH_SCREEN__
  445.     ShowCategory64Screen(TOUCH_SCR_UNLOCKED_FIRST_HELP_MESSAGE_RUNNING_STR, IMG_KPAD_SCR_UNLOCKED_HELP_MESSAGE, 0);
  446. #else /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  447. #ifdef __MMI_KEYPAD_LOCK_PATTERN_1__
  448.     ShowCategory64Screen(KPAD_SCR_UNLOCKED_FIRST_HELP_MESSAGE_RUNNING_STR, IMG_KPAD_SCR_UNLOCKED_HELP_MESSAGE, 0);
  449. //KP Jerry add on 2007-4-24 start
  450. #elif defined(__MMI_KEYPAD_LOCK_PATTERN_4__)
  451.     ShowCategory64Screen(KPAD_SCR_UNLOCKED_FIRST_HELP_MESSAGE_RUNNING_STR3, IMG_KPAD_SCR_UNLOCKED_HELP_MESSAGE, 0);
  452. //KP Jerry add on 2007-4-24 end
  453. #else 
  454.     ShowCategory64Screen(KPAD_SCR_UNLOCKED_FIRST_HELP_MESSAGE_RUNNING_STR2, IMG_KPAD_SCR_UNLOCKED_HELP_MESSAGE, 0);
  455. #endif 
  456. #endif /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  457.     /* Start Timer */
  458.     StartTimer(KEYPADUNLOCKEDHELPMESSAGE_TIMER, KEYPADUNLOCK_TIMEOUT, GoBackHistory);
  459.     /* SetGroupKeyHandler(GoBackHistory,(PU16)PresentAllKeys,(U8)TOTAL_KEYS,(U16)KEY_EVENT_DOWN); */
  460.     SetGroupKeyHandler(MMI_dummy_function, (PU16) PresentAllKeys, (U8) TOTAL_KEYS, (U16) KEY_EVENT_DOWN);
  461. #if defined(__MMI_TOUCH_SCREEN__) && (!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__) || defined(__MMI_SLIDE__)) //KP Jerry add "!defined(__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__)" on 2007-3-26
  462.     SetKeyHandler(EntryScrAfterPessingRSK, KEY_SEND, KEY_EVENT_DOWN);
  463. #else /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  464. #if defined(__MMI_KEYPAD_LOCK_PATTERN_1__) || defined(__MMI_KEYPAD_LOCK_PATTERN_3__) || defined(__MMI_KEYPAD_LOCK_PATTERN_4__)    //KP Jerry add "__MMI_KEYPAD_LOCK_PATTERN_3__" on 2007-3-27
  465.     SetKeyHandler(EntryScrAfterPessingRSK, KEY_RSK, KEY_EVENT_DOWN);
  466. #else 
  467.     SetKeyHandler(EntryScrAfterPessingRSK, KEY_LSK, KEY_EVENT_DOWN);
  468. #endif 
  469. #endif /* __MMI_TOUCH_SCREEN__ && !__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__ */ //KP Jerry add "!__MMI_TOUCH_SCREEN_WITH_NUMERIC_KEY__" on 2007-3-26 
  470.     playRequestedTone(SUCCESS_TONE);
  471.     TurnOnBacklight(1);
  472. }
  473. /*****************************************************************************
  474.  * FUNCTION
  475.  *  ExitScrKeyPadLockOnPessingAnyKey
  476.  * DESCRIPTION
  477.  *  Exit function for the scrren after
  478.  *  that give message messge " press # to unlock "
  479.  * PARAMETERS
  480.  *  void
  481.  * RETURNS
  482.  *  void
  483.  *****************************************************************************/
  484. void ExitScrKeyPadLockOnPessingAnyKey(void)
  485. {
  486.     /*----------------------------------------------------------------*/
  487.     /* Local Variables                                                */
  488.     /*----------------------------------------------------------------*/
  489.     /*----------------------------------------------------------------*/
  490.     /* Code Body                                                      */
  491.     /*----------------------------------------------------------------*/
  492.     StopTimer(KEYPADUNLOCKEDHELPMESSAGE_TIMER);
  493.     stopRequestedTone(SUCCESS_TONE);
  494. }
  495. #endif /* defined(__MMI_KEYPAD_LOCK_PROMPT_TEXT__) */ 
  496. /*****************************************************************************
  497.  * FUNCTION
  498.  *  MakeEmergencyCall
  499.  * DESCRIPTION
  500.  *  Make the emergency call in case of
  501.  *  Keypad lock
  502.  * PARAMETERS
  503.  *  void
  504.  * RETURNS
  505.  *  void
  506.  *****************************************************************************/
  507. void MakeEmergencyCall(void)
  508. {
  509.     /*----------------------------------------------------------------*/
  510.     /* Local Variables                                                */
  511.     /*----------------------------------------------------------------*/
  512.     /*----------------------------------------------------------------*/
  513.     /* Code Body                                                      */
  514.     /*----------------------------------------------------------------*/
  515.     StopTimer(EMERGENCY_NO_DIALED_TRANSIANT_SCR_TIMER);
  516.     MakeCall(emgNumberArr);
  517.     g_keylock_context.gKeyPadLockFlag = 0;
  518.     /* Lisen 02182005 */
  519. #ifdef __MMI_KEYPADLOCK_WITH_KEYTONE__
  520. #else 
  521.     mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_DISABLED);
  522. #endif 
  523.     memset(emgNumberArr, 0, (EMERGENCY_NUMBER_LENGTH + 1) * ENCODING_LENGTH);
  524. }
  525. /*****************************************************************************
  526.  * FUNCTION
  527.  *  DropEmergencyCall
  528.  * DESCRIPTION
  529.  *  Drop Emergency call
  530.  *  and back to idle screen
  531.  * PARAMETERS
  532.  *  void
  533.  * RETURNS
  534.  *  void
  535.  *****************************************************************************/
  536. void DropEmergencyCall(void)
  537. {
  538.     /*----------------------------------------------------------------*/
  539.     /* Local Variables                                                */
  540.     /*----------------------------------------------------------------*/
  541.     /*----------------------------------------------------------------*/
  542.     /* Code Body                                                      */
  543.     /*----------------------------------------------------------------*/
  544.     isEmergencyCallDropped = 1; /* Robin 1217 */
  545.     StopTimer(EMERGENCY_NO_DIALED_TRANSIANT_SCR_TIMER);
  546.     /* g_keylock_context.gKeyPadLockFlag=1; */
  547.     /* Lisen 02182005 */
  548. #ifndef __MMI_KEYPADLOCK_WITH_KEYTONE__
  549.     mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_DISABLED);
  550. #endif 
  551.     memset(emgNumberArr, 0, (EMERGENCY_NUMBER_LENGTH + 1) * ENCODING_LENGTH);
  552.     DisplayIdleScreen();
  553. }
  554. /*****************************************************************************
  555.  * FUNCTION
  556.  *  EmergencyCallCheck
  557.  * DESCRIPTION
  558.  *  Check the number entered on idel scrreen
  559.  *  if it is Emergency Number
  560.  * PARAMETERS
  561.  *  keyCode         [IN]        
  562.  *  keyType         [IN]        
  563.  *  KeyType(?)      [IN]        
  564.  *  KeyCode(?)      [IN]        
  565.  * RETURNS
  566.  *  void
  567.  *****************************************************************************/
  568. static U8 EmergengyNoArrIndex = 0;  /* Robin 1217 */
  569. void EmergencyCallCheck(S16 keyCode, S16 keyType)
  570. {
  571.     /*----------------------------------------------------------------*/
  572.     /* Local Variables                                                */
  573.     /*----------------------------------------------------------------*/
  574.     /*----------------------------------------------------------------*/
  575.     /* Code Body                                                      */
  576.     /*----------------------------------------------------------------*/
  577.     if (keyType == KEY_EVENT_DOWN)
  578.     {
  579.         char aTemp[5];
  580.         /* Robin 1217, static U8 EmergengyNoArrIndex=0; */
  581.         U8 AnsValidateEmgNo;
  582.         U8 i;
  583.         if ((keyCode >= 0) && (keyCode <= 9))
  584.         {
  585.             sprintf(aTemp, "%d", keyCode);
  586.             emgNumberArr[EmergengyNoArrIndex] = *aTemp;
  587.         #ifdef __UCS2_ENCODING
  588.             emgNumberArr[++EmergengyNoArrIndex] = 0;
  589.         #endif 
  590.             emgNumberArr[++EmergengyNoArrIndex] = 0;
  591.             for (i = 0; (EmergengyNoArrIndex > 0) || emgNumberArr != NULL; i++)
  592.             {
  593.                 AnsValidateEmgNo = ValidateEmergencyNo(emgNumberArr);
  594.                 switch (AnsValidateEmgNo)
  595.                 {
  596.                     case 0: /* Number not Matched, so shift number by one digit and try again. */
  597.                         memcpy(
  598.                             emgNumberArr,
  599.                             emgNumberArr + ENCODING_LENGTH,
  600.                             (EMERGENCY_NUMBER_LENGTH * ENCODING_LENGTH));
  601.                         /* Robin 1217 */
  602.                         if (EmergengyNoArrIndex <= 1 ||
  603.                             EmergengyNoArrIndex > (EMERGENCY_NUMBER_LENGTH * ENCODING_LENGTH))
  604.                         {
  605.                             memset(emgNumberArr, 0, (EMERGENCY_NUMBER_LENGTH + 1) * ENCODING_LENGTH);
  606.                             EmergengyNoArrIndex = 0;
  607.                             break;
  608.                         }
  609.                         EmergengyNoArrIndex = EmergengyNoArrIndex - ENCODING_LENGTH;
  610.                         continue;
  611.                     case 1:                         /* Number Partially Matched. */
  612.                         break;
  613.                     case 2:                         /* Number found as Emergency Number. */
  614.                         isEmergencyCallDropped = 0; /* Robin 1217 */
  615.                         EntryNewScreen(EMERENCY_CALL_SCR_DISPLAY_ID, ExitEmergencyCallScr, NULL, NULL);
  616.                         EmergengyNoArrIndex = 0;
  617.                         gEmerencyNoDialed = 1;
  618.                         /* diamond, 2006/04/04 Sync with reference phone to display keypad lock icon in this screen */
  619.                     #ifdef __MMI_TOUCH_SCREEN__
  620.                         ChangeStatusIconImage(STATUS_ICON_KEYPAD_LOCK, IMG_SI_KEYPAD_LOCK);
  621.                     #else 
  622.                         ShowStatusIcon(STATUS_ICON_KEYPAD_LOCK);
  623.                     #endif 
  624.                         ShowCategory16Screen(0, 0, STR_GLOBAL_BACK, IMG_GLOBAL_BACK, (U8*) emgNumberArr, 4, NULL);
  625.                         /* g_keylock_context.gKeyPadLockFlag=0; */
  626.                     #ifdef __MMI_WGUI_CSK_ENABLE__
  627.                         SetCenterSoftkeyFunction(DropEmergencyCall, KEY_EVENT_DOWN);
  628.                     #endif 
  629.                         /* Lisen 02182005 */
  630.                     #ifdef __MMI_KEYPADLOCK_WITH_KEYTONE__
  631.                     #else 
  632.                         mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_ENABLED);
  633.                     #endif 
  634.                         SetGroupKeyHandler(DropEmergencyCall, (PU16) PresentAllKeys, TOTAL_KEYS, KEY_EVENT_UP); /* KEY_EVENT_DOWN, keytone will play non-stop */
  635.                         StartTimer(
  636.                             EMERGENCY_NO_DIALED_TRANSIANT_SCR_TIMER,
  637.                             EMERGENCY_NO_DIALED_TRANSIANT_SCR_TIMEOUT,
  638.                             DropEmergencyCall);
  639.                         ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  640.                         SetRightSoftkeyFunction(DropEmergencyCall, KEY_EVENT_DOWN);
  641.                         SetKeyHandler(MakeEmergencyCall, KEY_SEND, KEY_EVENT_UP);
  642.                         SetKeyHandler(DropEmergencyCall, KEY_END, KEY_EVENT_DOWN);
  643.                         TurnOnBacklight(1);
  644.                         break;
  645.                     default:
  646.                         memset(emgNumberArr, 0, (EMERGENCY_NUMBER_LENGTH + 1) * ENCODING_LENGTH);
  647.                         EmergengyNoArrIndex = 0;
  648.                         break;
  649.                 }
  650.                 break;
  651.             }
  652.         }
  653.         else
  654.         {
  655.             memset(emgNumberArr, 0, (EMERGENCY_NUMBER_LENGTH + 1) * ENCODING_LENGTH);
  656.             EmergengyNoArrIndex = 0;
  657.         }
  658.     }
  659. }
  660. /*****************************************************************************
  661.  * FUNCTION
  662.  *  ExitEmergencyCallScr
  663.  * DESCRIPTION
  664.  *  
  665.  * PARAMETERS
  666.  *  void
  667.  * RETURNS
  668.  *  void
  669.  *****************************************************************************/
  670. void ExitEmergencyCallScr(void)
  671. {
  672.     /*----------------------------------------------------------------*/
  673.     /* Local Variables                                                */
  674.     /*----------------------------------------------------------------*/
  675.     /*----------------------------------------------------------------*/
  676.     /* Code Body                                                      */
  677.     /*----------------------------------------------------------------*/
  678.     /* 2006/04/17 Always hide keypad lock icon when leave this screen */
  679. #ifdef __MMI_TOUCH_SCREEN__
  680.     ChangeStatusIconImage(STATUS_ICON_KEYPAD_LOCK, IMG_SI_KEYPAD_UNLOCK);
  681. #else 
  682.     HideStatusIcon(STATUS_ICON_KEYPAD_LOCK);
  683. #endif 
  684.     if (isEmergencyCallDropped == 0)    /* Robin 1217 */
  685.     {
  686.         StopTimer(EMERGENCY_NO_DIALED_TRANSIANT_SCR_TIMER);
  687.         memset(emgNumberArr, 0, (EMERGENCY_NUMBER_LENGTH + 1) * ENCODING_LENGTH);
  688.     }
  689. }
  690. /*****************************************************************************
  691.  * FUNCTION
  692.  *  ValidateEmergencyNo
  693.  * DESCRIPTION
  694.  *  Validate the Emergency Number.
  695.  * PARAMETERS
  696.  *  tempbuffer      [?]     
  697.  * RETURNS
  698.  *  void
  699.  *****************************************************************************/
  700. U8 ValidateEmergencyNo(S8 *tempbuffer)
  701. {
  702.     /*----------------------------------------------------------------*/
  703.     /* Local Variables                                                */
  704.     /*----------------------------------------------------------------*/
  705.     S32 nNumLen;
  706.     S32 nLen;
  707.     U8 i;
  708.     /*----------------------------------------------------------------*/
  709.     /* Code Body                                                      */
  710.     /*----------------------------------------------------------------*/
  711.     nNumLen = pfnUnicodeStrlen(tempbuffer);
  712. #ifdef __MMI_Emergency_Call_911_Support__
  713.   /***  Robin 0714 Begin ***/
  714.   /***  For Insert SIM, Dail 911 as emergency call ***/
  715.     nLen = pfnUnicodeStrlen((PS8) EmergencyNumber[0]);
  716.     if (nLen == nNumLen)
  717.     {
  718.         if ((pfnUnicodeStrcmp((PS8) EmergencyNumber[0], tempbuffer) == 0))
  719.         {
  720.             return 2;
  721.         }
  722.     }
  723.     else if (nLen > nNumLen)
  724.     {
  725.         if ((pfnUnicodeStrncmp((PS8) EmergencyNumber[0], tempbuffer, nNumLen) == 0))
  726.         {
  727.             return 1;
  728.         }
  729.     }
  730.   /***  Robin 0714 End ***/
  731. #else /* __MMI_Emergency_Call_911_Support__ */ 
  732.     for (i = 0; i < MAX_EMERGENCYNUMBER; i++)
  733.     {
  734.         nLen = pfnUnicodeStrlen((PS8) EmergencyNumber[i]);
  735.         if (nLen == nNumLen)
  736.         {
  737.             if ((pfnUnicodeStrcmp((PS8) EmergencyNumber[i], tempbuffer) == 0))
  738.             {
  739.                 return 2;
  740.             }
  741.         }
  742.         else if (nLen > nNumLen)
  743.         {
  744.             if ((pfnUnicodeStrncmp((PS8) EmergencyNumber[i], tempbuffer, nNumLen) == 0))
  745.             {
  746.                 return 1;
  747.             }
  748.         }
  749.     }
  750. #endif /* __MMI_Emergency_Call_911_Support__ */ 
  751.     /* call Phone book API to validate the entered number from Phonebook SOS enteries. */
  752.     return mmi_phb_check_valid_sos_number(tempbuffer);
  753. }