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

MTK

开发平台:

C/C++

  1. /*****************************************************************************
  2. *  Copyright Statement:
  3. *  --------------------
  4. *  This software is protected by Copyright and the information contained
  5. *  herein is confidential. The software may not be copied and the information
  6. *  contained herein may not be used or disclosed except with the written
  7. *  permission of MediaTek Inc. (C) 2005
  8. *
  9. *  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  10. *  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  11. *  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
  12. *  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  13. *  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  14. *  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  15. *  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  16. *  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  17. *  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
  18. *  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
  19. *  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
  20. *  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
  21. *
  22. *  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
  23. *  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  24. *  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  25. *  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
  26. *  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
  27. *
  28. *  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
  29. *  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
  30. *  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
  31. *  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
  32. *  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
  33. *
  34. *****************************************************************************/
  35. /*****************************************************************************
  36.  *
  37.  * Filename:
  38.  * ---------
  39.  * ScheduledPowerOnOff.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  * MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  * This file is intends for scheduled power on / off application
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  * removed!
  115.  * removed!
  116.  *
  117.  * removed!
  118.  * removed!
  119.  * removed!
  120.  *
  121.  * removed!
  122.  * removed!
  123.  * removed!
  124.  *
  125.  *------------------------------------------------------------------------------
  126.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  127.  *============================================================================
  128.  ****************************************************************************/
  129. /*****************************************************************************
  130. *  Copyright Statement:
  131. *  --------------------
  132. *  This software is protected by Copyright and the information contained
  133. *  herein is confidential. The software may not be copied and the information
  134. *  contained herein may not be used or disclosed except with the written
  135. *  permission of MediaTek Inc. (C) 2004
  136. *
  137. *****************************************************************************/
  138. /*****************************************************************************
  139.  *
  140.  * Filename:
  141.  * ---------
  142.  * SchedulePowerOnOff.c
  143.  *
  144.  * Project:
  145.  * --------
  146.  * MAUI
  147.  *
  148.  * Description:
  149.  * ------------
  150.  * This file implements schedule power on of applications.
  151.  *
  152.  * Author:
  153.  * -------
  154.  * -------
  155.  *
  156.  *============================================================================
  157.  *             HISTORY
  158.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  159.  *------------------------------------------------------------------------------
  160.  * removed!
  161.  * removed!
  162.  * removed!
  163.  *
  164.  * removed!
  165.  * removed!
  166.  * removed!
  167.  *
  168.  * removed!
  169.  * removed!
  170.  * removed!
  171.  *
  172.  * removed!
  173.  * removed!
  174.  * removed!
  175.  *
  176.  * removed!
  177.  * removed!
  178.  * removed!
  179.  *
  180.  * removed!
  181.  * removed!
  182.  * removed!
  183.  *
  184.  * removed!
  185.  * removed!
  186.  * removed!
  187.  *
  188.  * removed!
  189.  * removed!
  190.  * removed!
  191.  *
  192.  * removed!
  193.  * removed!
  194.  * removed!
  195.  *
  196.  * removed!
  197.  * removed!
  198.  * removed!
  199.  *
  200.  * removed!
  201.  * removed!
  202.  * removed!
  203.  *
  204.  * removed!
  205.  * removed!
  206.  * removed!
  207.  *
  208.  * removed!
  209.  * removed!
  210.  * removed!
  211.  *
  212.  * removed!
  213.  * removed!
  214.  * removed!
  215.  *
  216.  * removed!
  217.  * removed!
  218.  * removed!
  219.  * removed!
  220.  * removed!
  221.  *
  222.  * removed!
  223.  * removed!
  224.  * removed!
  225.  *
  226.  * removed!
  227.  * removed!
  228.  * removed!
  229.  * removed!
  230.  * removed!
  231.  * removed!
  232.  * removed!
  233.  * removed!
  234.  * removed!
  235.  * removed!
  236.  * removed!
  237.  * removed!
  238.  * removed!
  239.  * removed!
  240.  * removed!
  241.  * removed!
  242.  * removed!
  243.  * removed!
  244.  * removed!
  245.  * removed!
  246.  *
  247.  *------------------------------------------------------------------------------
  248.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  249.  *============================================================================
  250.  ****************************************************************************/
  251. /**
  252.  * Copyright Notice
  253.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  254.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  255.  *  (It is illegal to remove this copyright notice from this software or any
  256.  *  portion of it)
  257.  */
  258. /***************** Settings Application implementation *********************/
  259. /**************************************************************
  260.    FILENAME : ScheduledPowerOnoff.c
  261.    PURPOSE     : Scheduled power on of fhandling
  262.    REMARKS     : nil
  263.    AUTHOR      : Gautam Saluja
  264.    DATE     : 
  265. **************************************************************/
  266. #ifndef _MMI_SCHEDULEPOWERONOFF_C
  267. #define _MMI_SCHEDULEPOWERONOFF_C
  268. /*  Include: MMI header file */
  269. #include "PixtelDataTypes.h"
  270. #include "GlobalDefs.h"
  271. #include "DebugInitDef.h"
  272. #include "NVRAMType.h"
  273. #include "NVRAMEnum.h"
  274. #include "NVRAMProt.h"
  275. #include "AlarmFrameworkProt.h"
  276. #include "AlarmGprot.h"
  277. #include "AlarmDef.h"
  278. #include "DateTimeGprot.h"
  279. #include "ScheduledPowerOnOff.h"
  280. #include "wgui_categories.h"
  281. #include "SettingDefs.h"
  282. #include "CommonScreens.h"
  283. #include "Wgui_categories_popup.h"
  284. #include "WrapperGprot.h"
  285. #include "SimDetectionGexdcl.h"
  286. #include "gpioInc.h"    /* TurnOnBacklight */
  287. #include "JavaAgencyDef.h"
  288. /* ... Add More MMI header */
  289. /*  Include: PS header file */
  290. /* ... Add More PS header */
  291. /* 
  292.  * Define
  293.  */
  294. /* 
  295.  * Typedef 
  296.  */
  297. /* 
  298.  * Local Variable
  299.  */
  300. /* 
  301.  * Local Function
  302.  */
  303. /* 
  304.  * Global Variable
  305.  */
  306. spof_context_struct g_spof_cntx;
  307. extern wgui_inline_item wgui_inline_items[];
  308. /* 
  309.  * Global Function
  310.  */
  311. extern void ShutdownSystemOperation(void);
  312. #ifdef __J2ME__
  313. extern void jvm_pause_dummy_screen(void);
  314. extern void jvm_resume_dummy_screen(void);
  315. #endif /* __J2ME__ */ 
  316. /*****************************************************************************
  317.  * FUNCTION
  318.  *  SPOFInit
  319.  * DESCRIPTION
  320.  *  Initialize SPOF application
  321.  * PARAMETERS
  322.  *  void
  323.  * RETURNS
  324.  *  void
  325.  *****************************************************************************/
  326. void SPOFInit(void)
  327. {
  328.     /*----------------------------------------------------------------*/
  329.     /* Local Variables                                                */
  330.     /*----------------------------------------------------------------*/
  331.     /*----------------------------------------------------------------*/
  332.     /* Code Body                                                      */
  333.     /*----------------------------------------------------------------*/
  334. }
  335. /*****************************************************************************
  336.  * FUNCTION
  337.  *  SPOFInitNvRam
  338.  * DESCRIPTION
  339.  *  Read nvram data of SPOF
  340.  * PARAMETERS
  341.  *  void
  342.  * RETURNS
  343.  *  void
  344.  *****************************************************************************/
  345. void SPOFInitNvRam(void)
  346. {
  347.     /*----------------------------------------------------------------*/
  348.     /* Local Variables                                                */
  349.     /*----------------------------------------------------------------*/
  350.     S16 error;
  351.     U8 nvram_buf[NVRAM_ALM_SPOF_DATA_SIZE];
  352.     /*----------------------------------------------------------------*/
  353.     /* Code Body                                                      */
  354.     /*----------------------------------------------------------------*/
  355.     ReadRecord(NVRAM_EF_ALM_SPOF_DATA_LID, 1, &nvram_buf, NVRAM_ALM_SPOF_DATA_SIZE, &error);
  356.     memcpy(g_spof_cntx.SPOFList, nvram_buf, sizeof(g_spof_cntx.SPOFList));
  357.     /* zero initialized */
  358.     if (g_spof_cntx.SPOFList[0].Hour > NUM_HRS_DAY)
  359.     {
  360.         memset(&g_spof_cntx.SPOFList, 0, sizeof(g_spof_cntx.SPOFList));
  361.     }
  362.     /* no require to set any alarm */
  363. }
  364. /*****************************************************************************
  365.  * FUNCTION
  366.  *  SPOFExpiryTimeCBH
  367.  * DESCRIPTION
  368.  *  Callback handler to get information of SPOF/SPON expiry setting.
  369.  * PARAMETERS
  370.  *  index           [IN]            
  371.  *  alarmTime       [?]             
  372.  *  Freq            [?]             
  373.  *  WeekDays        [?]             
  374.  *  MYTIME(?)       [IN/OUT]        Expiry time set by user
  375.  *  U8(?)           [IN/OUT]        Expiry days of week
  376.  * RETURNS
  377.  *  void
  378.  *****************************************************************************/
  379. void SPOFExpiryTimeCBH(U8 index, MYTIME *alarmTime, U8 *Freq, U8 *WeekDays, MYTIME* preReminder)
  380. {
  381.     /*----------------------------------------------------------------*/
  382.     /* Local Variables                                                */
  383.     /*----------------------------------------------------------------*/
  384.     /*----------------------------------------------------------------*/
  385.     /* Code Body                                                      */
  386.     /*----------------------------------------------------------------*/
  387.     alarmTime->nHour = g_spof_cntx.SPOFList[index].Hour;
  388.     alarmTime->nMin = g_spof_cntx.SPOFList[index].Min;
  389.     *Freq = ALM_FREQ_EVERYDAY;
  390.     *WeekDays = ALM_ALL_DAYS;
  391. }
  392. /*****************************************************************************
  393.  * FUNCTION
  394.  *  SPOFReInitQueueCBH
  395.  * DESCRIPTION
  396.  *  Reinit SPOF to alarm queue
  397.  * PARAMETERS
  398.  *  void
  399.  * RETURNS
  400.  *  void
  401.  *****************************************************************************/
  402. void SPOFReInitQueueCBH(void)
  403. {
  404.     /*----------------------------------------------------------------*/
  405.     /* Local Variables                                                */
  406.     /*----------------------------------------------------------------*/
  407.     U8 i;
  408.     /*----------------------------------------------------------------*/
  409.     /* Code Body                                                      */
  410.     /*----------------------------------------------------------------*/
  411.     for (i = 0; i < NUM_OF_SPOF; i++)
  412.     {
  413.         if (g_spof_cntx.SPOFList[i].Status == 1)
  414.         {
  415.             if (g_spof_cntx.SPOFList[i].Type == SPOF_POWERON)
  416.             {
  417.                 AlmInsertIntoQueue((U8) (i + ALM_SPON_START), FALSE);
  418.             }
  419.             else
  420.             {
  421.                 AlmInsertIntoQueue((U8) (i + ALM_SPOF_START), FALSE);
  422.             }
  423.         }
  424.     }
  425. }
  426. /*****************************************************************************
  427.  * FUNCTION
  428.  *  SponExpiryHandler
  429.  * DESCRIPTION
  430.  *  CallBack handler to execute SPON expiry.
  431.  * PARAMETERS
  432.  *  sponIndex       [IN]        
  433.  *  period          [?]         
  434.  *  power_on        [IN]        
  435.  *  BOOL(?)         [IN]        Power status
  436.  *  U8(?)           [IN]        Index of alarm item
  437.  * RETURNS
  438.  *  void
  439.  *****************************************************************************/
  440. U8 SponExpiryHandler(U8 sponIndex, U16 *period, BOOL power_on)
  441. {
  442.     /*----------------------------------------------------------------*/
  443.     /* Local Variables                                                */
  444.     /*----------------------------------------------------------------*/
  445.     U16 sponPeriod = 0;
  446. #ifdef __J2ME__
  447.     U8 IsJavaPlaying = FALSE;
  448. #endif 
  449.     /*----------------------------------------------------------------*/
  450.     /* Code Body                                                      */
  451.     /*----------------------------------------------------------------*/
  452.     period = &sponPeriod;
  453.     if (power_on)
  454.     {
  455.         /* Balance previous SPOF if exists, if first alarm in queue is pending SPOF, cancel it. */
  456.         U8 index = mmi_alm_get_index_from_queue(0);
  457.         if (AlmGetType(index) == ALM_TYPE_SPOF)
  458.         {
  459.         #ifdef __J2ME__
  460.             if (GetActiveScreenId() == SCR_JAVA_APP)
  461.             {
  462.                 IsJavaPlaying = TRUE;
  463.                 jvm_pause_dummy_screen();
  464.             }
  465.         #endif /* __J2ME__ */ 
  466.             AlmInsertIntoQueue(index, TRUE);
  467.         #ifdef __J2ME__
  468.             if (IsJavaPlaying == TRUE)
  469.             {
  470.                 jvm_resume_dummy_screen();
  471.             }
  472.         #endif /* __J2ME__ */ 
  473.         }
  474.     }
  475.     else
  476.     {
  477.         AlmSendPowerOn();
  478.     }
  479.     return ALM_HAS_NO_IND;
  480. }
  481. /*****************************************************************************
  482.  * FUNCTION
  483.  *  SpofExpiryHandler
  484.  * DESCRIPTION
  485.  *  CallBack handler to execute SPOF expiry.
  486.  * PARAMETERS
  487.  *  index           [IN]        
  488.  *  period          [?]         
  489.  *  power_on        [IN]        
  490.  *  BOOL(?)         [IN]        Power status
  491.  *  U8(?)           [IN]        Index of alarm item
  492.  * RETURNS
  493.  *  void
  494.  *****************************************************************************/
  495. U8 SpofExpiryHandler(U8 index, U16 *period, BOOL power_on)
  496. {
  497.     /*----------------------------------------------------------------*/
  498.     /* Local Variables                                                */
  499.     /*----------------------------------------------------------------*/
  500.     /*----------------------------------------------------------------*/
  501.     /* Code Body                                                      */
  502.     /*----------------------------------------------------------------*/
  503.     if (power_on)
  504.     {
  505.         *period = ALM_DEFAULT_EXPIRY_PERIOD;
  506.         EntryPowerOffConfirmation();
  507.         return ALM_HAS_IND;
  508.     }
  509.     else
  510.     {
  511.         if (g_alm_frm_cntx.EnabledAlarms > 0)
  512.         {
  513.             g_alm_frm_cntx.IsWaitForPwroff = TRUE;
  514.         }
  515.         else
  516.         {
  517.             AlmSendPowerOff();
  518.         }
  519.         *period = ALM_WITHOUD_EXPIRY_PERIOD;
  520.         return ALM_HAS_NO_IND;
  521.     }
  522. }
  523. /*****************************************************************************
  524.  * FUNCTION
  525.  *  SPOFFCBInit
  526.  * DESCRIPTION
  527.  *  Set callback function needed by alarm framework
  528.  * PARAMETERS
  529.  *  void
  530.  * RETURNS
  531.  *  void
  532.  *****************************************************************************/
  533. void SPOFFCBInit(void)
  534. {
  535.     /*----------------------------------------------------------------*/
  536.     /* Local Variables                                                */
  537.     /*----------------------------------------------------------------*/
  538.     /*----------------------------------------------------------------*/
  539.     /* Code Body                                                      */
  540.     /*----------------------------------------------------------------*/
  541.     mmi_alm_set_start_index(ALM_TYPE_SPON, ALM_SPON_START);
  542.     AlmSetExpiryTimeCB(ALM_TYPE_SPON, SPOFExpiryTimeCBH);
  543.     AlmSetExpiryHandlerCB(ALM_TYPE_SPON, SponExpiryHandler);
  544.     AlmSetInitHandlerCB(ALM_TYPE_SPON, SPOFInitNvRam, SPOFReInitQueueCBH);
  545.     mmi_alm_set_start_index(ALM_TYPE_SPOF, ALM_SPOF_START);
  546.     AlmSetExpiryTimeCB(ALM_TYPE_SPOF, SPOFExpiryTimeCBH);
  547.     AlmSetExpiryHandlerCB(ALM_TYPE_SPOF, SpofExpiryHandler);
  548. }
  549. /*****************************************************************************
  550.  * FUNCTION
  551.  *  SPOFDeInit
  552.  * DESCRIPTION
  553.  *  Deinitialize SPOF application
  554.  * PARAMETERS
  555.  *  void
  556.  * RETURNS
  557.  *  void
  558.  *****************************************************************************/
  559. void SPOFDeInit(void)
  560. {
  561.     /*----------------------------------------------------------------*/
  562.     /* Local Variables                                                */
  563.     /*----------------------------------------------------------------*/
  564.     /*----------------------------------------------------------------*/
  565.     /* Code Body                                                      */
  566.     /*----------------------------------------------------------------*/
  567. }
  568. /*****************************************************************************
  569.  * FUNCTION
  570.  *  EntrySpofApp
  571.  * DESCRIPTION
  572.  *  Entry function of schedule power on off application.
  573.  * PARAMETERS
  574.  *  void
  575.  * RETURNS
  576.  *  void
  577.  *****************************************************************************/
  578. void EntrySpofApp(void)
  579. {
  580.     /*----------------------------------------------------------------*/
  581.     /* Local Variables                                                */
  582.     /*----------------------------------------------------------------*/
  583.     U8 *guiBuffer;
  584.     S32 i;
  585.     S32 num_of_items = NUM_OF_SPOF;
  586.     MYTIME tmpTime;
  587.     U16 spof_states_icon[NUM_OF_SPOF];
  588.     U16 spof_type_icon[NUM_OF_SPOF];
  589.     /*----------------------------------------------------------------*/
  590.     /* Code Body                                                      */
  591.     /*----------------------------------------------------------------*/
  592. #ifdef __MMI_TWO_SPOF__
  593.     num_of_items = 2;
  594. #endif 
  595.     EntryNewScreen(SCR_ID_SPOF_APP, NULL, EntrySpofApp, NULL);
  596.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SPOF_APP);
  597.     if (guiBuffer == NULL)
  598.     {
  599.         g_spof_cntx.CurrItem = 0;
  600.     }
  601.     /* initialize list to display */
  602.     for (i = 0; i < NUM_OF_SPOF; i++)
  603.     {
  604.         /* get the value of spof_list */
  605.         memset(&tmpTime, 0, sizeof(MYTIME));
  606.         tmpTime.nHour = g_spof_cntx.SPOFList[i].Hour;
  607.         tmpTime.nMin = g_spof_cntx.SPOFList[i].Min;
  608.         time_string(&tmpTime, (UI_string_type) subMenuDataPtrs[i], DT_IDLE_SCREEN);
  609.         /* get the value of spof_vicons */
  610.         if (g_spof_cntx.SPOFList[i].Status == SPOF_DISABLE)
  611.         {
  612.             spof_states_icon[i] = CHECKBOX_OFF_IMAGE_ID;
  613.         }
  614.         else
  615.         {
  616.             spof_states_icon[i] = CHECKBOX_ON_IMAGE_ID;
  617.         }
  618.         /* get the value of spof_type poweon off */
  619.         if (g_spof_cntx.SPOFList[i].Type == SPOF_POWERON)
  620.         {
  621.             spof_type_icon[i] = SPOF_TYPEPOWERON_IMAGEID;
  622.         }
  623.         else
  624.         {
  625.             spof_type_icon[i] = SPOF_TYPEPOWEROFF_IMAGEID;
  626.         }
  627.     }
  628.     ShowCategory73Screen(
  629.         SPOF_MAIN_TITLE_STRINGID,
  630.         IMG_SCR_SETTING_CAPTION,
  631.         STR_GLOBAL_EDIT,
  632.         SPOF_EDIT_BUTTON_IMAGEID,
  633.         STR_GLOBAL_BACK,
  634.         IMG_GLOBAL_BACK,
  635.         num_of_items,
  636.         subMenuDataPtrs,
  637.         spof_states_icon,
  638.         spof_type_icon,
  639.         0,
  640.         guiBuffer,
  641.         1);
  642.     RegisterHighlightHandler(HighlightSpofList);
  643.     SetLeftSoftkeyFunction(EntrySpofEdit, KEY_EVENT_UP);
  644.     SetKeyHandler(EntrySpofEdit, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  645.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  646.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  647. }
  648. /*****************************************************************************
  649.  * FUNCTION
  650.  *  HighlightSpofList
  651.  * DESCRIPTION
  652.  *  Highlight handler of SPOF list
  653.  * PARAMETERS
  654.  *  nIndex      [IN]        Index item
  655.  * RETURNS
  656.  *  void
  657.  *****************************************************************************/
  658. void HighlightSpofList(S32 nIndex)
  659. {
  660.     /*----------------------------------------------------------------*/
  661.     /* Local Variables                                                */
  662.     /*----------------------------------------------------------------*/
  663.     /*----------------------------------------------------------------*/
  664.     /* Code Body                                                      */
  665.     /*----------------------------------------------------------------*/
  666.     g_spof_cntx.CurrItem = (U8) nIndex;
  667. }
  668. /*****************************************************************************
  669.  * FUNCTION
  670.  *  HighlightSPOFInlineItem
  671.  * DESCRIPTION
  672.  *  Highlight handler of inline editor screen
  673.  * PARAMETERS
  674.  *  nIndex      [IN]        Index of inline item
  675.  * RETURNS
  676.  *  void
  677.  *****************************************************************************/
  678. void HighlightSPOFInlineItem(S32 nIndex)
  679. {
  680.     /*----------------------------------------------------------------*/
  681.     /* Local Variables                                                */
  682.     /*----------------------------------------------------------------*/
  683.     /*----------------------------------------------------------------*/
  684.     /* Code Body                                                      */
  685.     /*----------------------------------------------------------------*/
  686.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  687.     SetCategory57LeftSoftkeyFunction(SpofSaveData);
  688. }
  689. /*****************************************************************************
  690.  * FUNCTION
  691.  *  EntrySpofEdit
  692.  * DESCRIPTION
  693.  *  Entry function of inline editor screen of schedule power on off
  694.  * PARAMETERS
  695.  *  void
  696.  * RETURNS
  697.  *  void
  698.  *****************************************************************************/
  699. void EntrySpofEdit(void)
  700. {
  701.     /*----------------------------------------------------------------*/
  702.     /* Local Variables                                                */
  703.     /*----------------------------------------------------------------*/
  704.     U8 *guiBuffer;
  705.     U8 *inputBuffer;        /* added for inline edit history */
  706.     U16 inputBufferSize;    /* added for inline edit history */
  707.     U16 spof_icon_list[] = {SPOF_SETTING_STATUS_IMAGEID, 0, SPOF_TYPEPOWERON_IMAGEID, IMG_TIME};
  708.     /*----------------------------------------------------------------*/
  709.     /* Code Body                                                      */
  710.     /*----------------------------------------------------------------*/
  711.     EntryNewScreen(SCR_ID_SPOF_EDITOR, ExitSpofEdit, NULL, NULL);
  712.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SPOF_EDITOR);
  713.     InitializeCategory57Screen();
  714.     SpofFillInlineEditStruct();
  715.     inputBuffer = GetCurrNInputBuffer(SCR_ID_SPOF_EDITOR, &inputBufferSize);    /* added for inline edit history */
  716.     if (inputBuffer != NULL)
  717.     {
  718.         SetCategory57Data(wgui_inline_items, NUM_ITEM_EDIT_SCREEN, inputBuffer);
  719.     }
  720.     RegisterHighlightHandler(HighlightSPOFInlineItem);
  721.     ShowCategory57Screen(
  722.         SPOF_EDIT_TITLE_STRINGID,
  723.         IMG_SCR_SETTING_CAPTION,
  724.         STR_GLOBAL_OK,
  725.         IMG_GLOBAL_OK,
  726.         STR_GLOBAL_BACK,
  727.         IMG_GLOBAL_BACK,
  728.         NUM_ITEM_EDIT_SCREEN,
  729.         spof_icon_list,
  730.         wgui_inline_items,
  731.         0,
  732.         guiBuffer);
  733.     DisableCategory57ScreenDone();
  734.     SetCategory57RightSoftkeyFunctions(SpofSaveData, GoBackHistory);
  735. }
  736. /*****************************************************************************
  737.  * FUNCTION
  738.  *  ExitSpofEdit
  739.  * DESCRIPTION
  740.  *  Exit Handler For SPOF Edit Screen
  741.  * PARAMETERS
  742.  *  void
  743.  * RETURNS
  744.  *  void
  745.  *****************************************************************************/
  746. void ExitSpofEdit(void)
  747. {
  748.     /*----------------------------------------------------------------*/
  749.     /* Local Variables                                                */
  750.     /*----------------------------------------------------------------*/
  751.     history Scr;
  752.     U16 inputBufferSize;    /* added for inline edit history */
  753.     S16 nHistory = 0;
  754.     /*----------------------------------------------------------------*/
  755.     /* Code Body                                                      */
  756.     /*----------------------------------------------------------------*/
  757.     Scr.scrnID = SCR_ID_SPOF_EDITOR;
  758.     CloseCategory57Screen();
  759.     Scr.entryFuncPtr = EntrySpofEdit;
  760.     pfnUnicodeStrcpy((S8*) Scr.inputBuffer, (S8*) & nHistory);
  761.     GetCategoryHistory(Scr.guiBuffer);
  762.     inputBufferSize = (U16) GetCategory57DataSize();    /* added for inline edit history */
  763.     GetCategory57Data((U8*) Scr.inputBuffer);           /* added for inline edit history */
  764.     AddNHistory(Scr, inputBufferSize);                  /* added for inline edit history */
  765. }
  766. /*****************************************************************************
  767.  * FUNCTION
  768.  *  SpofFillInlineEditStruct
  769.  * DESCRIPTION
  770.  *  Initialize inline editor structure
  771.  * PARAMETERS
  772.  *  void
  773.  * RETURNS
  774.  *  void
  775.  *****************************************************************************/
  776. void SpofFillInlineEditStruct(void)
  777. {
  778.     /*----------------------------------------------------------------*/
  779.     /* Local Variables                                                */
  780.     /*----------------------------------------------------------------*/
  781.     S8 dummyString[12];
  782.     /*----------------------------------------------------------------*/
  783.     /* Code Body                                                      */
  784.     /*----------------------------------------------------------------*/
  785.     /* initialize string resource for inline selection */
  786.     g_spof_cntx.ActStateList[0] = GetString(SPOF_DISABLE_STRINGID);
  787.     g_spof_cntx.ActStateList[1] = GetString(SPOF_ENABLE_STRINGID);
  788.     g_spof_cntx.OnOffStateList[0] = GetString(SPOF_PON_STRINGID);     //Old:GetString(STR_GLOBAL_ON);     //KP Jerry modify on 2007-3-30
  789.     g_spof_cntx.OnOffStateList[1] = GetString(SPOF_POFF_STRINGID);     //Old:GetString(STR_GLOBAL_OFF);     //KP Jerry modify on 2007-3-30
  790.     g_spof_cntx.CurrHiliteOnOff = g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Type;
  791.     g_spof_cntx.CurrHiliteActivation = g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Status;
  792.     /* hour buffer */
  793.     sprintf(dummyString, "%02d", g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Hour);
  794.     AnsiiToUnicodeString(g_spof_cntx.HourBuf, dummyString);
  795.     /* minute buffer */
  796.     sprintf(dummyString, "%02d", g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Min);
  797.     AnsiiToUnicodeString(g_spof_cntx.MinBuf, dummyString);
  798.     /* caption */
  799.     SetInlineItemCaption(&wgui_inline_items[0], (PU8) GetString(SPOF_STATUS_STRINGID));
  800.     /* activate/inactivate */
  801.     SetInlineItemActivation(&wgui_inline_items[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  802.     SetInlineItemSelect(
  803.         &wgui_inline_items[1],
  804.         SPOF_NUM_STATES_ACTINACT,
  805.         (U8 **) g_spof_cntx.ActStateList,
  806.         &g_spof_cntx.CurrHiliteActivation);
  807.     /* power on/off */
  808.     SetInlineItemActivation(&wgui_inline_items[2], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  809.     DisableInlineItemHighlight(&wgui_inline_items[2]);
  810.     SetInlineItemSelect(
  811.         &wgui_inline_items[2],
  812.         SPOF_NUM_STATES_ONOFF,
  813.         (U8 **) g_spof_cntx.OnOffStateList,
  814.         &g_spof_cntx.CurrHiliteOnOff);
  815.     /* time */
  816.     SetInlineItemActivation(&wgui_inline_items[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  817.     SetInlineItemTime(
  818.         &wgui_inline_items[3],
  819.         (U8*) g_spof_cntx.HourBuf,
  820.         (U8*) g_spof_cntx.MinBuf,
  821.         NULL,
  822.         AlmTimeEditorCallBack /* SOPFTimeEditorCallBack */ );
  823.     DisableInlineItemHighlight(&wgui_inline_items[3]);
  824. }
  825. /*****************************************************************************
  826.  * FUNCTION
  827.  *  SpofSaveData
  828.  * DESCRIPTION
  829.  *  Save SPOF data to NVRAM
  830.  * PARAMETERS
  831.  *  void
  832.  * RETURNS
  833.  *  void
  834.  *****************************************************************************/
  835. void SpofSaveData(void)
  836. {
  837.     /*----------------------------------------------------------------*/
  838.     /* Local Variables                                                */
  839.     /*----------------------------------------------------------------*/
  840.     U8 NewHour, NewMin;
  841.     /*----------------------------------------------------------------*/
  842.     /* Code Body                                                      */
  843.     /*----------------------------------------------------------------*/
  844.     NewHour = (g_spof_cntx.HourBuf[0] - '0') * 10 + (g_spof_cntx.HourBuf[ENCODING_LENGTH] - '0');
  845.     NewMin = (g_spof_cntx.MinBuf[0] - '0') * 10 + (g_spof_cntx.MinBuf[ENCODING_LENGTH] - '0');
  846.     if (SpofIsTimeClash(NewHour, NewMin))
  847.     {
  848.         DisplayPopup(
  849.             (PU8) GetString(SPOF_TIME_CONFLICT),
  850.             IMG_GLOBAL_UNFINISHED,
  851.             0,
  852.             UI_POPUP_NOTIFYDURATION_TIME,
  853.             ERROR_TONE);
  854.         return;
  855.     }
  856.     /* if setting changed */
  857.     if (g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Hour != NewHour ||
  858.         g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Min != NewMin ||
  859.         g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Type != (U8) g_spof_cntx.CurrHiliteOnOff ||
  860.         g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Status != g_spof_cntx.CurrHiliteActivation)
  861.     {
  862.         /* fill the SPOFList structure depending on the selected values */
  863.         g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Status = (U8) g_spof_cntx.CurrHiliteActivation;
  864.         g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Type = (U8) g_spof_cntx.CurrHiliteOnOff;
  865.         g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Hour = NewHour;
  866.         g_spof_cntx.SPOFList[g_spof_cntx.CurrItem].Min = NewMin;
  867.         /* save the alarm in the nvram */
  868.         SpofWritetoNvram();
  869.         if (g_spof_cntx.CurrHiliteActivation == SPOF_ENABLE)
  870.         {
  871.             if (g_spof_cntx.CurrHiliteOnOff == SPOF_POWERON)
  872.             {
  873.                 AlmCancelAlarm((U8) (g_spof_cntx.CurrItem + ALM_SPOF_START));
  874.                 AlmSetAlarm((U8) (g_spof_cntx.CurrItem + ALM_SPON_START));
  875.             }
  876.             else
  877.             {
  878.                 AlmCancelAlarm((U8) (g_spof_cntx.CurrItem + ALM_SPON_START));
  879.                 AlmSetAlarm((U8) (g_spof_cntx.CurrItem + ALM_SPOF_START));
  880.             }
  881.         }
  882.         else
  883.         {
  884.             AlmCancelAlarm((U8) (g_spof_cntx.CurrItem + ALM_SPON_START));
  885.             AlmCancelAlarm((U8) (g_spof_cntx.CurrItem + ALM_SPOF_START));
  886.         }
  887.     }
  888.     if (!g_spof_cntx.IsRestoreDefault)
  889.     {
  890.         DisplayPopup(
  891.             (PU8) GetString(STR_GLOBAL_DONE),
  892.             IMG_GLOBAL_ACTIVATED,
  893.             1,
  894.             UI_POPUP_NOTIFYDURATION_TIME,
  895.             SUCCESS_TONE);
  896.         DeleteUptoScrID(SCR_ID_SPOF_APP);
  897.     }
  898. }
  899. /*****************************************************************************
  900.  * FUNCTION
  901.  *  SpofWritetoNvram
  902.  * DESCRIPTION
  903.  *  Write SPOF Value to NVRAM
  904.  * PARAMETERS
  905.  *  void
  906.  * RETURNS
  907.  *  void
  908.  *****************************************************************************/
  909. void SpofWritetoNvram(void)
  910. {
  911.     /*----------------------------------------------------------------*/
  912.     /* Local Variables                                                */
  913.     /*----------------------------------------------------------------*/
  914.     S16 error;
  915.     U8 nvram_buf[NVRAM_ALM_SPOF_DATA_SIZE];
  916.     /*----------------------------------------------------------------*/
  917.     /* Code Body                                                      */
  918.     /*----------------------------------------------------------------*/
  919.     memset(nvram_buf, 0, NVRAM_ALM_SPOF_DATA_SIZE);
  920.     memcpy(nvram_buf, g_spof_cntx.SPOFList, sizeof(g_spof_cntx.SPOFList));
  921.     WriteRecord(NVRAM_EF_ALM_SPOF_DATA_LID, 1, (void*)nvram_buf, NVRAM_ALM_SPOF_DATA_SIZE, &error);
  922. }
  923. /*****************************************************************************
  924.  * FUNCTION
  925.  *  SpofHandler
  926.  * DESCRIPTION
  927.  *  Match The ALARM With SPOF Index, If Matches
  928.  *  1. If Phone is off, switch on the phone else normally expire the alarm if POWERON Expire
  929.  *  2. If Phone is on, switch off the phone else normally expire the alarm if PowerOff Expire
  930.  * PARAMETERS
  931.  *  index       [IN]        
  932.  *  id(?)       [IN]        Index of spof alarm
  933.  * RETURNS
  934.  *  void
  935.  *****************************************************************************/
  936. void SpofHandler(U8 index)
  937. {
  938.     /*----------------------------------------------------------------*/
  939.     /* Local Variables                                                */
  940.     /*----------------------------------------------------------------*/
  941.     /*----------------------------------------------------------------*/
  942.     /* Code Body                                                      */
  943.     /*----------------------------------------------------------------*/
  944.     if (index >= ALM_SPOF_START)
  945.     {
  946.         index -= ALM_SPOF_START;
  947.     }
  948.     /* depending on the index check whether it was power on or off */
  949.     if ((g_spof_cntx.SPOFList[index].Type == SPOF_POWERON) && (g_alm_frm_cntx.IsPwronAlarm == TRUE))
  950.     {
  951.         AlmSendPowerOn();
  952.     }
  953.     else if ((g_spof_cntx.SPOFList[index].Type == SPOF_POWEROFF) && (g_alm_frm_cntx.IsPwronAlarm == FALSE))
  954.     {
  955.         ShutdownSystemOperation();
  956.     }
  957. }
  958. /*****************************************************************************
  959.  * FUNCTION
  960.  *  SpofRestore
  961.  * DESCRIPTION
  962.  *  Restore default value of SPOF variables and save to NVRAM
  963.  * PARAMETERS
  964.  *  void
  965.  * RETURNS
  966.  *  void
  967.  *****************************************************************************/
  968. void SpofRestore(void)
  969. {
  970.     /*----------------------------------------------------------------*/
  971.     /* Local Variables                                                */
  972.     /*----------------------------------------------------------------*/
  973.     S32 i;
  974.     /*----------------------------------------------------------------*/
  975.     /* Code Body                                                      */
  976.     /*----------------------------------------------------------------*/
  977.     g_spof_cntx.CurrHiliteActivation = SPOF_DISABLE;
  978.     g_spof_cntx.CurrHiliteOnOff = SPOF_POWERON;
  979.     PRINT_INFORMATION_2((MMI_TRACE_G7_MISC, "=== SpofRestore(): Cancel SPOF Aalrm. ===n"));
  980.     for (i = 0; i < NUM_OF_SPOF; i++)
  981.         if (g_spof_cntx.SPOFList[i].Status == SPOF_ENABLE)
  982.         {
  983.             AlmCancelAlarm((U8) (ALM_SPOF_START + i));
  984.             AlmCancelAlarm((U8) (ALM_SPON_START + i));
  985.         }
  986.     memset(g_spof_cntx.SPOFList, 0, sizeof(g_spof_cntx.SPOFList));
  987.     SpofWritetoNvram();
  988. }
  989. /*****************************************************************************
  990.  * FUNCTION
  991.  *  SpofIsTimeClash
  992.  * DESCRIPTION
  993.  *  To check if the setting time clashes with other SPOF alarm
  994.  * PARAMETERS
  995.  *  hour        [IN]        Hour to be compared.
  996.  *  min         [IN]        Min to be compared.
  997.  * RETURNS
  998.  *  TRUE if clash, otherwise FALSE.
  999.  *****************************************************************************/
  1000. BOOL SpofIsTimeClash(U8 hour, U8 min)
  1001. {
  1002.     /*----------------------------------------------------------------*/
  1003.     /* Local Variables                                                */
  1004.     /*----------------------------------------------------------------*/
  1005.     S32 i;
  1006.     /*----------------------------------------------------------------*/
  1007.     /* Code Body                                                      */
  1008.     /*----------------------------------------------------------------*/
  1009.     if (g_spof_cntx.CurrHiliteActivation == SPOF_ENABLE)
  1010.     {
  1011.         for (i = 0; i < NUM_OF_SPOF; i++)
  1012.         {
  1013.             if (i != g_spof_cntx.CurrItem)
  1014.                 if (g_spof_cntx.SPOFList[i].Status == SPOF_ENABLE && hour == g_spof_cntx.SPOFList[i].Hour &&
  1015.                     min == g_spof_cntx.SPOFList[i].Min)
  1016.                 {
  1017.                     return TRUE;
  1018.                 }
  1019.         }
  1020.     }
  1021.     return FALSE;
  1022. }
  1023. /*****************************************************************************
  1024.  * FUNCTION
  1025.  *  EntryPowerOffConfirmation
  1026.  * DESCRIPTION
  1027.  *  Display confirmation screen to decide power off or not.
  1028.  * PARAMETERS
  1029.  *  void
  1030.  *  U8.(?)
  1031.  * RETURNS
  1032.  *  void
  1033.  *****************************************************************************/
  1034. void EntryPowerOffConfirmation(void)
  1035. {
  1036.     /*----------------------------------------------------------------*/
  1037.     /* Local Variables                                                */
  1038.     /*----------------------------------------------------------------*/
  1039.     U8 *guiBuffer;
  1040.     /*----------------------------------------------------------------*/
  1041.     /* Code Body                                                      */
  1042.     /*----------------------------------------------------------------*/
  1043.     EntryNewScreen(SCR_ID_SPOF_CONFIRM, ExitPowerOffConfirmation, EntryPowerOffConfirmation, NULL);
  1044.     SetDelScrnIDCallbackHandler(SCR_ID_SPOF_CONFIRM, (HistoryDelCBPtr) mmi_spof_del_scr_callback);
  1045.     TurnOnBacklight(1);
  1046.     guiBuffer = GetCurrGuiBuffer(SCR_ID_SPOF_CONFIRM);
  1047.     StartTimer(ALARM_ALERT_NOTIFYDURATION_TIMER, ALM_EXPIRE_DURATION, AlmHandleAlarmTimeout);
  1048.     ShowCategory123Screen(
  1049.         SPOF_MAIN_TITLE_STRINGID,
  1050.         ALARMS_MAIN_TITLE_IMAGEID,
  1051.         STR_GLOBAL_YES,
  1052.         IMG_GLOBAL_YES,
  1053.         STR_GLOBAL_NO,
  1054.         IMG_GLOBAL_NO,
  1055.         SPOF_POWER_OFF_CONFIRM,
  1056.         IMG_GLOBAL_QUESTION,
  1057.         guiBuffer);
  1058.     SetLeftSoftkeyFunction(ShutdownSystemOperation, KEY_EVENT_UP);
  1059.     SetRightSoftkeyFunction(SpofStopPowerOffConfirmation, KEY_EVENT_UP);
  1060.     ClearKeyHandler(KEY_END, KEY_EVENT_UP);
  1061.     ClearKeyHandler(KEY_END, KEY_EVENT_DOWN);
  1062.     SetKeyHandler(ShutdownSystemOperation, KEY_END, KEY_LONG_PRESS);
  1063. }
  1064. /*****************************************************************************
  1065.  * FUNCTION
  1066.  *  ExitPowerOffConfirmation
  1067.  * DESCRIPTION
  1068.  *  Exit function of SPOF confirm screen.
  1069.  * PARAMETERS
  1070.  *  void
  1071.  * RETURNS
  1072.  *  void
  1073.  *****************************************************************************/
  1074. void ExitPowerOffConfirmation(void)
  1075. {
  1076.     /*----------------------------------------------------------------*/
  1077.     /* Local Variables                                                */
  1078.     /*----------------------------------------------------------------*/
  1079.     /*----------------------------------------------------------------*/
  1080.     /* Code Body                                                      */
  1081.     /*----------------------------------------------------------------*/
  1082.     StopTimer(ALARM_ALERT_NOTIFYDURATION_TIMER);
  1083. }
  1084. /*****************************************************************************
  1085.  * FUNCTION
  1086.  *  SpofStopPowerOffConfirmation
  1087.  * DESCRIPTION
  1088.  *  Stop power off confirm screen manually.
  1089.  * PARAMETERS
  1090.  *  void
  1091.  * RETURNS
  1092.  *  void
  1093.  *****************************************************************************/
  1094. void SpofStopPowerOffConfirmation(void)
  1095. {
  1096.     /*----------------------------------------------------------------*/
  1097.     /* Local Variables                                                */
  1098.     /*----------------------------------------------------------------*/
  1099.     /*----------------------------------------------------------------*/
  1100.     /* Code Body                                                      */
  1101.     /*----------------------------------------------------------------*/
  1102.     StopTimer(ALARM_ALERT_NOTIFYDURATION_TIMER);
  1103.     GoBackHistory();
  1104.     if (g_alm_frm_cntx.IsExitByTimer == FALSE)
  1105.     {
  1106.         if (g_alm_frm_cntx.IsPwronAlarm)
  1107.         {
  1108.             AlmExecPwrOffAlarm();
  1109.         }
  1110.         else
  1111.         {
  1112.             AlmExecPwrOnAlarm();
  1113.         }
  1114.     }
  1115. }
  1116. /*****************************************************************************
  1117.  * FUNCTION
  1118.  *  mmi_spof_del_scr_callback
  1119.  * DESCRIPTION
  1120.  *  Callback handler of delete spof confirm screen from history stack.
  1121.  * PARAMETERS
  1122.  *  p       [?]     
  1123.  * RETURNS
  1124.  *  void
  1125.  *****************************************************************************/
  1126. U8 mmi_spof_del_scr_callback(void *p)
  1127. {
  1128.     /*----------------------------------------------------------------*/
  1129.     /* Local Variables                                                */
  1130.     /*----------------------------------------------------------------*/
  1131.     /*----------------------------------------------------------------*/
  1132.     /* Code Body                                                      */
  1133.     /*----------------------------------------------------------------*/
  1134.     /* if the confirm screen is in history stack, display confirm screen again */
  1135.     if (GetExitScrnID() == SCR_ID_SPOF_CONFIRM)
  1136.     {
  1137.         return MMI_FALSE;
  1138.     }
  1139.     else
  1140.     {
  1141.         return MMI_TRUE;
  1142.     }
  1143. }
  1144. #endif /* _MMI_SCHEDULEPOWERONOFF_C */ // #ifndef _MMI_SCHEDULEPOWERONOFF_C