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

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.  * VolumeHandler.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for Volume Key Handlers
  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.  *------------------------------------------------------------------------------
  112.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  113.  *============================================================================
  114.  ****************************************************************************/
  115. /**
  116.  * Copyright Notice
  117.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  118.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  119.  *  (It is illegal to remove this copyright notice from this software or any
  120.  *  portion of it)
  121.  */
  122. /**************************************************************
  123.    FILENAME : VolumeHandler.c
  124.    PURPOSE     : Volume Key Handlers
  125.    REMARKS     : nil
  126.    AUTHOR      : Deepali, NEERAJ SHARMA
  127.    DATE     : July 22,03
  128. **************************************************************/
  129. #include "PixtelDataTypes.h"
  130. #include "VolumeHandler.h"
  131. #include "GlobalConstants.h"
  132. #include "SettingProfile.h"
  133. #include "ProfileGProts.h"
  134. #include "ProfilesEnum.h"
  135. #include "TimerEvents.h"
  136. #include "CallManagementStruct.h"
  137. #include "CallManagementGProt.h"
  138. #ifdef __MMI_VOIP__
  139. #include "VoIPGProt.h"
  140. #endif
  141. #include "gpioInc.h"
  142. #include "KeyBrd.h"
  143. #include "IdleAppDef.h"
  144. #ifdef __MMI_BT_SUPPORT__
  145. #include "BTMMIScrGprots.h"
  146. #endif 
  147. #include "FrameworkStruct.h"
  148. static mmi_frm_kbd_tone_state_enum key_tone_state;
  149. #ifdef __MMI_AUDIO_PLAYER__
  150. BOOL mmi_audply_is_playing(void);
  151. void mmi_audply_press_inc_volume(void);
  152. void mmi_audply_press_dec_volume(void);
  153. #endif /* __MMI_AUDIO_PLAYER__ */ 
  154. #ifdef __MMI_FM_RADIO__
  155. BOOL mmi_fmrdo_is_power_on(void);
  156. void mmi_fmrdo_inc_volume(void);
  157. void mmi_fmrdo_dec_volume(void);
  158. #endif /* __MMI_FM_RADIO__ */ 
  159. extern S32 volume_level_UI;
  160. FuncPtr volumeDecreaseFunction;
  161. FuncPtr volumeIncreaseFunction;
  162. FuncPtr volumeMinFunction;
  163. FuncPtr volumeMaxFunction;
  164. FuncPtr hardwareVolumeFunction;
  165. U16 volumeCaption;
  166. S32 *initialVolume;
  167. U16 LSKCaption;
  168. U16 RSKCaption;
  169. FuncPtr LSKCallback;
  170. FuncPtr RSKCallback;
  171. FuncPtr ExitCallback;
  172. U32 volumeTimer;
  173. U8 updownFlag;
  174. S32 volLevel;
  175. /* PMT HIMANSHU START 20050729 */
  176. #if defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_WALLPAPER_ON_BOTTOM__)
  177. #define LONGPRESS_DELAY 6
  178. /* variable for synchronizing the time of KEY_LONG_PRESS event with MMI_PEN_EVENT_LONG_TAP event */
  179. U16 callback_timer = 0;
  180. #endif /* defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_WALLPAPER_ON_BOTTOM__) */ 
  181. /* PMT HIMANSHU END 20050729 */
  182. /*****************************************************************************
  183.  * FUNCTION
  184.  *  play_keypad_tone
  185.  * DESCRIPTION
  186.  *  play current profile keypad tone
  187.  * PARAMETERS
  188.  *  void
  189.  * RETURNS
  190.  *  void
  191.  *****************************************************************************/
  192. static void play_keypad_tone(void)
  193. {
  194.     /*----------------------------------------------------------------*/
  195.     /* Local Variables                                                */
  196.     /*----------------------------------------------------------------*/
  197.     U8 keypad_tone;
  198.     /*----------------------------------------------------------------*/
  199.     /* Code Body                                                      */
  200.     /*----------------------------------------------------------------*/
  201.     if (!IsSilentModeActivated())
  202.     {
  203. #ifdef __MMI_SILENT_MEETING_PROFILE__
  204.         if (!IsMeetingModeActivated())
  205. #endif 
  206.         {
  207.             keypad_tone = GetKeypadToneType();
  208.             if (keypad_tone == KEYPAD_CLICK)
  209.             {
  210.                 AudioPlayReq(TONE_KEY_CLICK, DEVICE_AUDIO_PLAY_ONCE);
  211.             }
  212.             else if (keypad_tone != KEYPAD_SILENT)
  213.             {
  214.                 AudioPlayReq(TONE_KEY_NORMAL, DEVICE_AUDIO_PLAY_ONCE);
  215.             }
  216.         }
  217.     }
  218. }
  219. /*****************************************************************************
  220.  * FUNCTION
  221.  *  SetDefaultVolumeKeyHandlers
  222.  * DESCRIPTION
  223.  *  Sets Default Volume Handlers
  224.  * PARAMETERS
  225.  *  void
  226.  * RETURNS
  227.  *  void
  228.  *****************************************************************************/
  229. void SetDefaultVolumeKeyHandlers(void)
  230. {
  231.     /*----------------------------------------------------------------*/
  232.     /* Local Variables                                                */
  233.     /*----------------------------------------------------------------*/
  234.     U8 isValid = 0;
  235.     /*----------------------------------------------------------------*/
  236.     /* Code Body                                                      */
  237.     /*----------------------------------------------------------------*/
  238. #ifdef __MMI_VOIP__
  239.     if ((GetCurrentState() == CM_INCOMING_STATE) || (mmi_voip_get_incoming_call_id() != -1))
  240. #else
  241.     if (GetCurrentState() == CM_INCOMING_STATE)
  242. #endif
  243.     {
  244.         volLevel = GetRingVolumeLevel();
  245.         SetVolumeKeyHandlerFunctions(
  246.             NULL,
  247.             NULL,
  248.             NULL,
  249.             NULL,
  250.             STR_COMMON_VOLUME_LEVEL_RING_CAPTION,
  251.             &volLevel,
  252.             0,
  253.             0,
  254.             NULL,
  255.             NULL,
  256.             1000,
  257.             RingVolumeExitFunction,
  258.             0,
  259.             VOLUMEHANDLER_RING_TONE);
  260.         isValid = 1;
  261.     }
  262.     else if (isInCall() && !IsWapCallPresent())
  263.     {
  264.         volLevel = GetModeSpeechVolume();
  265.         SetVolumeKeyHandlerFunctions(
  266.             NULL,
  267.             NULL,
  268.             NULL,
  269.             NULL,
  270.             /* MTK added by JL 031125 for string ID not found */ STR_VOLUME_LEVEL_CAPTION /* JL comment STR_DEFAULT_VOLUME_CAPTION */ ,
  271.             &volLevel,
  272.             0,
  273.             0,
  274.             NULL,
  275.             NULL,
  276.             1000,
  277.             SpeechVolumeExitFunction,
  278.             0,
  279.             VOLUMEHANDLER_SPEECH_TONE);
  280.         isValid = 1;
  281.     }
  282.     if (((g_idle_context.IsOnIdleScreen || g_idle_context.IsOnSimErrorScreen) && !g_keylock_context.gKeyPadLockFlag) || (g_idle_context.IsOnDialerScreen || g_idle_context.IsOnSimErrorDialerScreen))
  283.     {
  284.         volLevel = GetKeypadVolumeLevel();
  285.         SetVolumeKeyHandlerFunctions(
  286.             play_keypad_tone,
  287.             play_keypad_tone,
  288.             NULL,
  289.             NULL,
  290.             /* MTK added by JL 031125 for string ID not found */ STR_COMMON_VOLUME_LEVEL_KEY_CAPTION /* JL comment  STR_KEY_TONE_VOLUME_CAPTION */ ,
  291.             &volLevel,
  292.             0,
  293.             0,
  294.             NULL,
  295.             NULL,
  296.             2000,
  297.             KeyPadVolumeExitFunction,
  298.             0,
  299.             VOLUMEHANDLER_KEY_TONE);
  300.         isValid = 1;
  301.         key_tone_state = mmi_frm_kbd_get_key_tone_state();
  302.         mmi_frm_kbd_set_tone_state(MMI_KEY_VOL_TONE_DISABLED);
  303.     }
  304.     if (isValid)
  305.     {
  306.         if (updownFlag)
  307.         {
  308.             SetKeyHandler(SetKeyPadVolUp, KEY_UP_ARROW, KEY_EVENT_DOWN);
  309.             SetKeyHandler(SetKeyPadVolMaxLongPress, KEY_UP_ARROW, KEY_LONG_PRESS);
  310.             SetKeyHandler(SetKeyPadVolDown, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  311.             SetKeyHandler(SetKeyPadVolMinLongPress, KEY_DOWN_ARROW, KEY_LONG_PRESS);
  312.         }
  313.         SetKeyHandler(SetKeyPadVolUp, KEY_VOL_UP, KEY_EVENT_DOWN);
  314.         SetKeyHandler(SetKeyPadVolMaxLongPress, KEY_VOL_UP, KEY_LONG_PRESS);
  315.         SetKeyHandler(SetKeyPadVolDown, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  316.         SetKeyHandler(SetKeyPadVolMinLongPress, KEY_VOL_DOWN, KEY_LONG_PRESS);
  317.     }
  318. }
  319. /*****************************************************************************
  320.  * FUNCTION
  321.  *  SetVolumeKeyHandlerFunctions
  322.  * DESCRIPTION
  323.  *  Init Function to be called before using Volume Screen
  324.  * PARAMETERS
  325.  *  decreaseFunction        [IN]        Function to be called when volume down key is pressed.
  326.  *  increaseFunction        [IN]        
  327.  *  minFunction             [IN]        
  328.  *  maxFunction             [IN]        
  329.  *  caption                 [IN]        
  330.  *  volume                  [?]         
  331.  *  captionLSK              [IN]        
  332.  *  captionRSK              [IN]        
  333.  *  callbackLSK             [IN]        
  334.  *  callbackRSK             [IN]        
  335.  *  timerDuration           [IN]        
  336.  *  callbackExit            [IN]        
  337.  *  updown                  [IN]        
  338.  *  type                    [IN]        
  339.  * RETURNS
  340.  *  void
  341.  *****************************************************************************/
  342. void SetVolumeKeyHandlerFunctions(
  343.         FuncPtr decreaseFunction,
  344.         FuncPtr increaseFunction,
  345.         FuncPtr minFunction,
  346.         FuncPtr maxFunction,
  347.         U16 caption,
  348.         S32 *volume,
  349.         U16 captionLSK,
  350.         U16 captionRSK,
  351.         FuncPtr callbackLSK,
  352.         FuncPtr callbackRSK,
  353.         U32 timerDuration,
  354.         FuncPtr callbackExit,
  355.         U8 updown,
  356.         VOLUMEHANDLER_TYPE type)
  357. {
  358.     /*----------------------------------------------------------------*/
  359.     /* Local Variables                                                */
  360.     /*----------------------------------------------------------------*/
  361.     /*----------------------------------------------------------------*/
  362.     /* Code Body                                                      */
  363.     /*----------------------------------------------------------------*/
  364.     volumeDecreaseFunction = decreaseFunction;
  365.     volumeIncreaseFunction = increaseFunction;
  366.     volumeMinFunction = minFunction;
  367.     volumeMaxFunction = maxFunction;
  368.     volumeCaption = caption;
  369.     initialVolume = volume;
  370.     LSKCaption = captionLSK;
  371.     RSKCaption = captionRSK;
  372.     LSKCallback = callbackLSK;
  373.     RSKCallback = callbackRSK;
  374.     volumeTimer = timerDuration;
  375.     ExitCallback = callbackExit;
  376.     updownFlag = updown;
  377.     if (type == VOLUMEHANDLER_RING_TONE)
  378.     {
  379.         hardwareVolumeFunction = RingToneVolumeFunction;
  380.     }
  381.     else if (type == VOLUMEHANDLER_SPEECH_TONE)
  382.     {
  383.         hardwareVolumeFunction = SpeechVolumeFunction;
  384.     }
  385.     else
  386.     {
  387.         hardwareVolumeFunction = KeyPadVolumeFunction;
  388.     }
  389. }
  390. /*****************************************************************************
  391.  * FUNCTION
  392.  *  EntryScrSetKeyPadVolumeLevel
  393.  * DESCRIPTION
  394.  *  To Increase Volume level of keypad tone
  395.  * PARAMETERS
  396.  *  void
  397.  * RETURNS
  398.  *  void
  399.  *****************************************************************************/
  400. void EntryScrSetKeyPadVolumeLevel(void)
  401. {
  402.     /*----------------------------------------------------------------*/
  403.     /* Local Variables                                                */
  404.     /*----------------------------------------------------------------*/
  405.     U8 *guiBuffer;
  406.     /*----------------------------------------------------------------*/
  407.     /* Code Body                                                      */
  408.     /*----------------------------------------------------------------*/
  409.     guiBuffer = GetCurrGuiBuffer(SCR_KEY_TONE_VOLUME);
  410.     EntryNewScreen(SCR_KEY_TONE_VOLUME, StopKeyPadVolumeLevelTimer, NULL, NULL);
  411.     ShowCategory105Screen(
  412.         volumeCaption,
  413.         IMG_PROFILES_TITLEE,
  414.         LSKCaption,
  415.         0,
  416.         RSKCaption,
  417.         0,
  418.         (S32*) initialVolume,
  419.         guiBuffer);
  420.     if (volumeTimer)
  421.     {
  422.         SetGroupKeyHandler(ExitScrSetKeyPadVolumeLevel, (PU16) PresentAllKeys, (U8) TOTAL_KEYS, (U16) KEY_EVENT_DOWN);
  423.     }
  424.     SetLeftSoftkeyFunction(LSKCallback, KEY_EVENT_UP);
  425.     SetRightSoftkeyFunction(RSKCallback, KEY_EVENT_UP);
  426.     SetKeyHandler(ShowVerticalBarUp, KEY_VOL_UP, KEY_EVENT_DOWN);
  427.     SetKeyHandler(ShowVerticalBarMax, KEY_VOL_UP, KEY_LONG_PRESS);
  428.     SetKeyHandler(ShowVerticalBarDown, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  429.     SetKeyHandler(ShowVerticalBarMin, KEY_VOL_DOWN, KEY_LONG_PRESS);
  430.     if (updownFlag)
  431.     {
  432.         SetKeyHandler(ShowVerticalBarUp, KEY_UP_ARROW, KEY_EVENT_DOWN);
  433.         SetKeyHandler(ShowVerticalBarMax, KEY_UP_ARROW, KEY_LONG_PRESS);
  434.         SetKeyHandler(ShowVerticalBarDown, KEY_DOWN_ARROW, KEY_EVENT_DOWN);
  435.         SetKeyHandler(ShowVerticalBarMin, KEY_DOWN_ARROW, KEY_LONG_PRESS);
  436.     }
  437.     if (volumeTimer)
  438.     {
  439.         StartTimer(KEY_VOL_TIMER_ID, KEY_VOLUME_TIMEOUT, ExitScrSetKeyPadVolumeLevel);
  440.     }
  441.     /* SetExitHandler(SCR_KEY_TONE_VOLUME,StopKeyPadVolumeLevelTimer); */
  442. }
  443. /*****************************************************************************
  444.  * FUNCTION
  445.  *  SetKeyPadVolDown
  446.  * DESCRIPTION
  447.  *  To Increase Volume level of keypad tone
  448.  * PARAMETERS
  449.  *  void
  450.  * RETURNS
  451.  *  void
  452.  *****************************************************************************/
  453. void SetKeyPadVolDown(void)
  454. {
  455. #ifdef __MMI_AUDIO_PLAYER__
  456.     /*----------------------------------------------------------------*/
  457.     /* Local Variables                                                */
  458.     /*----------------------------------------------------------------*/
  459.     /*----------------------------------------------------------------*/
  460.     /* Code Body                                                      */
  461.     /*----------------------------------------------------------------*/
  462.     if (mmi_audply_is_playing())
  463.     {
  464.         mmi_audply_press_dec_volume();
  465.     }
  466.     else
  467. #endif /* __MMI_AUDIO_PLAYER__ */ 
  468. #ifdef __MMI_FM_RADIO__
  469.     if (mmi_fmrdo_is_power_on())
  470.     {
  471.         mmi_fmrdo_dec_volume();
  472.     }
  473.     else
  474. #endif /* __MMI_FM_RADIO__ */ 
  475.     {
  476.         EntryScrSetKeyPadVolumeLevel();
  477.         ShowVerticalBarDown();
  478.     }
  479. }
  480. /*****************************************************************************
  481.  * FUNCTION
  482.  *  SetKeyPadVolUp
  483.  * DESCRIPTION
  484.  *  To Increase Volume level of keypad tone
  485.  * PARAMETERS
  486.  *  void
  487.  * RETURNS
  488.  *  void
  489.  *****************************************************************************/
  490. void SetKeyPadVolUp(void)
  491. {
  492. #ifdef __MMI_AUDIO_PLAYER__
  493.     /*----------------------------------------------------------------*/
  494.     /* Local Variables                                                */
  495.     /*----------------------------------------------------------------*/
  496.     /*----------------------------------------------------------------*/
  497.     /* Code Body                                                      */
  498.     /*----------------------------------------------------------------*/
  499.     if (mmi_audply_is_playing())
  500.     {
  501.         mmi_audply_press_inc_volume();
  502.     }
  503.     else
  504. #endif /* __MMI_AUDIO_PLAYER__ */ 
  505. #ifdef __MMI_FM_RADIO__
  506.     if (mmi_fmrdo_is_power_on())
  507.     {
  508.         mmi_fmrdo_inc_volume();
  509.     }
  510.     else
  511. #endif /* __MMI_FM_RADIO__ */ 
  512.     {
  513.         EntryScrSetKeyPadVolumeLevel();
  514.         ShowVerticalBarUp();
  515.     }
  516. }
  517. /*****************************************************************************
  518.  * FUNCTION
  519.  *  SetKeyPadVolMinLongPress
  520.  * DESCRIPTION
  521.  *  To Increase Volume level of keypad tone
  522.  * PARAMETERS
  523.  *  void
  524.  * RETURNS
  525.  *  void
  526.  *****************************************************************************/
  527. void SetKeyPadVolMinLongPress(void)
  528. {
  529.     /*----------------------------------------------------------------*/
  530.     /* Local Variables                                                */
  531.     /*----------------------------------------------------------------*/
  532.     /*----------------------------------------------------------------*/
  533.     /* Code Body                                                      */
  534.     /*----------------------------------------------------------------*/
  535.     EntryScrSetKeyPadVolumeLevel();
  536.     ShowVerticalBarMin();
  537. }
  538. /*****************************************************************************
  539.  * FUNCTION
  540.  *  SetKeyPadVolMaxLongPress
  541.  * DESCRIPTION
  542.  *  To Increase Volume level of keypad tone
  543.  * PARAMETERS
  544.  *  void
  545.  * RETURNS
  546.  *  void
  547.  *****************************************************************************/
  548. void SetKeyPadVolMaxLongPress(void)
  549. {
  550.     /*----------------------------------------------------------------*/
  551.     /* Local Variables                                                */
  552.     /*----------------------------------------------------------------*/
  553.     /*----------------------------------------------------------------*/
  554.     /* Code Body                                                      */
  555.     /*----------------------------------------------------------------*/
  556.     EntryScrSetKeyPadVolumeLevel();
  557.     ShowVerticalBarMax();
  558. }
  559. /*****************************************************************************
  560.  * FUNCTION
  561.  *  ShowVerticalBarUp
  562.  * DESCRIPTION
  563.  *  To Increase Volume level of keypad tone
  564.  * PARAMETERS
  565.  *  void
  566.  * RETURNS
  567.  *  void
  568.  *****************************************************************************/
  569. void ShowVerticalBarUp(void)
  570. {
  571.     /*----------------------------------------------------------------*/
  572.     /* Local Variables                                                */
  573.     /*----------------------------------------------------------------*/
  574.     /*----------------------------------------------------------------*/
  575.     /* Code Body                                                      */
  576.     /*----------------------------------------------------------------*/
  577.     if (volumeTimer)
  578.     {
  579.         StopTimer(KEY_VOL_TIMER_ID);
  580.     }
  581.     show_vertical_bar_next();
  582.     *initialVolume = volume_level_UI;
  583.     hardwareVolumeFunction();
  584.     if (volumeIncreaseFunction)
  585.     {
  586.         volumeIncreaseFunction();
  587.     }
  588.     if (volumeTimer)
  589.     {
  590.         StartTimer(KEY_VOL_TIMER_ID, KEY_VOLUME_TIMEOUT, ExitScrSetKeyPadVolumeLevel);
  591.     }
  592. }
  593. /*****************************************************************************
  594.  * FUNCTION
  595.  *  ShowVerticalBarDown
  596.  * DESCRIPTION
  597.  *  To Increase Volume level of keypad tone
  598.  * PARAMETERS
  599.  *  void
  600.  * RETURNS
  601.  *  void
  602.  *****************************************************************************/
  603. void ShowVerticalBarDown(void)
  604. {
  605.     /*----------------------------------------------------------------*/
  606.     /* Local Variables                                                */
  607.     /*----------------------------------------------------------------*/
  608.     /*----------------------------------------------------------------*/
  609.     /* Code Body                                                      */
  610.     /*----------------------------------------------------------------*/
  611.     if (volumeTimer)
  612.     {
  613.         StopTimer(KEY_VOL_TIMER_ID);
  614.     }
  615.     show_vertical_bar_previous();
  616.     *initialVolume = volume_level_UI;
  617.     hardwareVolumeFunction();
  618.     if (volumeDecreaseFunction)
  619.     {
  620.         volumeDecreaseFunction();
  621.     }
  622.     if (volumeTimer)
  623.     {
  624.         StartTimer(KEY_VOL_TIMER_ID, KEY_VOLUME_TIMEOUT, ExitScrSetKeyPadVolumeLevel);
  625.     }
  626. }
  627. /*****************************************************************************
  628.  * FUNCTION
  629.  *  ShowVerticalBarMax
  630.  * DESCRIPTION
  631.  *  To Increase Volume level of keypad tone
  632.  * PARAMETERS
  633.  *  void
  634.  * RETURNS
  635.  *  void
  636.  *****************************************************************************/
  637. void ShowVerticalBarMax(void)
  638. {
  639.     /*----------------------------------------------------------------*/
  640.     /* Local Variables                                                */
  641.     /*----------------------------------------------------------------*/
  642.     /*----------------------------------------------------------------*/
  643.     /* Code Body                                                      */
  644.     /*----------------------------------------------------------------*/
  645.     if (volumeTimer)
  646.     {
  647.         StopTimer(KEY_VOL_TIMER_ID);
  648.     }
  649.     show_vertical_bar(LEVEL7);
  650.     *initialVolume = volume_level_UI;
  651.     hardwareVolumeFunction();
  652.     if (volumeMaxFunction)
  653.     {
  654.         volumeMaxFunction();
  655.     }
  656.     if (volumeTimer)
  657.     {
  658.         StartTimer(KEY_VOL_TIMER_ID, KEY_VOLUME_TIMEOUT, ExitScrSetKeyPadVolumeLevel);
  659.     }
  660. }
  661. /*****************************************************************************
  662.  * FUNCTION
  663.  *  ShowVerticalBarMin
  664.  * DESCRIPTION
  665.  *  To Increase Volume level of keypad tone
  666.  * PARAMETERS
  667.  *  void
  668.  * RETURNS
  669.  *  void
  670.  *****************************************************************************/
  671. void ShowVerticalBarMin(void)
  672. {
  673.     /*----------------------------------------------------------------*/
  674.     /* Local Variables                                                */
  675.     /*----------------------------------------------------------------*/
  676.     /*----------------------------------------------------------------*/
  677.     /* Code Body                                                      */
  678.     /*----------------------------------------------------------------*/
  679.     if (volumeTimer)
  680.     {
  681.         StopTimer(KEY_VOL_TIMER_ID);
  682.     }
  683.     show_vertical_bar(LEVEL1);
  684.     *initialVolume = volume_level_UI;
  685.     hardwareVolumeFunction();
  686.     if (volumeMinFunction)
  687.     {
  688.         volumeMinFunction();
  689.     }
  690.     if (volumeTimer)
  691.     {
  692.         StartTimer(KEY_VOL_TIMER_ID, KEY_VOLUME_TIMEOUT, ExitScrSetKeyPadVolumeLevel);
  693.     }
  694. }
  695. /*****************************************************************************
  696.  * FUNCTION
  697.  *  StopKeyPadVolumeLevelTimer
  698.  * DESCRIPTION
  699.  *  To Increase Volume level of keypad tone
  700.  * PARAMETERS
  701.  *  void
  702.  * RETURNS
  703.  *  void
  704.  *****************************************************************************/
  705. void StopKeyPadVolumeLevelTimer(void)
  706. {
  707.     /*----------------------------------------------------------------*/
  708.     /* Local Variables                                                */
  709.     /*----------------------------------------------------------------*/
  710.     /*----------------------------------------------------------------*/
  711.     /* Code Body                                                      */
  712.     /*----------------------------------------------------------------*/
  713.     if (volumeTimer)
  714.     {
  715.         StopTimer(KEY_VOL_TIMER_ID);
  716.     }
  717.     if (ExitCallback)
  718.     {
  719.         ExitCallback();
  720.     }
  721. }
  722. /*****************************************************************************
  723.  * FUNCTION
  724.  *  ExitScrSetKeyPadVolumeLevel
  725.  * DESCRIPTION
  726.  *  To Increase Volume level of keypad tone
  727.  * PARAMETERS
  728.  *  void
  729.  * RETURNS
  730.  *  void
  731.  *****************************************************************************/
  732. void ExitScrSetKeyPadVolumeLevel(void)
  733. {
  734.     /*----------------------------------------------------------------*/
  735.     /* Local Variables                                                */
  736.     /*----------------------------------------------------------------*/
  737.     /*----------------------------------------------------------------*/
  738.     /* Code Body                                                      */
  739.     /*----------------------------------------------------------------*/
  740.     if (volumeTimer)
  741.     {
  742.         StopTimer(KEY_VOL_TIMER_ID);
  743.     }
  744.     GoBackHistory();
  745. }
  746. /*****************************************************************************
  747.  * FUNCTION
  748.  *  SpeechVolumeFunction
  749.  * DESCRIPTION
  750.  *  Sets Default Volume Handlers
  751.  * PARAMETERS
  752.  *  void
  753.  * RETURNS
  754.  *  void
  755.  *****************************************************************************/
  756. void SpeechVolumeFunction(void)
  757. {
  758.     /*----------------------------------------------------------------*/
  759.     /* Local Variables                                                */
  760.     /*----------------------------------------------------------------*/
  761.     /*----------------------------------------------------------------*/
  762.     /* Code Body                                                      */
  763.     /*----------------------------------------------------------------*/
  764.     SetSpeechVolume(volume_level_UI);
  765. #ifdef __MMI_BT_SUPPORT__
  766.     mmi_bt_set_headset_speaker_volume(volume_level_UI);
  767. #endif 
  768. }
  769. /*****************************************************************************
  770.  * FUNCTION
  771.  *  RingToneVolumeFunction
  772.  * DESCRIPTION
  773.  *  Ring Tone Volume Function
  774.  * PARAMETERS
  775.  *  void
  776.  * RETURNS
  777.  *  void
  778.  *****************************************************************************/
  779. void RingToneVolumeFunction(void)
  780. {
  781.     /*----------------------------------------------------------------*/
  782.     /* Local Variables                                                */
  783.     /*----------------------------------------------------------------*/
  784.     /*----------------------------------------------------------------*/
  785.     /* Code Body                                                      */
  786.     /*----------------------------------------------------------------*/
  787.     SetRingerVolume(volume_level_UI);
  788. #ifdef __MMI_BT_SUPPORT__
  789.     mmi_bt_set_headset_speaker_volume(volume_level_UI);
  790. #endif 
  791. }
  792. /*****************************************************************************
  793.  * FUNCTION
  794.  *  SpeechVolumeExitFunction
  795.  * DESCRIPTION
  796.  *  Speech volume Exit function
  797.  * PARAMETERS
  798.  *  void
  799.  * RETURNS
  800.  *  void
  801.  *****************************************************************************/
  802. void SpeechVolumeExitFunction(void)
  803. {
  804.     /*----------------------------------------------------------------*/
  805.     /* Local Variables                                                */
  806.     /*----------------------------------------------------------------*/
  807.     /*----------------------------------------------------------------*/
  808.     /* Code Body                                                      */
  809.     /*----------------------------------------------------------------*/
  810.     SaveSpeechVolume((U8) volume_level_UI);
  811. }
  812. /*****************************************************************************
  813.  * FUNCTION
  814.  *  RingVolumeExitFunction
  815.  * DESCRIPTION
  816.  *  Ring volume Exit function
  817.  * PARAMETERS
  818.  *  void
  819.  * RETURNS
  820.  *  void
  821.  *****************************************************************************/
  822. void RingVolumeExitFunction(void)
  823. {
  824.     /*----------------------------------------------------------------*/
  825.     /* Local Variables                                                */
  826.     /*----------------------------------------------------------------*/
  827.     /*----------------------------------------------------------------*/
  828.     /* Code Body                                                      */
  829.     /*----------------------------------------------------------------*/
  830.     SetActivatedRingVolumeLevel((MMI_VOLUME_LEVEL_ENUM) volume_level_UI);
  831. }
  832. /*****************************************************************************
  833.  * FUNCTION
  834.  *  KeyPadVolumeFunction
  835.  * DESCRIPTION
  836.  *  Keypad volume function
  837.  * PARAMETERS
  838.  *  void
  839.  * RETURNS
  840.  *  void
  841.  *****************************************************************************/
  842. void KeyPadVolumeFunction(void)
  843. {
  844.     /*----------------------------------------------------------------*/
  845.     /* Local Variables                                                */
  846.     /*----------------------------------------------------------------*/
  847.     /*----------------------------------------------------------------*/
  848.     /* Code Body                                                      */
  849.     /*----------------------------------------------------------------*/
  850.     SetKeyPadVolume(volume_level_UI);
  851. }
  852. /*****************************************************************************
  853.  * FUNCTION
  854.  *  KeyPadVolumeExitFunction
  855.  * DESCRIPTION
  856.  *  KeyPad Volume Exit Function
  857.  * PARAMETERS
  858.  *  void
  859.  * RETURNS
  860.  *  void
  861.  *****************************************************************************/
  862. void KeyPadVolumeExitFunction(void)
  863. {
  864.     /*----------------------------------------------------------------*/
  865.     /* Local Variables                                                */
  866.     /*----------------------------------------------------------------*/
  867.     /*----------------------------------------------------------------*/
  868.     /* Code Body                                                      */
  869.     /*----------------------------------------------------------------*/
  870.     /* restore key tone state */
  871.     mmi_frm_kbd_set_tone_state(key_tone_state);
  872.     /* MTK Brian added for setting activated keypad volume, 2003/12/02 */
  873.     SetActivatedKeypadVolumeLevel((MMI_VOLUME_LEVEL_ENUM) volume_level_UI);
  874. }
  875. /* PMT HIMANSHU START 20050729 */
  876. #if defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_WALLPAPER_ON_BOTTOM__)
  877. /*****************************************************************************
  878.  * FUNCTION
  879.  *  CallShowVerticalBarMax
  880.  * DESCRIPTION
  881.  *  Callback function for time synchronization of KEY_LONG_PRESS
  882.  *  and MMI_PEN_EVENT_LONG_TAP event
  883.  * PARAMETERS
  884.  *  void
  885.  * RETURNS
  886.  *  void
  887.  *****************************************************************************/
  888. void CallShowVerticalBarMax(void)
  889. {
  890.     /*----------------------------------------------------------------*/
  891.     /* Local Variables                                                */
  892.     /*----------------------------------------------------------------*/
  893.     /*----------------------------------------------------------------*/
  894.     /* Code Body                                                      */
  895.     /*----------------------------------------------------------------*/
  896.     if (volumeTimer)
  897.     {
  898.         StopTimer(KEY_VOL_TIMER_ID);
  899.     }
  900.     callback_timer++;
  901.     if (callback_timer >= LONGPRESS_DELAY)
  902.     {
  903.         ShowVerticalBarMax();
  904.         callback_timer = 0;
  905.     }
  906.     if (volumeTimer)
  907.     {
  908.         StartTimer(KEY_VOL_TIMER_ID, KEY_VOLUME_TIMEOUT, ExitScrSetKeyPadVolumeLevel);
  909.     }
  910. }
  911. /*****************************************************************************
  912.  * FUNCTION
  913.  *  CallShowVerticalBarMin
  914.  * DESCRIPTION
  915.  *  Callback function for time synchronization of KEY_LONG_PRESS
  916.  *  and MMI_PEN_EVENT_LONG_TAP event
  917.  * PARAMETERS
  918.  *  void
  919.  * RETURNS
  920.  *  void
  921.  *****************************************************************************/
  922. void CallShowVerticalBarMin(void)
  923. {
  924.     /*----------------------------------------------------------------*/
  925.     /* Local Variables                                                */
  926.     /*----------------------------------------------------------------*/
  927.     /*----------------------------------------------------------------*/
  928.     /* Code Body                                                      */
  929.     /*----------------------------------------------------------------*/
  930.     if (volumeTimer)
  931.     {
  932.         StopTimer(KEY_VOL_TIMER_ID);
  933.     }
  934.     callback_timer++;
  935.     if (callback_timer >= LONGPRESS_DELAY)
  936.     {
  937.         ShowVerticalBarMin();
  938.         callback_timer = 0;
  939.     }
  940.     if (volumeTimer)
  941.     {
  942.         StartTimer(KEY_VOL_TIMER_ID, KEY_VOLUME_TIMEOUT, ExitScrSetKeyPadVolumeLevel);
  943.     }
  944. }
  945. /*****************************************************************************
  946.  * FUNCTION
  947.  *  ResetCallbackTimer
  948.  * DESCRIPTION
  949.  *  Callback function of PEN_EVENT_UP event for reseting the
  950.  *  synchronization variable.
  951.  * PARAMETERS
  952.  *  void
  953.  * RETURNS
  954.  *  void
  955.  *****************************************************************************/
  956. void ResetCallbackTimer(void)
  957. {
  958.     /*----------------------------------------------------------------*/
  959.     /* Local Variables                                                */
  960.     /*----------------------------------------------------------------*/
  961.     /*----------------------------------------------------------------*/
  962.     /* Code Body                                                      */
  963.     /*----------------------------------------------------------------*/
  964.     callback_timer = 0;
  965. }
  966. #endif /* defined(__MMI_TOUCH_SCREEN__) && defined(__MMI_WALLPAPER_ON_BOTTOM__) */ 
  967. /* PMT HIMANSHU END 20050729 */