📄 keybrd.c
字号:
}
/*****************************************************************************
* 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_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -