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

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) 2006
  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.  * PhnsetGPIO.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for GPIO setting Menus
  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.  *------------------------------------------------------------------------------
  84.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  85.  *============================================================================
  86.  ****************************************************************************/
  87. /***************************************************************************** 
  88. * Include
  89. *****************************************************************************/
  90. /* MMI standard headers */
  91. #include "MMI_features.h"
  92. #include "stdC.h"
  93. #include "L4Dr1.h"
  94. #include "PixtelDataTypes.h"
  95. /* Setting releative headers */ 
  96. #include "SettingDefs.h"
  97. #include "PhnsetGPIO.h"
  98. /* Device headers */
  99. #include "gpioinc.h"
  100. #include "lcd_if.h"
  101. /* UI */
  102. #include "MainMenuDef.h"              
  103. #include "GlobalConstants.h"
  104. #include "GlobalDefs.h"
  105. #include "CommonScreens.h"
  106. #include "IdleAppDef.h"
  107. /* nvram access */
  108. #include "custom_mmi_default_value.h" 
  109. #include "NVRAMProt.h"                
  110. #include "NVRAMType.h"
  111. /* Others */
  112. #include "SimDetectionGexdcl.h"       /* power on mode */
  113. /***************************************************************************** 
  114. * Local Functions
  115. *****************************************************************************/
  116. static void PhnsetContrastLevelEndHdlr(void);
  117. MMI_BOOL PhnsetRestoreToNvramContrast(void);
  118. void PhnsetMainLCDContrast(U8 level);
  119. void PhnsetSubLCDContrast(U8 level);
  120. /***************************************************************************** 
  121. * Local Varibles
  122. *****************************************************************************/
  123. static mmi_phnset_gpio_cntx_struct g_phnset_gpio_cntx;
  124. #if defined(MMI_ON_HARDWARE_P)
  125. static kal_uint8 PhnsetMainLCD_Contrast_Info[15];
  126. #if defined(__MMI_SUBLCD__)
  127. static kal_uint8 PhnsetSubLCD_Contrast_Info[15];
  128. #endif 
  129. #endif /* MMI_ON_HARDWARE_P  */ 
  130. /***************************************************************************** 
  131. * Global Varibles
  132. *****************************************************************************/
  133. mmi_phnset_gpio_cntx_struct *g_phnset_gpio_cntx_p = &g_phnset_gpio_cntx;
  134. //KP Jerry add on 2007-03-31 start
  135. #ifdef __MMI_PROFILE_POWER_SAVING__
  136. extern U32 GetCurrentActivatedProfileLCDBKTime(void);
  137. void ProfileResetBackLightSetting(void)
  138. {
  139.        g_phnset_gpio_cntx_p->bl_setting_level = GetCurrentActivatedProfileLCDBKLevel();
  140. g_phnset_gpio_cntx_p->bl_setting_hftime = GetCurrentActivatedProfileLCDBKTime();
  141. }
  142. #endif
  143. //KP Jerry add on 2007-03-31 end
  144. /*****************************************************************************
  145.  * FUNCTION
  146.  *  PhnsetReadGPIOSetting
  147.  * DESCRIPTION
  148.  *  ...
  149.  * PARAMETERS
  150.  *  void
  151.  * RETURNS
  152.  *  void
  153.  *****************************************************************************/
  154. void PhnsetReadGPIOSetting(void)
  155. {
  156.     /*----------------------------------------------------------------*/
  157.     /* Local Variables                                                */
  158.     /*----------------------------------------------------------------*/
  159.     S16 error;
  160.     /*----------------------------------------------------------------*/
  161.     /* Code Body                                                      */
  162.     /*----------------------------------------------------------------*/
  163.     if (g_pwr_context.PowerOnMode != POWER_ON_USB)
  164.     {
  165. //KP Jerry modify on 2007-03-31 start
  166. #ifdef __MMI_PROFILE_POWER_SAVING__
  167.         g_phnset_gpio_cntx_p->bl_setting_level = GetCurrentActivatedProfileLCDBKLevel();
  168. #else
  169.         ReadValue(NVRAM_BYTE_BL_SETTING_LEVEL, &(g_phnset_gpio_cntx_p->bl_setting_level), DS_BYTE, &error);
  170. #endif
  171. //KP Jerry modify on 2007-03-31 end
  172.         if (g_phnset_gpio_cntx_p->bl_setting_level > 5)
  173.         {
  174.         #if !defined(__MTK_TARGET__)
  175.             g_phnset_gpio_cntx_p->bl_setting_level = 5;
  176.         #else 
  177.             g_phnset_gpio_cntx_p->bl_setting_level = 5;     //old=3;   //jerson modify 20070622
  178.         #endif 
  179.             WriteValue(NVRAM_BYTE_BL_SETTING_LEVEL, &(g_phnset_gpio_cntx_p->bl_setting_level), DS_BYTE, &error);
  180.         }
  181. //KP Jerry modify on 2007-03-31 start
  182. #ifdef __MMI_PROFILE_POWER_SAVING__
  183.         g_phnset_gpio_cntx_p->bl_setting_hftime = GetCurrentActivatedProfileLCDBKTime();
  184. #else
  185.         ReadValue(NVRAM_BYTE_BL_SETTING_HFTIME, &(g_phnset_gpio_cntx_p->bl_setting_hftime), DS_BYTE, &error);
  186. #endif
  187. //KP Jerry modify on 2007-03-31 end
  188.         if (g_phnset_gpio_cntx_p->bl_setting_hftime < 5 || g_phnset_gpio_cntx_p->bl_setting_hftime > 60)
  189.         {
  190.             g_phnset_gpio_cntx_p->bl_setting_hftime = 15;     //Old:45      //KP Jerry modify on 2007-3-6
  191.             WriteValue(NVRAM_BYTE_BL_SETTING_HFTIME, &(g_phnset_gpio_cntx_p->bl_setting_hftime), DS_BYTE, &error);
  192.         }
  193.         ReadValue(NVRAM_BYTE_LED_SETTING, &(g_phnset_gpio_cntx_p->led_setting), DS_BYTE, &error);
  194.         if (g_phnset_gpio_cntx_p->led_setting != 0 && g_phnset_gpio_cntx_p->led_setting != 1)
  195.         {
  196.             g_phnset_gpio_cntx_p->led_setting = 1;
  197.             WriteValue(NVRAM_BYTE_LED_SETTING, &(g_phnset_gpio_cntx_p->led_setting), DS_BYTE, &error);
  198.         }
  199.     #ifdef __MMI_PHNSET_GPIO_COVER__
  200.         ReadValue(NVRAM_BYTE_COVER_CLOSE_BACK_TO_IDLE, &(g_phnset_gpio_cntx_p->cover_close_back_to_idle), DS_BYTE, &error);
  201.         ReadValue(NVRAM_BYTE_COVER_CLOSE_REJECT_CALL, &(g_phnset_gpio_cntx_p->cover_close_reject_call), DS_BYTE, &error);
  202.         ReadValue(NVRAM_BYTE_COVER_CLOSE_KEYPAD_LOCK, &(g_phnset_gpio_cntx_p->cover_close_keypad_lock), DS_BYTE, &error);
  203.         g_phnset_gpio_cntx_p->cover_close_back_to_idle &= 0x01;
  204.         g_phnset_gpio_cntx_p->cover_close_reject_call &= 0x01;
  205.         g_phnset_gpio_cntx_p->cover_close_keypad_lock &= 0x01;
  206.     #endif /* __MMI_PHNSET_GPIO_COVER__ */
  207.     }
  208.     else
  209.     {
  210.         g_phnset_gpio_cntx_p->bl_setting_level = 3;
  211.         g_phnset_gpio_cntx_p->bl_setting_hftime = 15;     //Old:45      //KP Jerry modify on 2007-3-6
  212.         g_phnset_gpio_cntx_p->led_setting = 1;
  213.     }
  214. }
  215. /*****************************************************************************
  216.  * FUNCTION
  217.  *  EntryPhnsetGPIOSetting
  218.  * DESCRIPTION
  219.  *  ...
  220.  * PARAMETERS
  221.  *  void
  222.  * RETURNS
  223.  *  void
  224.  *****************************************************************************/
  225. void EntryPhnsetGPIOSetting(void)
  226. {
  227.     /*----------------------------------------------------------------*/
  228.     /* Local Variables                                                */
  229.     /*----------------------------------------------------------------*/
  230.     U16 nStrItemList[MAX_SUB_MENUS];    /* Stores the strings id of submenus returned */
  231.     U16 nNumofItem;                     /* Stores no of children in the submenu */
  232.     U16 nDispAttribute;                 /* Stores display attribue */
  233.     U8 *guiBuffer;                      /* Buffer holding history data */
  234.     U8 *ItemType[MAX_SUB_MENUS];
  235.     /*----------------------------------------------------------------*/
  236.     /* Code Body                                                      */
  237.     /*----------------------------------------------------------------*/
  238.     /* 1 Call Exit Handler */
  239.     EntryNewScreen(SCR_ID_PHNSET_GPIO_SETTING, NULL, EntryPhnsetGPIOSetting, NULL);
  240.     /* 2 Get current screen to gui buffer  for history purposes */
  241.     guiBuffer = GetCurrGuiBuffer(SCR_ID_PHNSET_GPIO_SETTING);
  242.     /* 3. Retrieve no of child of menu item to be displayed */
  243.     nNumofItem = GetNumOfChild(MENU_ID_PHNSET_GPIO_SETTING);
  244.     /* 4. Get attribute of menu to be displayed */
  245.     nDispAttribute = GetDispAttributeOfItem(MENU_ID_PHNSET_GPIO_SETTING);
  246.     /* 5. Retrieve string ids in sequence of given menu item to be displayed */
  247.     GetSequenceStringIds(MENU_ID_PHNSET_GPIO_SETTING, nStrItemList);
  248.     /* 6 Set current parent id */
  249.     SetParentHandler(MENU_ID_PHNSET_GPIO_SETTING);
  250.     /* 7 Register highlight handler to be called in menu screen */
  251.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  252.     /* 8 Construct the Hints List */
  253.     ConstructHintsList(MENU_ID_PHNSET_GPIO_SETTING, ItemType);
  254.     ShowCategory52Screen(
  255.         STR_ID_PHNSET_GPIO_SETTING,
  256.         MAIN_MENU_TITLE_SETTINGS_ICON,
  257.         STR_GLOBAL_OK,
  258.         IMG_GLOBAL_OK,
  259.         STR_GLOBAL_BACK,
  260.         IMG_GLOBAL_BACK,
  261.         nNumofItem,
  262.         nStrItemList,
  263.         (PU16) gIndexIconsImageList,
  264.         ItemType,
  265.         0,
  266.         0,
  267.         guiBuffer);
  268.     /* 9.Register function with right softkey */
  269.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  270.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  271.     /* 10. Register Exit handler */
  272.     //SetExitHandler(SCR9003_INITIALSETUP, ExitPhnsetScr);
  273.     //SetGenericExitHandler( SCR_DISP_SETUP, NULL, EntryDispSetup);
  274. }
  275. /*****************************************************************************
  276.  * FUNCTION
  277.  *  EntryPhnsetGPIOLED
  278.  * DESCRIPTION
  279.  *  ...
  280.  * PARAMETERS
  281.  *  void
  282.  * RETURNS
  283.  *  void
  284.  *****************************************************************************/
  285. void EntryPhnsetGPIOLED(void)
  286. {
  287.     /*----------------------------------------------------------------*/
  288.     /* Local Variables                                                */
  289.     /*----------------------------------------------------------------*/
  290.     U16 index;
  291.     index = GetCurrHiliteID();
  292.     /*----------------------------------------------------------------*/
  293.     /* Code Body                                                      */
  294.     /*----------------------------------------------------------------*/
  295.     if (GetExitScrnID() != POPUP_SCREENID)
  296.     {
  297.         S16 error;
  298.         if (g_phnset_gpio_cntx_p->led_setting)
  299.         {
  300.             g_phnset_gpio_cntx_p->led_setting = 0;
  301.             StopLEDPatternBackGround();
  302.             DisplayPopup(
  303.                 (U8*) GetString(STR_GLOBAL_OFF),
  304.                 IMG_GLOBAL_ACTIVATED,
  305.                 1,
  306.                 UI_POPUP_NOTIFYDURATION_TIME,
  307.                 (U8) SUCCESS_TONE);
  308.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  309.             Category52ChangeItemDescription(index, hintData[index]);
  310.         }
  311.         else
  312.         {
  313.             g_phnset_gpio_cntx_p->led_setting = 1;
  314.             StartLEDPatternBackGround();
  315.             DisplayPopup(
  316.                 (U8*) GetString(STR_GLOBAL_ON),
  317.                 IMG_GLOBAL_ACTIVATED,
  318.                 1,
  319.                 UI_POPUP_NOTIFYDURATION_TIME,
  320.                 (U8) SUCCESS_TONE);
  321.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  322.             Category52ChangeItemDescription(index, hintData[index]);
  323.         }
  324.         WriteValue(NVRAM_BYTE_LED_SETTING, &(g_phnset_gpio_cntx_p->led_setting), DS_BYTE, &error);
  325.     }
  326. }
  327. /*****************************************************************************
  328.  * FUNCTION
  329.  *  HighlightPhnsetBackLiteLevel
  330.  * DESCRIPTION
  331.  *  
  332.  * PARAMETERS
  333.  *  index       [IN]        
  334.  * RETURNS
  335.  *  void
  336.  *****************************************************************************/
  337. void HighlightPhnsetBackLiteLevel(S32 index)
  338. {
  339.     /*----------------------------------------------------------------*/
  340.     /* Local Variables                                                */
  341.     /*----------------------------------------------------------------*/
  342.     /*----------------------------------------------------------------*/
  343.     /* Code Body                                                      */
  344.     /*----------------------------------------------------------------*/
  345.     if (index > 0 && index <= 5)
  346.     {
  347.         g_phnset_gpio_cntx_p->bl_setting_level = index;
  348.         SetGPIOLevelReq(GPIO_DEV_LED_MAINLCD, LED_LIGHT_LEVEL5);
  349.     }
  350. }
  351. /*****************************************************************************
  352.  * FUNCTION
  353.  *  HighlightPhnsetBackLiteHFTime
  354.  * DESCRIPTION
  355.  *  This function is highlight handler for Phonesetup-> Contrast -> SubLCD
  356.  *  Follow functions:
  357.  * PARAMETERS
  358.  *  index       [IN]        
  359.  * RETURNS
  360.  *  void
  361.  *****************************************************************************/
  362. void HighlightPhnsetBackLiteHFTime(S32 index)
  363. {
  364.     /*----------------------------------------------------------------*/
  365.     /* Local Variables                                                */
  366.     /*----------------------------------------------------------------*/
  367.     /*----------------------------------------------------------------*/
  368.     /* Code Body                                                      */
  369.     /*----------------------------------------------------------------*/
  370.     if (index >= 5 && index <= 60)
  371.     {
  372.         g_phnset_gpio_cntx_p->bl_setting_hftime = index;
  373.     }
  374. }
  375. /*****************************************************************************
  376.  * FUNCTION
  377.  *  PhnsetGPIOBackLiteEndHdlr
  378.  * DESCRIPTION
  379.  *  
  380.  * PARAMETERS
  381.  *  void
  382.  * RETURNS
  383.  *  void
  384.  *****************************************************************************/
  385. void PhnsetGPIOBackLiteEndHdlr(void)
  386. {
  387.     /*----------------------------------------------------------------*/
  388.     /* Local Variables                                                */
  389.     /*----------------------------------------------------------------*/
  390.     S16 error;
  391.     /*----------------------------------------------------------------*/
  392.     /* Code Body                                                      */
  393.     /*----------------------------------------------------------------*/
  394.     ReadValue(NVRAM_BYTE_BL_SETTING_LEVEL, &(g_phnset_gpio_cntx_p->bl_setting_level), DS_BYTE, &error);
  395.     SetGPIOLevelReq(GPIO_DEV_LED_MAINLCD, LED_LIGHT_LEVEL5);
  396.     ReadValue(NVRAM_BYTE_BL_SETTING_HFTIME, &(g_phnset_gpio_cntx_p->bl_setting_hftime), DS_BYTE, &error);
  397.     DisplayIdleScreen();
  398. }
  399. /*****************************************************************************
  400.  * FUNCTION
  401.  *  PhnsetGPIOBackLiteLSKHdlr
  402.  * DESCRIPTION
  403.  *  This function is Left softkey handler
  404.  *  for Phonesetup->Constract -> Main/Sub LCD
  405.  * PARAMETERS
  406.  *  void
  407.  * RETURNS
  408.  *  void
  409.  *****************************************************************************/
  410. void PhnsetGPIOBackLiteLSKHdlr(void)
  411. {
  412.     /*----------------------------------------------------------------*/
  413.     /* Local Variables                                                */
  414.     /*----------------------------------------------------------------*/
  415.     S16 error;
  416.     U8 data;
  417.     /*----------------------------------------------------------------*/
  418.     /* Code Body                                                      */
  419.     /*----------------------------------------------------------------*/
  420.     ReadValue(NVRAM_BYTE_BL_SETTING_LEVEL, &data, DS_BYTE, &error);
  421.     if (data != g_phnset_gpio_cntx_p->bl_setting_level)
  422.     {
  423.         WriteValue(NVRAM_BYTE_BL_SETTING_LEVEL, &(g_phnset_gpio_cntx_p->bl_setting_level), DS_BYTE, &error);
  424.     }
  425.     ReadValue(NVRAM_BYTE_BL_SETTING_HFTIME, &data, DS_BYTE, &error);
  426.     if (data != g_phnset_gpio_cntx_p->bl_setting_hftime)
  427.     {
  428.         WriteValue(NVRAM_BYTE_BL_SETTING_HFTIME, &(g_phnset_gpio_cntx_p->bl_setting_hftime), DS_BYTE, &error);
  429.     }
  430.     DisplayPopup(
  431.         (U8*) GetString(STR_GLOBAL_DONE),
  432.         IMG_GLOBAL_ACTIVATED,
  433.         1,
  434.         UI_POPUP_NOTIFYDURATION_TIME,
  435.         (U8) SUCCESS_TONE);
  436.     DeleteScreenIfPresent(SCR_ID_PHNSET_GPIO_BACKLITE);
  437. }
  438. /*****************************************************************************
  439.  * FUNCTION
  440.  *  PhnsetGPIOBackLiteRSKHdlr
  441.  * DESCRIPTION
  442.  *  This function is Right softkey handler
  443.  *  for Phonesetup->Constract -> Main/Sub LCD
  444.  * PARAMETERS
  445.  *  void
  446.  * RETURNS
  447.  *  void
  448.  *****************************************************************************/
  449. void PhnsetGPIOBackLiteRSKHdlr(void)
  450. {
  451.     /*----------------------------------------------------------------*/
  452.     /* Local Variables                                                */
  453.     /*----------------------------------------------------------------*/
  454.     S16 error;
  455.     /*----------------------------------------------------------------*/
  456.     /* Code Body                                                      */
  457.     /*----------------------------------------------------------------*/
  458.     ReadValue(NVRAM_BYTE_BL_SETTING_LEVEL, &g_phnset_gpio_cntx_p->bl_setting_level, DS_BYTE, &error);
  459.     ReadValue(NVRAM_BYTE_BL_SETTING_HFTIME, &g_phnset_gpio_cntx_p->bl_setting_hftime, DS_BYTE, &error);
  460.     GoBackHistory();
  461. }
  462. /*****************************************************************************
  463.  * FUNCTION
  464.  *  EntryPhnsetGPIOBackLite
  465.  * DESCRIPTION
  466.  *  ...
  467.  * PARAMETERS
  468.  *  void
  469.  * RETURNS
  470.  *  void
  471.  *****************************************************************************/
  472. void ExitPhnsetGPIOBackLite(void)
  473. {
  474.     /*----------------------------------------------------------------*/
  475.     /* Local Variables                                                */
  476.     /*----------------------------------------------------------------*/
  477.     S16 error;
  478.     
  479.     /*----------------------------------------------------------------*/
  480.     /* Code Body                                                      */
  481.     /*----------------------------------------------------------------*/
  482.     ReadValue(NVRAM_BYTE_BL_SETTING_LEVEL, &(g_phnset_gpio_cntx_p->bl_setting_level), DS_BYTE, &error);
  483.     SetGPIOLevelReq(GPIO_DEV_LED_MAINLCD, LED_LIGHT_LEVEL5);
  484.     ReadValue(NVRAM_BYTE_BL_SETTING_HFTIME, &(g_phnset_gpio_cntx_p->bl_setting_hftime), DS_BYTE, &error);
  485. }
  486. /*****************************************************************************
  487.  * FUNCTION
  488.  *  EntryPhnsetGPIOBackLite
  489.  * DESCRIPTION
  490.  *  ...
  491.  * PARAMETERS
  492.  *  void
  493.  * RETURNS
  494.  *  void
  495.  *****************************************************************************/
  496. void EntryPhnsetGPIOBackLite(void)
  497. {
  498.     /*----------------------------------------------------------------*/
  499.     /* Local Variables                                                */
  500.     /*----------------------------------------------------------------*/
  501.     U8 *guiBuffer, *BLHFTime = NULL, *BLLevel = NULL;
  502. #ifndef __MMI_GPIO_SUPPORT_BL_LEVEL__       //Old:#ifdef __MMI_GPIO_SUPPORT_BL_LEVEL__      //KP Jerry modify on 2007-3-6
  503.     S32 lower_limit[1];
  504.     S32 upper_limit[1];
  505.     S32 *current_value[1];
  506.     void (*cb_func[1]) (S32 value);
  507. #else /* __MMI_GPIO_SUPPORT_BL_LEVEL__ */ 
  508.     S32 lower_limit[2];
  509.     S32 upper_limit[2];
  510.     S32 *current_value[2];
  511.     void (*cb_func[2]) (S32 value);
  512.     U8 *str_list[2];
  513. #endif /* __MMI_GPIO_SUPPORT_BL_LEVEL__ */ 
  514.     /*----------------------------------------------------------------*/
  515.     /* Code Body                                                      */
  516.     /*----------------------------------------------------------------*/
  517.     /* Call Exit Handler */
  518.     EntryNewScreen(SCR_ID_PHNSET_GPIO_BACKLITE, ExitPhnsetGPIOBackLite, EntryPhnsetGPIOBackLite, NULL);
  519.     /* Get current screen to gui buffer  for history purposes */
  520.     guiBuffer = GetCurrGuiBuffer(SCR_ID_PHNSET_GPIO_BACKLITE);
  521.     BLLevel = (U8*) GetString(STR_ID_PHNSET_GPIO_BACKLITE_LEVEL);
  522.     BLHFTime = (U8*) GetString(STR_ID_PHNSET_GPIO_BACKLITE_HF_TIME);
  523.     /* Set current parent id */
  524.     SetParentHandler(MENU_ID_PHNSET_GPIO_BACKLITE);
  525. #ifndef __MMI_GPIO_SUPPORT_BL_LEVEL__       //Old:#ifdef __MMI_GPIO_SUPPORT_BL_LEVEL__      //KP Jerry modify on 2007-3-6
  526.     lower_limit[0] = 5;
  527.     upper_limit[0] = 60;
  528.     current_value[0] = & (g_phnset_gpio_cntx_p->bl_setting_hftime);
  529.     cb_func[0] = HighlightPhnsetBackLiteHFTime;
  530.     ShowCategory88Screen(
  531.         STR_ID_PHNSET_GPIO_BACKLITE,
  532.         MAIN_MENU_TITLE_SETTINGS_ICON,
  533.         STR_GLOBAL_OK,
  534.         IMG_GLOBAL_OK,
  535.         0,
  536.         0,
  537.         0,
  538.         1,
  539.         NULL,
  540.         lower_limit,
  541.         upper_limit,
  542.         current_value,
  543.         cb_func,
  544.         guiBuffer);
  545. #else /* __MMI_GPIO_SUPPORT_BL_LEVEL__ */ 
  546.     lower_limit[0] = 1;
  547.     upper_limit[0] = 5;
  548.     current_value[0] = &(g_phnset_gpio_cntx_p->bl_setting_level);
  549.     cb_func[0] = HighlightPhnsetBackLiteLevel;
  550.     str_list[0] = BLLevel;
  551.     lower_limit[1] = 5;
  552.     upper_limit[1] = 60;
  553.     current_value[1] = (S32 *)&(g_phnset_gpio_cntx_p->bl_setting_hftime);
  554.     cb_func[1] = HighlightPhnsetBackLiteHFTime;
  555.     str_list[1] = BLHFTime;
  556.     ShowCategory88Screen(
  557.         STR_ID_PHNSET_GPIO_BACKLITE,
  558.         MAIN_MENU_TITLE_SETTINGS_ICON,
  559.         STR_GLOBAL_OK,
  560.         0,
  561.         STR_GLOBAL_BACK,
  562.         0,
  563.         0,
  564.         2,
  565.         str_list,
  566.         lower_limit,
  567.         upper_limit,
  568.         current_value,
  569.         cb_func,
  570.         guiBuffer);
  571. #endif /* __MMI_GPIO_SUPPORT_BL_LEVEL__ */ 
  572.     /* Register function with right softkey */
  573.     SetKeyHandler(PhnsetGPIOBackLiteEndHdlr, KEY_END, KEY_EVENT_DOWN);
  574.     SetLeftSoftkeyFunction(PhnsetGPIOBackLiteLSKHdlr, KEY_EVENT_UP);
  575.     SetRightSoftkeyFunction(PhnsetGPIOBackLiteRSKHdlr, KEY_EVENT_UP);
  576. }
  577. #ifdef __MMI_PHNSET_GPIO_COVER__
  578. /*****************************************************************************
  579.  * FUNCTION
  580.  *  PhnsetGPIOCoverLSKHdlr
  581.  * DESCRIPTION
  582.  *  This function is Left softkey handler
  583.  *  for Phonesetup->Constract -> Main/Sub LCD
  584.  * PARAMETERS
  585.  *  void
  586.  * RETURNS
  587.  *  void
  588.  *****************************************************************************/
  589. void PhnsetGPIOCoverLSKHdlr(void)
  590. {
  591.     /*----------------------------------------------------------------*/
  592.     /* Local Variables                                                */
  593.     /*----------------------------------------------------------------*/
  594.     S16 error;
  595.     /*----------------------------------------------------------------*/
  596.     /* Code Body                                                      */
  597.     /*----------------------------------------------------------------*/
  598.     WriteValue(NVRAM_BYTE_COVER_CLOSE_BACK_TO_IDLE, &(g_phnset_gpio_cntx_p->cover_close_back_to_idle), DS_BYTE, &error);
  599.     WriteValue(NVRAM_BYTE_COVER_CLOSE_REJECT_CALL, &(g_phnset_gpio_cntx_p->cover_close_reject_call), DS_BYTE, &error);
  600.     WriteValue(NVRAM_BYTE_COVER_CLOSE_KEYPAD_LOCK, &(g_phnset_gpio_cntx_p->cover_close_keypad_lock), DS_BYTE, &error);
  601.     DisplayPopup(
  602.         (U8*) GetString(STR_GLOBAL_DONE),
  603.         IMG_GLOBAL_ACTIVATED,
  604.         1,
  605.         UI_POPUP_NOTIFYDURATION_TIME,
  606.         (U8) SUCCESS_TONE);
  607.     DeleteScreenIfPresent(SCR_ID_PHNSET_GPIO_COVER_CLOSE);
  608. }
  609. /*****************************************************************************
  610.  * FUNCTION
  611.  *  PhnsetGPIOCoverFillInline
  612.  * DESCRIPTION
  613.  *  
  614.  * PARAMETERS
  615.  *  InLineItems     [IN]        
  616.  * RETURNS
  617.  *  void
  618.  *****************************************************************************/
  619. void PhnsetGPIOCoverFillInline(InlineItem *InLineItems)
  620. {
  621.     /*----------------------------------------------------------------*/
  622.     /* Local Variables                                                */
  623.     /*----------------------------------------------------------------*/
  624.     /*----------------------------------------------------------------*/
  625.     /* Code Body                                                      */
  626.     /*----------------------------------------------------------------*/
  627.     SetInlineItemActivation(&InLineItems[1], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  628.     SetInlineItemActivation(&InLineItems[3], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  629.     SetInlineItemActivation(&InLineItems[5], INLINE_ITEM_ACTIVATE_WITHOUT_KEY_EVENT, 0);
  630.     subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_BACK_TO_IDLE_TITLE] =
  631.         (PU8) GetString(STR_ID_PHNSET_GPIO_COVER_CLOSE_BACK_TO_IDLE);
  632.     subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_BACK_TO_IDLE_ON] = (PU8) GetString(STR_GLOBAL_OFF);
  633.     subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_BACK_TO_IDLE_OFF] = (PU8) GetString(STR_GLOBAL_ON);
  634.     subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_REJECT_CALL_TITLE] =
  635.         (PU8) GetString(STR_ID_PHNSET_GPIO_COVER_CLOSE_REJECT_CALL);
  636.     subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_REJECT_CALL_YES] = (PU8) GetString(STR_GLOBAL_YES);
  637.     subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_REJECT_CALL_NO] = (PU8) GetString(STR_GLOBAL_NO);
  638.     subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_KEYPAD_LOCK_TITLE] =
  639.         (PU8) GetString(STR_ID_PHNSET_GPIO_COVER_CLOSE_KEYPAD_LOCK);
  640.     subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_KEYPAD_LOCK_ON] = (PU8) GetString(STR_GLOBAL_OFF);
  641.     subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_KEYPAD_LOCK_OFF] = (PU8) GetString(STR_GLOBAL_ON);
  642.     SetInlineItemCaption(&InLineItems[0], subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_BACK_TO_IDLE_TITLE]);
  643.     SetInlineItemSelect(
  644.         &InLineItems[1],
  645.         2,
  646.         &subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_BACK_TO_IDLE_ON],
  647.         &(g_phnset_gpio_cntx_p->cover_close_back_to_idle));
  648.     SetInlineItemCaption(&InLineItems[2], subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_REJECT_CALL_TITLE]);
  649.     SetInlineItemSelect(
  650.         &InLineItems[3],
  651.         2,
  652.         &subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_REJECT_CALL_YES],
  653.         &(g_phnset_gpio_cntx_p->cover_close_reject_call));
  654.     SetInlineItemCaption(&InLineItems[4], subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_KEYPAD_LOCK_TITLE]);
  655.     SetInlineItemSelect(
  656.         &InLineItems[5],
  657.         2,
  658.         &subMenuDataPtrs[PHNSET_GPIO_COVER_CLOSE_KEYPAD_LOCK_ON],
  659.         &(g_phnset_gpio_cntx_p->cover_close_keypad_lock));
  660. }
  661. /*****************************************************************************
  662.  * FUNCTION
  663.  *  PhnsetGPIOCoverInlineHiliteHdlr
  664.  * DESCRIPTION
  665.  *  
  666.  * PARAMETERS
  667.  *  nIndex      [IN]        
  668.  * RETURNS
  669.  *  void
  670.  *****************************************************************************/
  671. void PhnsetGPIOCoverInlineHiliteHdlr(S32 nIndex)
  672. {
  673.     /*----------------------------------------------------------------*/
  674.     /* Local Variables                                                */
  675.     /*----------------------------------------------------------------*/
  676.     /*----------------------------------------------------------------*/
  677.     /* Code Body                                                      */
  678.     /*----------------------------------------------------------------*/
  679.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  680.     SetCategory57LeftSoftkeyFunction(PhnsetGPIOCoverLSKHdlr);
  681. }
  682. /*****************************************************************************
  683.  * FUNCTION
  684.  *  EntryPhnsetGPIOCover
  685.  * DESCRIPTION
  686.  *  ...
  687.  * PARAMETERS
  688.  *  void
  689.  * RETURNS
  690.  *  void
  691.  *****************************************************************************/
  692. void EntryPhnsetGPIOCover(void)
  693. {
  694.     /*----------------------------------------------------------------*/
  695.     /* Local Variables                                                */
  696.     /*----------------------------------------------------------------*/
  697.     U8 *guiBuffer;
  698.     U16 icons[6] = {IMG_SETTING_GREET_TEXT, 0, IMG_SETTING_GREET_TEXT, 0, IMG_SETTING_GREET_TEXT, 0};
  699.     InlineItem InLineItems[6];
  700.     U8 *inputBuffer;        /* added for inline edit history */
  701.     U16 inputBufferSize;    /* added for inline edit history */
  702.     /*----------------------------------------------------------------*/
  703.     /* Code Body                                                      */
  704.     /*----------------------------------------------------------------*/
  705.     EntryNewScreen(SCR_ID_PHNSET_GPIO_COVER_CLOSE, NULL, EntryPhnsetGPIOCover, NULL);
  706.     InitializeCategory57Screen();
  707.     guiBuffer = GetCurrGuiBuffer(SCR_ID_PHNSET_GPIO_COVER_CLOSE);
  708.     memset((void*)InLineItems, 0, sizeof(InlineItem) * 6);
  709.     PhnsetGPIOCoverFillInline(InLineItems);
  710.     SetLeftSoftkeyFunction(PhnsetGPIOCoverLSKHdlr, KEY_EVENT_UP);
  711.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  712.     RegisterHighlightHandler(PhnsetGPIOCoverInlineHiliteHdlr);
  713.     /* added for inline edit history */
  714.     inputBuffer = GetCurrNInputBuffer(SCR_ID_PHNSET_GPIO_COVER_CLOSE, &inputBufferSize);
  715.     if (inputBuffer != NULL)    /* added for inline edit history */
  716.     {
  717.         SetCategory57Data(InLineItems, 6, inputBuffer); /* sets the data */
  718.     }
  719.     ShowCategory57Screen(
  720.         STR_ID_PHNSET_GPIO_COVER_CLOSE,
  721.         IMG_SCR_SETTING_CAPTION,
  722.         STR_GLOBAL_OK,
  723.         IMG_GLOBAL_OK,
  724.         STR_GLOBAL_BACK,
  725.         IMG_GLOBAL_BACK,
  726.         6,
  727.         icons,
  728.         InLineItems,
  729.         0,
  730.         guiBuffer);
  731.     DisableCategory57ScreenDone();
  732.     SetCategory57RightSoftkeyFunctions(PhnsetGPIOCoverLSKHdlr, GoBackHistory);
  733. }
  734. /*****************************************************************************
  735.  * FUNCTION
  736.  *  HighlightPhnsetGPIOCover
  737.  * DESCRIPTION
  738.  *  ...
  739.  * PARAMETERS
  740.  *  void
  741.  * RETURNS
  742.  *  void
  743.  *****************************************************************************/
  744. void HighlightPhnsetGPIOCover(void)
  745. {
  746.     /*----------------------------------------------------------------*/
  747.     /* Local Variables                                                */
  748.     /*----------------------------------------------------------------*/
  749.     /*----------------------------------------------------------------*/
  750.     /* Code Body                                                      */
  751.     /*----------------------------------------------------------------*/
  752.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  753.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  754.     SetLeftSoftkeyFunction(EntryPhnsetGPIOCover, KEY_EVENT_UP);
  755.     SetKeyHandler(EntryPhnsetGPIOCover, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  756.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  757.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  758. }
  759. #endif /* __MMI_PHNSET_GPIO_COVER__ */
  760. /*****************************************************************************
  761.  * FUNCTION
  762.  *  HighlightPhnsetGPIOSetting
  763.  * DESCRIPTION
  764.  *  ...
  765.  * PARAMETERS
  766.  *  void
  767.  * RETURNS
  768.  *  void
  769.  *****************************************************************************/
  770. void HighlightPhnsetGPIOSetting(void)
  771. {
  772.     /*----------------------------------------------------------------*/
  773.     /* Local Variables                                                */
  774.     /*----------------------------------------------------------------*/
  775.     /*----------------------------------------------------------------*/
  776.     /* Code Body                                                      */
  777.     /*----------------------------------------------------------------*/
  778.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  779.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  780.     SetLeftSoftkeyFunction(EntryPhnsetGPIOSetting, KEY_EVENT_UP);
  781.     SetKeyHandler(EntryPhnsetGPIOSetting, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  782.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  783.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  784. }
  785. /*****************************************************************************
  786.  * FUNCTION
  787.  *  HighlightPhnsetGPIOLED
  788.  * DESCRIPTION
  789.  *  ...
  790.  * PARAMETERS
  791.  *  void
  792.  * RETURNS
  793.  *  void
  794.  *****************************************************************************/
  795. void HighlightPhnsetGPIOLED(void)
  796. {
  797.     /*----------------------------------------------------------------*/
  798.     /* Local Variables                                                */
  799.     /*----------------------------------------------------------------*/
  800.     U16 index;
  801.     index = GetCurrHiliteID();
  802.     /*----------------------------------------------------------------*/
  803.     /* Code Body                                                      */
  804.     /*----------------------------------------------------------------*/
  805.     if (g_phnset_gpio_cntx_p->led_setting == 1)
  806.     {
  807.         ChangeLeftSoftkey(STR_GLOBAL_OFF, 0);
  808.     }
  809.     else
  810.     {
  811.         ChangeLeftSoftkey(STR_GLOBAL_ON, 0);
  812.     }
  813.     /* Change right soft key icon and label */
  814.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  815.     SetLeftSoftkeyFunction(EntryPhnsetGPIOLED, KEY_EVENT_UP);
  816.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  817.     /* Register function for right soft key */
  818.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  819.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  820. }
  821. /*****************************************************************************
  822.  * FUNCTION
  823.  *  HighlightPhnsetGPIOBackLite
  824.  * DESCRIPTION
  825.  *  ...
  826.  * PARAMETERS
  827.  *  void
  828.  * RETURNS
  829.  *  void
  830.  *****************************************************************************/
  831. void HighlightPhnsetGPIOBackLite(void)
  832. {
  833.     /*----------------------------------------------------------------*/
  834.     /* Local Variables                                                */
  835.     /*----------------------------------------------------------------*/
  836.     /*----------------------------------------------------------------*/
  837.     /* Code Body                                                      */
  838.     /*----------------------------------------------------------------*/
  839.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  840.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  841.     SetLeftSoftkeyFunction(EntryPhnsetGPIOBackLite, KEY_EVENT_UP);
  842.     SetKeyHandler(EntryPhnsetGPIOBackLite, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  843.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  844.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  845. }
  846. /*****************************************************************************
  847.  * FUNCTION
  848.  *  HintPhnsetGPIOLED
  849.  * DESCRIPTION
  850.  *  ...
  851.  * PARAMETERS
  852.  *  index       [IN]        
  853.  * RETURNS
  854.  *  void
  855.  *****************************************************************************/
  856. void HintPhnsetGPIOLED(U16 index)
  857. {
  858.     /*----------------------------------------------------------------*/
  859.     /* Local Variables                                                */
  860.     /*----------------------------------------------------------------*/
  861.     /*----------------------------------------------------------------*/
  862.     /* Code Body                                                      */
  863.     /*----------------------------------------------------------------*/
  864.     if (g_phnset_gpio_cntx_p->led_setting == 1)
  865.     {
  866.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_ON));
  867.     }
  868.     else
  869.     {
  870.         pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_GLOBAL_OFF));
  871.     }
  872. }
  873. #if !defined(__MMI_NO_CONTRAST_LEVEL__)
  874. /*****************************************************************************
  875.  * FUNCTION
  876.  *  HighlightPhnsetContrastLevel
  877.  * DESCRIPTION
  878.  *  This function is highlight handler for Phonesetup-> Contrast
  879.  *  Follow functions:
  880.  * PARAMETERS
  881.  *  void
  882.  *  a(?)        [IN/OUT]        
  883.  *  b(?)        [IN]            
  884.  * RETURNS
  885.  *  void
  886.  *****************************************************************************/
  887. void HighlightPhnsetContrastLevel(void)
  888. {
  889.     /*----------------------------------------------------------------*/
  890.     /* Local Variables                                                */
  891.     /*----------------------------------------------------------------*/
  892.     /*----------------------------------------------------------------*/
  893.     /* Code Body                                                      */
  894.     /*----------------------------------------------------------------*/
  895.     /* Change left soft key icon and label */
  896.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  897.     /* Change right soft key icon and label */
  898.     ChangeRightSoftkey(STR_GLOBAL_BACK, 0);
  899.     /* Register function for left soft key */
  900.     SetLeftSoftkeyFunction(EntryPhnsetContrastLevel, KEY_EVENT_UP);
  901.     SetKeyHandler(EntryPhnsetContrastLevel, KEY_RIGHT_ARROW, KEY_EVENT_UP);
  902.     SetKeyHandler(NULL, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  903.     /* Register function for right soft key */
  904.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  905.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  906. }
  907. /*****************************************************************************
  908.  * FUNCTION
  909.  *  EntryPhnsetContrastLevel
  910.  * DESCRIPTION
  911.  *  This function is Entry function for Phonesetup-> Contrast
  912.  *  Following functions: PhnsetContrastLevelEndHdlr, PhnsetContrastLevelLskHdlr,
  913.  *  HighlightPhnsetContrastLevelMain, HighlightPhnsetContrastLevelSub
  914.  * PARAMETERS
  915.  *  void
  916.  *  a(?)        [IN/OUT]        
  917.  *  b(?)        [IN]            
  918.  * RETURNS
  919.  *  void
  920.  *****************************************************************************/
  921. void EntryPhnsetContrastLevel(void)
  922. {
  923.     /*----------------------------------------------------------------*/
  924.     /* Local Variables                                                */
  925.     /*----------------------------------------------------------------*/
  926.     U8 *guiBuffer, *MainLcd = NULL, *SubLcd = NULL; /* Buffer holding history data */
  927. #ifdef __MMI_SUBLCD__
  928.     S32 lower_limit[2];
  929.     S32 upper_limit[2];
  930.     S32 *current_value[2];
  931.     /*----------------------------------------------------------------*/
  932.     /* Code Body                                                      */
  933.     /*----------------------------------------------------------------*/
  934.     void (*cb_func[2]) (S32 value);
  935.     U8 *str_list[2];
  936. #else /* __MMI_SUBLCD__ */ 
  937.     S32 lower_limit[1];
  938.     S32 upper_limit[1];
  939.     S32 *current_value[1];
  940.     void (*cb_func[1]) (S32 value);
  941. #endif /* __MMI_SUBLCD__ */ 
  942.     /* Call Exit Handler */
  943.     EntryNewScreen(SCR_SETTING_CONTRAST_LEVEL, NULL, EntryPhnsetContrastLevel, NULL);
  944.     /* Get current screen to gui buffer  for history purposes */
  945.     guiBuffer = GetCurrGuiBuffer(SCR_SETTING_CONTRAST_LEVEL);
  946.     SubLcd = (U8*) GetString(STR_SETTING_SUB_LCD);
  947.     MainLcd = (U8*) GetString(STR_SETTING_MAIN_LCD);
  948.     /* Set current parent id */
  949.     SetParentHandler(MENU_SETTING_CONTRAST_LEVEL);
  950. #ifdef __MMI_SUBLCD__
  951.     lower_limit[0] = 1;
  952.     upper_limit[0] = 15;
  953.     current_value[0] = &(g_phnset_gpio_cntx_p->MainCntrst);
  954.     cb_func[0] = HighlightPhnsetContrastLevelMain;
  955.     str_list[0] = MainLcd;
  956.     lower_limit[1] = 1;
  957.     upper_limit[1] = 15;
  958.     current_value[1] = &(g_phnset_gpio_cntx_p->SubCntrst);
  959.     cb_func[1] = HighlightPhnsetContrastLevelSub;
  960.     str_list[1] = SubLcd;
  961.     ShowCategory88Screen(
  962.         STR_MENU_SETTING_CONTRAST_LEVEL,
  963.         MAIN_MENU_TITLE_SETTINGS_ICON,
  964.         STR_GLOBAL_OK,
  965.         0,
  966.         0,
  967.         0,
  968.         0,
  969.         2,
  970.         str_list,
  971.         lower_limit,
  972.         upper_limit,
  973.         current_value,
  974.         cb_func,
  975.         guiBuffer);
  976. #else /* __MMI_SUBLCD__ */ 
  977.     lower_limit[0] = 1;
  978.     upper_limit[0] = 15;
  979.     if (g_phnset_gpio_cntx_p->MainCntrst == 255)
  980.     {
  981.         g_phnset_gpio_cntx_p->MainCntrst = 1;
  982.     }
  983.     current_value[0] = (S32*) & g_phnset_gpio_cntx_p->MainCntrst;
  984.     cb_func[0] = HighlightPhnsetContrastLevelMain;
  985.     ShowCategory88Screen(
  986.         STR_MENU_SETTING_CONTRAST_LEVEL,
  987.         MAIN_MENU_TITLE_SETTINGS_ICON,
  988.         STR_GLOBAL_OK,
  989.         IMG_GLOBAL_OK,
  990.         0,
  991.         0,
  992.         IMG_CONTRAST_BACKGROUND,
  993.         1,
  994.         NULL,
  995.         lower_limit,
  996.         upper_limit,
  997.         current_value,
  998.         cb_func,
  999.         guiBuffer);
  1000. #endif /* __MMI_SUBLCD__ */ 
  1001.     /* Register function with right softkey */
  1002.     SetKeyHandler(PhnsetContrastLevelEndHdlr, KEY_END, KEY_EVENT_DOWN);
  1003.     SetLeftSoftkeyFunction(PhnsetContrastLevelLskHdlr, KEY_EVENT_UP);
  1004. }
  1005. /*****************************************************************************
  1006.  * FUNCTION
  1007.  *  PhnsetContrastLevelEndHdlr
  1008.  * DESCRIPTION
  1009.  *  This function is END key handler for Phonesetup-> Constract
  1010.  * PARAMETERS
  1011.  *  void
  1012.  *  a(?)        [IN/OUT]        
  1013.  *  b(?)        [IN]            
  1014.  * RETURNS
  1015.  *  void
  1016.  *****************************************************************************/
  1017. static void PhnsetContrastLevelEndHdlr(void)
  1018. {
  1019.     /*----------------------------------------------------------------*/
  1020.     /* Local Variables                                                */
  1021.     /*----------------------------------------------------------------*/
  1022.     /*----------------------------------------------------------------*/
  1023.     /* Code Body                                                      */
  1024.     /*----------------------------------------------------------------*/
  1025.     PhnsetRestoreToNvramContrast();
  1026.     DisplayIdleScreen();
  1027. }
  1028. /*****************************************************************************
  1029.  * FUNCTION
  1030.  *  HighlightPhnsetContrastLevelMain
  1031.  * DESCRIPTION
  1032.  *  This function is highlight handler for Phonesetup-> Contrast -> MainLCD
  1033.  *  Follow functions:
  1034.  * PARAMETERS
  1035.  *  index       [IN]            
  1036.  *  a(?)        [IN/OUT]        
  1037.  *  b(?)        [IN]            
  1038.  * RETURNS
  1039.  *  void
  1040.  *****************************************************************************/
  1041. void HighlightPhnsetContrastLevelMain(S32 index)
  1042. {
  1043.     /*----------------------------------------------------------------*/
  1044.     /* Local Variables                                                */
  1045.     /*----------------------------------------------------------------*/
  1046.     /*----------------------------------------------------------------*/
  1047.     /* Code Body                                                      */
  1048.     /*----------------------------------------------------------------*/
  1049.     if (index > 0 && index <= 15)
  1050.     {
  1051.         g_phnset_gpio_cntx_p->MainCntrst = index;
  1052.         PhnsetMainLCDContrast((U8) index);
  1053.     }
  1054. }
  1055. /*****************************************************************************
  1056.  * FUNCTION
  1057.  *  HighlightPhnsetContrastLevelSub
  1058.  * DESCRIPTION
  1059.  *  This function is highlight handler for Phonesetup-> Contrast -> SubLCD
  1060.  *  Follow functions:
  1061.  * PARAMETERS
  1062.  *  index       [IN]            
  1063.  *  a(?)        [IN/OUT]        
  1064.  *  b(?)        [IN]            
  1065.  * RETURNS
  1066.  *  void
  1067.  *****************************************************************************/
  1068. #ifdef __MMI_SUBLCD__
  1069. void HighlightPhnsetContrastLevelSub(S32 index)
  1070. {
  1071.     /*----------------------------------------------------------------*/
  1072.     /* Local Variables                                                */
  1073.     /*----------------------------------------------------------------*/
  1074.     /*----------------------------------------------------------------*/
  1075.     /* Code Body                                                      */
  1076.     /*----------------------------------------------------------------*/
  1077.     if (index > 0 && index <= 15)
  1078.     {
  1079.         g_phnset_gpio_cntx_p->SubCntrst = index;
  1080.         PhnsetSubLCDContrast(index);
  1081.     }
  1082. }
  1083. #endif /* __MMI_SUBLCD__ */ 
  1084. /*****************************************************************************
  1085.  * FUNCTION
  1086.  *  PhnsetContrastLevelLskHdlr
  1087.  * DESCRIPTION
  1088.  *  This function is Left softkey handler
  1089.  *  for Phonesetup->Constract -> Main/Sub LCD
  1090.  * PARAMETERS
  1091.  *  void
  1092.  *  a(?)        [IN/OUT]        
  1093.  *  b(?)        [IN]            
  1094.  * RETURNS
  1095.  *  void
  1096.  *****************************************************************************/
  1097. void PhnsetContrastLevelLskHdlr(void)
  1098. {
  1099.     /*----------------------------------------------------------------*/
  1100.     /* Local Variables                                                */
  1101.     /*----------------------------------------------------------------*/
  1102.     S16 error;
  1103.     U8 data;
  1104.     /*----------------------------------------------------------------*/
  1105.     /* Code Body                                                      */
  1106.     /*----------------------------------------------------------------*/
  1107.     ReadValue(NVRAM_SETTING_CONTRAST_LEVEL, &data, DS_BYTE, &error);
  1108.     if (data != g_phnset_gpio_cntx_p->MainCntrst)
  1109.     {
  1110.         WriteValue(NVRAM_SETTING_CONTRAST_LEVEL, &(g_phnset_gpio_cntx_p->MainCntrst), DS_BYTE, &error);
  1111.     }
  1112. #ifdef __MMI_SUBLCD__
  1113.     ReadValue(NVRAM_SETTING_CONTRAST_SUBLCD_LEVEL, &data, DS_BYTE, &error);
  1114.     if (data != g_phnset_gpio_cntx_p->SubCntrst)
  1115.     {
  1116.         WriteValue(NVRAM_SETTING_CONTRAST_SUBLCD_LEVEL, &(g_phnset_gpio_cntx_p->SubCntrst), DS_BYTE, &error);
  1117.     }
  1118. #endif /* __MMI_SUBLCD__ */ 
  1119.     GoBackHistory();
  1120. }
  1121. #endif /* !defined(__MMI_NO_CONTRAST_LEVEL__) */ /* #if !defined(__MMI_NO_CONTRAST_LEVEL__) */
  1122. /*****************************************************************************
  1123.  * FUNCTION
  1124.  *  PhnsetHWLCDContrastInfoRsp
  1125.  * DESCRIPTION
  1126.  *  
  1127.  * PARAMETERS
  1128.  *  Rsp_Msg     [?]     
  1129.  * RETURNS
  1130.  *  void
  1131.  *****************************************************************************/
  1132. void PhnsetHWLCDContrastInfoRsp(void *Rsp_Msg)
  1133. {
  1134. #ifdef MMI_ON_HARDWARE_P
  1135.     /*----------------------------------------------------------------*/
  1136.     /* Local Variables                                                */
  1137.     /*----------------------------------------------------------------*/
  1138.     U8 i;
  1139.     mmi_eq_get_hw_level_rsp_struct *rsp_p = Rsp_Msg;
  1140.     /*----------------------------------------------------------------*/
  1141.     /* Code Body                                                      */
  1142.     /*----------------------------------------------------------------*/
  1143.     for (i = 0; i < 15; i++)
  1144.     {
  1145.         PhnsetMainLCD_Contrast_Info[i] = rsp_p->hw_profile.MainLCD_Contrast_Level_Info[i];
  1146.     }
  1147.     PhnsetMainLCDContrast(g_phnset_gpio_cntx_p->MainCntrst);
  1148. #ifdef __MMI_SUBLCD__
  1149.     for (i = 0; i < 15; i++)
  1150.     {
  1151.         PhnsetSubLCD_Contrast_Info[i] = rsp_p->hw_profile.SubLCD_Contrast_Level_Info[i];
  1152.     }
  1153.     PhnsetSubLCDContrast(g_phnset_gpio_cntx_p->SubCntrst);
  1154. #endif /* __MMI_SUBLCD__ */ 
  1155. #endif /* MMI_ON_HARDWARE_P */ 
  1156. }
  1157. /*****************************************************************************
  1158.  * FUNCTION
  1159.  *  PhnsetRestoreToNvramContrast
  1160.  * DESCRIPTION
  1161.  *  Set Contrast Level From Stored Values
  1162.  * PARAMETERS
  1163.  *  void
  1164.  * RETURNS
  1165.  *  MMI_BOOL
  1166.  *  
  1167.  *  Author            : Vanita Jain
  1168.  *****************************************************************************/
  1169. MMI_BOOL PhnsetRestoreToNvramContrast(void)
  1170. {
  1171. #ifdef MMI_ON_HARDWARE_P
  1172.     /*----------------------------------------------------------------*/
  1173.     /* Local Variables                                                */
  1174.     /*----------------------------------------------------------------*/
  1175.     S16 error;
  1176.     U8 data = 0;
  1177.     ilm_struct *ilm_ptr = NULL;
  1178.     l4c_hw_profile_struct *dst_data_ptr;
  1179.     /*----------------------------------------------------------------*/
  1180.     /* Code Body                                                      */
  1181.     /*----------------------------------------------------------------*/
  1182.     SetProtocolEventHandler(PhnsetHWLCDContrastInfoRsp, MSG_ID_MMI_EQ_GET_HW_LEVEL_RSP);
  1183.     ReadValue(NVRAM_SETTING_CONTRAST_LEVEL, &data, DS_BYTE, &error);
  1184.     g_phnset_gpio_cntx_p->MainCntrst = data;
  1185. #ifdef __MMI_SUBLCD__
  1186.     data = 0;
  1187.     ReadValue(NVRAM_SETTING_CONTRAST_SUBLCD_LEVEL, &data, DS_BYTE, &error);
  1188.     g_phnset_gpio_cntx_p->SubCntrst = data;
  1189. #endif /* __MMI_SUBLCD__ */ 
  1190.     /* First allocate a memory for an interlayer message structure */
  1191.     ilm_ptr = allocate_ilm(MOD_MMI);
  1192.     ilm_ptr->src_mod_id = MOD_MMI;
  1193.     ilm_ptr->sap_id = MMI_L4C_SAP;
  1194.     ilm_ptr->dest_mod_id = MOD_L4C;
  1195.     ilm_ptr->msg_id = (msg_type) MSG_ID_MMI_EQ_GET_HW_LEVEL_REQ;        /* Set the message id */
  1196.     ilm_ptr->peer_buff_ptr = NULL;
  1197.     dst_data_ptr = (l4c_hw_profile_struct*) construct_local_para(sizeof(l4c_hw_profile_struct), TD_CTRL);
  1198.     ilm_ptr->local_para_ptr = (local_para_struct*) dst_data_ptr;
  1199.     msg_send_ext_queue(ilm_ptr);
  1200. #endif /* MMI_ON_HARDWARE_P */ 
  1201.     return MMI_TRUE;
  1202. }
  1203. /*****************************************************************************
  1204.  * FUNCTION
  1205.  *  PhnsetChangeMainLCDContrastValue
  1206.  * DESCRIPTION
  1207.  *  This function is to set  main LCD contrast in phone setup context
  1208.  *  Functionality:
  1209.  * PARAMETERS
  1210.  *  level       [IN]            
  1211.  *  a(?)        [IN/OUT]        
  1212.  *  b(?)        [IN]            
  1213.  * RETURNS
  1214.  *  void
  1215.  *****************************************************************************/
  1216. void PhnsetChangeMainLCDContrastValue(U8 level)
  1217. {
  1218.     /*----------------------------------------------------------------*/
  1219.     /* Local Variables                                                */
  1220.     /*----------------------------------------------------------------*/
  1221.     /*----------------------------------------------------------------*/
  1222.     /* Code Body                                                      */
  1223.     /*----------------------------------------------------------------*/
  1224.     g_phnset_gpio_cntx_p->MainCntrst = level;
  1225. }
  1226. #ifdef __MMI_SUBLCD__
  1227. /*****************************************************************************
  1228.  * FUNCTION
  1229.  *  PhnsetChangeSubLCDContrastValue
  1230.  * DESCRIPTION
  1231.  *  This function is to set  sub LCD contrast in phone setup context
  1232.  *  Functionality:
  1233.  * PARAMETERS
  1234.  *  level       [IN]            
  1235.  *  a(?)        [IN/OUT]        
  1236.  *  b(?)        [IN]            
  1237.  * RETURNS
  1238.  *  void
  1239.  *****************************************************************************/
  1240. void PhnsetChangeSubLCDContrastValue(U8 level)
  1241. {
  1242.     /*----------------------------------------------------------------*/
  1243.     /* Local Variables                                                */
  1244.     /*----------------------------------------------------------------*/
  1245.     /*----------------------------------------------------------------*/
  1246.     /* Code Body                                                      */
  1247.     /*----------------------------------------------------------------*/
  1248.     g_phnset_gpio_cntx_p->SubCntrst = level;
  1249. }
  1250. #endif /* __MMI_SUBLCD__ */ 
  1251. /*****************************************************************************
  1252.  * FUNCTION
  1253.  *  PhnsetMainLCDContrast
  1254.  * DESCRIPTION
  1255.  *  This function is to set main LCD contrast
  1256.  *  Functionality:
  1257.  * PARAMETERS
  1258.  *  level       [IN]            
  1259.  *  a(?)        [IN/OUT]        
  1260.  *  b(?)        [IN]            
  1261.  * RETURNS
  1262.  *  void
  1263.  *****************************************************************************/
  1264. void PhnsetMainLCDContrast(U8 level)
  1265. {
  1266.     /*----------------------------------------------------------------*/
  1267.     /* Local Variables                                                */
  1268.     /*----------------------------------------------------------------*/
  1269.     /*----------------------------------------------------------------*/
  1270.     /* Code Body                                                      */
  1271.     /*----------------------------------------------------------------*/
  1272.     if (level > 15 || level < 1)
  1273.     {
  1274.         return;
  1275.     }
  1276. #if defined(MMI_ON_HARDWARE_P) && !defined(__MMI_NO_CONTRAST_LEVEL__)
  1277.     lcd_bright_level(MAIN_LCD, PhnsetMainLCD_Contrast_Info[level - 1]);
  1278. #endif 
  1279. }
  1280. /*****************************************************************************
  1281.  * FUNCTION
  1282.  *  PhnsetSubLCDContrast
  1283.  * DESCRIPTION
  1284.  *  This function is to set sub LCD contrast
  1285.  *  Functionality:
  1286.  * PARAMETERS
  1287.  *  level       [IN]            
  1288.  *  a(?)        [IN/OUT]        
  1289.  *  b(?)        [IN]            
  1290.  * RETURNS
  1291.  *  void
  1292.  *****************************************************************************/
  1293. void PhnsetSubLCDContrast(U8 level)
  1294. {
  1295.     /*----------------------------------------------------------------*/
  1296.     /* Local Variables                                                */
  1297.     /*----------------------------------------------------------------*/
  1298.     /*----------------------------------------------------------------*/
  1299.     /* Code Body                                                      */
  1300.     /*----------------------------------------------------------------*/
  1301.     if (level > 15 || level < 1)
  1302.     {
  1303.         return;
  1304.     }
  1305. #if defined(__MMI_SUBLCD__) && defined(MMI_ON_HARDWARE_P)
  1306.     lcd_bright_level(SUB_LCD, PhnsetSubLCD_Contrast_Info[level - 1]);
  1307. #endif 
  1308. }