GeneralDeviceInterface.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:132k
源码类别:
MTK
开发平台:
C/C++
- /*****************************************************************************
- * 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:
- * ---------
- * GeneralDeviceInterface.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * This file is intends for Utility functions for GPIO
- *
- * Author:
- * -------
- * -------
- *
- *============================================================================
- * HISTORY
- * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *------------------------------------------------------------------------------
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- * removed!
- * removed!
- * removed!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- /*****************************************************************************
- * Include
- *****************************************************************************/
- #include "MMI_features.h"
- /* Include: MMI header file */
- #include "StdC.h"
- #include "L4Dr1.h"
- #include "gpioInc.h"
- #include "PhnsetPROT.h"
- #include "KeyBrd.h"
- #include "pixteldatatypes.h"
- #include "QueueGprot.h"
- #include "IdleAppDef.h"
- #include "TimerEvents.h"
- #include "EventsGprot.h"
- #include "wgui_categories.h"
- #include "wgui_status_icons.h"
- #include "SettingProfile.h"
- #include "ProfileGprots.h"
- #include "IdleAppProt.h"
- #include "SimDetectionGexdcl.h"
- #include "SimDetectionGprot.h"
- #include "GlobalDefs.h"
- #include "CallManagementIdDef.h"
- #include "CallManagementGprot.h"
- #ifdef __MMI_VOIP__
- #include "VoIPGProt.h"
- #endif
- #include "CommonScreens.h"
- #include "SubLCDHistoryGprot.h"
- #include "NVRAMProt.h"
- #include "NVRAMEnum.h"
- #include "NVRAMType.h"
- #include "DebugInitDef.h"
- #include "mmiapi_enum.h"
- #include "mmiapi_struct.h"
- #include "Mdi_datatype.h"
- #include "Mdi_audio.h"
- #include "mdi_video.h"
- #include "lcd_if.h"
- #include "gdi_include.h"
- #include "custom_equipment.h"
- #include "AlarmFrameworkProt.h"
- #include "PhoneBookTypes.h"
- #include "WPSSProtos.h"
- #include "Event_shed.h"
- #if defined(__MMI_BT_HP_SUPPORT__)
- #include "BTMMIHPGprots.h"
- #endif
- #ifdef __CTM_SUPPORT__
- #include "TextPhoneProt.h"
- #endif
- #if defined(__MMI_BT_SUPPORT__)
- #include "BTMMIScrGprots.h"
- #endif
- #ifdef __MMI_SLIDE__
- #include "QuickAccessMenuItemProt.h"
- #include "StatusIconRes.h"
- #endif /* __MMI_SLIDE__ */
- #if defined(__MMI_VIDEO_PLAYER__) && defined(__MMI_TVOUT__)
- #include "VdoPlyGprot.h"
- #endif
- #ifdef __MMI_TVOUT__
- #include "PhoneSetupGprots.h"
- #endif
- #if defined(__MMI_SUBLCD__) && defined(__MMI_SUBLCD_COLOR__)
- #include "mmi_features_camera.h"
- #endif
- #ifdef __MMI_SUBLCD_CAMERA__
- #include "mdi_camera.h"
- #include "cameraapp.h"
- #endif
- #ifdef __PHOEDT_FEATURE_SLIDSHOW__
- #include "PhotoEditorGProt.h" /* ignore slide shell effect */
- #endif /* __PHOEDT_FEATURE_SLIDSHOW__ */
- #include "SettingDefs.h"
- #include "MainMenuDef.h"
- #ifdef MMI_ON_HARDWARE_P
- #include "l4dr.h"
- #include "lcd_sw.h"
- #include "lcd_sw_inc.h"
- #endif /* MMI_ON_HARDWARE_P */
- #if defined(__WIFI_SUPPORT__) && defined (__MTK_TARGET__)
- #include "wndrv_api.h"
- #endif
- #ifdef __MMI_VIDEO_PLAYER__
- #include "VdoPlyGprot.h"
- #endif
- #ifdef __MMI_VIDEO_RECORDER__
- #include "VdoRecGprot.h"
- #endif
- #ifdef __MMI_GAME__
- #include "GameFramework.h" /* temp solution for checking if current screen is game screen */
- #endif /* __MMI_GAME__ */
- //KP Jerry add on 2007-4-17 start
- #ifdef __LINE_CONTROL_EARPHONE_SUPPORT__
- #include "AudioPlayerDef.h"
- extern BOOL g_mmi_audply_init_done;
- extern mmi_audply_init_before_entry_main();
- extern mmi_audply_enable_key_button();
- #endif
- //KP Jerry add on 2007-4-17 end
- /*****************************************************************************
- * Local variable
- *****************************************************************************/
- static U8 isTimerSuspend; /* Is UI timer (aligned) suspended. 0 == non-suspend, 1 == suspend */
- static U8 gbacklight_mode = 1;
- static U8 gpioOutOfCtrl;
- static U8 sublcd_backlight; /* 0 = dark. 1 = light */
- static U8 keypad_backlight; /* 0 = dark. 1 = light */
- /* 0 = no timer, 1 = timer for half mode backlight , 2 = timer for sleep mode, 3 = in sleep mode */
- static U8 gBackLightTimerStatus = 1;
- static U8 IsCallerGroupPatternPlaying;
- static U8 aud_mode_to_resume;
- /*****************************************************************************
- * Local function
- *****************************************************************************/
- static void BacklightTimerHdlr(void);
- #if (defined(__MMI_CLAMCLOSE_BACK2IDLE__) || defined (__MMI_SUBLCD_SHOW_ANALOG_CLOCK__) )
- static void ClamCloseGotoIdleScreen(void);
- #endif
- #if defined(__MMI_CLAMSHELL__) || defined(__MMI_SLIDE__)
- static BOOL IsClamToneAllow(void);
- #endif
- static void EarphoneConnectHdlr(BOOL is_in);
- static void EarphoneDisplayPopup(BOOL is_plugin);
- static void GpioEarphonePlugIn(void);
- static void GpioEarphonePlugOut(void);
- static void GpioTurnOffKeypadLight(void);
- static void GpioLCDSleepIn(void);
- static void GpioLCDSleepOut(void);
- static void GpioTurnOnKeypadLight(void);
- /*****************************************************************************
- * Global function
- *****************************************************************************/
- void SetBacklightMode(void *info);
- void GpioSendMsg(U16 src_mod_id, U16 msg_id, void *local_param_ptr, void *peer_buf_ptr);
- #if defined(__MMI_LCMSLEEP_BACK2IDLE__)
- void LCMSleepGotoIdleScreen(void);
- #endif
- /*****************************************************************************
- * Global variable
- *****************************************************************************/
- U8 lcd_backlight = 1; /* 0 = dark, 1 = half light, 2 = full light */
- #if defined(__MMI_CLAMSHELL__) && !defined(__AMNT__) //Old:#if defined(__MMI_CLAMSHELL__) && !defined(__MMI_SLIDE__) && !defined(__AMNT__) //KP Jerry disable "!defined(__MMI_SLIDE__)" for keep sync with drv on 2007-4-25
- U8 gMMIClamState = 0; /* Sync with Drv state */
- #else
- U8 gMMIClamState = 1;
- #endif
- U8 isEarphonePlugged = 0;
- #if !defined(__MMI_GPIO_DISABLE_SLEEP_MODE__)
- BOOL gIsInSleepMode = KAL_FALSE;
- #endif
- #ifdef __MMI_ENGINEER_MODE__
- U32 gClamOpenCnt = 0;
- U32 gClamCloseCnt = 0;
- #endif /* __MMI_ENGINEER_MODE__ */
- U32 gDeviceState = 0x0; /* Keep device state for concurrency accessing */
- /*****************************************************************************
- * External variable
- *****************************************************************************/
- extern event_scheduler *event_scheduler1_ptr;
- extern pBOOL processingNow;
- extern U8 mmi_msg_need_mem_full_ind(void);
- #if ( defined(__MMI_ENGINEER_MODE__) || defined(__MMI_FACTORY_MODE__))
- extern U8 gCurrentMode;
- #endif
- #ifdef MMI_ON_HARDWARE_P
- extern PROFILE gcurrentprofile;
- #endif
- /*****************************************************************************
- * External functitons
- *****************************************************************************/
- extern void UI_BLT_double_buffer(S32 x1, S32 y1, S32 x2, S32 y2);
- #ifdef MMI_ON_WIN32
- extern void simulate_lcd_bklight_turn_off(void);
- extern void simulate_sublcd_bklight_turn_off(void);
- extern void simulate_lcd_bklight_turn_on(void);
- extern void simulate_sublcd_bklight_turn_on(void);
- #endif /* MMI_ON_WIN32 */
- extern void SendSetHWLevelInfoReq(void);
- #ifdef __MMI_AUDIO_PLAYER__
- extern BOOL mmi_audply_is_play_activated(void);
- #ifdef __MMI_AUDIO_SPECTRUM_DISPLAY__
- void mmi_audply_turn_on_spectrum(void);
- void mmi_audply_turn_off_spectrum(void);
- #endif /* __MMI_AUDIO_SPECTRUM_DISPLAY__ */
- #endif /* __MMI_AUDIO_PLAYER__ */
- #ifdef __MMI_FM_RADIO__
- extern BOOL mmi_fmrdo_is_power_on(void);
- #endif
- #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
- extern void ShowSubLCDAnalogClockScreen(void);
- #endif
- /*****************************************************************************
- * FUNCTION
- * backlight_check_call_present
- * DESCRIPTION
- * check if there is a call
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static pBOOL backlight_check_call_present(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* We should not use GetTotalCallCount() because it does not handle automatic call redial */
- if (isInCall() && !IsWapCallPresent())
- {
- return MMI_TRUE;
- }
- else
- {
- return MMI_FALSE;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * GpioDetectInd
- * DESCRIPTION
- * Event handler of gpio detect indication
- *
- * PARAMETERS: mmi_eq_gpio_detect_ind_struct *
- * info [IN]
- *****************************************************************************/
- void GpioDetectInd(void *info)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- mmi_eq_gpio_detect_ind_struct *gpioDetectInd;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gpioDetectInd = (mmi_eq_gpio_detect_ind_struct*) info;
- if (mmi_bootup_is_before_power_on() == MMI_TRUE)
- {
- switch (gpioDetectInd->gpio_device)
- {
- case EXT_DEV_EARPHONE:
- if (gpioDetectInd->on_off == 1)
- {
- isEarphonePlugged = 1;
- //KP Jerry add on 2007-4-17 start
- #ifdef __LINE_CONTROL_EARPHONE_SUPPORT__
- uem_send_msg_to_aux(MSG_ID_AUX_LC_EARPHONE_PLUGIN);
- #endif
- //KP Jerry add on 2007-4-17 end
- {
- #if (defined (__MMI_STATUS_ICON_EN_EARPHONE__) || defined(__MMI_BT_SUPPORT__))
- IdleSetStatusIcon(STATUS_ICON_EARPHONE_INDICATOR);
- #endif
- }
- }
- else
- {
- //KP Jerry add on 2007-4-17 start
- #ifdef __LINE_CONTROL_EARPHONE_SUPPORT__
- uem_send_msg_to_aux(MSG_ID_AUX_CALL_DISCONNECT_REQ_IND);
- #endif
- //KP Jerry add on 2007-4-17 end
- isEarphonePlugged = 0;
- }
- mdi_audio_set_audio_mode(isEarphonePlugged);
- break;
- #ifdef __MMI_CLAMSHELL__
- case EXT_DEV_CLAM_OPEN:
- gMMIClamState = 1;
- break;
- case EXT_DEV_CLAM_CLOSE:
- gMMIClamState = 0;
- break;
- #endif /* __MMI_CLAMSHELL__ */
- default:
- break;
- }
- PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "[GPIO] GPIO indication before power on"));
- return;
- }
- switch (gpioDetectInd->gpio_device)
- {
- case EXT_DEV_EARPHONE: /* Earphone plug in/out */
- {
- if (gpioDetectInd->on_off == 1)
- {
- EarphoneConnectHdlr(MMI_TRUE);
- }
- else
- {
- EarphoneConnectHdlr(MMI_FALSE);
- }
- break;
- }
- case EXT_DEV_KEY_1: /* SEND(END) key press */
- {
- if (mmi_bootup_is_in_power_on_period() == MMI_FALSE)
- {
- if (isInCall())
- {
- PRINT_INFORMATION(("n[GpioDetectInd] In Call, Ready to Process Headset Keyn"));
- #ifdef __MMI_VOIP__
- if (GetTotalCallCount() != 0)
- {
- ProcessHeadsetKeyPress();
- PRINT_INFORMATION(("n[GpioDetectInd] Process Headset Key for GSMn"));
- }
- else if (mmi_voip_app_total_call() != 0)
- {
- mmi_voip_entry_headsetkey();
- PRINT_INFORMATION(("n[GpioDetectInd] Process Headset Key for VoIPn"));
- }
- #else
- ProcessHeadsetKeyPress();
- #endif
- }
- }
- break;
- }
- //KP Jerry add on 2007-4-17 start
- #ifdef __LINE_CONTROL_EARPHONE_SUPPORT__
- case EXT_DEV_KEY_PLAY_AND_STOP:
- {
- if(GetCurrentState()!=CM_IDLE_STATE)
- ProcessHeadsetKeyPress();
- else
- {
- if(!g_mmi_audply_init_done)
- mmi_audply_init_before_entry_main();
- mmi_audply_enable_key_button();
- mmi_audply_press_play_button_down();
- mmi_audply_press_play_button_up();
- }
- //kal_prompt_trace(MOD_AUX,"EXT_DEV_KEY_PLAY_AND_STOP111");
- break;
- }
- case EXT_DEV_KEY_PREV:
- {
- mmi_audply_press_prev_button_down();
- mmi_audply_press_prev_button_up();
- //kal_prompt_trace(MOD_AUX,"EXT_DEV_KEY_PREV1111");
- break;
- }
- case EXT_DEV_KEY_NEXT:
- {
- mmi_audply_press_next_button_down();
- mmi_audply_press_next_button_up();
- //kal_prompt_trace(MOD_AUX,"EXT_DEV_KEY_NEXT1111");
- break;
- }
- case EXT_DEV_KEY_VOLUME_DOWN:
- {
- mmi_audply_press_dec_volume();
- //kal_prompt_trace(MOD_AUX,"EXT_DEV_KEY_VOLUME_DOWN1111");
- break;
- }
- case EXT_DEV_KEY_VOLUME_UP:
- {
- mmi_audply_press_inc_volume();
- //kal_prompt_trace(MOD_AUX,"EXT_DEV_KEY_VOLUME_UP1111");
- break;
- }
- case EXT_DEV_KEY_PREV_LONGPRESS:
- {
- if(GetActiveScreenId() == SCR_ID_AUDPLY_MAIN)
- {
- mmi_audply_press_prev_button_down();
- mmi_audply_press_prev_button_longpress();
- //kal_prompt_trace(MOD_AUX,"EXT_DEV_KEY_PREV_LONGPRESS1111");
- }
- break;
- }
- case EXT_DEV_KEY_NEXT_LONGPRESS:
- {
- if(GetActiveScreenId() == SCR_ID_AUDPLY_MAIN)
- {
- mmi_audply_press_next_button_down();
- mmi_audply_press_next_button_longpress();
- //kal_prompt_trace(MOD_AUX,"EXT_DEV_KEY_NEXT_LONGPRESS1111");
- }
- break;
- }
- case EXT_DEV_KEY_PREV_LONGPRESS_STOP:
- {
- mmi_audply_press_prev_button_up();
- //kal_prompt_trace(MOD_AUX,"EXT_DEV_KEY_PREV_LONGPRESS_STOP1111");
- break;
- }
- case EXT_DEV_KEY_NEXT_LONGPRESS_STOP:
- {
- mmi_audply_press_next_button_up();
- //kal_prompt_trace(MOD_AUX,"EXT_DEV_KEY_NEXT_LONGPRESS_STOP1111");
- break;
- }
- #endif
- //KP Jerry add on 2007-4-17 end
- #ifdef __MMI_CLAMSHELL__ /* { */
- case EXT_DEV_CLAM_OPEN: /* Clam open */
- {
- gMMIClamState = 1;
- #if defined(__MMI_SUBLCD_SHOW_ANALOG_CLOCK__)
- if (g_pwr_context.PowerOnMode == POWER_ON_KEYPAD || g_pwr_context.PowerOnMode == POWER_ON_EXCEPTION)
- ForceSubLCDScreen(ShowIdleAppSubLcd);
- #endif
- #ifdef __MMI_SUBLCD_CAMERA__
- if(mmi_sublcd_camera_delete_screen_if_present())
- GoBackHistory();
- else if (mmi_idle_is_on_idle_screen()==TRUE)
- EntryIdleScreen();
- #endif
- if (!AlmIsRTCPwron())
- {
- TurnOnBacklight(1);
- }
- NotifyCMClampOpen();
- if (mmi_bootup_is_in_power_on_period() == MMI_FALSE)
- {
- if (IsClamToneAllow())
- {
- playRequestedTone(COVER_OPEN_TONE);
- //KP Jerry add on 2007-4-26 start
- #ifdef __MMI_TONE_LIST_STYLE_CHANGED__
- gui_start_timer(3000,StopExtCoverOpenTone);
- #endif
- //KP Jerry add on 2007-4-26 end
- }
- #ifdef __MMI_SLIDE__/* keypad lock for slide phone */ /* { */
- if (g_keylock_context.gKeyPadLockFlag)
- {
- if (isInCall())
- {
- /* Not display unlock message if there is an incoming call when the slide is closed */
- StopTimer(KEYPADUNLOCKEDMESSAGE_TIMER);
- g_keylock_context.gKeyPadLockFlag = 0;
- #ifndef __MMI_KEYPADLOCK_WITH_KEYTONE__
- mmi_frm_kbd_set_tone_state(MMI_KEY_TONE_ENABLED);
- #endif
- #ifdef __MMI_TOUCH_SCREEN__
- ChangeStatusIconImage(STATUS_ICON_KEYPAD_LOCK, IMG_SI_KEYPAD_UNLOCK);
- #else
- IdleResetStatusIcon(STATUS_ICON_KEYPAD_LOCK);
- #endif
- }
- else
- {
- HandlePoundKeyForUnlock();
- }
- #ifdef __MMI_TOUCH_SCREEN__ /* unblock pen for touch screen phone */
- mmi_pen_unblock();
- #endif
- }
- #endif /* __MMI_SLIDE__ */ /* } */
- #ifdef __MMI_CLAMOPEN_STOP_SCRSAVER__
- if (GetActiveScreenId() == IDLE_SCREEN_SCREENSAVER_ID)
- {
- GoBackHistory(); /* Screensaver is running */
- }
- else
- #endif /* __MMI_CLAMOPEN_STOP_SCRSAVER__ */
- mmi_idle_restart_screensaver_timer(); /* diamond, 2006/01/16 Restart screensaver timer when clam is open */
- }
- #ifdef __MMI_ENGINEER_MODE__
- gClamOpenCnt++;
- #endif
- break;
- }
- case EXT_DEV_CLAM_CLOSE: /* Clam close */
- {
- gMMIClamState = 0;
- if (mmi_bootup_is_in_power_on_period() == MMI_FALSE)
- {
- #ifndef __MMI_SLIDE__
- CloseBacklight();
- #else /* __MMI_SLIDE__ */
- if (AlmIsRTCPwron())
- {
- TurnOnBacklight(0);
- }
- else
- {
- TurnOnBacklight(1);
- }
- #endif /* __MMI_SLIDE__ */
- if (IsClamToneAllow())
- {
- playRequestedTone(COVER_CLOSE_TONE);
- //KP Jerry add on 2007-4-26 start
- #ifdef __MMI_TONE_LIST_STYLE_CHANGED__
- gui_start_timer(3000,StopExtCoverCloseTone);
- #endif
- //KP Jerry add on 2007-4-26 end
- }
- #if defined(__MMI_SUBLCD_CAMERA__)
- if (mmi_bootup_is_sim_valid() && !g_keylock_context.gKeyPadLockFlag)
- SetKeyHandler(mmi_sublcd_camera_entry_option_screen, CAMERA_SHORTCUT_KEY, KEY_EVENT_DOWN);
- #endif
- }
- #ifndef __MMI_SLIDE__
- NotifyCMClampClose();
- #endif
- #if (defined __MMI_CLAMCLOSE_BACK2IDLE__ || defined __MMI_SUBLCD_SHOW_ANALOG_CLOCK__)
- ClamCloseGotoIdleScreen();
- #endif
- //KP Jerry add on 2007-4-21 start
- #ifdef __MMI_SLIDE__
- if(mmi_bootup_is_searching_or_idle_reached() && (!g_keylock_context.gKeyPadLockFlag) && (!backlight_check_call_present()))
- {
- if (mmi_bootup_is_sim_valid() == MMI_TRUE)
- {
- IdleSetKeyPadLockFlag();
- }
- else
- {
- InsertSimSetKeyPadLockFlag();
- }
- }
- #endif
- //KP Jerry add on 2007-4-21 end
- #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
- ForceSubLCDScreen(ShowSubLCDAnalogClockScreen);
- #endif
- #ifdef __MMI_ENGINEER_MODE__
- gClamCloseCnt++;
- #endif
- break;
- }
- #endif /* __MMI_CLAMSHELL__ */ /* } */
- default:
- break;
- }
- /* Popup screen display permisstion flag */
- /* Shall reset this flag in the end of msg handler func */
- SetInterruptPopupDisplay(POPUP_ALL_ON);
- }
- /*
- *Earphone_Handling_Functions
- */
- /*****************************************************************************
- * FUNCTION
- * mmi_gpio_is_earphone_plug_in
- * DESCRIPTION
- * tell other applications if the earphone exist
- * PARAMETERS
- * void
- * RETURNS
- * yse or no
- *****************************************************************************/
- BOOL mmi_gpio_is_earphone_plug_in(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- return (isEarphonePlugged == 1);
- }
- /*****************************************************************************
- * FUNCTION
- * EarphoneConnectHdlr
- * DESCRIPTION
- * General handler for earphone plug in/out
- *
- * PARAMETERS: is_in
- * is_in [IN]
- *****************************************************************************/
- static void EarphoneConnectHdlr(BOOL is_in)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Do not switch profile if not normal power on mode */
- /* 1. Charge power on --> X */
- /* 2. Alarm power on --> X */
- /* 3. RTC power on --> X */
- #ifdef __MMI_UI_DALMATIAN_STATUSBAR__
- disable_statusbar_fill_background();
- #endif
- if (g_pwr_context.PowerOnMode == POWER_ON_KEYPAD || g_pwr_context.PowerOnMode == POWER_ON_EXCEPTION)
- {
- if (is_in)
- {
- GpioEarphonePlugIn();
- }
- else
- {
- GpioEarphonePlugOut();
- }
- EarphoneDisplayPopup(is_in);
- }
- else
- {
- if (is_in)
- {
- isEarphonePlugged = 1; /* diamond, 2005/10/28 Fit the case of alarm power on + GPIO detection + keypad power on */
- aud_mode_to_resume = mdi_audio_get_audio_mode();
- mdi_audio_set_audio_mode(AUD_MODE_HEADSET);
- #if (defined (__MMI_STATUS_ICON_EN_EARPHONE__) || defined(__MMI_BT_SUPPORT__))
- IdleSetStatusIcon(STATUS_ICON_EARPHONE_INDICATOR);
- #endif
- }
- else
- {
- isEarphonePlugged = 0;
- mdi_audio_set_audio_mode(aud_mode_to_resume);
- #if (defined (__MMI_STATUS_ICON_EN_EARPHONE__) || defined(__MMI_BT_SUPPORT__))
- IdleResetStatusIcon(STATUS_ICON_EARPHONE_INDICATOR);
- #endif
- }
- }
- #ifdef __MMI_UI_DALMATIAN_STATUSBAR__
- enable_statusbar_fill_background();
- #endif
- }
- /*****************************************************************************
- * FUNCTION
- * EarphoneDisplayPopup
- * DESCRIPTION
- * Display earphone plug in/out popup
- *
- * PARAMETERS: BOOL
- * is_plugin [IN]
- *****************************************************************************/
- static void EarphoneDisplayPopup(BOOL is_plugin)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 str_id = 0;
- U8 pp_flag, tone_id = 0;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Application who wanna stop popup has to intercept related messages and set the flag */
- pp_flag = GetInterruptPopupDisplay();
- if ((pp_flag & POPUP_DSPL_ON) == 0)
- {
- return;
- }
- if (pp_flag & POPUP_TONE_ON)
- {
- tone_id = AUX_TONE;
- }
- /* Cases not allow to display popup */
- /* 1. Call manager adjusting history */
- /* 2. During power on animation */
- /* 3. Power on mode is neither Keypad nor Exception (Means, Alarm, Charger, Usb) */
- /* 4. In Engineer mode */
- /* 5. In Factory mode */
- if ((GetTransitionToActiveFlag() == MMI_TRUE)
- || (mmi_bootup_is_in_power_on_period() == MMI_TRUE)
- || (g_pwr_context.PowerOnMode != POWER_ON_KEYPAD && g_pwr_context.PowerOnMode != POWER_ON_EXCEPTION))
- {
- return;
- }
- #ifdef __MMI_ENGINEER_MODE__
- if (gCurrentMode == ENGINEERING_MODE)
- {
- return;
- }
- #endif /* __MMI_ENGINEER_MODE__ */
- #ifdef __MMI_FACTORY_MODE__
- if (gCurrentMode == FACTORY_MODE)
- {
- return;
- }
- #endif /* __MMI_FACTORY_MODE__ */
- #ifdef __CTM_SUPPORT__
- if (mmi_ctm_is_tty_on() == MMI_TRUE)
- {
- if (is_plugin == MMI_TRUE)
- {
- str_id = STR_CTM_TTY_PLUG_IN;
- }
- else
- {
- str_id = STR_CTM_TTY_PLUG_OUT;
- }
- }
- else
- #endif /* __CTM_SUPPORT__ */
- {
- /* Display popup according plug in/out */
- if (is_plugin == MMI_TRUE) /* Plug in */
- {
- str_id = STR_EARPHONE_POPUP;
- }
- else /* Plug out */
- {
- str_id = STR_HEADSET_DEACTIVATE_MESSAGE;
- }
- }
- /* Should turn on backlight first to make LCD sleep out */
- TurnOnBacklight(1);
- DisplayPopup((U8*) GetString(str_id), IMG_EARPHONE_POPUP_MAINLCD, 0, UI_POPUP_NOTIFYDURATION_TIME, tone_id);
- #ifdef __MMI_SUBLCD__
- if (MMI_TRUE == is_plugin)
- {
- DisplaySubLcdPopup(IMG_EARPHONE_POPUP_SUBLCD);
- }
- #endif /* __MMI_SUBLCD__ */
- }
- /*****************************************************************************
- * FUNCTION
- * GpioEarphonePlugIn
- * DESCRIPTION
- * General action after earphone plug in
- *
- * PARAMETERS:
- * void
- *****************************************************************************/
- static void GpioEarphonePlugIn(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- isEarphonePlugged = 1;
- #ifdef __CTM_SUPPORT__
- mmi_ctm_switch_tty_status(MMI_TRUE);
- if (mmi_ctm_is_tty_on())
- {
- /* take as TTY, don't switch profile */
- return;
- }
- #endif /* __CTM_SUPPORT__ */
- mmi_profiles_earphone_plug_in_callback();
- #if (defined (__MMI_STATUS_ICON_EN_EARPHONE__) || defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__))
- IdleSetStatusIcon(STATUS_ICON_EARPHONE_INDICATOR);
- #endif
- //KP Jerry add on 2007-4-17 start
- #ifdef __LINE_CONTROL_EARPHONE_SUPPORT__
- uem_send_msg_to_aux(MSG_ID_AUX_LC_EARPHONE_PLUGIN);
- #endif
- //KP Jerry add on 2007-4-17 end
- }
- /*****************************************************************************
- * FUNCTION
- * GpioEarphonePlugOut
- * DESCRIPTION
- * General action after earphone plug out
- *
- * PARAMETERS:
- * void
- *****************************************************************************/
- static void GpioEarphonePlugOut(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- isEarphonePlugged = 0;
- #ifdef __CTM_SUPPORT__
- mmi_ctm_switch_tty_status(MMI_FALSE);
- if (mmi_ctm_is_tty_on())
- {
- /* take as TTY, don't switch profile */
- return;
- }
- #endif /* __CTM_SUPPORT__ */
- mmi_profiles_earphone_plug_out_callback();
- #if (defined (__MMI_STATUS_ICON_EN_EARPHONE__) || defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__))
- #if defined(__MMI_BT_HP_SUPPORT__)
- if (!mmi_bt_is_hs_connected())
- #elif defined(__MMI_BT_SUPPORT__)
- if (!mmi_bt_is_hs_connected() && !mmi_bt_is_a2dp_connected())
- #endif
- {
- IdleResetStatusIcon(STATUS_ICON_EARPHONE_INDICATOR);
- }
- #endif /* (defined (__MMI_STATUS_ICON_EN_EARPHONE__) || defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__)) */
- //KP Jerry add on 2007-4-17 start
- #ifdef __LINE_CONTROL_EARPHONE_SUPPORT__
- uem_send_msg_to_aux(MSG_ID_AUX_CALL_DISCONNECT_REQ_IND);
- #endif
- //KP Jerry add on 2007-4-17 end
- }
- /*
- * Clam_handling_functions
- */
- #ifdef __MMI_GAME__
- /*****************************************************************************
- * FUNCTION
- * IsCurrentScrGameScr
- * DESCRIPTION
- * temp solution for checking if current screen is game screen
- *
- * PARAMETERS:
- * void
- *****************************************************************************/
- BOOL IsCurrentScrGameScr(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 scr_id = GetExitScrnID();
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (scr_id == GFX_MENU_SCREEN ||
- scr_id == GFX_GAME_SCREEN ||
- scr_id == GFX_LEVEL_SCREEN ||
- scr_id == GFX_GRADE_SCREEN ||
- scr_id == GFX_HELP_SCREEN ||
- scr_id == GFX_GAMEOVER_SCREEN)
- {
- return MMI_TRUE;
- }
- else
- {
- return MMI_FALSE;
- }
- }
- #endif /* __MMI_GAME__ */
- #if defined(__MMI_CLAMSHELL__) || defined(__MMI_SLIDE__)
- /*****************************************************************************
- * FUNCTION
- * IsClamToneAllow
- * DESCRIPTION
- * Query if clam tone allow to play (No other audio tone is playing, except clam tone it self
- *
- * PARAMETERS:
- * void
- *****************************************************************************/
- static BOOL IsClamToneAllow(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if ((!g_charbat_context.PowerOnCharger) && (!AlmIsRTCPwron()) && (!isInCall()) /* Even for CSD call */
- && (!AlmIsTonePlaying())
- #ifdef __MMI_AUDIO_PLAYER__
- && (!mmi_audply_is_play_activated())
- #endif
- #ifdef __MMI_FM_RADIO__
- && (!mmi_fmrdo_is_power_on())
- #endif
- #ifdef __PHOEDT_FEATURE_SLIDSHOW__
- && (!mmi_slidshow_aud_is_playing())
- #endif
- #ifdef __MMI_VIDEO_PLAYER__
- && (!mmi_vdoply_is_in_app())
- && (!mdi_video_is_playing())
- #endif
- #ifdef __MMI_VIDEO_RECORDER__
- && (!mmi_vdorec_is_in_app())
- && (!mdi_video_is_recording())
- #endif
- #ifdef __MMI_GAME__
- && (!IsCurrentScrGameScr())
- #endif
- )
- return MMI_TRUE;
- else
- {
- return MMI_FALSE;
- }
- }
- #endif /* #if defined(__MMI_CLAMSHELL__) || defined(__MMI_SLIDE__) */
- /*****************************************************************************
- * FUNCTION
- * IsClamClose
- * DESCRIPTION
- * Query clam statue
- *
- * PARAMETERS:
- * void
- *****************************************************************************/
- BOOL IsClamClose(void)
- {
- #ifdef __MMI_CLAMSHELL__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!gMMIClamState)
- {
- return MMI_TRUE; /* 0: Close */
- }
- else
- #endif /* __MMI_CLAMSHELL__ */
- return MMI_FALSE; /* 1: Open */
- }
- /*****************************************************************************
- * FUNCTION
- * SetClamState
- * DESCRIPTION
- * Set clam state
- * PARAMETERS
- * clam_state [IN] Clam state
- * RETURNS
- * void
- *****************************************************************************/
- void SetClamState(U16 clam_state)
- {
- #ifdef __MMI_CLAMSHELL__
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (clam_state == EXT_DEV_CLAM_OPEN)
- {
- gMMIClamState = 1; /* open */
- }
- else if (clam_state == EXT_DEV_CLAM_CLOSE)
- {
- gMMIClamState = 0; /* close */
- }
- else
- {
- MMI_ASSERT(0); /* wrong parameter */
- }
- #else /* __MMI_CLAMSHELL__ */
- MMI_ASSERT(0); /* shall not call this function when no clam support */
- #endif /* __MMI_CLAMSHELL__ */
- }
- /*****************************************************************************
- * FUNCTION
- * ClamCloseGotoIdleScreen
- * DESCRIPTION
- * Function for clam close go back to idle screen
- *
- * PARAMETERS:
- * void
- *****************************************************************************/
- #if (defined(__MMI_CLAMCLOSE_BACK2IDLE__) || defined (__MMI_SUBLCD_SHOW_ANALOG_CLOCK__) )
- static void ClamCloseGotoIdleScreen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (backlight_check_call_present())
- {
- if (isEarphonePlugged == 1
- #if defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__)
- || mmi_bt_is_incall_aud_swap2bt() == MMI_TRUE
- #endif
- )
- return;
- }
- PRINT_INFORMATION(("ClamCloseGotoIdleScreen():END Key Press, FP: %x", GetKeyHandler(KEY_END, KEY_EVENT_DOWN)));
- #ifdef __MMI_FACTORY_MODE__
- if (gCurrentMode == FACTORY_MODE)
- {
- return;
- }
- #endif /* __MMI_FACTORY_MODE__ */
- ClearKeyEvents();
- ExecuteCurrKeyHandler(KEY_END, KEY_EVENT_DOWN);
- }
- #endif /* (defined(__MMI_CLAMCLOSE_BACK2IDLE__) || defined (__MMI_SUBLCD_SHOW_ANALOG_CLOCK__) ) */
- /*
- * LED_pattern_handling_functions
- */
- /*****************************************************************************
- * FUNCTION
- * GetBackgroundPattern
- * DESCRIPTION
- * Returns Existing Pattern
- *
- * PARAMETERS:
- * void
- *****************************************************************************/
- U8 GetBackgroundPattern(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 band_pattern = LED_NoService;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (g_charbat_context.LowBatteryFlag && (!g_charbat_context.isChargerConnected)) /* Robin 1217, Charger connect shall not play battery low pattern */
- {
- band_pattern = LED_BATTERY_LOW;
- }
- #ifdef __MMI_LED_POWERON_CHARGEFULL__
- else if (g_charbat_context.ChargingComplete == 1)
- {
- band_pattern = LED_FullCharging;
- }
- #endif /* __MMI_LED_POWERON_CHARGEFULL__ */
- else if (mmi_bootup_is_roaming() == MMI_TRUE)
- {
- band_pattern = LED_Roaming;
- }
- else if (g_pwr_context.CurrentServiceType == FULL_SERVICE)
- {
- switch (g_pwr_context.CurrentCampOnBand)
- {
- case NW_BAND_PGSM900:
- case NW_BAND_EGSM900:
- case NW_BAND_RGSM900:
- band_pattern = LED_Connect900;
- break;
- case NW_BAND_DCS1800:
- band_pattern = LED_Connect1800;
- break;
- case NW_BAND_PCS1900:
- band_pattern = LED_Connect1900;
- break;
- default:
- band_pattern = LED_Connect900;
- break;
- }
- }
- else if (g_pwr_context.CurrentServiceType == LIMITED_SERVICE)
- {
- band_pattern = LED_LimitService;
- }
- else
- {
- band_pattern = LED_NoService;
- }
- return band_pattern;
- }
- /*****************************************************************************
- * FUNCTION
- * PlayPatternReq
- * DESCRIPTION
- * Plays a pattern on vibrator or LED
- *
- * PARAMETERS:
- * pattern [IN]
- * action [IN] ON/OFF
- *****************************************************************************/
- void PlayPatternReq(U8 pattern, U8 action)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- signed char pat = (signed char)pattern;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (gCurrentMode == ENGINEERING_MODE || gCurrentMode == FACTORY_MODE)
- {
- return;
- }
- /* Other module might request to obtain control of LEDs from MMI */
- if (gpioOutOfCtrl == 1 && !(pat >= VIB_PATTERN_BEGIN && pat <= VIB_PATTERN_END))
- {
- return;
- }
- /* Background LED pattern (for example: Camp on LED, Low battery...etc) */
- /* play request might comes anytime, it will interrupt the on going */
- /* caller group pattern */
- if ((IsCallerGroupPatternPlaying)
- && (((pat >= LED_PATTERN_BEGIN) && (pat < LED_Caller1)) || ((pat > LED_Caller6) && (pat <= LED_PATTERN_END))))
- {
- return;
- }
- if ((!g_phnset_gpio_cntx_p->led_setting) && pattern == GetBackgroundPattern() && action != PLAY_STOP)
- {
- return;
- }
- SendPlayPatternReqToHW(pat, action);
- /* Start play CampOn LED pattern */
- if ((pat >= LED_PATTERN_BEGIN && pat < LED_PATTERN_END)
- && (action == PLAY_STOP)
- && (g_phnset_gpio_cntx_p->led_setting) && (mmi_bootup_is_searching_or_idle_reached() == MMI_TRUE))
- {
- SendPlayPatternReqToHW(GetBackgroundPattern(), PLAY_REPEAT);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * PlayPatternCallerGroup
- * DESCRIPTION
- * Plays pattern as caller group functionality
- *
- * PARAMETERS:
- * pattern [IN]
- *****************************************************************************/
- void PlayPatternCallerGroup(MMI_LEDLIGHT_STATUS_ENUM pattern)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IsCallerGroupPatternPlaying = 1;
- switch (pattern)
- {
- case COLOR_PATTERN1:
- StartLEDPatternCaller1();
- break;
- case COLOR_PATTERN2:
- StartLEDPatternCaller2();
- break;
- case COLOR_PATTERN3:
- StartLEDPatternCaller3();
- break;
- case COLOR_PATTERN4:
- StartLEDPatternCaller4();
- break;
- case COLOR_PATTERN5:
- StartLEDPatternCaller5();
- break;
- case COLOR_PATTERN6:
- StartLEDPatternCaller6();
- break;
- default:
- IsCallerGroupPatternPlaying = 0;
- break;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * StopPatternCallerGroup
- * DESCRIPTION
- * Stops pattern as caller group functionality
- *
- * PARAMETERS:
- * pattern [IN]
- *****************************************************************************/
- void StopPatternCallerGroup(MMI_LEDLIGHT_STATUS_ENUM pattern)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- IsCallerGroupPatternPlaying = 0;
- switch (pattern)
- {
- case COLOR_PATTERN1:
- StopLEDPatternCaller1();
- break;
- case COLOR_PATTERN2:
- StopLEDPatternCaller2();
- break;
- case COLOR_PATTERN3:
- StopLEDPatternCaller3();
- break;
- case COLOR_PATTERN4:
- StopLEDPatternCaller4();
- break;
- case COLOR_PATTERN5:
- StopLEDPatternCaller5();
- break;
- case COLOR_PATTERN6:
- StopLEDPatternCaller6();
- break;
- }
- }
- /*
- * Tone_ID_Range_Qery_functions
- */
- /*****************************************************************************
- * FUNCTION
- * GetRingToneRange
- * DESCRIPTION
- * Gets Tone Range for Ring Tones
- *
- * PARAMETERS:
- * startId [IN]
- * totalId [IN]
- *****************************************************************************/
- void GetRingToneRange(U8 *startId, U8 *totalId)
- {
- #ifndef MMI_ON_WIN32
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 endId;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- custom_get_fixed_imelody_range(startId, &endId);
- *totalId = endId - *startId + 1;
- #else /* MMI_ON_WIN32 */
- *startId = 1;
- *totalId = 15;
- #endif /* MMI_ON_WIN32 */
- }
- /*****************************************************************************
- * FUNCTION
- * GetMidiRange
- * DESCRIPTION
- * Gets Tone Range for Midi Tones
- *
- * PARAMETERS:
- * startId [IN]
- * totalId [IN]
- *****************************************************************************/
- void GetMidiRange(U8 *startId, U8 *totalId)
- {
- #ifndef MMI_ON_WIN32
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 endId;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- custom_get_fixed_midi_range(startId, &endId);
- *totalId = endId - *startId + 1;
- #else /* MMI_ON_WIN32 */
- *startId = 16;
- *totalId = 15;
- #endif /* MMI_ON_WIN32 */
- }
- /*****************************************************************************
- * FUNCTION
- * GetToneRange
- * DESCRIPTION
- * Gets Tone Range for General Tones
- *
- * PARAMETERS: startid: Starting Range Value
- * startId [IN]
- * totalId [IN]
- *****************************************************************************/
- void GetToneRange(U8 *startId, U8 *totalId)
- {
- #ifndef MMI_ON_WIN32
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 endId;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- custom_get_fixed_sound_range(startId, &endId);
- *totalId = endId - *startId + 1;
- #else /* MMI_ON_WIN32 */
- *startId = 31;
- *totalId = 10;
- #endif /* MMI_ON_WIN32 */
- }
- /*****************************************************************************
- * FUNCTION
- * GetMiscToneRange
- * DESCRIPTION
- * Gets Tone Range for Misc Tones
- *
- * PARAMETERS: startid: Starting Range Value
- * startId [IN]
- * totalId [IN]
- *****************************************************************************/
- void GetMiscToneRange(U8 *startId, U8 *totalId)
- {
- #ifndef MMI_ON_WIN32
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U8 endId;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- custom_get_fixed_message_sound_range(startId, &endId);
- *totalId = endId - *startId + 1;
- #else /* MMI_ON_WIN32 */
- *startId = 46;
- *totalId = 10;
- #endif /* MMI_ON_WIN32 */
- }
- /*
- * Backlight_handling_functions
- */
- /*****************************************************************************
- * FUNCTION
- * GpioWakeUpTimer
- * DESCRIPTION
- * Wake up timer
- *
- * PARAMETERS: void
- * void
- *****************************************************************************/
- void GpioWakeUpTimer(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* resume timer if suspended */
- if (isTimerSuspend == 1)
- {
- if (mmi_bootup_get_active_flight_mode() == 0)
- {
- evshed_resume_all_events(event_scheduler1_ptr);
- }
- isTimerSuspend = 0;
- }
- }
- /*****************************************************************************
- * FUNCTION
- * GpioTurnOffKeypadLight
- * DESCRIPTION
- * turn off keypad backlight
- *
- * PARAMETERS: void
- * void
- *****************************************************************************/
- static void GpioTurnOffKeypadLight(void)
- {
- #ifdef MMI_ON_HARDWARE_P
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* turn off keypad backlight */
- StopTimer(GPIO_KEYPAD_LIGHT_TIMER);
- if (keypad_backlight == 1)
- {
- KeyPadBackLightOff();
- keypad_backlight = 0;
- }
- #endif /* MMI_ON_HARDWARE_P */
- }
- //KP Jerry add on 2007-4-10 start
- #ifdef __MMI_PEN_BLOCK_WHEN_KAYPAD_LOCKED__
- BOOL GetLCDSleepStatus(void)
- {
- return gIsInSleepMode;
- }
- #endif/*__MMI_PEN_BLOCK_WHEN_KAYPAD_LOCKED__*/
- //KP Jerry add on 2007-4-10 end
- /*****************************************************************************
- * FUNCTION
- * GpioLCDSleepIn
- * DESCRIPTION
- * Wake up LCM
- * PARAMETERS:
- * void
- *****************************************************************************/
- static void GpioLCDSleepIn(void)
- {
- #ifdef MMI_ON_HARDWARE_P
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (gIsInSleepMode == FALSE)
- {
- /* stop screensaver if need, since it might playing video */
- mmi_scrsvr_lcd_sleepin_handler();
- /* tvout sleepin */
- #ifdef __MMI_TVOUT__
- mmi_phnset_tvout_lcd_sleepin_handler();
- #endif
- #ifdef __MMI_AUDIO_SPECTRUM_DISPLAY__
- mmi_audply_turn_off_spectrum();
- #endif
- #if defined(__WIFI_SUPPORT__) && defined (__MTK_TARGET__)
- wndrv_LCD_isOFF();
- #endif /* #if defined(__WIFI_SUPPORT__) && defined (__MTK_TARGET__) */
- lcd_sleep_in(MAIN_LCD);
- gIsInSleepMode = TRUE;
- #ifdef __MMI_TOUCH_SCREEN__
- /* diamond, 2006/06/22 Pen will not be blocked if backlight is becoming off */
- //KP Jerry modify for LCD Backlight don't open when press any key during keypad been locked on 2007-4-4 start
- #ifdef __MMI_PEN_BLOCK_WHEN_KAYPAD_LOCKED__
- if(g_keylock_context.gKeyPadLockFlag)
- {
- mmi_pen_block();
- }
- #else
- if ((g_idle_context.IsOnIdleScreen || g_idle_context.IsOnSimErrorScreen) && g_keylock_context.gKeyPadLockFlag)
- {
- mmi_pen_unblock();
- }
- #endif
- //KP Jerry modify for LCD Backlight don't open when press any key during keypad been locked on 2007-4-4 end
- #endif /* __MMI_TOUCH_SCREEN__ */
- }
- #endif /* MMI_ON_HARDWARE_P */
- }
- /*****************************************************************************
- * FUNCTION
- * GpioLCDSleepOut
- * DESCRIPTION
- * Sleep LCM
- * PARAMETERS:
- * void
- *****************************************************************************/
- static void GpioLCDSleepOut(void)
- {
- #ifdef MMI_ON_HARDWARE_P
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (gIsInSleepMode)
- {
- ClearInterruptEventHandler(MSG_ID_MMI_EQ_ALARM_IND);
- lcd_sleep_out(MAIN_LCD);
- gIsInSleepMode = FALSE;
- #ifdef __MMI_AUDIO_SPECTRUM_DISPLAY__
- mmi_audply_turn_on_spectrum();
- #endif
- update_mainlcd_dt_display();
- update_sublcd_dt_display();
- #if defined(__MMI_SUBLCD__)
- {
- gdi_lcd_set_active(GDI_LCD_SUB_LCD_HANDLE);
- gdi_lcd_repaint_all();
- gdi_lcd_set_active(GDI_LCD_MAIN_LCD_HANDLE);
- }