KeyBrd.c
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:75k
- /*****************************************************************************
- * Copyright Statement:
- * --------------------
- * This software is protected by Copyright and the information contained
- * herein is confidential. The software may not be copied and the information
- * contained herein may not be used or disclosed except with the written
- * permission of MediaTek Inc. (C) 2005
- *
- * BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
- * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
- * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
- * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
- * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
- * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
- * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
- * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
- * NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
- * SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
- *
- * BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
- * LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
- * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
- * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
- * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
- *
- * THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
- * WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
- * LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
- * RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
- * THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
- *
- *****************************************************************************/
- /*****************************************************************************
- *
- * Filename:
- * ---------
- * Keybrd.C
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends for keypad processing
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- /**
- * Copyright Notice
- * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
- * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
- * (It is illegal to remove this copyright notice from this software or any
- * portion of it)
- */
- /**************************************************************
- FILENAME : KeyBrd.c
- PURPOSE : Key Board Handler
- REMARKS : nil
- AUTHOR : Neeraj Sharma
- DATE : Aug 25, 2003
- **************************************************************/
- /* Include: MMI header file */
- #include "MMI_features.h"
- #include "stdC.h"
- #include "L4Dr1.h"
- #include "PixtelDataTypes.h"
- #include "KeyBrd.h"
- #include "TimerEvents.h"
- #include "AudioInc.h"
- #include "GlobalConstants.h"
- #include "ThrdOsInterface.h"
- #include "DebugInitDef.h"
- #include "FrameworkStruct.h"
- #include "SettingProfile.h"
- #include "IdleAppDef.h"
- #include "QueueGprot.h"
- #include "taskinit.h" /* amitM */
- #include "MMITaskProt.h"
- #include "WrapperGprot.h"
- #include "ProfileGprots.h"
- #include "L4Dr.h"
- #include "kbd_table.h"
- #include "MMI_trc.h"
- #include "EventsGprot.h"
- #include "gpioInc.h"
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- #include "wgui_touch_screen.h"
- #endif
- #include "ScreenRotationGprot.h"
- #include "kbd_table.h"
- #include "ProfilingEngine.h"
- #include "SimDetectionGprot.h"
- extern U8 processUpRepeatKey;
- extern U8 pressKey;
- /*****************************************************************************
- * Define
- *****************************************************************************/
- #define MAX_PRESENTALLKEYS sizeof(PresentAllKeys)/sizeof(PresentAllKeys[0])
- #define MAX_PRESENTDIGITSKEYS sizeof(PresentDigitsKeys)/sizeof(PresentDigitsKeys[0])
- #define MAX_KEYPADMAP sizeof(nKeyPadMap)/sizeof(nKeyPadMap[0])
- mmi_frm_context_struct g_mmi_frm_cntx;
- mmi_frm_context_struct *frm_p = &g_mmi_frm_cntx;
- /*****************************************************************************
- * Local Variable
- *****************************************************************************/
- static U16 currKeyPadTone = 0xFFFF;
- static mmi_key_types_enum nKeyPadStatus[MAX_KEYS];
- /* allow multiple keys's processing at the same time */
- static MMI_BOOL g_kbd_concurrent_key_mode = MMI_FALSE;
- /* how many key under pressing */
- static U8 key_is_pressing_count = 0;
- static MMI_BOOL g_process_key_in_high_frequency = MMI_FALSE;
- /*****************************************************************************
- * Global Variable
- *****************************************************************************/
- extern oslMsgqid mmi_ext_qid;
- extern MMI_BOOL g_keypad_flag;
- extern drv_get_key_func keypad_ptr;
- U32 g_2step_key_num = 0;
- U16 g_2step_keyCode[MAX_KEYS];
- const U16 PresentDigitsKeys[] = {KEY_0, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7, KEY_8, KEY_9};
- const U16 PresentAllKeys[] =
- {
- KEY_0,
- KEY_1,
- KEY_2,
- KEY_3,
- KEY_4,
- KEY_5,
- KEY_6,
- KEY_7,
- KEY_8,
- KEY_9,
- KEY_LSK,
- KEY_RSK,
- KEY_UP_ARROW,
- KEY_DOWN_ARROW,
- KEY_LEFT_ARROW,
- KEY_RIGHT_ARROW,
- KEY_SEND,
- KEY_END,
- KEY_STAR,
- KEY_POUND,
- KEY_VOL_UP,
- KEY_VOL_DOWN,
- KEY_CLEAR,
- KEY_CAMERA,
- KEY_WAP,
- KEY_EXTRA_1,
- KEY_EXTRA_2,
- KEY_PLAY_STOP,
- KEY_PLAY_STOP,
- KEY_BACK,
- KEY_POWER
- //KP Jerry add on 2007-4-23 start
- ,KEY_LEFT_SHORTCUT
- ,KEY_RIGHT_SHORTCUT
- //KP Jerry add on 2007-4-23 end
- };
- #ifndef MMI_ON_WIN32
- static const KeyPadMap nKeyPadMap[] =
- {
- {DEVICE_KEY_0, KEY_0, KEY_TIMER_ID0, TONE_DTMF_0, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_1, KEY_1, KEY_TIMER_ID1, TONE_DTMF_1, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_2, KEY_2, KEY_TIMER_ID2, TONE_DTMF_2, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_3, KEY_3, KEY_TIMER_ID3, TONE_DTMF_3, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_4, KEY_4, KEY_TIMER_ID4, TONE_DTMF_4, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_5, KEY_5, KEY_TIMER_ID5, TONE_DTMF_5, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_6, KEY_6, KEY_TIMER_ID6, TONE_DTMF_6, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_7, KEY_7, KEY_TIMER_ID7, TONE_DTMF_7, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_8, KEY_8, KEY_TIMER_ID8, TONE_DTMF_8, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_9, KEY_9, KEY_TIMER_ID9, TONE_DTMF_9, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_STAR, KEY_STAR, KEY_TIMER_ID10, TONE_KEY_STAR, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_HASH, KEY_POUND, KEY_TIMER_ID11, TONE_KEY_HASH, DEVICE_AUDIO_PLAY_INFINITE},
- {DEVICE_KEY_VOL_UP, KEY_VOL_UP, KEY_TIMER_ID12, TONE_KEY_VOL_UP, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_TIMER_ID13, TONE_KEY_VOL_DOWN, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_UP, KEY_UP_ARROW, KEY_TIMER_ID14, TONE_KEY_UP, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_DOWN, KEY_DOWN_ARROW, KEY_TIMER_ID15, TONE_KEY_DOWN, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_LEFT, KEY_LEFT_ARROW, KEY_TIMER_ID16, TONE_KEY_LEFT, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_RIGHT, KEY_RIGHT_ARROW, KEY_TIMER_ID17, TONE_KEY_RIGHT, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_MENU, KEY_ENTER, KEY_TIMER_ID18, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_FUNCTION, KEY_QUICK_ACS, KEY_TIMER_ID19, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_SK_LEFT, KEY_LSK, KEY_TIMER_ID20, TONE_KEY_SK_LEFT, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_SK_RIGHT, KEY_RSK, KEY_TIMER_ID21, TONE_KEY_SK_RIGHT, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_SEND, KEY_SEND, KEY_TIMER_ID22, TONE_KEY_SEND, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_END, KEY_END, KEY_TIMER_ID23, TONE_KEY_END, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_POWER, KEY_POWER, KEY_TIMER_ID24, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE}, /* 24 IMPORTANT :This will be power key */
- {DEVICE_KEY_CLEAR, KEY_CLEAR, KEY_TIMER_ID25, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_EXT_FUNC1, KEY_EXTRA_1, KEY_TIMER_ID27, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_EXT_FUNC2, KEY_EXTRA_2, KEY_TIMER_ID28, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_MP3_PLAY_STOP, KEY_PLAY_STOP, KEY_TIMER_ID29, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_MP3_FWD, KEY_FWD, KEY_TIMER_ID30, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE},
- {DEVICE_KEY_MP3_BACK, KEY_BACK, KEY_TIMER_ID31, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE}
- //KP Jerry add on 2007-4-23 start
- ,{DEVICE_KEY_MP3_SHORTCUT, KEY_LEFT_SHORTCUT, KEY_TIMER_ID32, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE}
- ,{DEVICE_KEY_WAP_SHORTCUT, KEY_RIGHT_SHORTCUT, KEY_TIMER_ID33, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE}
- //KP Jerry add on 2007-4-23 end
- };
- #else /* MMI_ON_WIN32 */
- /*
- * virtual-Key Code is defined in "WINUSER.H", and "WINDOWS.H" includes "WINUSER.H"
- *
- * Constant name Value (hexadecimal)
- *-------------------------------------------------
- * #define VK_SPACE 0x20
- * #define VK_PRIOR 0x21
- * #define VK_NEXT 0x22
- * #define VK_END 0x23
- * #define VK_HOME 0x24
- * #define VK_LEFT 0x25
- * #define VK_UP 0x26
- * #define VK_RIGHT 0x27
- * #define VK_DOWN 0x28
- * #define VK_SELECT 0x29
- * #define VK_PRINT 0x2A
- * #define VK_EXECUTE 0x2B
- * #define VK_SNAPSHOT 0x2C
- * #define VK_INSERT 0x2D
- * #define VK_DELETE 0x2E
- * #define VK_HELP 0x2F
- *
- * [ VK_0 thru VK_9 are the same as ASCII '0' thru '9' (0x30 - 0x39) ]
- * [ VK_A thru VK_Z are the same as ASCII 'A' thru 'Z' (0x41 - 0x5A) ]
- *
- * #define VK_LWIN 0x5B
- * #define VK_RWIN 0x5C
- * #define VK_APPS 0x5D
- *
- * #define VK_NUMPAD0 0x60
- * #define VK_NUMPAD1 0x61
- * #define VK_NUMPAD2 0x62
- * #define VK_NUMPAD3 0x63
- * #define VK_NUMPAD4 0x64
- * #define VK_NUMPAD5 0x65
- * #define VK_NUMPAD6 0x66
- * #define VK_NUMPAD7 0x67
- * #define VK_NUMPAD8 0x68
- * #define VK_NUMPAD9 0x69
- * #define VK_MULTIPLY 0x6A
- * #define VK_ADD 0x6B
- * #define VK_SEPARATOR 0x6C
- * #define VK_SUBTRACT 0x6D
- * #define VK_DECIMAL 0x6E
- * #define VK_DIVIDE 0x6F
- * #define VK_F1 0x70
- * #define VK_F2 0x71
- * #define VK_F3 0x72
- * #define VK_F4 0x73
- * #define VK_F5 0x74
- * #define VK_F6 0x75
- * #define VK_F7 0x76
- * #define VK_F8 0x77
- * #define VK_F9 0x78
- * #define VK_F10 0x79
- * #define VK_F11 0x7A
- * #define VK_F12 0x7B
- * #define VK_F13 0x7C
- * #define VK_F14 0x7D
- * #define VK_F15 0x7E
- * #define VK_F16 0x7F
- * #define VK_F17 0x80
- * #define VK_F18 0x81
- * #define VK_F19 0x82
- * #define VK_F20 0x83
- * #define VK_F21 0x84
- * #define VK_F22 0x85
- * #define VK_F23 0x86
- * #define VK_F24 0x87
- *
- */
- static const KeyPadMap nKeyPadMap[] =
- {
- {KEY_0, KEY_0, KEY_TIMER_ID0, TONE_DTMF_0, DEVICE_AUDIO_PLAY_INFINITE, VK_NUMPAD0 /* 0 */ },
- {KEY_1, KEY_1, KEY_TIMER_ID1, TONE_DTMF_1, DEVICE_AUDIO_PLAY_INFINITE, VK_NUMPAD1 /* 1 */ },
- {KEY_2, KEY_2, KEY_TIMER_ID2, TONE_DTMF_2, DEVICE_AUDIO_PLAY_INFINITE, VK_NUMPAD2 /* 2 */ },
- {KEY_3, KEY_3, KEY_TIMER_ID3, TONE_DTMF_3, DEVICE_AUDIO_PLAY_INFINITE, VK_NUMPAD3 /* 3 */ },
- {KEY_4, KEY_4, KEY_TIMER_ID4, TONE_DTMF_4, DEVICE_AUDIO_PLAY_INFINITE, VK_NUMPAD4 /* 4 */ },
- {KEY_5, KEY_5, KEY_TIMER_ID5, TONE_DTMF_5, DEVICE_AUDIO_PLAY_INFINITE, VK_NUMPAD5 /* 5 */ },
- {KEY_6, KEY_6, KEY_TIMER_ID6, TONE_DTMF_6, DEVICE_AUDIO_PLAY_INFINITE, VK_NUMPAD6 /* 6 */ },
- {KEY_7, KEY_7, KEY_TIMER_ID7, TONE_DTMF_7, DEVICE_AUDIO_PLAY_INFINITE, VK_NUMPAD7 /* 7 */ },
- {KEY_8, KEY_8, KEY_TIMER_ID8, TONE_DTMF_8, DEVICE_AUDIO_PLAY_INFINITE, VK_NUMPAD8 /* 8 */ },
- {KEY_9, KEY_9, KEY_TIMER_ID9, TONE_DTMF_9, DEVICE_AUDIO_PLAY_INFINITE, VK_NUMPAD9 /* 9 */ },
- {KEY_LSK, KEY_LSK, KEY_TIMER_ID10, TONE_KEY_STAR, DEVICE_AUDIO_PLAY_INFINITE, VK_INSERT /* Ins */ },
- {KEY_RSK, KEY_RSK, KEY_TIMER_ID11, TONE_KEY_HASH, DEVICE_AUDIO_PLAY_INFINITE, VK_PRIOR /* PgUp */ },
- {KEY_UP_ARROW, KEY_UP_ARROW, KEY_TIMER_ID12, TONE_KEY_VOL_UP, DEVICE_AUDIO_PLAY_ONCE, VK_UP /* Up */ },
- {KEY_DOWN_ARROW, KEY_DOWN_ARROW, KEY_TIMER_ID13, TONE_KEY_VOL_DOWN, DEVICE_AUDIO_PLAY_ONCE, VK_DOWN /* Down */ },
- {KEY_LEFT_ARROW, KEY_LEFT_ARROW, KEY_TIMER_ID14, TONE_KEY_LEFT, DEVICE_AUDIO_PLAY_ONCE, VK_LEFT /* Left */ },
- {KEY_RIGHT_ARROW, KEY_RIGHT_ARROW, KEY_TIMER_ID15, TONE_KEY_RIGHT, DEVICE_AUDIO_PLAY_ONCE, VK_RIGHT /* Right */ },
- {KEY_SEND, KEY_SEND, KEY_TIMER_ID16, TONE_KEY_SEND, DEVICE_AUDIO_PLAY_ONCE, VK_DELETE /* Del */ },
- {KEY_END, KEY_END, KEY_TIMER_ID17, TONE_KEY_END, DEVICE_AUDIO_PLAY_ONCE, VK_NEXT /* PgDn */ },
- {KEY_CLEAR, KEY_CLEAR, KEY_TIMER_ID25, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE, VK_END /* End */ },
- {KEY_STAR, KEY_STAR, KEY_TIMER_ID19, TONE_KEY_STAR, DEVICE_AUDIO_PLAY_INFINITE, VK_DIVIDE /* / */ },
- {KEY_POUND, KEY_POUND, KEY_TIMER_ID20, TONE_KEY_HASH, DEVICE_AUDIO_PLAY_INFINITE, VK_MULTIPLY /* * */ },
- {KEY_VOL_UP, KEY_VOL_UP, KEY_TIMER_ID21, TONE_KEY_VOL_UP, DEVICE_AUDIO_PLAY_ONCE, VK_ADD /* + */ },
- {KEY_VOL_DOWN, KEY_VOL_DOWN, KEY_TIMER_ID22, TONE_KEY_VOL_DOWN, DEVICE_AUDIO_PLAY_ONCE, VK_SUBTRACT /* - */ },
- {KEY_INVALID, KEY_INVALID, KEY_TIMER_ID_NONE, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE, 0 /* None */ },
- {KEY_QUICK_ACS, KEY_QUICK_ACS, KEY_TIMER_ID19, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE, VK_BACK /* Backspace */ },
- {KEY_ENTER, KEY_ENTER, KEY_TIMER_ID18, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE, VK_RETURN /* Enter */ },
- {KEY_EXTRA_1, KEY_EXTRA_1, KEY_TIMER_ID27, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE, VK_F1 /* F1 */ },
- {KEY_EXTRA_2, KEY_EXTRA_2, KEY_TIMER_ID28, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE, VK_F2 /* F2 */ },
- {KEY_PLAY_STOP, KEY_PLAY_STOP, KEY_TIMER_ID29, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE, 0 /* TBD */},
- {KEY_FWD, KEY_FWD, KEY_TIMER_ID30, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE, 0 /* TBD */},
- {KEY_BACK, KEY_BACK, KEY_TIMER_ID31, TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE, 0 /* TBD */}
- };
- #endif /* MMI_ON_WIN32 */
- extern void IdleHandleKeypadLockProcess(void);
- #if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)
- extern U8 CanPlayHumanVoiceKeyTone(void);
- #endif
- #if defined(__MMI_CUST_KEYPAD_TONE__)
- extern U8 CanPlayCustKeyTone(void);
- #endif
- #if defined(MMI_ON_WIN32)
- extern void MMI_system_keybord_handler(S32 key_code, S32 key_state);
- #endif
- extern void ShutdownSystemOperation(void);
- /*****************************************************************************
- * FUNCTION
- * InitProcessKeyEvent
- * DESCRIPTION
- * To init the process key handler for preprocessing and postprocessing.
- * PARAMETERS
- * void
- * U32(?) [IN] MsgType, U16 KeyMapIndex
- * RETURNS
- * void
- *****************************************************************************/
- void InitProcessKeyEvent(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < MAX_KEYS; i++)
- {
- nKeyPadStatus[i] = KEY_EVENT_UP;
- key_is_pressing_count = 0;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * KeyEventHandler
- * DESCRIPTION
- * To handle the key event.
- * PARAMETERS
- * eventKey [IN]
- * RETURNS
- * void
- *****************************************************************************/
- static void KeyEventHandler(KEYBRD_MESSAGE *eventKey)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Preprocess the keypad handler */
- mmi_kbd_app_key_hdlr(eventKey);
- if (g_mmi_frm_cntx.kbd_pre_func)
- {
- g_mmi_frm_cntx.kbd_pre_func(eventKey);
- }
- /* Process the register App keypad handler */
- ExecuteCurrKeyHandler((S16) eventKey->nKeyCode, (S16) eventKey->nMsgType);
- if (g_mmi_frm_cntx.kbd_post_func)
- {
- g_mmi_frm_cntx.kbd_post_func(eventKey);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_get_2step_keys
- * DESCRIPTION
- * To get the 2 step keys of handset.
- * The function should be called in MMI_Init()
- * PARAMETERS
- * void
- * KEYBRD_MESSAGE(?) [IN] *eventKey
- * RETURNS
- * void
- *****************************************************************************/
- extern void kbd_find_2step(kal_uint32 *number, kal_uint8 *two_step);
- void mmi_frm_get_2step_keys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 i;
- U8 _2step_key[MAX_KEYS];
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- memset(_2step_key, 0, sizeof(U8) * MAX_KEYS);
- memset(g_2step_keyCode, 0, sizeof(U16) * MAX_KEYS);
- #ifndef MMI_ON_WIN32
- kbd_find_2step(&g_2step_key_num, _2step_key);
- #endif
- for (i = 0; i < g_2step_key_num; i++)
- {
- g_2step_keyCode[i] = nKeyPadMap[_2step_key[i]].nMMIKeyCode;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_is_2step_keyCode
- * DESCRIPTION
- * To get the 2 step keys of handset.
- * The function should be called in MMI_Init()
- * PARAMETERS
- * keyCode [IN]
- * KEYBRD_MESSAGE(?) [IN] *eventKey
- * RETURNS
- * MMI_TRUE - it's 2 step key
- * MMI_FALSE - it isn't 2 step key
- *****************************************************************************/
- static MMI_BOOL mmi_frm_is_2step_keyCode(U16 keyCode)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U32 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < g_2step_key_num; i++)
- {
- if (keyCode == g_2step_keyCode[i])
- {
- return MMI_TRUE;
- }
- }
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * ProcessKeyEvent
- * DESCRIPTION
- * To send the key events to MMI task
- * PARAMETERS
- * MsgType [IN]
- * KeyMapIndex [IN]
- * RETURNS
- * void
- *****************************************************************************/
- /* TBD */
- #define DRV_WM_ENABLE_TWOKEY_DETECTION 5
- #define DRV_WM_DISABLE_TWOKEY_DETECTION 6
- void ProcessKeyEvent(U32 MsgType, U16 KeyMapIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_ASSERT(KeyMapIndex < MAX_KEYPADMAP);
- MMI_ASSERT(nKeyPadMap[KeyMapIndex].nMMIKeyCode != KEY_INVALID);
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_PROC_KEYEVENT_HDLR, MsgType, nKeyPadMap[KeyMapIndex].nMMIKeyCode));
- if (MsgType == WM_KEYPRESS)
- {
- if (nKeyPadStatus[KeyMapIndex] == KEY_EVENT_UP)
- {
- KEYBRD_MESSAGE KeyBrdMsg;
- KeyBrdMsg.nKeyCode = nKeyPadMap[KeyMapIndex].nMMIKeyCode;
- if (mmi_frm_is_2step_keyCode(KeyBrdMsg.nKeyCode))
- {
- nKeyPadStatus[KeyMapIndex] = KEY_HALF_PRESS_DOWN;
- key_is_pressing_count++;
- KeyBrdMsg.nMsgType = KEY_HALF_PRESS_DOWN;
- }
- else
- {
- nKeyPadStatus[KeyMapIndex] = KEY_EVENT_DOWN; /* same with KEY_FULL_PRESS_DOWN */
- key_is_pressing_count++;
- KeyBrdMsg.nMsgType = KEY_EVENT_DOWN;
- }
- KeyEventHandler((KEYBRD_MESSAGE*) & KeyBrdMsg);
- #ifdef MMI_ON_WIN32
- StartTimer(nKeyPadMap[KeyMapIndex].nTimerId, KEYTIMER_LONGPRESS, (FuncPtr) KeyTimerExpiryProc);
- #endif
- }
- else
- {
- /* Ignore the event */
- }
- }
- else if (MsgType == WM_KEYRELEASE)
- {
- if ((nKeyPadStatus[KeyMapIndex] == KEY_EVENT_DOWN)
- || (nKeyPadStatus[KeyMapIndex] == KEY_LONG_PRESS)
- || (nKeyPadStatus[KeyMapIndex] == KEY_REPEAT) || (nKeyPadStatus[KeyMapIndex] == KEY_HALF_PRESS_DOWN))
- {
- KEYBRD_MESSAGE KeyBrdMsg;
- #ifdef MMI_ON_WIN32
- /* stop timer as early as possible. avoid timer expire later */
- StopTimer(nKeyPadMap[KeyMapIndex].nTimerId);
- #endif /* MMI_ON_WIN32 */
- nKeyPadStatus[KeyMapIndex] = KEY_EVENT_UP;
- key_is_pressing_count--;
- KeyBrdMsg.nMsgType = KEY_EVENT_UP;
- KeyBrdMsg.nKeyCode = nKeyPadMap[KeyMapIndex].nMMIKeyCode;
- KeyEventHandler((KEYBRD_MESSAGE*) & KeyBrdMsg);
- }
- else
- {
- /* Ignore the event */
- }
- }
- /* ++Robin, modified by Max Chen */
- #ifndef MMI_ON_WIN32
- else if (MsgType == DRV_WM_KEYLONGPRESS)
- {
- if (nKeyPadStatus[KeyMapIndex] == KEY_EVENT_DOWN)
- {
- KEYBRD_MESSAGE KeyBrdMsg;
- nKeyPadStatus[KeyMapIndex] = KEY_LONG_PRESS;
- KeyBrdMsg.nMsgType = KEY_LONG_PRESS;
- KeyBrdMsg.nKeyCode = nKeyPadMap[KeyMapIndex].nMMIKeyCode;
- KeyEventHandler((KEYBRD_MESSAGE*) & KeyBrdMsg);
- }
- else
- {
- /* Ignore the event */
- }
- }
- else if (MsgType == DRV_WM_KEYREPEATED)
- {
- if ((nKeyPadStatus[KeyMapIndex] == KEY_LONG_PRESS) || (nKeyPadStatus[KeyMapIndex] == KEY_REPEAT))
- {
- KEYBRD_MESSAGE KeyBrdMsg;
- nKeyPadStatus[KeyMapIndex] = KEY_REPEAT;
- KeyBrdMsg.nMsgType = KEY_REPEAT;
- KeyBrdMsg.nKeyCode = nKeyPadMap[KeyMapIndex].nMMIKeyCode;
- KeyEventHandler((KEYBRD_MESSAGE*) & KeyBrdMsg);
- }
- else
- {
- /* Ignore the event */
- }
- }
- else if (MsgType == DRV_WM_KEYFULLPRESS)
- {
- /*
- * Only in two-stage key will have KEY_FULL_PRESS_DOWN, and it followed after KEY_HALF_PRESS_DOWN
- */
- if (nKeyPadStatus[KeyMapIndex] == KEY_HALF_PRESS_DOWN)
- {
- KEYBRD_MESSAGE KeyBrdMsg;
- nKeyPadStatus[KeyMapIndex] = KEY_EVENT_DOWN;
- KeyBrdMsg.nMsgType = KEY_EVENT_DOWN;
- KeyBrdMsg.nKeyCode = nKeyPadMap[KeyMapIndex].nMMIKeyCode;
- KeyEventHandler((struct KEYBRD_MESSAGE*)&KeyBrdMsg);
- }
- else
- {
- /* Ignore the event */
- }
- }
- else if (MsgType == DRV_WM_ENABLE_TWOKEY_DETECTION || MsgType == DRV_WM_DISABLE_TWOKEY_DETECTION)
- {
- /* Ignore the event */
- }
- #endif /* MMI_ON_WIN32 */
- else
- {
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_ERROR_PROC_KEYEVENT_HDLR));
- MMI_ASSERT(0);
- }
- }
- #ifdef MMI_ON_WIN32
- #define CHECK_SIMPLY_HANDLE_MULTIPLEKEY(type, id)
- {
- static U16 lastId = 0xffff;
- if (mmi_kbd_get_concurrent_mode() == MMI_FALSE)
- {
- if (type == WM_KEYPRESS)
- {
- if (lastId == 0xffff)
- { /* update lastId */
- lastId = id;
- }
- else if (lastId != id)
- { /* previous key isn't release but another key is pressed */
- /* release the previous key first */
- /* then continue to press the current key */
- ProcessKeyEvent(WM_KEYRELEASE, lastId);
- lastKeyId = i;
- }
- }
- else /* WM_KEYRELEASE */
- { /* reset lastId */
- lastId = 0xffff;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ProcessPCKeyEvent
- * DESCRIPTION
- * This function is to convert the W32 key to MMI keys.
- * PARAMETERS
- * MsgType [IN] Type of key event
- * KeyBrdMsg [?]
- * KeyMsg(?) [IN] Key structure
- * RETURNS
- * void
- *****************************************************************************/
- U8 ProcessPCKeyEvent(U32 MsgType, KEYBRD_MESSAGE *KeyBrdMsg)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- static U16 lastKeyId = 0xffff; /* initial value (magic number) */
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((MsgType == WM_KEYBRD_PRESS) || (MsgType == WM_KEYBRD_RELEASE))
- {
- /*
- * handle the key event from the keyboard event
- * find keyCode in nHotKey of nKeyPadMap's table
- */
- for (i = 0; i < MAX_KEYPADMAP; i++)
- {
- if (KeyBrdMsg->nKeyCode == nKeyPadMap[i].nHotKey)
- {
- if (MsgType == WM_KEYBRD_PRESS)
- {
- MsgType = WM_KEYPRESS;
- }
- else
- {
- MsgType = WM_KEYRELEASE;
- }
- CHECK_SIMPLY_HANDLE_MULTIPLEKEY(MsgType, i) ProcessKeyEvent(MsgType, i);
- return MMI_TRUE;
- }
- }
- }
- else if ((MsgType == WM_KEYPRESS) || (MsgType == WM_KEYRELEASE))
- {
- /*
- * handle the key event from the mouse event
- * find keyCode in nKeyCode of nKeyPadMap's table
- */
- for (i = 0; i < MAX_KEYPADMAP; i++)
- {
- if (KeyBrdMsg->nKeyCode == nKeyPadMap[i].nKeyCode)
- {
- CHECK_SIMPLY_HANDLE_MULTIPLEKEY(MsgType, i);
- ProcessKeyEvent(MsgType, i); /* Msg type press or release & keymap index */
- return MMI_TRUE;
- }
- }
- }
- /* Not handle this message */
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_set_key_handle_in_high_frequency
- * DESCRIPTION
- * The dummy function for PC simulator
- * PARAMETERS
- * is_enable [IN]
- * a(?) [IN] Is_enable
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_set_key_handle_in_high_frequency(MMI_BOOL is_enable)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* do nothing */
- }
- /*****************************************************************************
- * FUNCTION
- * KeyTimerExpiryProc
- * DESCRIPTION
- * Timer expiry procedure
- * PARAMETERS
- * idEvent [?]
- * handle(?) [IN] To window
- * RETURNS
- * void
- *****************************************************************************/
- void KeyTimerExpiryProc(void *idEvent)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 i;
- MMI_BOOL bNeedToDo = MMI_FALSE;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Check the timer ID */
- if ((KEY_TIMER_ID0 <= (U32) idEvent) && ((U32) idEvent < UI_TIMER_ID_BASE))
- {
- for (i = 0; i < MAX_KEYPADMAP; i++)
- {
- bNeedToDo = MMI_FALSE;
- if (((S32) idEvent) == nKeyPadMap[i].nTimerId)
- {
- /* Check the keypad status. It should not be KEY_EVENT_UP */
- if (nKeyPadStatus[i] == KEY_EVENT_DOWN)
- {
- nKeyPadStatus[i] = KEY_LONG_PRESS;
- bNeedToDo = MMI_TRUE;
- }
- else if ((nKeyPadStatus[i] == KEY_LONG_PRESS) || (nKeyPadStatus[i] == KEY_REPEAT))
- {
- nKeyPadStatus[i] = KEY_REPEAT;
- bNeedToDo = MMI_TRUE;
- }
- /* stop the timer even the keypad status is KEY_EVENT_UP */
- StopTimer(nKeyPadMap[i].nTimerId);
- /* Only the */
- if (bNeedToDo == MMI_TRUE)
- {
- KEYBRD_MESSAGE KeyBrdMsg;
- KeyBrdMsg.nMsgType = nKeyPadStatus[i];
- KeyBrdMsg.nKeyCode = nKeyPadMap[i].nMMIKeyCode;
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_PROC_TIMER_EVENT_HDLR, KeyBrdMsg.nMsgType,
- KeyBrdMsg.nKeyCode));
- KeyEventHandler((KEYBRD_MESSAGE*) & KeyBrdMsg);
- StartTimer(nKeyPadMap[i].nTimerId, KEYTIMER_REPEAT, (FuncPtr) KeyTimerExpiryProc);
- }
- break;
- }
- }
- }
- else
- {
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_ERROR_KEY_TIMER_EXPIRY_HDLR, (U32) idEvent));
- MMI_ASSERT(0);
- }
- }
- /* MTK added, Max to solve power on race condition 0730 */
- #else
- /*****************************************************************************
- * FUNCTION
- * InitKeypadBeforePWRON
- * DESCRIPTION
- * Initializes keypad before power on
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void InitKeypadBeforePWRON(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- SetProtocolEventHandler(KeyHandleBeforePWRON, MSG_ID_MMI_EQ_KEYPAD_DETECT_IND);
- }
- /*****************************************************************************
- * FUNCTION
- * KeyHandleBeforePWRON
- * DESCRIPTION
- * This function detects key presses before power on
- * PARAMETERS
- * paraBuff [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void KeyHandleBeforePWRON(void *paraBuff)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_eq_keypad_detect_ind_struct *p;
- kbd_data k;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- p = (mmi_eq_keypad_detect_ind_struct*) paraBuff;
- while ((*(p->func)) (&k) == KAL_TRUE);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_convert_process_key_event
- * DESCRIPTION
- * convert the driver key event type to MMI key event type
- * and process the key event
- * PARAMETERS
- * Keyevent [IN]
- * KeyMapIndex [IN]
- * a(?) [IN] ParaBuff
- * RETURNS
- * void
- *****************************************************************************/
- #if defined(__MMI_SCREEN_ROTATE__)
- static mmi_frm_screen_rotate_enum key_rotate = MMI_FRM_SCREEN_ROTATE_0;
- #endif
- void mmi_frm_convert_process_key_event(U32 Keyevent, U16 KeyMapIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (Keyevent == WM_KEYPRESS)
- {
- #ifdef __MMI_SCREEN_ROTATE__
- key_rotate = mmi_frm_get_screen_rotate();
- #endif
- }
- #ifdef __MMI_INTERACTIVE_PROFILNG__
- if (Keyevent == WM_KEYPRESS)
- {
- mmi_frm_profiling_interactive_start3();
- }
- else if (Keyevent == WM_KEYRELEASE)
- {
- mmi_frm_profiling_interactive_start2();
- }
- #endif /* __MMI_INTERACTIVE_PROFILNG__ */
- #ifdef __MMI_SCREEN_ROTATE__
- switch (key_rotate)
- {
- case MMI_FRM_SCREEN_ROTATE_270:
- switch (KeyMapIndex)
- {
- case DEVICE_KEY_UP:
- KeyMapIndex = DEVICE_KEY_LEFT;
- break;
- case DEVICE_KEY_DOWN:
- KeyMapIndex = DEVICE_KEY_RIGHT;
- break;
- case DEVICE_KEY_LEFT:
- KeyMapIndex = DEVICE_KEY_DOWN;
- break;
- case DEVICE_KEY_RIGHT:
- KeyMapIndex = DEVICE_KEY_UP;
- break;
- }
- break;
- }
- #endif /* __MMI_SCREEN_ROTATE__ */
- ProcessKeyEvent(Keyevent, KeyMapIndex);
- if (Keyevent == WM_KEYRELEASE)
- {
- #ifdef __MMI_SCREEN_ROTATE__
- key_rotate = MMI_FRM_SCREEN_ROTATE_0;
- #endif
- }
- #ifdef __MMI_INTERACTIVE_PROFILNG__
- if (Keyevent == WM_KEYPRESS)
- {
- mmi_frm_profiling_interactive_end3();
- }
- else if (Keyevent == WM_KEYRELEASE)
- {
- mmi_frm_profiling_interactive_end2();
- mmi_frm_profiling_interactive_show((U8*) L"K", MMI_FRM_PROFILING_MASK_2 | MMI_FRM_PROFILING_MASK_3);
- }
- #endif /* __MMI_INTERACTIVE_PROFILNG__ */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_set_key_handle_in_high_frequency
- * DESCRIPTION
- * This function is to process the keypad handler in high frequency mode
- * PARAMETERS
- * is_enable [IN]
- * a(?) [IN] Is_enable
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_set_key_handle_in_high_frequency(MMI_BOOL is_enable)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- g_process_key_in_high_frequency = is_enable;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_key_handle
- * DESCRIPTION
- * This function is to process the keypad handler.
- * PARAMETERS
- * paraBuff [?]
- * a(?) [IN] ParaBuff
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_key_handle(void *paraBuff)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- kbd_data k;
- U32 msg_count;
- mmi_eq_keypad_detect_ind_struct *p;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (paraBuff != NULL)
- {
- drv_get_key_func new_key_ptr;
- p = (mmi_eq_keypad_detect_ind_struct*) paraBuff;
- new_key_ptr = (drv_get_key_func) (p->func);
- if (new_key_ptr != keypad_ptr)
- {
- ClearKeyEvents();
- }
- keypad_ptr = new_key_ptr;
- }
- while (1)
- {
- if ((*(keypad_ptr)) (&k) == MMI_TRUE)
- {
- if (k.Keydata[0] != KEY_INVALID)
- {
- static U8 is_allow_key_action = MMI_TRUE;
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- kal_bool is_pen_enabled, is_pen_down;
- mmi_pen_get_state(&is_pen_enabled, &is_pen_down);
- #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */
- #if defined(__MMI_SLEEP_OUT_BACKLIGHT_ON__)
- if ((IsBacklightOn() == MMI_FALSE) && (k.Keyevent == WM_KEYPRESS))
- {
- //KP Jerry modify for LCD Backlight don't open when press any key during keypad been locked on 2007-4-4 start
- #ifdef __MMI_LCD_OFF_WHEN_ANYKEY_PRESSED_AND_KEYPAD_LOCKED__
- if(g_keylock_context.gKeyPadLockFlag)
- {
- if( (k.Keydata[0] == DEVICE_KEY_SEND) || (k.Keydata[0] == DEVICE_KEY_END) || (k.Keydata[0] == DEVICE_KEY_SK_RIGHT) )
- TurnOnBacklight(1); /* timer backlight control */
- }
- else
- {
- TurnOnBacklight(1); /* timer backlight control */
- }
- #else
- TurnOnBacklight(1); /* timer backlight control */
- #endif
- //KP Jerry modify for LCD Backlight don't open when press any key during keypad been locked on 2007-4-4 end
- is_allow_key_action = MMI_FALSE;
- }
- else
- #endif /* defined(__MMI_SLEEP_OUT_BACKLIGHT_ON__) */
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- if (is_pen_down && (k.Keyevent == WM_KEYPRESS))
- {
- is_allow_key_action = MMI_FALSE;
- }
- else
- #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */
- if ((k.Keyevent == WM_KEYRELEASE) && (is_allow_key_action == MMI_FALSE))
- {
- is_allow_key_action = MMI_TRUE;
- }
- else if (is_allow_key_action == MMI_TRUE)
- {
- if ((k.Keyevent == WM_KEYPRESS) && (mmi_kbd_get_key_is_pressing_count() == 0))
- {
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- mmi_pen_disable();
- #endif
- }
- mmi_frm_convert_process_key_event(k.Keyevent, k.Keydata[0]);
- if ((k.Keyevent == WM_KEYRELEASE) && (mmi_kbd_get_key_is_pressing_count() == 0))
- {
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- mmi_pen_enable();
- #endif
- }
- }
- }
- msg_get_ext_queue_info(mmi_ext_qid, &msg_count);
- if (msg_count > 0 || OslNumOfCircularQMsgs() > 0)
- {
- g_keypad_flag = MMI_TRUE;
- break;
- }
- }
- else
- {
- g_keypad_flag = MMI_FALSE;
- break;
- }
- } /* while(1) */
- }
- #endif /* MMI_ON_WIN32 */
- /*****************************************************************************
- * FUNCTION
- * StopCurrentKeyPadTone
- * DESCRIPTION
- * Stops Current keypad tone
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void StopCurrentKeyPadTone(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (currKeyPadTone != 0xFFFF)
- {
- AudioStopReq(currKeyPadTone);
- currKeyPadTone = 0xFFFF;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * ClearKeyEvents
- * DESCRIPTION
- * Clears Keyboard buffer
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void ClearKeyEvents(void)
- {
- #ifndef MMI_ON_WIN32
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- extern drv_get_key_func keypad_ptr;
- kbd_data k;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_CLEAR_KEY_EVENTS_HDLR));
- if (keypad_ptr != NULL)
- {
- while ((*(keypad_ptr)) (&k) == KAL_TRUE)
- {
- /* restore state of keys */
- if (k.Keydata[0] != KEY_INVALID)
- {
- mmi_kbd_reset_key_state(k.Keyevent, k.Keydata[0]);
- }
- }
- }
- processUpRepeatKey = 0;
- pressKey = 0; /* 0- full up, 1- half down, 2- full down */
- StopCurrentKeyPadTone();
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- /*
- * We disable pen on key down and enable pen on key up.
- * * If key down and key up events are not paired, pen is not enabled again.
- */
- mmi_pen_enable();
- #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */
- #endif /* MMI_ON_WIN32 */
- }
- #if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)
- /*****************************************************************************
- * FUNCTION
- * GetHumanVoiceToneID
- * DESCRIPTION
- *
- * PARAMETERS
- * MMIKeyCode [IN]
- * RETURNS
- *
- *****************************************************************************/
- S16 GetHumanVoiceToneID(S16 MMIKeyCode)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 i;
- U8 keypad_tone_type = GetKeypadToneType();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (keypad_tone_type >= KEYPAD_TONE_HUMAN_VOICE_1 && keypad_tone_type <= KEYPAD_TONE_HUMAN_VOICE_6)
- {
- if (!CanPlayHumanVoiceKeyTone())
- {
- return -1;
- }
- if (MMIKeyCode >= KEY_0 && MMIKeyCode <= KEY_9)
- {
- i = MMIKeyCode - KEY_0;
- }
- else if (MMIKeyCode == KEY_STAR)
- {
- i = 10;
- }
- else if (MMIKeyCode == KEY_POUND)
- {
- i = 11;
- }
- else
- {
- i = -1;
- }
- if (i >= 0)
- {
- return (S16) ((keypad_tone_type - KEYPAD_TONE_HUMAN_VOICE_1) * 13 + i + MIN_HUMAN_VOICE_ID);
- }
- }
- return -1;
- }
- #endif /* defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__) */
- #if defined(__MMI_CUST_KEYPAD_TONE__)
- /*****************************************************************************
- * FUNCTION
- * GetCustKeyPadToneID
- * DESCRIPTION
- *
- * PARAMETERS
- * MMIKeyCode [IN]
- * RETURNS
- *
- *****************************************************************************/
- S16 GetCustKeyPadToneID(S16 MMIKeyCode)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 keypad_tone_type = GetKeypadToneType();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (keypad_tone_type >= KEYPAD_TONE_CUST_1 && keypad_tone_type <= KEYPAD_TONE_CUST_6)
- {
- if (!CanPlayCustKeyTone())
- {
- return -1;
- }
- return (S16) (keypad_tone_type - KEYPAD_TONE_CUST_1 + MIN_KEYPAD_TONE_ID);
- }
- return -1;
- }
- #endif /* defined(__MMI_CUST_KEYPAD_TONE__) */
- /*****************************************************************************
- * FUNCTION
- * GetKeypadTone
- * DESCRIPTION
- *
- * PARAMETERS
- * MMIKeyCode [IN]
- * RETURNS
- *
- *****************************************************************************/
- U16 GetKeypadTone(S16 MMIKeyCode)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 is_found = MMI_FALSE;
- S16 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(__MMI_CUST_KEYPAD_TONE__)
- if ((i = GetCustKeyPadToneID(MMIKeyCode)) >= 0)
- {
- return (U16) i;
- }
- #endif /* defined(__MMI_CUST_KEYPAD_TONE__) */
- #if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)
- /* MTK added by Tim for human voice keypad tone */
- if ((i = GetHumanVoiceToneID(MMIKeyCode)) >= 0)
- {
- return (U16) i;
- }
- #endif /* defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__) */
- for (i = 0; i < MAX_KEYPADMAP; i++)
- {
- if (MMIKeyCode == nKeyPadMap[i].nMMIKeyCode)
- {
- is_found = MMI_TRUE;
- break;
- }
- }
- MMI_ASSERT(is_found == MMI_TRUE);
- return (U16) nKeyPadMap[i].KeyPadTone;
- }
- /*****************************************************************************
- * FUNCTION
- * GetCurKeypadTone
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- *
- *****************************************************************************/
- U16 GetCurKeypadTone(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return currKeyPadTone;
- }
- /*****************************************************************************
- * FUNCTION
- * SetCurKeypadTone
- * DESCRIPTION
- *
- * PARAMETERS
- * KeyTone [IN]
- * RETURNS
- *
- *****************************************************************************/
- U8 SetCurKeypadTone(U16 KeyTone)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- currKeyPadTone = KeyTone;
- return MMI_TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * GetKeypadDuration
- * DESCRIPTION
- *
- * PARAMETERS
- * MMIKeyCode [IN]
- * RETURNS
- *
- *****************************************************************************/
- U8 GetKeypadDuration(S16 MMIKeyCode)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 is_found = MMI_FALSE;
- U16 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if defined(__MMI_CUST_KEYPAD_TONE__)
- if (GetCustKeyPadToneID(MMIKeyCode) >= 0)
- {
- return DEVICE_AUDIO_PLAY_ONCE;
- }
- #endif /* defined(__MMI_CUST_KEYPAD_TONE__) */
- #if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)
- /* MTK added by Tim for human voice keypad tone */
- if (GetHumanVoiceToneID(MMIKeyCode) >= 0)
- {
- return DEVICE_AUDIO_PLAY_ONCE;
- }
- #endif /* defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__) */
- for (i = 0; i < MAX_KEYPADMAP; i++)
- {
- if (MMIKeyCode == nKeyPadMap[i].nMMIKeyCode)
- {
- is_found = MMI_TRUE;
- break;
- }
- }
- MMI_ASSERT(is_found == MMI_TRUE);
- /* return KeyToneMap[KeyCode].KeyPadDuration; */
- return nKeyPadMap[i].KeyPadDuration;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_kbd_reverse_code
- * DESCRIPTION
- * This function reversly get the key code of L4/Driver.
- * PARAMETERS
- * mmi_key_code [IN] Key code of MMI
- * RETURNS
- * key code of L4/Driver
- *****************************************************************************/
- S16 mmi_kbd_reverse_code(S16 mmi_key_code)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MMI_BOOL is_found = MMI_FALSE;
- U16 i;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- for (i = 0; i < MAX_KEYPADMAP; i++)
- {
- if (mmi_key_code == nKeyPadMap[i].nMMIKeyCode)
- {
- is_found = MMI_TRUE;
- break;
- }
- }
- MMI_ASSERT(is_found == MMI_TRUE);
- /* in current disign, keycode is equavlent to key code */
- MMI_ASSERT(i == nKeyPadMap[i].nKeyCode);
- PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "mmi_kbd_reverse_code: return %d n", nKeyPadMap[i].nKeyCode));
- return (nKeyPadMap[i].nKeyCode);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_kbd_reset_key_state
- * DESCRIPTION
- * This function set the keypad state according corrent key event.
- * But keypad handler is not executed.
- * PARAMETERS
- * MsgType [IN] Type of key event
- * KeyMapIndex [IN] Key index
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_kbd_reset_key_state(U32 MsgType, U16 KeyMapIndex)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (MsgType == WM_KEYPRESS)
- {
- nKeyPadStatus[KeyMapIndex] = KEY_EVENT_DOWN;
- key_is_pressing_count++;
- }
- else if (MsgType == WM_KEYRELEASE)
- {
- nKeyPadStatus[KeyMapIndex] = KEY_EVENT_UP;
- key_is_pressing_count--;
- }
- /*
- * else
- * others won't change key state.
- */
- }
- /*****************************************************************************
- * FUNCTION
- * GetMaxPresentAllKeys
- * DESCRIPTION
- * This function is to get all MMI keys.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U8 GetMaxPresentAllKeys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return MAX_PRESENTALLKEYS;
- }
- /*****************************************************************************
- * FUNCTION
- * GetMaxPresentDigitsKeys
- * DESCRIPTION
- * This function is to get all MMI digits keys.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- U8 GetMaxPresentDigitsKeys(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return MAX_PRESENTDIGITSKEYS;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_kbd_set_tone_state
- * DESCRIPTION
- * This function is to chage the state of keypad tone.
- * To prevent abnormal cases, keypad tone will be stopped before state changed.
- * PARAMETERS
- * state [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_kbd_set_tone_state(mmi_frm_kbd_tone_state_enum state)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* not stop original keypage tone. next key tone is able to stop previous tone if still exist */
- // StopCurrentKeyPadTone();
- frm_p->key_tone_state = state;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_kbd_get_key_tone_state
- * DESCRIPTION
- * Get the state to see if keypad tone is disabled
- * PARAMETERS
- * void
- * RETURNS
- * state of keypad tone.
- *****************************************************************************/
- mmi_frm_kbd_tone_state_enum mmi_frm_kbd_get_key_tone_state(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return frm_p->key_tone_state;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_kbd_reg_pre_key_hdlr
- * DESCRIPTION
- * Regiester function to execute before general keypad handler.
- * PARAMETERS
- * func [IN]
- * RETURNS
- * state of keypad tone.(?)
- *****************************************************************************/
- void mmi_frm_kbd_reg_pre_key_hdlr(PsKeyProcessCBPtr func)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- frm_p->kbd_pre_func = func;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_kbd_reg_post_key_hdlr
- * DESCRIPTION
- * Regiester function to execute afer general keypad handler.
- * PARAMETERS
- * func [IN]
- * RETURNS
- * state of keypad tone.(?)
- *****************************************************************************/
- void mmi_frm_kbd_reg_post_key_hdlr(PsKeyProcessCBPtr func)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- frm_p->kbd_post_func = func;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_kbd_is_tone_enabled
- * DESCRIPTION
- * Function to check if keypad tone can be played or not
- * PARAMETERS
- * key_code [IN] Key code
- * key_type [IN] Key type
- * RETURNS
- * TRUE if the keypad tone shall be played by framework; otherwise, FALSE.
- *****************************************************************************/
- BOOL mmi_frm_kbd_is_tone_enabled(S16 key_code, S16 key_type)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 tone_type = GetKeypadToneType();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (tone_type == KEYPAD_SILENT /* silent profile */
- || frm_p->key_tone_state == MMI_KEY_TONE_DISABLED)
- {
- return FALSE;
- }
- else if (frm_p->key_tone_state == MMI_KEY_VOL_TONE_DISABLED)
- {
- /* disable volume keypad tone */
- if (key_code == KEY_VOL_UP || key_code == KEY_VOL_DOWN)
- {
- return FALSE;
- }
- }
- else if (frm_p->key_tone_state == MMI_KEY_VOL_UP_DOWN_TONE_DISABLED)
- {
- /* disable volume keypad tone */
- if (key_code == KEY_VOL_UP || key_code == KEY_VOL_DOWN ||
- key_code == KEY_UP_ARROW || key_code == KEY_DOWN_ARROW)
- {
- return FALSE;
- }
- }
- else if (frm_p->key_tone_state == MMI_KEY_RIGHT_LEFT_ARROW_TONE_DISABLED)
- {
- if (key_code == KEY_RIGHT_ARROW || key_code == KEY_LEFT_ARROW)
- {
- return FALSE;
- }
- }
- return TRUE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_play_keypad_tone
- * DESCRIPTION
- * Function to play corresponding keypad tone
- * PARAMETERS
- * key_code [IN] Key code
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_play_keypad_tone(S16 key_code)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 tone_type = GetKeypadToneType();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (tone_type == KEYPAD_CLICK)
- {
- AudioPlayReq(TONE_KEY_CLICK, DEVICE_AUDIO_PLAY_ONCE);
- }
- else
- {
- SetCurKeypadTone(GetKeypadTone(key_code));
- frm_p->key_tone_id = GetCurKeypadTone();
- frm_p->key_tone_duration = GetKeypadDuration(key_code);
- AudioPlayReq(frm_p->key_tone_id, frm_p->key_tone_duration);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_frm_stop_keypad_tone
- * DESCRIPTION
- * Function to stop corresponding keypad tone
- * PARAMETERS
- * key_code [IN] Key code
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_stop_keypad_tone(S16 key_code)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 tone_type = GetKeypadToneType();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (tone_type == KEYPAD_TONE)
- {
- SetCurKeypadTone(0xFFFF);
- if (GetKeypadDuration(key_code) == DEVICE_AUDIO_PLAY_INFINITE)
- {
- AudioStopReq(GetKeypadTone(key_code));
- }
- }
- #if defined(__MMI_CUST_KEYPAD_TONE__)
- else if (tone_type >= KEYPAD_TONE_CUST_1 && tone_type <= KEYPAD_TONE_CUST_6
- #if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)
- && frm_p->key_tone_id < MIN_HUMAN_VOICE_ID) /* MIN_KEYPAD_TONE_ID > MIN_HUMAN_VOICE_ID */
- #else
- && frm_p->key_tone_id < MIN_KEYPAD_TONE_ID)
- #endif
- {
- SetCurKeypadTone(0xFFFF);
- if (frm_p->key_tone_duration == DEVICE_AUDIO_PLAY_INFINITE)
- {
- AudioStopReq(frm_p->key_tone_id);
- }
- }
- #endif /* defined(__MMI_CUST_KEYPAD_TONE__) */
- #if defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__)
- else
- if (tone_type >= KEYPAD_TONE_HUMAN_VOICE_1 && tone_type <= KEYPAD_TONE_HUMAN_VOICE_6 && frm_p->key_tone_id < MIN_HUMAN_VOICE_ID) /* MIN_KEYPAD_TONE_ID > MIN_HUMAN_VOICE_ID */
- {
- SetCurKeypadTone(0xFFFF);
- if (frm_p->key_tone_duration == DEVICE_AUDIO_PLAY_INFINITE)
- {
- AudioStopReq(frm_p->key_tone_id);
- }
- }
- #endif /* defined(__MMI_HUMAN_VOICE_KEYPAD_TONE__) */
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_kbn_key_tone_hdlr
- * DESCRIPTION
- * Function to handle general keypad tones
- * PARAMETERS
- * eventKey [IN] Key event
- * RETURNS
- * TRUE if general key tone plays; otherwise, FALSE.
- *****************************************************************************/
- U8 mmi_kbn_key_tone_hdlr(KEYBRD_MESSAGE *eventKey)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* MTK added by JL 031220 for mute microphone to avoid the conflict with speaker and cause the DTMF frequency error */
- PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "key event <<code %d, type %d>> n", eventKey->nKeyCode,
- eventKey->nMsgType));
- if (eventKey->nKeyCode == KEY_INVALID)
- {
- return MMI_TRUE;
- }
- /* To Play Tones */
- if (eventKey->nMsgType == KEY_EVENT_DOWN)
- {
- if (mmi_frm_kbd_is_tone_enabled(eventKey->nKeyCode, eventKey->nMsgType))
- {
- mmi_frm_play_keypad_tone(eventKey->nKeyCode);
- }
- }
- else if (eventKey->nMsgType == KEY_EVENT_UP)
- {
- mmi_frm_stop_keypad_tone(eventKey->nKeyCode);
- }
- #ifdef MMI_ON_WIN32
- if (((S16) eventKey->nMsgType == WM_KEYBRD_PRESS || (S16) eventKey->nMsgType == WM_KEYBRD_RELEASE))
- {
- MMI_system_keybord_handler((S16) eventKey->nKeyCode, (S16) eventKey->nMsgType);
- return MMI_TRUE;
- }
- #endif /* MMI_ON_WIN32 */ /* 0 */
- //move to Framework ExecuteCurrKeyHandler((S16)eventKey->nKeyCode,(S16)eventKey->nMsgType);
- //To continue to handler framework process, if false.
- return MMI_FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_kbd_app_key_hdlr
- * DESCRIPTION
- * Function to handle general appplication events
- * PARAMETERS
- * eventKey [?]
- * key_code(?) [IN] Key code
- * RETURNS
- * U8, if return true, Framework will not control the key, otherwse.
- *****************************************************************************/
- extern void mmi_idle_key_event_backlight_check(void);
- extern void mmi_idle_key_event_keypad_lock_check(KEYBRD_MESSAGE *eventKey);
- U8 mmi_kbd_app_key_hdlr(KEYBRD_MESSAGE *eventKey)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* diamond, 2006/02/06 Move these checking codes to idleapp.c */
- mmi_idle_key_event_backlight_check();
- mmi_idle_key_event_keypad_lock_check(eventKey);
- return mmi_kbn_key_tone_hdlr(eventKey);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_kbd_set_concurrent_mode
- * DESCRIPTION
- * Function to trun on/off concurrent mode. Key concurrent mode is to allow
- * application handling (through call-back) concurrent two-key events on keypad.
- * For example, user presses "up arrow" key while "left arrow" is pressing.
- * In general cases, the mode is turned off to prevent applicaiton to make mistake
- * at processing key events.
- * PARAMETERS
- * mode [IN] Concurrent mode
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_kbd_set_concurrent_mode(MMI_BOOL mode)
- {
- #if defined(__TWO_KEY_DETECTION_SWITCHABLE__)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #if !defined(MMI_ON_WIN32)
- if (mode == MMI_TRUE)
- {
- /* enable 2 key simultanenous detection */
- kbd_two_key_detection_switch(KAL_TRUE);
- }
- else
- {
- /* disable 2 key simultanenous detection */
- kbd_two_key_detection_switch(KAL_FALSE);
- }
- #endif /* !defined(MMI_ON_WIN32) */
- ClearKeyEvents();
- g_kbd_concurrent_key_mode = mode;
- #endif /* defined(__TWO_KEY_DETECTION_SWITCHABLE__) */
- return;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_kbd_get_concurrent_mode
- * DESCRIPTION
- * Function to handle transparent mode
- * PARAMETERS
- * void
- * RETURNS
- * MMI_TRUE if at coucurrent mode; MMI_FALSE if not.
- *****************************************************************************/
- MMI_BOOL mmi_kbd_get_concurrent_mode(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return g_kbd_concurrent_key_mode;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_kbd_get_key_is_pressing_count
- * DESCRIPTION
- * Function to query count of keys are under pressing state
- * PARAMETERS
- * void
- * RETURNS
- * count of keys are under pressing state
- *****************************************************************************/
- U8 mmi_kbd_get_key_is_pressing_count(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return key_is_pressing_count;
- }
- /*****************************************************************************
- * FUNCTION
- mmi_frm_set_default_power_onoff_key
- * DESCRIPTION
- * set power on/off key to default handler
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_frm_set_default_power_onoff_key(void)
- {
- #ifdef __MMI_POWER_ON_OFF_BY_POWER_KEY__
- SetKeyHandler(NULL, KEY_END, KEY_LONG_PRESS);
- SetKeyHandler(ShutdownSystemOperation, KEY_POWER, KEY_LONG_PRESS);
- #else
- SetKeyHandler(ShutdownSystemOperation, KEY_END, KEY_LONG_PRESS);
- #endif /* __MMI_POWER_ON_OFF_BY_POWER_KEY__ */
- }