MiscFunctions.c
资源名称:mmi.rar [点击查看]
上传用户:lqx1163
上传日期:2014-08-13
资源大小:9183k
文件大小:75k
源码类别:
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:
- * ---------
- * MiscFunctions.c
- *
- * Project:
- * --------
- * MAUI
- *
- * Description:
- * ------------
- * Misc Functions
- * (1) Power On/Off
- * (2) Analog clock
- * (3) Others - UI
- *
- * 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!
- *
- *------------------------------------------------------------------------------
- * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
- *============================================================================
- ****************************************************************************/
- /****************************************************************************
- * Include Files
- *****************************************************************************/
- #include "MMI_features.h"
- #include "EventsGprot.h"
- #include "FontRes.h"
- #include "CSP.h"
- #include "gdi_include.h"
- #include "gui_setting.h"
- #include "CustDataProts.h"
- #include "AlarmFrameWorkProt.h"
- #include "IdleAppDef.h"
- #include "HistoryGprot.h"
- #include "MiscFunctions.h"
- #include "SimDetectionGprot.h"
- #include "Unicodexdcl.h"
- #include "Globaldefs.h"
- #include "gpioInc.h"
- #include "SimDetectionGexdcl.h"
- #include "TimerEvents.h"
- #include "IdleAppProt.h"
- #include "ProfileGprots.h"
- #include "Fat_fs.h"
- #include "FileSystemDef.h" /* file function */
- #include "FileManagerGProt.h" /* file path / file error */
- #include "FileManagerDef.h" /* error string id */
- #include "FileMgr.h"
- #include "WPSSProtos.h" /* phone setup interface */
- #include "DebugInitDef.h" /* MMI_ASSERT */
- #include "NVRAMType.h" /* NVRAM data type */
- #include "NVRAMProt.h" /* NVRAM access fucntions */
- #include "NVRAMEnum.h" /* NVRAM ID define */
- #include "CallManagementIdDef.h" /* for MT screen id */
- #include "CustResDef.h"
- #include "PhoneSetup.h" /* Cylen 0926, customize display char */
- #ifdef MMI_ON_HARDWARE_P
- #include "GpioInc.h"
- #endif
- #include "wgui_status_icons.h"
- #include "wgui_categories_defs.h"
- #include "wgui_categories_sublcd.h"
- #include "wgui_categories_multimedia.h"
- #include "SubLCDHistoryGprot.h" /* for ForceSubLCDScreen() */
- #include "ProfilesGexdcl.h" /* for profile global var */
- #include "StatusIconRes.h"
- #include "AppMemMgrGprot.h"
- #include "ScrMemMgrGprot.h"
- #include "SettingGprots.h"
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- #include "kal_non_specific_general_types.h"
- #include "TouchScreenGprot.h"
- #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */
- #include "mmi_trc.h"
- #ifdef __DRM_SUPPORT__
- #include "Drm_gprot.h" /* DRM support */
- #endif
- #include "datetimetype.h"
- #include "app_datetime.h"
- /*****************************************************************************
- * Define
- *****************************************************************************/
- /*****************************************************************************
- * Typedef
- *****************************************************************************/
- /*****************************************************************************
- * Global Variabl
- *****************************************************************************/
- #if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
- BOOL DirectMode = FALSE;
- #endif
- BOOL g_pwron_is_terminate_diplay = FALSE;
- BOOL g_pwron_is_image = FALSE;
- BOOL g_pwron_is_successful_play = FALSE;
- BOOL g_pwron_is_entered = FALSE;
- /*****************************************************************************
- * Global Function
- *****************************************************************************/
- extern void ShowLowPowerShutdownScr(void);
- extern void EntryFMMenu(void);
- extern void ReqReadDailNum(void);
- extern void wgui_set_animation(S32 x, S32 y, MMI_ID_TYPE img);
- extern void InitAllApplications(void);
- extern void CallBackPowerOnAnimationComplete(GDI_RESULT ret);
- extern void RegisterCategory166AnimationCompleteCallback(void (*f) (S32 result));
- extern void PowerOnBatteryIndicationComplete(void);
- extern BOOL IsClamClose(void);
- extern void ShowCategory310Screen(UI_string_type string);
- /*****************************************************************************
- * Local Variable
- *****************************************************************************/
- #if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
- U8 FMPatternBuffer[20];
- S8 *ssc_fm_string = SSC_FACTORY_MODE;
- #endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */
- /*****************************************************************************
- * Local Function
- *****************************************************************************/
- void mmi_pwron_exit_animation_screen(void);
- void exit_custom_startup_screen(void);
- /*****************************************************************************
- *
- * Power On
- *
- *****************************************************************************/
- /*****************************************************************************
- * FUNCTION
- * goto_opening_screen
- * DESCRIPTION
- * go to opening screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void goto_opening_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (GetAbnormalReset() == 1) /* abnormal reset */
- {
- TurnOnBacklight(1);
- ResetAbnormalReset();
- /* to initialize SMS/CPHS after abnormal reset */
- CSPModifyHiliteHandlers();
- BeforeEntryIdleScr();
- }
- else
- {
- TurnOnBacklight(1);
- ClearInputEventHandler(MMI_DEVICE_ALL);
- ClearKeyHandler(KEY_END, KEY_LONG_PRESS);
- InitAllApplications();
- exit_custom_startup_screen();
- }
- GetPhoneLock(); /* diamond, 2006/02/27 Move this function call here because smu is not initialized in exception power on */
- }
- /*****************************************************************************
- * FUNCTION
- * exit_custom_startup_screen
- * DESCRIPTION
- * exit power on animation screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void exit_custom_startup_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (GetAbnormalReset() == 0)
- {
- gui_hide_animations();
- CSPModifyHiliteHandlers(); /* CSP Functionality needs to be here after all
- applications have initialised */
- ShowWelcomeScr();
- ShowIdleAppSubLcd();
- }
- }
- #if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
- /*****************************************************************************
- * FUNCTION
- * CallBackPowerOnAnimationCompleteWrapper
- * DESCRIPTION
- * wrapper function to enumate poweron animation play finish
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void CallBackPowerOnAnimationCompleteWrapper(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- CallBackPowerOnAnimationComplete(0);
- }
- /*****************************************************************************
- * FUNCTION
- * DirectModeToFM
- * DESCRIPTION
- * Direct entry factory mode
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void DirectModeToFM(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- DirectMode = TRUE;
- /* Low battery shutdown */
- if (((g_charbat_context.batteryStatus == PMIC_VBAT_STATUS || /* Battery Status */
- g_charbat_context.batteryStatus == PMIC_CHARGER_OUT) && g_charbat_context.isChargerConnected == 0) && (g_charbat_context.chargerLevel == BATTERY_LOW_POWEROFF)) /* Battery Level */
- {
- ShowLowPowerShutdownScr();
- return;
- }
- gui_hide_animations();
- EntryFMMenu();
- }
- /*****************************************************************************
- * FUNCTION
- * KeyPatternIdentifier
- * DESCRIPTION
- * Key Pattern Identifier
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void KeyPatternIdentifier(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 Keycode, Keytype;
- /* Avoid compile warning because KEY_0 is 0 for now,
- but it might be changed to non-zero value in the future. */
- S16 Keycode_signed;
- static U8 index = 0;
- U8 *pTemp;
- U8 len;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GetkeyInfo(&Keycode, &Keytype);
- Keycode_signed = (S16) Keycode;
- len = (strlen((char*)(ssc_fm_string)));
- if (index < len)
- {
- /* Only accept '#' , '*', '0' ~ '9' */
- if (Keycode == KEY_POUND)
- {
- FMPatternBuffer[index] = '#';
- }
- else if (Keycode == KEY_STAR)
- {
- FMPatternBuffer[index] = '*';
- }
- else if ((Keycode_signed >= KEY_0) && (Keycode <= KEY_9)) /* 0 ~ 9 */
- {
- FMPatternBuffer[index] = Keycode + '0';
- }
- index++;
- }
- if (index == len)
- {
- pTemp = (U8*) ssc_fm_string;
- if (strcmp((S8*) pTemp, (S8*) FMPatternBuffer) == 0)
- {
- ClearKeyHandler(KEY_POUND, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_STAR, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_0, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_1, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_2, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_3, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_4, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_5, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_6, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_7, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_8, KEY_EVENT_DOWN);
- ClearKeyHandler(KEY_9, KEY_EVENT_DOWN);
- DirectModeToFM();
- }
- }
- }
- #endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_pwron_play_video_callback
- * DESCRIPTION
- * play power on video result callback function
- * PARAMETERS
- * result [IN] Play video's reult
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pwron_play_video_callback(MDI_RESULT result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POWER_ON_ANIMATION_FINISH));
- if (g_pwron_is_terminate_diplay)
- {
- /* means already terminated by time out, shall skip this callback */
- return;
- }
- /* treat as gif animation */
- /* change to GIF's return */
- if (result < 0)
- {
- /* return false, will force to enter the next procedure of power on */
- CallBackPowerOnAnimationComplete(-1);
- }
- else
- {
- /* play finish successfully - reset flag to PWRON_DISPLAY_SUCCESS */
- g_pwron_is_successful_play = TRUE;
- /* call before access NVRAM */
- CallBackPowerOnAnimationComplete(GDI_GIF_LAST_FRAME);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pwron_show_image_callback
- * DESCRIPTION
- * show power on image result callback function
- * PARAMETERS
- * result [IN] Play video's reult
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pwron_show_image_callback(GDI_RESULT result)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POWER_ON_IMAGE_FINISH));
- if (g_pwron_is_terminate_diplay)
- {
- /* means already terminated by time out, shall skip this callback */
- return;
- }
- if (result < 0 && result != GDI_IMAGE_IS_STILL_IMAGE)
- {
- /* return false, will force to enter the next procedure of power on */
- CallBackPowerOnAnimationComplete(result);
- }
- /* diamond, 2005/08/28 fix still image cannot enter idle screen issue */
- else if (result == GDI_IMAGE_IS_STILL_IMAGE)
- {
- g_pwron_is_successful_play = TRUE;
- CallBackPowerOnAnimationComplete(result);
- }
- /* end, diamond */
- else
- {
- /* play finish successfully */
- g_pwron_is_successful_play = TRUE;
- /* call before access NVRAM */
- CallBackPowerOnAnimationComplete(GDI_SUCCEED);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pwron_froce_terminate_display
- * DESCRIPTION
- * force terminate power on display
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- static void mmi_pwron_froce_terminate_display(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POWER_ON_ANIMATION_TIMEOUT));
- /* if never successfully play once, force stop */
- if (!g_pwron_is_successful_play)
- {
- g_pwron_is_terminate_diplay = TRUE;
- g_pwron_is_successful_play = TRUE;
- /* mimic gif last frame callback */
- CallBackPowerOnAnimationComplete(GDI_GIF_LAST_FRAME);
- /* start another timer to try */
- gui_start_timer(200, mmi_pwron_froce_terminate_display);
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pwron_stop_animation
- * DESCRIPTION
- * this function is used to stop power on animation screen, called when ready
- * to enter idle screen, it is used to solve NVRAM & timer interlace problem
- *
- * [Note]
- * when ready to enter power on screen, it will enter goto_opening_screen(),
- * in this function, it will call InitAllApplications(), there are NVRAM access
- * in this function, which will cause NVRAM & timer interlace problem.
- *
- * we have to stop all animation timer when we are sure poweron procdure success.
- * we may call this function in mmi_ready_to_idle_screen_ind.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pwron_stop_animation(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 pwron_flag;
- S16 error;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (GetExitScrnID() != SCR_OPEN_SCREEN_ID)
- {
- return;
- }
- /* stop force teminate timer */
- gui_cancel_timer(mmi_pwron_froce_terminate_display);
- if (g_pwron_is_image)
- {
- /* stop image playing */
- StopCategory166Animation();
- }
- else
- {
- #if defined(__MMI_VIDEO_PLAYER__)
- /* stop video playing */
- StopCategory224Video();
- #endif /* defined(__MMI_VIDEO_PLAYER__) */
- }
- /* write proper value to NVRAM */
- if (!g_pwron_is_successful_play)
- {
- #if defined(__MMI_POWER_ON_OFF_DISPLAY__)
- /* restore default */
- PhnsetRstPwrOnDisplayDefault();
- #endif /* defined(__MMI_POWER_ON_OFF_DISPLAY__) */
- }
- pwron_flag = PWRON_DISPLAY_SUCCESS;
- WriteValue(NVRAM_POWER_ON_DISPLAY_SUCCESS, &pwron_flag, DS_SHORT, &error);
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pwron_pause_video
- * DESCRIPTION
- * pause video, this funcion will be used by TV-Out
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- #if defined(__MMI_VIDEO_PLAYER__)
- void mmi_pwron_pause_video(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_pwron_is_image)
- {
- PauseCategory224Video();
- }
- }
- #endif /* defined(__MMI_VIDEO_PLAYER__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_pwron_resume_video
- * DESCRIPTION
- * resume video, this funcion will be used by TV-Out
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- #if defined(__MMI_VIDEO_PLAYER__)
- void mmi_pwron_resume_video(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (!g_pwron_is_image)
- {
- ResumeCategory224Video();
- }
- }
- #endif /* defined(__MMI_VIDEO_PLAYER__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_pwron_draw_sublcd_dummy_screen
- * DESCRIPTION
- * dummy screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- #if defined(__MMI_VIDEO_PLAYER__)
- static void mmi_pwron_draw_sublcd_dummy_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* draw nothing, just for category224's sublcd screen have a screen to goback. */
- }
- #endif /* defined(__MMI_VIDEO_PLAYER__) */
- /*****************************************************************************
- * FUNCTION
- * mmi_pwron_entry_animation_screen
- * DESCRIPTION
- * start play poweron animation
- * (1) GIF animation
- * (2) Still image
- * (3) Video clip
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pwron_entry_animation_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 disp_id;
- PS8 filename_ptr;
- S16 error;
- U16 pwron_flag;
- U16 force_stop_time;
- #if defined(__MMI_VIDEO_PLAYER__)
- SubLCDHistoryNode sub_history;
- BOOL play_audio;
- #endif /* defined(__MMI_VIDEO_PLAYER__) */
- #if defined(__MMI_POWER_ON_OFF_DISPLAY__)
- FS_HANDLE fs_handle;
- #endif /* defined(__MMI_POWER_ON_OFF_DISPLAY__) */
- U16 res_type;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /*
- *
- * Power On Procedure
- *
- * Power On Display NAND SIM Net Search Idle Scr
- * #----------------------#----------#----------#-------------#-----------#
- * (option) (option) (option)
- *
- *
- */
- /* if is entered before, means back from interrupt while playing power on display */
- if (g_pwron_is_entered)
- {
- MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POWER_ON_BACK2_ANIMATION));
- ClearInputEventHandler(MMI_DEVICE_ALL); /* Prevent from END key is pre-registered by call management */
- ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
- /* MT/SMS/USSD or other inetrrupt happened during poweron display, some initialzation need to be done afterward */
- PowerOnBatteryIndicationComplete();
- return;
- }
- MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POWER_ON_START_ANIMATION));
- /* init */
- filename_ptr = NULL;
- disp_id = 0;
- g_pwron_is_entered = TRUE;
- g_pwron_is_image = TRUE;
- g_pwron_is_successful_play = FALSE;
- if (mmi_bootup_is_sim_failure_received() == MMI_TRUE)
- {
- g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_ANIMATION_SIM_FAIL;
- }
- else if (mmi_bootup_is_sim_need_security_check() == MMI_TRUE)
- {
- g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_ANIMATION_PSWD_REQ;
- }
- else
- {
- g_pwr_context.PowerOnMMIStatus = MMI_POWER_ON_ANIMATION; /* 0x04: Power on animation */
- }
- TurnOnBacklight(0);
- /*******************************************/
- /* Valid power on display checking */
- /*******************************************/
- /* Valid power on display restoration checking */
- ReadValue(NVRAM_POWER_ON_DISPLAY_SUCCESS, &pwron_flag, DS_SHORT, &error);
- /*
- * 0xff is the default value, each time power on display play successfully,
- * it will set to 0xff as well.
- */
- #if defined(__MMI_POWER_ON_OFF_DISPLAY__)
- if (pwron_flag == PWRON_DISPLAY_FAILED)
- {
- /* if flag is PWRON_DISPLAY_FAILED, means something wrong happened during playing power on display */
- /* we will restore power on display to default settings */
- PhnsetRstPwrOnDisplayDefault();
- }
- #endif /* defined(__MMI_POWER_ON_OFF_DISPLAY__) */
- /* set the flag to 0x01 , if play successfully to end, will reset back to 0xff */
- pwron_flag = PWRON_DISPLAY_PLAYING;
- WriteValue(NVRAM_POWER_ON_DISPLAY_SUCCESS, &pwron_flag, DS_SHORT, &error);
- #if defined(__MMI_POWER_ON_OFF_DISPLAY__)
- /*******************************************/
- /* Get animation resource from phone setup */
- /*******************************************/
- PhnsetGetPwrOnDisp(&disp_id);
- if (disp_id == 0xff) /* invalid format */
- {
- /* reset as default */
- PhnsetRstPwrOnDisplayDefault();
- /* this id must be a valid id */
- PhnsetGetPwrOnDisp(&disp_id);
- }
- else if (disp_id == 0x00 || /* source from file */
- disp_id == 0x01) /* short file name */
- {
- PS8 error;
- disp_id = 0x00;
- /* filename buffer is allocated in phnset */
- filename_ptr = PhnsetGetPwrOnFileName();
- if (!mmi_fmgr_util_file_limit_check(FMGR_LIMIT_POWER_ON_OFF_DSPL, filename_ptr, &error))
- {
- /* limit check failed */
- /* reset to default */
- PhnsetRstPwrOnDisplayDefault();
- /* this id must be a valid id */
- PhnsetGetPwrOnDisp(&disp_id);
- filename_ptr = NULL;
- }
- }
- else
- {
- /* source from intenal resource */
- filename_ptr = NULL;
- }
- /*******************************************/
- /* Check if is image or video */
- /*******************************************/
- /* get file resource type */
- if (filename_ptr != NULL)
- {
- /* source from file */
- res_type = mmi_fmgr_get_file_group(filename_ptr);
- if (res_type == FMGR_GROUP_IMAGE)
- {
- g_pwron_is_image = TRUE;
- }
- #if !defined (MMI_ON_WIN32)
- else if (res_type == FMGR_GROUP_VIDEO)
- {
- g_pwron_is_image = FALSE;
- }
- #endif /* !defined (MMI_ON_WIN32) */
- #ifdef __MMI_SWFLASH__
- else if (res_type == FMGR_GROUP_SWFLASH)
- {
- g_pwron_is_image = TRUE;
- }
- #endif /* __MMI_SWFLASH__ */
- else
- {
- /* unsupported file format ext */
- PhnsetRstPwrOnDisplayDefault();
- /* this id must be a valid id */
- PhnsetGetPwrOnDisp(&disp_id);
- filename_ptr = NULL;
- }
- #ifdef __DRM_SUPPORT__
- /* DRM permission check */
- if ((fs_handle = DRM_open_file((PU16) filename_ptr, FS_READ_ONLY, DRM_PERMISSION_NONE)) >= FS_NO_ERROR)
- {
- if (res_type == FMGR_GROUP_IMAGE && DRM_validate_permission(fs_handle, DRM_PERMISSION_DISPLAY))
- {
- DRM_consume_rights(fs_handle, DRM_PERMISSION_DISPLAY);
- }
- #ifdef __MMI_SWFLASH__
- else if (res_type == FMGR_GROUP_SWFLASH && DRM_validate_permission(fs_handle, DRM_PERMISSION_DISPLAY))
- {
- DRM_consume_rights(fs_handle, DRM_PERMISSION_DISPLAY);
- }
- #endif
- else if (res_type == FMGR_GROUP_VIDEO && DRM_validate_permission(fs_handle, DRM_PERMISSION_PLAY))
- {
- DRM_consume_rights(fs_handle, DRM_PERMISSION_PLAY);
- }
- DRM_close_file(fs_handle);
- }
- #else /* __DRM_SUPPORT__ */
- fs_handle = FS_Open((U16*) filename_ptr, FS_READ_ONLY);
- #endif /* __DRM_SUPPORT__ */
- if (fs_handle < FS_NO_ERROR)
- {
- /* open file failed */
- /* reset as default */
- PhnsetRstPwrOnDisplayDefault();
- /* this id must be a valid id */
- PhnsetGetPwrOnDisp(&disp_id);
- filename_ptr = NULL;
- }
- else
- {
- /* open file successful */
- FS_Close(fs_handle);
- }
- }
- /* check internal resource type */
- if (filename_ptr == NULL)
- {
- res_type = PhnsetGetDisplayType(disp_id);
- if (res_type == PHNSET_TYPE_DISP_IMAGE)
- {
- g_pwron_is_image = TRUE;
- res_type = FMGR_GROUP_IMAGE;
- }
- #if !defined (MMI_ON_WIN32)
- else if (res_type == PHNSET_TYPE_DISP_VIDEO)
- {
- g_pwron_is_image = FALSE;
- res_type = FMGR_GROUP_VIDEO;
- }
- #endif /* !defined (MMI_ON_WIN32) */
- #ifdef __MMI_SWFLASH__
- else if (res_type == PHNSET_TYPE_DISP_SWFLASH)
- {
- g_pwron_is_image = TRUE;
- res_type = FMGR_GROUP_SWFLASH;
- }
- #endif /* __MMI_SWFLASH__ */
- else
- {
- MMI_ASSERT(0);
- }
- }
- #else /* defined(__MMI_POWER_ON_OFF_DISPLAY__) */
- /* play from internal build in resource */
- g_pwron_is_image = TRUE;
- #ifdef __MMI_POWER_ON_OFF_DISPLAY__ /* Cylen 0926, customize display char */
- disp_id = IMG_ID_PHNSET_ON_0;
- #else
- disp_id = IMG_ID_PHNSET_ON_ANIMATION_DEFAULT;
- #endif
- filename_ptr = NULL;
- #endif /* defined(__MMI_POWER_ON_OFF_DISPLAY__) */
- /*******************************************/
- /* Start to play */
- /*******************************************/
- if (res_type == FMGR_GROUP_IMAGE)
- {
- /* Play GIF animation or still image */
- if (ExitCategoryFunction != NULL)
- {
- ExitCategoryFunction();
- }
- ShowCategory166Screen(disp_id, filename_ptr, mmi_pwron_show_image_callback);
- #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
- if (!IsClamClose())
- {
- ShowCategory310Screen(get_string(STR_GLOBAL_LOGO));
- }
- else
- #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */
- ShowCategory313Screen(IMG_SUBLCD_POWER_ON_SCR, NULL);
- /* play power on tone */
- playRequestedTone(POWER_ON_TONE);
- //KP Jerry add for changing the style of message tone list on 2007-4-10 start
- #ifdef __MMI_TONE_LIST_STYLE_CHANGED__
- gui_start_timer(10000, StopExtPowerOnTone);
- #endif
- //KP Jerry add for changing the style of message tone list on 2007-4-10 end
- }
- else if (res_type == FMGR_GROUP_VIDEO)
- {
- /* Play video clip */
- #if defined(__MMI_VIDEO_PLAYER__)
- /* check silent mode */
- play_audio = (gcurrentprofile.toneSetup.powerOnTone != POWERON_SILENT) ? TRUE : FALSE;
- /* set volume as ring tone volume */
- mdi_audio_set_volume(MDI_VOLUME_MEDIA, GetRingVolumeLevel());
- /* add sublcd screen in history */
- /*
- * this is when Categry224 play finish, it's sublcd will go back history,
- * If we go back to root sublcd screen, sometimes it might draw an empty
- * screen due to sim or network not ready.
- * So we have to let it back to a dummy screen, whihc will draw nothing .
- */
- sub_history.entryFuncPtr = mmi_pwron_draw_sublcd_dummy_screen;
- AddSubLCDHistory(&sub_history);
- /* entry video play screen */
- ShowCategory224Screen(
- disp_id, /* video id */
- filename_ptr, /* filename */
- 0, /* repeat_count *//* 0 means infinite */
- TRUE, /* is_visaul_update */
- play_audio, /* is_play_audio */
- FALSE, /* is_lcd_sleep *//* already in non-sleep mode */
- GDI_COLOR_BLACK, /* bg_color */
- mmi_pwron_play_video_callback, /* (*play_finish_callback)(S16) */
- NULL); /* gui_buffer */
- #else /* defined(__MMI_VIDEO_PLAYER__) */
- MMI_ASSERT(0);
- #endif /* defined(__MMI_VIDEO_PLAYER__) */
- }
- #ifdef __MMI_SWFLASH__
- else if (res_type == FMGR_GROUP_SWFLASH)
- {
- ShowCategory229Screen(
- 0, /* title_str */
- 0, /* title_icon */
- 0, /* lsk_str */
- 0, /* lsk_icon */
- 0, /* rsk_str */
- 0, /* rsk_icon */
- disp_id, /* resource_id */
- filename_ptr, /* resource_filename */
- 1, /* repeat_count */
- MMI_TRUE, /* is_play_audio */
- 0, /* is_vibrate_on */
- 0, /* is_interaction_on */
- 0, /* is_lcd_no_sleep */
- MMI_TRUE, /* is_full_screen */
- GDI_COLOR_WHITE, /* bg_color */
- mmi_pwron_show_image_callback,
- NULL);
- }
- #endif
- #if defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__)
- SetKeyHandler(KeyPatternIdentifier, KEY_POUND, KEY_EVENT_DOWN);
- SetKeyHandler(KeyPatternIdentifier, KEY_STAR, KEY_EVENT_DOWN);
- SetKeyHandler(KeyPatternIdentifier, KEY_0, KEY_EVENT_DOWN);
- SetKeyHandler(KeyPatternIdentifier, KEY_1, KEY_EVENT_DOWN);
- SetKeyHandler(KeyPatternIdentifier, KEY_2, KEY_EVENT_DOWN);
- SetKeyHandler(KeyPatternIdentifier, KEY_3, KEY_EVENT_DOWN);
- SetKeyHandler(KeyPatternIdentifier, KEY_4, KEY_EVENT_DOWN);
- SetKeyHandler(KeyPatternIdentifier, KEY_5, KEY_EVENT_DOWN);
- SetKeyHandler(KeyPatternIdentifier, KEY_6, KEY_EVENT_DOWN);
- SetKeyHandler(KeyPatternIdentifier, KEY_7, KEY_EVENT_DOWN);
- SetKeyHandler(KeyPatternIdentifier, KEY_8, KEY_EVENT_DOWN);
- SetKeyHandler(KeyPatternIdentifier, KEY_9, KEY_EVENT_DOWN);
- #endif /* defined(__DIRECT_ENTRY_FACTORY_MODE_ON_BOOTUP__) */
- StartLEDPatternPowerOn();
- ReplaceNewScreenHandler(SCR_OPEN_SCREEN_ID, mmi_pwron_exit_animation_screen, mmi_pwron_entry_animation_screen);
- /* this timer is used to avoid gif/video play too long, will force to enter idle */
- ReadValue(NVRAM_POWER_ON_FORCE_STOP_TIME, &force_stop_time, DS_SHORT, &error);
- /* not set in NVRAM, use defulat 20 sec limit */
- if (force_stop_time == 0xffff)
- {
- force_stop_time = 20000;
- }
- /* POWER ON time have NVRAM-timer interlace problem, so put time at last to eliminate this problem */
- gui_start_timer(force_stop_time, mmi_pwron_froce_terminate_display);
- g_pwron_is_terminate_diplay = FALSE;
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pwron_exception_check_display
- * DESCRIPTION
- * this function is for exception power on to check wether need to restore
- * power on diplay to default or not.
- * we cant 100% guarantee decoder will work for all image/video from file, we
- * use this method to restore back if decoder has assert or fatal error.
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pwron_exception_check_display(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S16 error;
- U16 pwron_flag;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* Valid power on display restoration checking */
- ReadValue(NVRAM_POWER_ON_DISPLAY_SUCCESS, &pwron_flag, DS_SHORT, &error);
- /* this means exception happened during previous decoding process */
- if (pwron_flag == PWRON_DISPLAY_PLAYING)
- {
- #if defined(__MMI_POWER_ON_OFF_DISPLAY__)
- PhnsetRstPwrOnDisplayDefault();
- #endif
- }
- }
- /*****************************************************************************
- * FUNCTION
- * mmi_pwron_exit_animation_screen
- * DESCRIPTION
- * exit power on animation screen
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void mmi_pwron_exit_animation_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- U16 pwron_flag;
- S16 error;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- MMI_TRACE((MMI_TRACE_G7_MISC, MMI_POWER_ON_LEAVE_ANIMATION));
- TurnOffBacklight(); /* To start backlight timer */
- ExitSubLCDIdleScr(); /* Add idle screen to sub-lcd history if power on animation is interrupted */
- /* if is force stopped by MT call, treat this recource as play successfully */
- if (GetActiveScreenId() == ITEMSCR_INCOMING_CALL)
- {
- pwron_flag = PWRON_DISPLAY_SUCCESS;
- WriteValue(NVRAM_POWER_ON_DISPLAY_SUCCESS, &pwron_flag, DS_SHORT, &error);
- }
- gui_cancel_timer(mmi_pwron_froce_terminate_display);
- }
- /***************************************************************************
- *
- * Analog Clock
- *
- ***************************************************************************/
- /* Analog clock implementation: Must be moved to a different file later */
- #define ANALOG_CLOCK_DRAW_POLYGON_HANDS 1
- #define ANALOG_CLOCK_SMOOTHEN_LINES 1
- /* PMT HIMANSHU START 20050625 */
- #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
- /* PMT HIMANSHU START 20050721 */
- #if defined(__MMI_MAINLCD_176X220__)
- /* PMT HIMANSHU END 20050721 */
- #define ANALOG_CLOCK_HOURS_HAND_LENGTH 12
- #define ANALOG_CLOCK_MINUTES_HAND_LENGTH 16
- /* PMT HIMANSHU START 20050721 */
- #elif defined(__MMI_MAINLCD_240X320__)
- #define ANALOG_CLOCK_HOURS_HAND_LENGTH 15
- #define ANALOG_CLOCK_MINUTES_HAND_LENGTH 20
- #endif
- /* PMT HIMANSHU END 20050721 */
- #else /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- #define ANALOG_CLOCK_HOURS_HAND_LENGTH (MAIN_LCD_DEVICE_HEIGHT/6) /* 20 */
- #define ANALOG_CLOCK_MINUTES_HAND_LENGTH (ANALOG_CLOCK_HOURS_HAND_LENGTH+8) /* 28 */
- #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- /* PMT HIMANSHU END */
- #define ANALOG_CLOCK_SECONDS_HAND_LENGTH (ANALOG_CLOCK_HOURS_HAND_LENGTH+12) /* 32 */
- /* PMT HIMANSHU START 20050721 */
- #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
- #define ANALOG_CLOCK_HOURS_HAND_COLOR { 255,255,255,100 }
- #define ANALOG_CLOCK_MINUTES_HAND_COLOR { 255,255,255,100 }
- #define ANALOG_CLOCK_SECONDS_HAND_COLOR { 255,255,255,100 }
- #else /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- #if defined(__MMI_SUBLCD_COLOR__)
- #define ANALOG_CLOCK_HOURS_HAND_COLOR { 0,0,93,100 }
- #define ANALOG_CLOCK_MINUTES_HAND_COLOR { 0,0,93,100 }
- #define ANALOG_CLOCK_SECONDS_HAND_COLOR { 255,0,0,100 }
- #else /* defined(__MMI_SUBLCD_COLOR__) */
- #define ANALOG_CLOCK_HOURS_HAND_COLOR { 0,0,0,100 }
- #define ANALOG_CLOCK_MINUTES_HAND_COLOR { 0,0,0,100 }
- #define ANALOG_CLOCK_SECONDS_HAND_COLOR { 0,0,0,100 }
- #endif /* defined(__MMI_SUBLCD_COLOR__) */
- #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- /* PMT HIMANSHU END 20050721 */
- /*
- * Moved to MiscFunctions.h
- * #define ANALOG_CLOCK_DIAL_WIDTH 77
- * #define ANALOG_CLOCK_DIAL_HEIGHT 77
- */
- S32 ANALOG_CLOCK_DIAL_X = 26;
- S32 ANALOG_CLOCK_DIAL_Y = 26;
- S32 ANALOG_CLOCK_CENTER_X = 64;
- S32 ANALOG_CLOCK_CENTER_Y = 64;
- #define ANALOG_CLOCK_DRAW_POLYGON_HANDS 1
- #define ANALOG_CLOCK_SMOOTHEN_LINES 1
- #define SUB_ANALOG_CLOCK_HOURS_HAND_LENGTH (SUB_LCD_DEVICE_WIDTH/4)
- #define SUB_ANALOG_CLOCK_MINUTES_HAND_LENGTH (SUB_ANALOG_CLOCK_HOURS_HAND_LENGTH+4)
- #define SUB_ANALOG_CLOCK_SECONDS_HAND_LENGTH (SUB_ANALOG_CLOCK_HOURS_HAND_LENGTH+6)
- #define SUB_ANALOG_CLOCK_DIAL_WIDTH SUB_LCD_DEVICE_WIDTH
- #define SUB_ANALOG_CLOCK_DIAL_HEIGHT SUB_LCD_DEVICE_HEIGHT
- #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
- S32 SUB_ANALOG_CLOCK_DIAL_X = 2;
- S32 SUB_ANALOG_CLOCK_DIAL_Y = 2;
- S32 SUB_ANALOG_CLOCK_CENTER_X = SUB_LCD_DEVICE_WIDTH >> 1;
- S32 SUB_ANALOG_CLOCK_CENTER_Y = SUB_LCD_DEVICE_HEIGHT >> 1;
- #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */
- PU8 analog_clock_background_image = NULL;
- const float acm_sine_table[] =
- {
- (float)-0.99999820, (float)-0.99431727, (float)-0.97773360, (float)-0.95042917, (float)-0.91270313,
- (float)-0.86496924, (float)-0.80775119, (float)-0.74167587,
- (float)-0.66746803, (float)-0.58594175, (float)-0.49799022, (float)-0.40457821, (float)-0.30673042,
- (float)-0.20551889, (float)-0.10205382, (float)0.00000000,
- (float)0.10457040, (float)0.20799418, (float)0.30913729, (float)0.40689072, (float)0.50018258, (float)0.58798990,
- (float)0.66934994, (float)0.74337050,
- (float)0.80923998, (float)0.86623616, (float)0.91373403, (float)0.95121274, (float)0.97826142, (float)0.99458343,
- (float)0.99999980, (float)0.99445115,
- (float)0.97799831, (float)0.95082172, (float)0.91321931, (float)0.86560342, (float)0.80849624, (float)0.74252372,
- (float)0.66840956, (float)0.58696629,
- (float)0.49908672, (float)0.40573486, (float)0.30793410, (float)0.20675662, (float)0.10331227, (float)-0.00126490,
- (float)-0.10582843, (float)-0.20923132,
- (float)-0.31033998, (float)-0.40804598, (float)-0.50127753, (float)-0.58901256, (float)-0.67028925,
- (float)-0.74421601, (float)-0.80998244, (float)-0.86686752,
- (float)-0.91424734, (float)-0.95160225, (float)-0.97852297, (float)-0.99471414,
- };
- const float acm_cosine_table[] =
- {
- (float)0.00189735, (float)0.10645731, (float)0.20984996, (float)0.31094114, (float)0.40862330, (float)0.50182489,
- (float)0.58952354, (float)0.67075845,
- (float)0.74463846, (float)0.81035318, (float)0.86718264, (float)0.91450340, (float)0.95179643, (float)0.97865315,
- (float)0.99477888, (float)1.00000000,
- (float)0.99451749, (float)0.97813006, (float)0.95101742, (float)0.91347684, (float)0.86591997, (float)0.80886827,
- (float)0.74294728, (float)0.66887989,
- (float)0.58747821, (float)0.49963478, (float)0.40631283, (float)0.30853576, (float)0.20737548, (float)0.10394131,
- (float)-0.00063245, (float)-0.10519940,
- (float)-0.20861283, (float)-0.30973870, (float)-0.40746839, (float)-0.50073018, (float)-0.58850135,
- (float)-0.66981977, (float)-0.74379342, (float)-0.80961137,
- (float)-0.86655204, (float)-0.91399082, (float)-0.95140769, (float)-0.97839241, (float)-0.99464897,
- (float)-0.99999920, (float)-0.99438440, (float)-0.97786617,
- (float)-0.95062563, (float)-0.91296138, (float)-0.86528656, (float)-0.80812388, (float)-0.74209994,
- (float)-0.66793902, (float)-0.58645414, (float)-0.49853857,
- (float)-0.40515651, (float)-0.30733233, (float)-0.20613779, (float)-0.10268295,
- };
- #if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
- const U8 analog_clock_center_dot_image[] =
- {
- 0x04, 0x00, 0x8D, 0x00, 0x00, 0x00,
- 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x0C, 0x10, 0x00, 0x00, 0x00,
- 0x34, 0x12, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x12, 0x34, 0x12,
- 0x34, 0x12, 0x00, 0x00, 0x04, 0x30, 0x05, 0xF7, 0x05, 0xF7, 0x04, 0x30, 0x00, 0x00, 0x34, 0x12,
- 0x00, 0x00, 0x04, 0x30, 0xFF, 0xFF, 0x05, 0xF7, 0x05, 0xF7, 0x05, 0xF7, 0x04, 0x30, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x30, 0xFF, 0xFF, 0x05, 0xF7, 0x05, 0xF7, 0x05, 0xF7, 0x04, 0x30, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x30, 0x05, 0xF7, 0x05, 0xF7, 0x05, 0xF7, 0x05, 0xF7, 0x04, 0x30, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x30, 0x04, 0x30, 0x05, 0xF7, 0x05, 0xF7, 0x04, 0x30, 0x04, 0x30, 0x00, 0x00,
- 0x34, 0x12, 0x00, 0x00, 0x04, 0x30, 0x04, 0x30, 0x04, 0x30, 0x04, 0x30, 0x00, 0x00, 0x34, 0x12,
- 0x34, 0x12, 0x34, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x12, 0x34, 0x12,
- };
- extern void flat_triangle_fill(polygon_vertex vertices[], color c);
- void polygon_draw(polygon_vertex vertices[], S32 n_vertices, color c);
- #elif(ANALOG_CLOCK_SMOOTHEN_LINES)
- extern void UI_antialiased_line(S32 x1, S32 y1, S32 x2, S32 y2, color c);
- #endif
- /* PMT HIMANSHU START 20050625 */
- #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
- /* PMT HIMANSHU START 20050721 */
- #if defined(__MMI_MAINLCD_176X220__)
- /* PMT HIMANSHU END 20050721 */
- /* offset to (0,0) */
- polygon_vertex analog_clock_hour_hand_vertices[] = { {-0, 0},
- {+0, 0},
- {0, -ANALOG_CLOCK_HOURS_HAND_LENGTH},
- };
- /* offset to (0,0) */
- polygon_vertex analog_clock_minute_hand_vertices[] = { {-0, 0},
- {+0, 0},
- {0, -ANALOG_CLOCK_MINUTES_HAND_LENGTH},
- };
- /* PMT HIMANSHU START 20050721 */
- #elif defined(__MMI_MAINLCD_240X320__)
- /* offset to (0,0) */
- polygon_vertex analog_clock_hour_hand_vertices[] = { {-2, 0},
- {+2, 0},
- {0, -ANALOG_CLOCK_HOURS_HAND_LENGTH},
- };
- /* offset to (0,0) */
- polygon_vertex analog_clock_minute_hand_vertices[] = { {-1, 0},
- {+1, 0},
- {0, -ANALOG_CLOCK_MINUTES_HAND_LENGTH},
- };
- #endif
- /* PMT HIMANSHU END 20050721 */
- #else /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- /* PMT HIMANSHU END */
- /* offset to (0,0) */
- polygon_vertex analog_clock_hour_hand_vertices[] =
- {
- {-3, 0},
- {+3, 0},
- {0, -ANALOG_CLOCK_HOURS_HAND_LENGTH},
- };
- /* offset to (0,0) */
- polygon_vertex analog_clock_minute_hand_vertices[] =
- {
- {-2, 0},
- {+2, 0},
- {0, -ANALOG_CLOCK_MINUTES_HAND_LENGTH},
- };
- /* PMT HIMANSHU START 20050625 */
- #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- /* PMT HIMANSHU END */
- #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
- /* offset to (0,0) */
- polygon_vertex sub_analog_clock_hour_hand_vertices[] =
- {
- {-2, +1},
- {+2, +1},
- {0, -SUB_ANALOG_CLOCK_HOURS_HAND_LENGTH},
- };
- /* offset to (0,0) */
- polygon_vertex sub_analog_clock_minute_hand_vertices[] =
- {
- {-2, 0},
- {+2, 0},
- {0, -SUB_ANALOG_CLOCK_MINUTES_HAND_LENGTH},
- };
- #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */
- /* Rotate about (0,0) */
- /*****************************************************************************
- * FUNCTION
- * rotate_analog_clock_hand
- * DESCRIPTION
- *
- * PARAMETERS
- * vertices [?]
- * minute [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void rotate_analog_clock_hand(polygon_vertex vertices[], S32 minute)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- float cosa, sina, x, y;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- minute += 15;
- if (minute >= 60)
- {
- minute = minute - 60;
- }
- cosa = (float)acm_cosine_table[minute];
- sina = (float)acm_sine_table[minute];
- x = (float)vertices[0].x;
- y = (float)vertices[0].y;
- vertices[0].x = (S32) (x * cosa - y * sina);
- vertices[0].y = (S32) (x * sina + y * cosa);
- x = (float)vertices[1].x;
- y = (float)vertices[1].y;
- vertices[1].x = (S32) (x * cosa - y * sina);
- vertices[1].y = (S32) (x * sina + y * cosa);
- x = (float)vertices[2].x;
- y = (float)vertices[2].y;
- vertices[2].x = (S32) (x * cosa - y * sina);
- vertices[2].y = (S32) (x * sina + y * cosa);
- }
- /*****************************************************************************
- * FUNCTION
- * analog_clock_draw_hand
- * DESCRIPTION
- *
- * PARAMETERS
- * type [IN]
- * minute [IN]
- * RETURNS
- * void
- *****************************************************************************/
- void analog_clock_draw_hand(S32 type, S32 minute)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- S32 radius;
- S32 x1 = ANALOG_CLOCK_CENTER_X;
- S32 y1 = ANALOG_CLOCK_CENTER_Y;
- S32 x2, y2;
- #if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
- polygon_vertex vertices[3];
- #endif
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
- if (GDI_LCD->act_handle == GDI_LCD_SUB_LCD_HANDLE)
- {
- x1 = SUB_ANALOG_CLOCK_CENTER_X;
- y1 = SUB_ANALOG_CLOCK_CENTER_Y;
- radius = SUB_ANALOG_CLOCK_HOURS_HAND_LENGTH;
- }
- else
- #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */
- {
- x1 = ANALOG_CLOCK_CENTER_X;
- y1 = ANALOG_CLOCK_CENTER_Y;
- radius = ANALOG_CLOCK_HOURS_HAND_LENGTH;
- }
- switch (type)
- {
- case 0:
- {
- color c = ANALOG_CLOCK_HOURS_HAND_COLOR;
- #if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
- #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
- if (GDI_LCD->act_handle == GDI_LCD_SUB_LCD_HANDLE)
- {
- vertices[0] = sub_analog_clock_hour_hand_vertices[0];
- vertices[1] = sub_analog_clock_hour_hand_vertices[1];
- vertices[2] = sub_analog_clock_hour_hand_vertices[2];
- }
- else
- #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */
- {
- vertices[0] = analog_clock_hour_hand_vertices[0];
- vertices[1] = analog_clock_hour_hand_vertices[1];
- vertices[2] = analog_clock_hour_hand_vertices[2];
- }
- rotate_analog_clock_hand(vertices, minute);
- vertices[0].x += x1;
- vertices[0].y += y1;
- vertices[1].x += x1;
- vertices[1].y += y1;
- vertices[2].x += x1;
- vertices[2].y += y1;
- flat_triangle_fill(vertices, c);
- polygon_draw(vertices, 3, c);
- #elif(ANALOG_CLOCK_SMOOTHEN_LINES)
- x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
- y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
- UI_antialiased_line(x1, y1, x2, y2, c);
- UI_antialiased_line(x1 + 1, y1 + 1, x2 + 1, y2 + 1, c);
- #else
- x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
- y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
- gui_wline(x1, y1, x2, y2, c, 3);
- #endif
- }
- break;
- case 1:
- {
- color c = ANALOG_CLOCK_MINUTES_HAND_COLOR;
- #if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
- #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
- if (GDI_LCD->act_handle == GDI_LCD_SUB_LCD_HANDLE)
- {
- vertices[0] = sub_analog_clock_minute_hand_vertices[0];
- vertices[1] = sub_analog_clock_minute_hand_vertices[1];
- vertices[2] = sub_analog_clock_minute_hand_vertices[2];
- }
- else
- #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */
- {
- vertices[0] = analog_clock_minute_hand_vertices[0];
- vertices[1] = analog_clock_minute_hand_vertices[1];
- vertices[2] = analog_clock_minute_hand_vertices[2];
- }
- rotate_analog_clock_hand(vertices, minute);
- vertices[0].x += x1;
- vertices[0].y += y1;
- vertices[1].x += x1;
- vertices[1].y += y1;
- vertices[2].x += x1;
- vertices[2].y += y1;
- flat_triangle_fill(vertices, c);
- polygon_draw(vertices, 3, c);
- #elif(ANALOG_CLOCK_SMOOTHEN_LINES)
- x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
- y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
- UI_antialiased_line(x1, y1, x2, y2, c);
- #else
- x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
- y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
- gui_wline(x1, y1, x2, y2, c, 1);
- #endif
- }
- break;
- case 2:
- {
- color c = ANALOG_CLOCK_SECONDS_HAND_COLOR;
- #if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
- x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
- y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
- gui_line(x1, y1, x2, y2, c);
- #elif(ANALOG_CLOCK_SMOOTHEN_LINES)
- x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
- y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
- UI_antialiased_line(x1, y1, x2, y2, c);
- #else
- x2 = x1 + (S32) ((float)radius * acm_cosine_table[minute]);
- y2 = y1 + (S32) ((float)radius * acm_sine_table[minute]);
- gui_line(x1, y1, x2, y2, c);
- #endif
- }
- break;
- }
- }
- S32 analog_clock_hours_hand_counter = 0;
- S32 analog_clock_minutes_hand_counter = 0;
- /*****************************************************************************
- * FUNCTION
- * show_analog_clock_dial
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void show_analog_clock_dial(void)
- { /* For removing warning
- S32 x1=ANALOG_CLOCK_DIAL_X;
- S32 y1=ANALOG_CLOCK_DIAL_Y;
- S32 x2=ANALOG_CLOCK_DIAL_X+ANALOG_CLOCK_DIAL_WIDTH-1;
- S32 y2=ANALOG_CLOCK_DIAL_Y+ANALOG_CLOCK_DIAL_HEIGHT-1; */
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* PMT HIMANSHU START 20050625 */
- #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
- gui_push_clip();
- gui_set_clip(
- ANALOG_BACKGROUND_X,
- ANALOG_BACKGROUND_Y,
- ANALOG_BACKGROUND_X + ANALOG_BACKGROUND_WIDTH - 1,
- ANALOG_BACKGROUND_Y + MMI_IDLESCREEN_BAR_HEIGHT - 1);
- //gui_show_image((ANALOG_CLOCK_DIAL_X), (ANALOG_CLOCK_DIAL_Y), get_image(IMG_TECHNO_ANALOG_CLOCK));
- gui_show_image((ANALOG_BACKGROUND_X), (ANALOG_BACKGROUND_Y), get_image(IMG_TECHNO_ANALOG_CLOCK)); //Old:gui_show_image(0, (ANALOG_BACKGROUND_Y), get_image(IMG_TECHNO_ANALOG_CLOCK)); //KP Jerry modify on 2007-3-8
- #else /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- gui_reset_clip();
- #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- /* PMT HIMANSHU END */
- #if(ANALOG_CLOCK_DRAW_POLYGON_HANDS)
- if (GDI_LCD->act_handle == GDI_LCD_MAIN_LCD_HANDLE)
- /* PMT HIMANSHU START 20050625 */
- #ifndef __MMI_UI_TECHNO_IDLESCREEN_BAR__
- gui_show_transparent_image(
- ANALOG_CLOCK_CENTER_X - 4,
- ANALOG_CLOCK_CENTER_Y - 4,
- (U8*) analog_clock_center_dot_image,
- 0);
- #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- /* PMT HIMANSHU END */
- #ifdef __MMI_SUBLCD_SHOW_ANALOG_CLOCK__
- else
- #if defined(__MMI_SUBLCD_COLOR__)
- gui_show_transparent_image(
- SUB_ANALOG_CLOCK_CENTER_X - 4,
- SUB_ANALOG_CLOCK_CENTER_Y - 4,
- (U8*) analog_clock_center_dot_image,
- 0);
- #else /* defined(__MMI_SUBLCD_COLOR__) */
- gdi_draw_round_rect(
- SUB_ANALOG_CLOCK_CENTER_X - 3,
- SUB_ANALOG_CLOCK_CENTER_Y - 3,
- SUB_ANALOG_CLOCK_CENTER_X + 3,
- SUB_ANALOG_CLOCK_CENTER_Y + 3,
- GDI_COLOR_BLACK,
- GDI_COLOR_BLACK,
- 2);
- #endif /* defined(__MMI_SUBLCD_COLOR__) */
- #endif /* __MMI_SUBLCD_SHOW_ANALOG_CLOCK__ */
- #endif /* (ANALOG_CLOCK_DRAW_POLYGON_HANDS) */
- analog_clock_draw_hand(0, analog_clock_hours_hand_counter);
- analog_clock_draw_hand(1, analog_clock_minutes_hand_counter);
- /* PMT HIMANSHU START 20050625 */
- #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
- gui_pop_clip();
- #endif
- /* PMT HIMANSHU END */
- #if 0
- /* under construction !*/
- #endif /* 0 */
- }
- /*****************************************************************************
- * FUNCTION
- * show_analog_clock
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void show_analog_clock(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- show_analog_clock_dial();
- }
- /*****************************************************************************
- * FUNCTION
- * analog_clock_initialize
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void analog_clock_initialize(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYTIME t;
- S32 h, m;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- /* PMT HIMANSHU START 20050625 */
- #ifdef __MMI_UI_TECHNO_IDLESCREEN_BAR__
- ANALOG_CLOCK_CENTER_X = (MMI_SIGNAL_WIDTH + (ANALOG_BACKGROUND_WIDTH >> 1));
- ANALOG_CLOCK_DIAL_X = (MMI_SIGNAL_WIDTH);
- ANALOG_CLOCK_CENTER_Y = (MMI_status_bar_height + (MMI_IDLESCREEN_BAR_HEIGHT >> 1));
- ANALOG_CLOCK_DIAL_Y = (MMI_status_bar_height);
- #else /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- ANALOG_CLOCK_DIAL_X = (UI_device_width >> 1) - (ANALOG_CLOCK_DIAL_WIDTH >> 1);
- ANALOG_CLOCK_DIAL_Y = (UI_device_height >> 1) - (ANALOG_CLOCK_DIAL_HEIGHT >> 1);
- ANALOG_CLOCK_CENTER_X = (UI_device_width >> 1);
- ANALOG_CLOCK_CENTER_Y = (UI_device_height >> 1);
- #endif /* __MMI_UI_TECHNO_IDLESCREEN_BAR__ */
- /* PMT HIMANSHU END */
- GetDateTime(&t);
- m = t.nMin;
- analog_clock_minutes_hand_counter = m;
- h = t.nHour;
- h++;
- if (h > 12)
- {
- h -= 12;
- }
- analog_clock_hours_hand_counter = (h - 1) * 5;
- analog_clock_hours_hand_counter += m / 12;
- }
- /*****************************************************************************
- * FUNCTION
- * analog_clock_minute_tick
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void analog_clock_minute_tick(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- MYTIME t;
- S32 h, m;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- GetDateTime(&t);
- m = t.nMin;
- analog_clock_minutes_hand_counter = m;
- h = t.nHour;
- h++;
- if (h > 12)
- {
- h -= 12;
- }
- analog_clock_hours_hand_counter = (h - 1) * 5;
- analog_clock_hours_hand_counter += m / 12;
- if (analog_clock_minutes_hand_counter >= 60)
- {
- analog_clock_minutes_hand_counter = 0;
- }
- if ((analog_clock_minutes_hand_counter % 12) == 0)
- { /* analog_clock_hours_hand_counter++; */
- if (analog_clock_hours_hand_counter >= 60)
- {
- analog_clock_hours_hand_counter = 0;
- }
- }
- }
- /*****************************************************************************
- * FUNCTION
- * analog_clock_demo_timer
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void analog_clock_demo_timer(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- color c = gui_color(255, 255, 255);
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- analog_clock_minutes_hand_counter++;
- if (analog_clock_minutes_hand_counter >= 60)
- {
- analog_clock_minutes_hand_counter = 0;
- }
- if ((analog_clock_minutes_hand_counter % 12) == 0)
- {
- analog_clock_hours_hand_counter++;
- if (analog_clock_hours_hand_counter >= 60)
- {
- analog_clock_hours_hand_counter = 0;
- }
- }
- gui_reset_clip();
- gui_fill_rectangle(0, 0, UI_device_width - 1, UI_device_height - 1, c);
- show_analog_clock_dial();
- #if(UI_DOUBLE_BUFFER_SUPPORT)
- gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
- #endif
- gui_start_timer(200, analog_clock_demo_timer);
- }
- extern void PB_test_demo(void);
- /*****************************************************************************
- * FUNCTION
- * initialize_UI_demo
- * DESCRIPTION
- * Initialize UI environment
- *
- * Remark: this function may be executed more than one times for special poweron
- * mode (e.g. Alarm poweron, Charger poweron, USB poweron)
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void initialize_UI_demo(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- mmi_frm_appmem_init();
- mmi_frm_scrmem_init();
- dm_init();
- wgui_init();
- initialize_category_screens();
- #if defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__)
- /*
- * We do not enable touch screen in certain cases like charger poweron
- * * because some related tasks are not running.
- */
- if (g_pwr_context.PowerOnMode == POWER_ON_KEYPAD || g_pwr_context.PowerOnMode == POWER_ON_EXCEPTION ||
- #if defined(__NVRAM_IN_USB_MS__) /* for alarm in usb boot mode */
- g_pwr_context.PowerOnMode == POWER_ON_USB ||
- #endif
- g_pwr_context.PowerOnMode == POWER_ON_ALARM || g_pwr_context.PowerOnMode == POWER_ON_CHARGER_IN)
- {
- mmi_pen_init();
- mmi_pen_enable();
- }
- #endif /* defined(__MMI_TOUCH_SCREEN__) || defined(__MMI_HANDWRITING_PAD__) */
- /* Temporary: Must be moved to boot up application */
- ShowStatusIcon(STATUS_ICON_SIGNAL_STRENGTH);
- ShowStatusIcon(STATUS_ICON_BATTERY_STRENGTH);
- ShowStatusIcon(STATUS_ICON_SUBLCD_SIGNAL_STRENGTH);
- ShowStatusIcon(STATUS_ICON_SUBLCD_BATTERY_STRENGTH);
- #ifdef __MMI_TOUCH_SCREEN__
- ChangeStatusIconImage(STATUS_ICON_KEYPAD_LOCK, IMG_SI_KEYPAD_UNLOCK);
- UpdateStatusIcons(); /* 101805 ChangeStatusIconImage Calvin: ChangeStatusIconImage will not call UpdateStatusIcon */
- ShowStatusIcon(STATUS_ICON_KEYPAD_LOCK);
- #endif /* __MMI_TOUCH_SCREEN__ */
- UpdateStatusIcons();
- }
- /*****************************************************************************
- * FUNCTION
- * redraw_custom_startup_screen
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void redraw_custom_startup_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- color c;
- S32 iwidth, iheight;
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- gui_lock_double_buffer();
- c.r = 255;
- c.b = 255;
- c.g = 255;
- c.alpha = 100;
- gui_set_clip(0, 0, UI_device_width - 1, UI_device_height - 1);
- gui_fill_rectangle(0, 0, UI_device_width - 1, UI_device_height - 1, c);
- gui_measure_image(get_image(CUSTOM_LOGO_IMAGE_ID), &iwidth, &iheight);
- gui_show_image(
- (UI_device_width >> 1) - (iwidth >> 1),
- (UI_device_height >> 1) - (iheight >> 1),
- get_image(CUSTOM_LOGO_IMAGE_ID));
- gui_unlock_double_buffer();
- gui_BLT_double_buffer(0, 0, UI_device_width - 1, UI_device_height - 1);
- }
- /*****************************************************************************
- * FUNCTION
- * goto_custom_startup_screen
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void goto_custom_startup_screen(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- redraw_custom_startup_screen();
- gui_start_timer(DEMO_OPENING_CUSTOM_LOGO_TIMEOUT, exit_custom_startup_screen);
- }
- /*****************************************************************************
- * FUNCTION
- * UI_update
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void UI_update(void)
- {
- #if(!BUILD_TYPE_X86WIN32_DISABLE_REDRAW)
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (RedrawCategoryFunction != NULL)
- {
- RedrawCategoryFunction();
- }
- if (SUBLCD_RedrawCategoryFunction != NULL)
- {
- SUBLCD_RedrawCategoryFunction();
- }
- #endif /* (!BUILD_TYPE_X86WIN32_DISABLE_REDRAW) */
- }
- /*****************************************************************************
- * FUNCTION
- * terminate_UI_demo
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void terminate_UI_demo(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (ExitCategoryFunction != NULL)
- {
- ExitCategoryFunction();
- }
- if (SUBLCD_ExitCategoryFunction != NULL)
- {
- SUBLCD_ExitCategoryFunction();
- }
- gui_hide_animations();
- }
- U8 temp_sublcd_display_flag = 0;
- /*****************************************************************************
- * FUNCTION
- * toggle_temp_sublcd_display
- * DESCRIPTION
- *
- * PARAMETERS
- * void
- * RETURNS
- * void
- *****************************************************************************/
- void toggle_temp_sublcd_display(void)
- {
- /*----------------------------------------------------------------*/
- /* Local Variables */
- /*----------------------------------------------------------------*/
- /*----------------------------------------------------------------*/
- /* Code Body */
- /*----------------------------------------------------------------*/
- if (temp_sublcd_display_flag)
- {
- temp_sublcd_display_flag = 0;
- ShowCategory302Screen(NULL);
- }
- else
- {
- temp_sublcd_display_flag = 1;
- ShowCategory301Screen((U8*) GetString(TEMP_SUBLCD_ANIMATION_STR_ID), TEMP_SUBLCD_ANIMATION_IMAGE_ID, NULL);
- }
- }