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

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.  * SettingProf.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This file is intends for profile API
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  * removed!
  116.  * removed!
  117.  * removed!
  118.  *
  119.  * removed!
  120.  * removed!
  121.  * removed!
  122.  *
  123.  * removed!
  124.  * removed!
  125.  * removed!
  126.  *
  127.  * removed!
  128.  * removed!
  129.  * removed!
  130.  *
  131.  * removed!
  132.  * removed!
  133.  * removed!
  134.  *
  135.  * removed!
  136.  * removed!
  137.  * removed!
  138.  *
  139.  * removed!
  140.  * removed!
  141.  * removed!
  142.  *
  143.  * removed!
  144.  * removed!
  145.  * removed!
  146.  *
  147.  * removed!
  148.  * removed!
  149.  * removed!
  150.  *
  151.  * removed!
  152.  * removed!
  153.  * removed!
  154.  *
  155.  * removed!
  156.  * removed!
  157.  * removed!
  158.  *
  159.  * removed!
  160.  * removed!
  161.  * removed!
  162.  *
  163.  * removed!
  164.  * removed!
  165.  * removed!
  166.  *
  167.  * removed!
  168.  * removed!
  169.  * removed!
  170.  *
  171.  * removed!
  172.  * removed!
  173.  * removed!
  174.  *
  175.  * removed!
  176.  * removed!
  177.  * removed!
  178.  *
  179.  * removed!
  180.  * removed!
  181.  * removed!
  182.  *
  183.  * removed!
  184.  * removed!
  185.  * removed!
  186.  *
  187.  * removed!
  188.  * removed!
  189.  * removed!
  190.  *
  191.  * removed!
  192.  * removed!
  193.  * removed!
  194.  *
  195.  * removed!
  196.  * removed!
  197.  * removed!
  198.  *
  199.  * removed!
  200.  * removed!
  201.  * removed!
  202.  *
  203.  * removed!
  204.  * removed!
  205.  * removed!
  206.  *
  207.  * removed!
  208.  * removed!
  209.  * removed!
  210.  *
  211.  * removed!
  212.  * removed!
  213.  * removed!
  214.  *
  215.  * removed!
  216.  * removed!
  217.  * removed!
  218.  *
  219.  * removed!
  220.  * removed!
  221.  * removed!
  222.  *
  223.  * removed!
  224.  * removed!
  225.  * removed!
  226.  *
  227.  * removed!
  228.  * removed!
  229.  * removed!
  230.  *
  231.  * removed!
  232.  * removed!
  233.  * removed!
  234.  *
  235.  * removed!
  236.  * removed!
  237.  * removed!
  238.  *
  239.  * removed!
  240.  * removed!
  241.  * removed!
  242.  *
  243.  * removed!
  244.  * removed!
  245.  * removed!
  246.  *
  247.  * removed!
  248.  * removed!
  249.  * removed!
  250.  *
  251.  * removed!
  252.  * removed!
  253.  * removed!
  254.  *
  255.  * removed!
  256.  * removed!
  257.  * removed!
  258.  *
  259.  * removed!
  260.  * removed!
  261.  * removed!
  262.  *
  263.  * removed!
  264.  * removed!
  265.  * removed!
  266.  *
  267.  * removed!
  268.  * removed!
  269.  * removed!
  270.  *
  271.  * removed!
  272.  * removed!
  273.  * removed!
  274.  *
  275.  * removed!
  276.  * removed!
  277.  * removed!
  278.  *
  279.  * removed!
  280.  * removed!
  281.  * removed!
  282.  *
  283.  * removed!
  284.  * removed!
  285.  * removed!
  286.  *
  287.  * removed!
  288.  * removed!
  289.  * removed!
  290.  *
  291.  * removed!
  292.  * removed!
  293.  * removed!
  294.  *
  295.  * removed!
  296.  * removed!
  297.  * removed!
  298.  *
  299.  * removed!
  300.  * removed!
  301.  * removed!
  302.  *
  303.  * removed!
  304.  * removed!
  305.  * removed!
  306.  *
  307.  * removed!
  308.  * removed!
  309.  * removed!
  310.  *
  311.  * removed!
  312.  * removed!
  313.  * removed!
  314.  *
  315.  * removed!
  316.  * removed!
  317.  * removed!
  318.  *
  319.  * removed!
  320.  * removed!
  321.  * removed!
  322.  *
  323.  * removed!
  324.  * removed!
  325.  * removed!
  326.  *
  327.  * removed!
  328.  * removed!
  329.  * removed!
  330.  *
  331.  * removed!
  332.  * removed!
  333.  * removed!
  334.  *
  335.  * removed!
  336.  * removed!
  337.  * removed!
  338.  *
  339.  * removed!
  340.  * removed!
  341.  * removed!
  342.  *
  343.  * removed!
  344.  * removed!
  345.  * removed!
  346.  *
  347.  * removed!
  348.  * removed!
  349.  * removed!
  350.  *
  351.  * removed!
  352.  * removed!
  353.  * removed!
  354.  *
  355.  * removed!
  356.  * removed!
  357.  * removed!
  358.  *
  359.  * removed!
  360.  * removed!
  361.  * removed!
  362.  *
  363.  * removed!
  364.  * removed!
  365.  * removed!
  366.  *
  367.  * removed!
  368.  * removed!
  369.  * removed!
  370.  *
  371.  * removed!
  372.  * removed!
  373.  * removed!
  374.  *
  375.  * removed!
  376.  * removed!
  377.  * removed!
  378.  *
  379.  *------------------------------------------------------------------------------
  380.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  381.  *============================================================================
  382.  ****************************************************************************/
  383. /**
  384.  * Copyright Notice
  385.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  386.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  387.  *  (It is illegal to remove this copyright notice from this software or any
  388.  *  portion of it)
  389.  */
  390. /***************** Settings Application implementation *********************/
  391. /**************************************************************
  392.    FILENAME : Profiles.c
  393.    PURPOSE     : API's to all applications.
  394.    REMARKS     : nil
  395.    AUTHOR      : Ashima Bajaj, Deepali
  396.    DATE     : 5/5/2003
  397. **************************************************************/
  398. #include "MMI_features.h"     //KP Jerry add on 2007-4-27
  399. #include "PixtelDataTypes.h"
  400. #include "CommonScreens.h"
  401. #include "SettingProfile.h"
  402. #include "CustDataRes.h"
  403. #include "SettingDefs.h"
  404. #include "ProfileGprots.h"
  405. #include "EventsGprot.h"
  406. #include "ProfilesEnum.h"
  407. #include "ProfilesGexdcl.h"
  408. #include "NVRAMEnum.h"
  409. #include "NVRAMProt.h"
  410. #include "NVRAMType.h"
  411. #include "DebugInitDef.h"
  412. #include "gpioInc.h"
  413. #include "AudioInc.h"
  414. #include "mdi_audio.h"
  415. #include "Globaldefs.h"
  416. #include "IdleAppDef.h"
  417. #include "ProfilesGexdcl.h"
  418. #include "CallManagementGProt.h"
  419. #include "KeyBrd.h"
  420. #include "Profiles_prot.h"
  421. #include "ProfilesDefs.h"       /* MTK robin 1119, AT command set wallpaper and profile */
  422. #include "ATHandlerProt.h"
  423. /* Leo add for DLT */
  424. #include "DownloadDefs.h"
  425. #include "SimDetectionGprot.h"
  426. /* Leo end */
  427. #ifdef __MMI_BT_PROFILE__
  428. #ifdef __MMI_BT_MTK_SUPPORT__
  429. #include "BTMMICM.h"
  430. #include "BTMMICMGprots.h"
  431. #else /* __MMI_BT_MTK_SUPPORT__ */ 
  432. #include "BTMMIBCHS.h"
  433. #include "BTMMIBCHSGprots.h"
  434. #endif /* __MMI_BT_MTK_SUPPORT__ */ 
  435. #include "BTMMIScr.h"
  436. #include "BTMMIScrGprots.h"
  437. #endif /* __MMI_BT_PROFILE__ */ 
  438. #ifdef __MMI_USB_SUPPORT__
  439. #define MMI_PROF_GENERAL_KEYPAD_TIMER_DUR 15    /* sec */
  440. #ifdef MMI_ON_HARDWARE_P
  441. extern kal_bool INT_USBBoot(void);
  442. #endif 
  443. #endif /* __MMI_USB_SUPPORT__ */ 
  444. #ifdef __MMI_AUDIO_PLAYER__
  445. extern BOOL mmi_audply_save_volume(U8 volume);
  446. extern void mmi_audply_bt_power_off_callback(BOOL success);
  447. #ifdef __MMI_AUDIO_SPECTRUM_DISPLAY__
  448. extern void mmi_audply_disable_spectrum_display(void);
  449. #endif 
  450. #endif /* __MMI_AUDIO_PLAYER__ */ 
  451. #ifdef __MMI_FM_RADIO__
  452. extern void mmi_fmrdo_power_on_main_screen(BOOL turn_on);
  453. extern void mmi_fmrdo_power_on(BOOL turn_on);
  454. #endif /* __MMI_FM_RADIO__ */ 
  455. #if defined(__MMI_ALM_AUDIO_OPTIONS__) || defined(__MMI_ALM_CUSTOMIZE_TONE__)
  456. #include "AlarmDef.h"
  457. #include "AlarmProt.h"
  458. extern alm_context_struct g_alm_cntx;
  459. extern alm_framework_context_struct g_alm_frm_cntx;
  460. #endif /* defined(__MMI_ALM_AUDIO_OPTIONS__) || defined(__MMI_ALM_CUSTOMIZE_TONE__) */ 
  461. extern void mdi_audio_set_audio_mode(U8 mode);
  462. extern void change_font(void);
  463. #ifdef __MMI_BT_PROFILE__
  464. extern void mmi_bt_a2dp_deactivate_req(void);
  465. U8 g_mmi_profiles_bt_reset_pending = 0;
  466. BOOL g_mmi_profiles_bt_in_call = FALSE;
  467. static MMI_BOOL g_mmi_profiles_bt_allow_sco = MMI_TRUE; /* Allow SCO connection */
  468. static MMI_BOOL g_mmi_profiles_bt_inquerying = MMI_FALSE; /* No SCO connection when inquerying */
  469. #if defined(__MMI_BT_BCHS_SUPPORT__) && defined(__MMI_A2DP_SUPPORT__)
  470. static BOOL a2dp_signal_disconnecting = FALSE;
  471. #endif
  472. #ifdef __MMI_HFP_SUPPORT__
  473. BOOL g_mmi_profiles_bt_always_use_in_call = FALSE;
  474. static void (*mmi_profiles_bt_connect_sco_app_callback) (void) = NULL;
  475. BOOL g_mmi_profiles_bt_app_in_use = FALSE;
  476. #endif /* __MMI_HFP_SUPPORT__ */ 
  477. #endif /* __MMI_BT_PROFILE__ */ 
  478. #if defined(__MMI_BT_AUDIO_VIA_SCO__) || defined(__MMI_BT_FM_VIA_SCO__)
  479. #include "mdi_video.h"
  480. #define BT_SCO_CONNECT_TIMEOUT_DURATION 20000 /* Timeout to disconnect duration */
  481. static MMI_BOOL g_mmi_profiles_bt_sco_timeout = MMI_TRUE; /* Timeout mechanism */
  482. static void (*g_mmi_profiles_bt_inquery_callback) (void) = NULL;
  483. #endif /* #if defined(__MMI_BT_AUDIO_VIA_SCO__) || defined(__MMI_BT_FM_VIA_SCO__) */
  484. /*****************************************************************************
  485.  * FUNCTION
  486.  *  initializeProfiles
  487.  * DESCRIPTION
  488.  *  Set default values in profiles structure.
  489.  * PARAMETERS
  490.  *  void
  491.  * RETURNS
  492.  *  void
  493.  *****************************************************************************/
  494. void initializeProfiles(void)
  495. {
  496.     /*----------------------------------------------------------------*/
  497.     /* Local Variables                                                */
  498.     /*----------------------------------------------------------------*/
  499.     /*----------------------------------------------------------------*/
  500.     /* Code Body                                                      */
  501.     /*----------------------------------------------------------------*/
  502.     GetDynamicToneIds();
  503.     /* Initialising General Profile */
  504.     gprofiles[0].toneSetup.ringTone = gstartMidiId;
  505.     gprofiles[0].toneSetup.alarmTone = (gstartMidiId + 1);
  506.     gprofiles[0].toneSetup.powerOnTone = (gstartGeneralToneId);
  507.     gprofiles[0].toneSetup.powerOffTone = (gstartGeneralToneId + 1);
  508.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  509. #ifdef __MMI_CLAMSHELL__
  510.     gprofiles[0].toneSetup.coverOpenTone = (gstartGeneralToneId + 2);
  511.     gprofiles[0].toneSetup.coverCloseTone = (gstartGeneralToneId + 3);
  512. #endif /* __MMI_CLAMSHELL__ */ 
  513.     /* MTK end */
  514.     gprofiles[0].toneSetup.messageTone = (gstartMiscToneId + 4);
  515.     gprofiles[0].toneSetup.keypadTone = KEYPAD_TONE;
  516.     gprofiles[0].mtCallAlertTypeEnum = MMI_RING;
  517.     gprofiles[0].ringTypeEnum = REPEAT;
  518.     gprofiles[0].extraTone.connectTone = 0;
  519.     gprofiles[0].extraTone.errorTone = 1;
  520.     gprofiles[0].extraTone.campOnTone = 1;
  521.     gprofiles[0].extraTone.warningTone = 1;
  522.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  523. #ifdef __MMI_CLAMSHELL__
  524.     gprofiles[0].answeringMode.coverAnswer = 1;
  525. #endif 
  526.     /* MTK end */
  527.     gprofiles[0].answeringMode.anyKey = 0;
  528.     gprofiles[0].answeringMode.automatic = 1;
  529.     gprofiles[0].light.timer.setsec = 15;
  530.     gprofiles[0].light.status = COLOR_PATTERN1;
  531.     gprofiles[0].fontSizeEnum = THEME_DEFAULT;
  532.     gprofiles[0].keypadVolumeLevel = LEVEL2;
  533.     gprofiles[0].ringVolumeLevel = LEVEL4;
  534.     gprofiles[0].loudSpeakerVolumeLevel = LEVEL4;
  535.     gprofiles[0].intelligentCallAlert = MMI_INTELLIGENT_CALL_ALERT_OFF;
  536.     gprofiles[1].toneSetup.ringTone = gstartMidiId;
  537.     gprofiles[1].toneSetup.alarmTone = (gstartMidiId + 1);
  538.     gprofiles[1].toneSetup.powerOnTone = (POWERON_SILENT);
  539.     gprofiles[1].toneSetup.powerOffTone = (POWEROFF_SILENT);
  540.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  541. #ifdef __MMI_CLAMSHELL__
  542.     gprofiles[1].toneSetup.coverOpenTone = (COVER_OPEN_SILENT);
  543.     gprofiles[1].toneSetup.coverCloseTone = (COVER_CLOSE_SILENT);
  544. #endif /* __MMI_CLAMSHELL__ */ 
  545.     /* MTK end */
  546.     gprofiles[1].toneSetup.messageTone = (MESSAGE_SILENT);
  547.     gprofiles[1].toneSetup.keypadTone = KEYPAD_SILENT;
  548.     gprofiles[1].mtCallAlertTypeEnum = MMI_VIBRATION_ONLY;
  549.     gprofiles[1].ringTypeEnum = SINGLE;
  550.     gprofiles[1].extraTone.connectTone = 0;
  551.     gprofiles[1].extraTone.errorTone = 0;
  552.     gprofiles[1].extraTone.campOnTone = 0;
  553.     gprofiles[1].extraTone.warningTone = 0;
  554.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  555. #ifdef __MMI_CLAMSHELL__
  556.     gprofiles[1].answeringMode.coverAnswer = 1;
  557. #endif 
  558.     /* MTK end */
  559.     gprofiles[1].answeringMode.anyKey = 0;
  560.     gprofiles[1].answeringMode.automatic = 1;
  561.     gprofiles[1].light.timer.setsec = 15;
  562.     gprofiles[1].light.status = COLOR_PATTERN1;
  563.     gprofiles[1].fontSizeEnum = THEME_DEFAULT;
  564.     gprofiles[1].keypadVolumeLevel = LEVEL1;
  565.     gprofiles[1].ringVolumeLevel = LEVEL4;
  566.     gprofiles[1].loudSpeakerVolumeLevel = LEVEL4;
  567.     gprofiles[1].intelligentCallAlert = MMI_INTELLIGENT_CALL_ALERT_OFF;
  568.     /* Initialising Outdoor Profile */
  569.     gprofiles[2].toneSetup.ringTone = gstartMidiId;
  570.     gprofiles[2].toneSetup.alarmTone = (gstartMidiId + 1);
  571.     gprofiles[2].toneSetup.powerOnTone = (gstartGeneralToneId + 0);
  572.     gprofiles[2].toneSetup.powerOffTone = (gstartGeneralToneId + 1);
  573.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  574. #ifdef __MMI_CLAMSHELL__
  575.     gprofiles[2].toneSetup.coverOpenTone = (gstartGeneralToneId + 2);
  576.     gprofiles[2].toneSetup.coverCloseTone = (gstartGeneralToneId + 3);
  577. #endif /* __MMI_CLAMSHELL__ */ 
  578.     /* MTK end */
  579.     gprofiles[2].toneSetup.messageTone = (gstartMiscToneId + 4);
  580.     gprofiles[2].toneSetup.keypadTone = KEYPAD_TONE;
  581.     gprofiles[2].mtCallAlertTypeEnum = MMI_VIBRATION_AND_RING;
  582.     gprofiles[2].ringTypeEnum = REPEAT;
  583.     gprofiles[2].extraTone.connectTone = 0;
  584.     gprofiles[2].extraTone.errorTone = 1;
  585.     gprofiles[2].extraTone.campOnTone = 1;
  586.     gprofiles[2].extraTone.warningTone = 1;
  587.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  588. #ifdef __MMI_CLAMSHELL__
  589.     gprofiles[2].answeringMode.coverAnswer = 1;
  590. #endif 
  591.     /* MTK end */
  592.     gprofiles[2].answeringMode.anyKey = 0;
  593.     gprofiles[2].answeringMode.automatic = 1;
  594.     gprofiles[2].light.timer.setsec = 15;
  595.     gprofiles[2].light.status = COLOR_PATTERN1;
  596.     gprofiles[2].fontSizeEnum = THEME_DEFAULT;
  597.     gprofiles[2].keypadVolumeLevel = LEVEL7;
  598.     gprofiles[2].ringVolumeLevel = LEVEL7;
  599.     gprofiles[2].loudSpeakerVolumeLevel = LEVEL4;
  600.     gprofiles[2].intelligentCallAlert = MMI_INTELLIGENT_CALL_ALERT_OFF;
  601.     /* Initialising Indoor Profile */
  602.     gprofiles[3].toneSetup.ringTone = gstartMidiId;
  603.     gprofiles[3].toneSetup.alarmTone = (gstartMidiId + 1);
  604.     gprofiles[3].toneSetup.powerOnTone = (gstartGeneralToneId + 0);
  605.     gprofiles[3].toneSetup.powerOffTone = (gstartGeneralToneId + 1);
  606.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  607. #ifdef __MMI_CLAMSHELL__
  608.     gprofiles[3].toneSetup.coverOpenTone = (gstartGeneralToneId + 2);
  609.     gprofiles[3].toneSetup.coverCloseTone = (gstartGeneralToneId + 3);
  610. #endif /* __MMI_CLAMSHELL__ */ 
  611.     /* MTK end */
  612.     gprofiles[3].toneSetup.messageTone = (gstartMiscToneId + 4);
  613.     gprofiles[3].toneSetup.keypadTone = KEYPAD_TONE;
  614.     gprofiles[3].mtCallAlertTypeEnum = MMI_RING;
  615.     gprofiles[3].ringTypeEnum = ASCENDING;
  616.     gprofiles[3].extraTone.connectTone = 0;
  617.     gprofiles[3].extraTone.errorTone = 1;
  618.     gprofiles[3].extraTone.campOnTone = 1;
  619.     gprofiles[3].extraTone.warningTone = 1;
  620.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  621. #ifdef __MMI_CLAMSHELL__
  622.     gprofiles[3].answeringMode.coverAnswer = 1;
  623. #endif 
  624.     /* MTK end */
  625.     gprofiles[3].answeringMode.anyKey = 0;
  626.     gprofiles[3].answeringMode.automatic = 1;
  627.     gprofiles[3].light.timer.setsec = 15;
  628.     gprofiles[3].light.status = COLOR_PATTERN1;
  629.     gprofiles[3].fontSizeEnum = THEME_DEFAULT;
  630.     gprofiles[3].keypadVolumeLevel = LEVEL1;
  631.     gprofiles[3].ringVolumeLevel = LEVEL3;
  632.     gprofiles[3].loudSpeakerVolumeLevel = LEVEL4;
  633.     gprofiles[3].intelligentCallAlert = MMI_INTELLIGENT_CALL_ALERT_OFF;
  634.     /* Initialising Headset Profile */
  635.     gprofiles[4].toneSetup.ringTone = gstartMidiId;
  636.     gprofiles[4].toneSetup.alarmTone = (gstartMidiId + 1);
  637.     gprofiles[4].toneSetup.powerOnTone = (gstartGeneralToneId + 0);
  638.     gprofiles[4].toneSetup.powerOffTone = (gstartGeneralToneId + 1);
  639.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  640. #ifdef __MMI_CLAMSHELL__
  641.     gprofiles[4].toneSetup.coverOpenTone = (gstartGeneralToneId + 2);
  642.     gprofiles[4].toneSetup.coverCloseTone = (gstartGeneralToneId + 3);
  643. #endif /* __MMI_CLAMSHELL__ */ 
  644.     /* MTK end */
  645.     gprofiles[4].toneSetup.messageTone = (gstartMiscToneId + 4);
  646.     gprofiles[4].toneSetup.keypadTone = KEYPAD_TONE;
  647.     gprofiles[4].mtCallAlertTypeEnum = MMI_RING;
  648.     gprofiles[4].ringTypeEnum = REPEAT;
  649.     gprofiles[4].extraTone.connectTone = 0;
  650.     gprofiles[4].extraTone.errorTone = 1;
  651.     gprofiles[4].extraTone.campOnTone = 1;
  652.     gprofiles[4].extraTone.warningTone = 1;
  653.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  654. #ifdef __MMI_CLAMSHELL__
  655.     gprofiles[4].answeringMode.coverAnswer = 1;
  656. #endif 
  657.     /* MTK end */
  658.     gprofiles[4].answeringMode.anyKey = 0;
  659.     /* MTK: Brian added for KLM */
  660.     gprofiles[4].answeringMode.automatic = 1;
  661.     /* MTK end */
  662.     gprofiles[4].light.timer.setsec = 15;
  663.     gprofiles[4].light.status = COLOR_PATTERN1;
  664.     gprofiles[4].fontSizeEnum = THEME_DEFAULT;
  665.     gprofiles[4].keypadVolumeLevel = LEVEL2;
  666.     gprofiles[4].ringVolumeLevel = LEVEL4;
  667.     gprofiles[4].loudSpeakerVolumeLevel = LEVEL4;
  668.     gprofiles[4].intelligentCallAlert = MMI_INTELLIGENT_CALL_ALERT_OFF;
  669.     /* Initialising Silent Profile */
  670.     gprofiles[5].toneSetup.ringTone = gstartMidiId;
  671.     gprofiles[5].toneSetup.alarmTone = (gstartMidiId + 1);
  672.     gprofiles[5].toneSetup.powerOnTone = (POWERON_SILENT);
  673.     gprofiles[5].toneSetup.powerOffTone = (POWEROFF_SILENT);
  674.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  675. #ifdef __MMI_CLAMSHELL__
  676.     gprofiles[5].toneSetup.coverOpenTone = (COVER_OPEN_SILENT);
  677.     gprofiles[5].toneSetup.coverCloseTone = (COVER_CLOSE_SILENT);
  678. #endif /* __MMI_CLAMSHELL__ */ 
  679.     /* MTK end */
  680.     gprofiles[5].toneSetup.messageTone = (MESSAGE_SILENT);
  681.     gprofiles[5].toneSetup.keypadTone = KEYPAD_TONE;
  682.     gprofiles[5].mtCallAlertTypeEnum = MMI_RING;
  683.     gprofiles[5].ringTypeEnum = REPEAT;
  684.     gprofiles[5].extraTone.connectTone = 0;
  685.     gprofiles[5].extraTone.errorTone = 1;
  686.     gprofiles[5].extraTone.campOnTone = 1;
  687.     gprofiles[5].extraTone.warningTone = 1;
  688.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  689. #ifdef __MMI_CLAMSHELL__
  690.     gprofiles[5].answeringMode.coverAnswer = 1;
  691. #endif 
  692.     /* MTK end */
  693.     gprofiles[5].answeringMode.anyKey = 0;
  694.     gprofiles[5].answeringMode.automatic = 1;
  695.     gprofiles[5].light.timer.setsec = 15;
  696.     gprofiles[5].light.status = COLOR_PATTERN1;
  697.     gprofiles[5].fontSizeEnum = THEME_DEFAULT;
  698.     gprofiles[5].keypadVolumeLevel = LEVEL5;
  699.     gprofiles[5].ringVolumeLevel = LEVEL3;
  700.     gprofiles[5].loudSpeakerVolumeLevel = LEVEL4;
  701.     gprofiles[5].intelligentCallAlert = MMI_INTELLIGENT_CALL_ALERT_OFF;
  702.     /* Initialising LoudSpeaker Profile */
  703.     gprofiles[6].toneSetup.ringTone = gstartMidiId;
  704.     gprofiles[6].toneSetup.alarmTone = (gstartMidiId + 1);
  705.     gprofiles[6].toneSetup.powerOnTone = (gstartGeneralToneId + 0);
  706.     gprofiles[6].toneSetup.powerOffTone = (gstartGeneralToneId + 1);
  707.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  708. #ifdef __MMI_CLAMSHELL__
  709.     gprofiles[6].toneSetup.coverOpenTone = (gstartGeneralToneId + 2);
  710.     gprofiles[6].toneSetup.coverCloseTone = (gstartGeneralToneId + 3);
  711. #endif /* __MMI_CLAMSHELL__ */ 
  712.     /* MTK end */
  713.     gprofiles[6].toneSetup.messageTone = (gstartMiscToneId + 4);
  714.     gprofiles[6].toneSetup.keypadTone = KEYPAD_TONE;
  715.     gprofiles[6].mtCallAlertTypeEnum = MMI_RING;
  716.     gprofiles[6].ringTypeEnum = REPEAT;
  717.     gprofiles[6].extraTone.connectTone = 0;
  718.     gprofiles[6].extraTone.errorTone = 1;
  719.     gprofiles[6].extraTone.campOnTone = 1;
  720.     gprofiles[6].extraTone.warningTone = 1;
  721.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  722. #ifdef __MMI_CLAMSHELL__
  723.     gprofiles[6].answeringMode.coverAnswer = 1;
  724. #endif 
  725.     /* MTK end */
  726.     gprofiles[6].answeringMode.anyKey = 0;
  727.     gprofiles[6].answeringMode.automatic = 1;
  728.     gprofiles[6].light.timer.setsec = 15;
  729.     gprofiles[6].light.status = COLOR_PATTERN1;
  730.     gprofiles[6].fontSizeEnum = THEME_DEFAULT;
  731.     gprofiles[6].keypadVolumeLevel = LEVEL5;
  732.     gprofiles[6].ringVolumeLevel = LEVEL3;
  733.     gprofiles[6].loudSpeakerVolumeLevel = LEVEL4;
  734.     gprofiles[6].intelligentCallAlert = MMI_INTELLIGENT_CALL_ALERT_OFF;
  735. }
  736. /*****************************************************************************
  737.  * FUNCTION
  738.  *  GetRingVolumeLevel
  739.  * DESCRIPTION
  740.  *  Setting Ring Volume Level for a Profile
  741.  * PARAMETERS
  742.  *  void
  743.  * RETURNS
  744.  *  void
  745.  *****************************************************************************/
  746. MMI_VOLUME_LEVEL_ENUM GetRingVolumeLevel(void)
  747. {
  748.     /*----------------------------------------------------------------*/
  749.     /* Local Variables                                                */
  750.     /*----------------------------------------------------------------*/
  751.     MMI_VOLUME_LEVEL_ENUM ringVolumeLevel;
  752.     /*----------------------------------------------------------------*/
  753.     /* Code Body                                                      */
  754.     /*----------------------------------------------------------------*/
  755.     ringVolumeLevel = gcurrentprofile.ringVolumeLevel;
  756.     PRINT_INFORMATION(("File: Setting Prof.c <<GetRingVolumeLevel>
  757.                the ring volume level is : %d n", ringVolumeLevel));
  758.     return ringVolumeLevel;
  759. }
  760. /*****************************************************************************
  761.  * FUNCTION
  762.  *  GetLoudspkrVolumeLevel
  763.  * DESCRIPTION
  764.  *  Setting Ring Volume Level for a Profile
  765.  * PARAMETERS
  766.  *  void
  767.  * RETURNS
  768.  *  void
  769.  *****************************************************************************/
  770. MMI_VOLUME_LEVEL_ENUM GetLoudspkrVolumeLevel(void)
  771. {
  772.     /*----------------------------------------------------------------*/
  773.     /* Local Variables                                                */
  774.     /*----------------------------------------------------------------*/
  775.     MMI_VOLUME_LEVEL_ENUM loudspkr;
  776.     /*----------------------------------------------------------------*/
  777.     /* Code Body                                                      */
  778.     /*----------------------------------------------------------------*/
  779.     loudspkr = gprofiles[6].loudSpeakerVolumeLevel;
  780.     PRINT_INFORMATION(("File: Setting Prof.c <<GetLoudspkrVolumeLevel>
  781.                the loud volume level is : %d n", loudspkr));
  782.     return loudspkr;
  783. }
  784. /*****************************************************************************
  785.  * FUNCTION
  786.  *  GetKeypadVolumeLevel
  787.  * DESCRIPTION
  788.  *  Setting Keypad Volume Level for a Profile
  789.  * PARAMETERS
  790.  *  void
  791.  * RETURNS
  792.  *  void
  793.  *****************************************************************************/
  794. MMI_VOLUME_LEVEL_ENUM GetKeypadVolumeLevel(void)
  795. {
  796.     /*----------------------------------------------------------------*/
  797.     /* Local Variables                                                */
  798.     /*----------------------------------------------------------------*/
  799.     MMI_VOLUME_LEVEL_ENUM keypadVolumeLevel;
  800.     /*----------------------------------------------------------------*/
  801.     /* Code Body                                                      */
  802.     /*----------------------------------------------------------------*/
  803.     keypadVolumeLevel = gcurrentprofile.keypadVolumeLevel;
  804.     PRINT_INFORMATION(("File: Setting Prof.c <<GetKeypadVolumeLevel>
  805.                the keypadVolumeLevel is : %d n", keypadVolumeLevel));
  806.     return keypadVolumeLevel;
  807. }
  808. /*****************************************************************************
  809.  * FUNCTION
  810.  *  GetMtCallAlertTypeEnum
  811.  * DESCRIPTION
  812.  *  Setting Call Alert type for a Profile
  813.  * PARAMETERS
  814.  *  void
  815.  * RETURNS
  816.  *  void
  817.  *****************************************************************************/
  818. MMI_ALERT_TYPE GetMtCallAlertTypeEnum(void)
  819. {
  820.     /*----------------------------------------------------------------*/
  821.     /* Local Variables                                                */
  822.     /*----------------------------------------------------------------*/
  823.     MMI_ALERT_TYPE mtCallAlertTypeEnum;
  824.     /*----------------------------------------------------------------*/
  825.     /* Code Body                                                      */
  826.     /*----------------------------------------------------------------*/
  827.     mtCallAlertTypeEnum = gcurrentprofile.mtCallAlertTypeEnum;
  828.     PRINT_INFORMATION(("File: Setting Prof.c <<GetMtCallAlertTypeEnum>
  829.                the mtCallAlertTypeEnum is : %d n", mtCallAlertTypeEnum));
  830.     return mtCallAlertTypeEnum;
  831. }
  832. /*****************************************************************************
  833.  * FUNCTION
  834.  *  GetLightStatus
  835.  * DESCRIPTION
  836.  *  Setting Light for a Profile
  837.  * PARAMETERS
  838.  *  void
  839.  * RETURNS
  840.  *  void
  841.  *****************************************************************************/
  842. MMI_LEDLIGHT_STATUS_ENUM GetLightStatus(void)
  843. {
  844.     /*----------------------------------------------------------------*/
  845.     /* Local Variables                                                */
  846.     /*----------------------------------------------------------------*/
  847.     LIGHT templight;
  848.     /*----------------------------------------------------------------*/
  849.     /* Code Body                                                      */
  850.     /*----------------------------------------------------------------*/
  851.     templight.status = gcurrentprofile.light.status;
  852.     PRINT_INFORMATION(("File: Setting Prof.c <<GetLightStatus>
  853.                the light color is : %d n", templight.status));
  854.     return templight.status;
  855. }
  856. /*****************************************************************************
  857.  * FUNCTION
  858.  *  GetRingTypeEnum
  859.  * DESCRIPTION
  860.  *  Setting Ring_Type for a Profile
  861.  * PARAMETERS
  862.  *  void
  863.  * RETURNS
  864.  *  void
  865.  *****************************************************************************/
  866. MMI_RING_TYPE_ENUM GetRingTypeEnum(void)
  867. {
  868.     /*----------------------------------------------------------------*/
  869.     /* Local Variables                                                */
  870.     /*----------------------------------------------------------------*/
  871.     MMI_RING_TYPE_ENUM ringType;
  872.     /*----------------------------------------------------------------*/
  873.     /* Code Body                                                      */
  874.     /*----------------------------------------------------------------*/
  875.     ringType = gcurrentprofile.ringTypeEnum;
  876.     switch (ringType)
  877.     {
  878.         case SINGLE:
  879.             return 2;
  880.         case REPEAT:
  881.             return 1;
  882.         case ASCENDING:
  883.             return 0;
  884.         default:
  885.             return 1;
  886.     }
  887.     PRINT_INFORMATION(("File: Setting Prof.c <<GetRingTypeEnum>
  888.                the ringType is : %d n", ringType));
  889. }
  890. #ifdef __MMI_CONNECT_NOTICE__
  891. /*****************************************************************************
  892.  * FUNCTION
  893.  *  GetConnectNoticeType
  894.  * DESCRIPTION
  895.  *  Setting Call Alert type for a Profile
  896.  * PARAMETERS
  897.  *  void
  898.  * RETURNS
  899.  *  void
  900.  *****************************************************************************/
  901. U16 GetConnectNoticeType(void)
  902. {
  903.     /*----------------------------------------------------------------*/
  904.     /* Local Variables                                                */
  905.     /*----------------------------------------------------------------*/
  906.     MMI_CONNECT_NOTICE_TYPE connectNotice;
  907.     /*----------------------------------------------------------------*/
  908.     /* Code Body                                                      */
  909.     /*----------------------------------------------------------------*/
  910.     connectNotice = gcurrentprofile.extraTone.connectTone;
  911.     PRINT_INFORMATION(("File: Setting Prof.c <<GetConnectNoticeType>
  912.                the GetConnectNoticeType is : %d n", connectNotice));
  913.     return (U16) connectNotice;
  914. }
  915. #endif /* __MMI_CONNECT_NOTICE__ */ 
  916. /*****************************************************************************
  917.  * FUNCTION
  918.  *  GetAnsweringMode
  919.  * DESCRIPTION
  920.  *  Setting Answering mode for a Profile
  921.  * PARAMETERS
  922.  *  void
  923.  * RETURNS
  924.  *  void
  925.  *****************************************************************************/
  926. MMI_ANSWERING_MODE *GetAnsweringMode(void)
  927. {
  928.     /*----------------------------------------------------------------*/
  929.     /* Local Variables                                                */
  930.     /*----------------------------------------------------------------*/
  931.     static MMI_ANSWERING_MODE answeringMode;
  932.     /*----------------------------------------------------------------*/
  933.     /* Code Body                                                      */
  934.     /*----------------------------------------------------------------*/
  935.     /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  936. #ifdef __MMI_CLAMSHELL__
  937.     answeringMode.coverAnswer = gcurrentprofile.answeringMode.coverAnswer;
  938. #endif 
  939.     /* MTK end */
  940.     /* MTK: Brian modified for auto answer if test sim, 031020 */
  941. #ifdef MMI_ON_HARDWARE_P
  942.     if (is_test_sim() || gactivatedprofile == MMI_PROFILE_HEADSET)
  943.     {
  944.         answeringMode.automatic = gcurrentprofile.answeringMode.automatic;
  945.     }
  946.     else
  947.     {
  948.         answeringMode.automatic = FALSE;
  949.     }
  950. #else /* MMI_ON_HARDWARE_P */ 
  951.     if (gactivatedprofile == MMI_PROFILE_HEADSET)
  952.     {
  953.         answeringMode.automatic = gcurrentprofile.answeringMode.automatic;
  954.     }
  955.     else
  956.     {
  957.         answeringMode.automatic = FALSE;
  958.     }
  959. #endif /* MMI_ON_HARDWARE_P */ 
  960.     //MTK: Brian end
  961.     //answeringMode.automatic = gcurrentprofile.answeringMode.automatic;
  962.     answeringMode.anyKey = gcurrentprofile.answeringMode.anyKey;
  963.     return &answeringMode;
  964. }
  965. /*****************************************************************************
  966.  * FUNCTION
  967.  *  LoudSpeaker
  968.  * DESCRIPTION
  969.  *  Setting loud speaker for a Profile
  970.  * PARAMETERS
  971.  *  void
  972.  * RETURNS
  973.  *  void
  974.  *****************************************************************************/
  975. pBOOL LoudSpeaker(void)
  976. {
  977.     /*----------------------------------------------------------------*/
  978.     /* Local Variables                                                */
  979.     /*----------------------------------------------------------------*/
  980.     pBOOL loudSpeaker;
  981.     /*----------------------------------------------------------------*/
  982.     /* Code Body                                                      */
  983.     /*----------------------------------------------------------------*/
  984.     loudSpeaker = gloudSpeaker;
  985.     PRINT_INFORMATION(("File: Setting Prof.c <<LoudSpeaker>
  986.                the loudSpeaker is : %d n", loudSpeaker));
  987.     return loudSpeaker;
  988. }
  989. /*****************************************************************************
  990.  * FUNCTION
  991.  *  FontSizeEnum
  992.  * DESCRIPTION
  993.  *  Setting Font Size for a Profile
  994.  * PARAMETERS
  995.  *  void
  996.  * RETURNS
  997.  *  void
  998.  *****************************************************************************/
  999. MMI_FONT_SIZE_ENUM FontSizeEnum(void)
  1000. {
  1001.     /*----------------------------------------------------------------*/
  1002.     /* Local Variables                                                */
  1003.     /*----------------------------------------------------------------*/
  1004.     MMI_FONT_SIZE_ENUM fontSize;
  1005.     /*----------------------------------------------------------------*/
  1006.     /* Code Body                                                      */
  1007.     /*----------------------------------------------------------------*/
  1008.     fontSize = gcurrentprofile.fontSizeEnum;
  1009.     PRINT_INFORMATION(("File: Setting Prof.c <<FontSizeEnum>
  1010.                the fontSize is : %d n", fontSize));
  1011.     return fontSize;
  1012. }
  1013. /*****************************************************************************
  1014.  * FUNCTION
  1015.  *  GetConnectToneStatus
  1016.  * DESCRIPTION
  1017.  *  Setting Extra Tone for a Profile
  1018.  * PARAMETERS
  1019.  *  void
  1020.  * RETURNS
  1021.  *  void
  1022.  *****************************************************************************/
  1023. pBOOL GetConnectToneStatus(void)
  1024. {
  1025.     /*----------------------------------------------------------------*/
  1026.     /* Local Variables                                                */
  1027.     /*----------------------------------------------------------------*/
  1028.     EXTRA_TONE tempExtraTone;
  1029.     /*----------------------------------------------------------------*/
  1030.     /* Code Body                                                      */
  1031.     /*----------------------------------------------------------------*/
  1032.     tempExtraTone.connectTone = gcurrentprofile.extraTone.connectTone;
  1033.     PRINT_INFORMATION(("File: Setting Prof.c <<GetConnectToneStatus>
  1034.                the connectTone is : %d n", tempExtraTone.connectTone));
  1035.     return tempExtraTone.connectTone;
  1036. }
  1037. /*****************************************************************************
  1038.  * FUNCTION
  1039.  *  GetErrorToneStatus
  1040.  * DESCRIPTION
  1041.  *  Setting Extra Tone for a Profile
  1042.  * PARAMETERS
  1043.  *  void
  1044.  * RETURNS
  1045.  *  void
  1046.  *****************************************************************************/
  1047. pBOOL GetErrorToneStatus(void)
  1048. {
  1049.     /*----------------------------------------------------------------*/
  1050.     /* Local Variables                                                */
  1051.     /*----------------------------------------------------------------*/
  1052.     EXTRA_TONE tempExtraTone;
  1053.     /*----------------------------------------------------------------*/
  1054.     /* Code Body                                                      */
  1055.     /*----------------------------------------------------------------*/
  1056.     tempExtraTone.errorTone = gcurrentprofile.extraTone.errorTone;
  1057.     PRINT_INFORMATION(("File: Setting Prof.c <<GetErrorToneStatus>
  1058.                the errorTone is : %d n", tempExtraTone.errorTone));
  1059.     return tempExtraTone.errorTone;
  1060. }
  1061. /*****************************************************************************
  1062.  * FUNCTION
  1063.  *  GetRingToneID
  1064.  * DESCRIPTION
  1065.  *  Setting ringtone
  1066.  * PARAMETERS
  1067.  *  void
  1068.  * RETURNS
  1069.  *  void
  1070.  *****************************************************************************/
  1071. U16 GetRingToneID(void)
  1072. {
  1073.     /*----------------------------------------------------------------*/
  1074.     /* Local Variables                                                */
  1075.     /*----------------------------------------------------------------*/
  1076.     TONE_SETUP temptoneSetup;
  1077.     /*----------------------------------------------------------------*/
  1078.     /* Code Body                                                      */
  1079.     /*----------------------------------------------------------------*/
  1080.     temptoneSetup.ringTone = gcurrentprofile.toneSetup.ringTone;
  1081.     PRINT_INFORMATION(("File: Setting Prof.c <<GetRingToneID>
  1082.                the RingToneID is : %d n", temptoneSetup.ringTone));
  1083.     return temptoneSetup.ringTone;
  1084. }
  1085. /*****************************************************************************
  1086.  * FUNCTION
  1087.  *  GetPowerOnToneType
  1088.  * DESCRIPTION
  1089.  *  Setting power tone
  1090.  * PARAMETERS
  1091.  *  void
  1092.  * RETURNS
  1093.  *  void
  1094.  *****************************************************************************/
  1095. POWERON_TONE_ENUM GetPowerOnToneType(void)
  1096. {
  1097.     /*----------------------------------------------------------------*/
  1098.     /* Local Variables                                                */
  1099.     /*----------------------------------------------------------------*/
  1100.     TONE_SETUP temptoneSetup;
  1101.     /*----------------------------------------------------------------*/
  1102.     /* Code Body                                                      */
  1103.     /*----------------------------------------------------------------*/
  1104.     temptoneSetup.powerOnTone = gcurrentprofile.toneSetup.powerOnTone;
  1105.     PRINT_INFORMATION(("File: Setting Prof.c <<GetPowerOnToneType>
  1106.                the PowerOnTone is : %d n", temptoneSetup.powerOnTone));
  1107.     return temptoneSetup.powerOnTone;
  1108. }
  1109. /*****************************************************************************
  1110.  * FUNCTION
  1111.  *  GetPowerOffToneType
  1112.  * DESCRIPTION
  1113.  *  Setting power tone
  1114.  * PARAMETERS
  1115.  *  void
  1116.  * RETURNS
  1117.  *  void
  1118.  *****************************************************************************/
  1119. POWEROFF_TONE_ENUM GetPowerOffToneType(void)
  1120. {
  1121.     /*----------------------------------------------------------------*/
  1122.     /* Local Variables                                                */
  1123.     /*----------------------------------------------------------------*/
  1124.     TONE_SETUP temptoneSetup;
  1125.     /*----------------------------------------------------------------*/
  1126.     /* Code Body                                                      */
  1127.     /*----------------------------------------------------------------*/
  1128.     temptoneSetup.powerOffTone = gcurrentprofile.toneSetup.powerOffTone;
  1129.     PRINT_INFORMATION(("File: Setting Prof.c <<GetPowerOffToneType>
  1130.                the PowerOffTone is : %d n", temptoneSetup.powerOffTone));
  1131.     return temptoneSetup.powerOffTone;
  1132. }
  1133. /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  1134. #ifdef __MMI_CLAMSHELL__
  1135. /*****************************************************************************
  1136.  * FUNCTION
  1137.  *  GetCoverOpenToneType
  1138.  * DESCRIPTION
  1139.  *  Setting coveropentone
  1140.  * PARAMETERS
  1141.  *  void
  1142.  * RETURNS
  1143.  *  void
  1144.  *****************************************************************************/
  1145. COVER_OPEN_TONE_ENUM GetCoverOpenToneType(void)
  1146. {
  1147.     /*----------------------------------------------------------------*/
  1148.     /* Local Variables                                                */
  1149.     /*----------------------------------------------------------------*/
  1150.     TONE_SETUP temptoneSetup;
  1151.     /*----------------------------------------------------------------*/
  1152.     /* Code Body                                                      */
  1153.     /*----------------------------------------------------------------*/
  1154.     temptoneSetup.coverOpenTone = gcurrentprofile.toneSetup.coverOpenTone;
  1155.     PRINT_INFORMATION(("File: Setting Prof.c <<GetCoverOpenToneType>
  1156.                the CoverOpenTone is : %d n", temptoneSetup.coverOpenTone));
  1157.     return temptoneSetup.coverOpenTone;
  1158. }
  1159. /*****************************************************************************
  1160.  * FUNCTION
  1161.  *  GetCoverCloseToneType
  1162.  * DESCRIPTION
  1163.  *  Setting power tone
  1164.  * PARAMETERS
  1165.  *  void
  1166.  * RETURNS
  1167.  *  void
  1168.  *****************************************************************************/
  1169. COVER_CLOSE_TONE_ENUM GetCoverCloseToneType(void)
  1170. {
  1171.     /*----------------------------------------------------------------*/
  1172.     /* Local Variables                                                */
  1173.     /*----------------------------------------------------------------*/
  1174.     TONE_SETUP temptoneSetup;
  1175.     /*----------------------------------------------------------------*/
  1176.     /* Code Body                                                      */
  1177.     /*----------------------------------------------------------------*/
  1178.     temptoneSetup.coverCloseTone = gcurrentprofile.toneSetup.coverCloseTone;
  1179.     PRINT_INFORMATION(("File: Setting Prof.c <<GetCoverCloseToneType>
  1180.                the CoverCloseTone is : %d n", temptoneSetup.coverCloseTone));
  1181.     return temptoneSetup.coverCloseTone;
  1182. }
  1183. #endif /* __MMI_CLAMSHELL__ */ 
  1184. /* MTK end */
  1185. /*****************************************************************************
  1186.  * FUNCTION
  1187.  *  GetKeypadToneType
  1188.  * DESCRIPTION
  1189.  *  Setting Keypad tone
  1190.  * PARAMETERS
  1191.  *  void
  1192.  * RETURNS
  1193.  *  void
  1194.  *****************************************************************************/
  1195. KEYPAD_TONE_ENUM GetKeypadToneType(void)
  1196. {
  1197.     /*----------------------------------------------------------------*/
  1198.     /* Local Variables                                                */
  1199.     /*----------------------------------------------------------------*/
  1200.     TONE_SETUP temptoneSetup;
  1201.     /*----------------------------------------------------------------*/
  1202.     /* Code Body                                                      */
  1203.     /*----------------------------------------------------------------*/
  1204.     temptoneSetup.keypadTone = gcurrentprofile.toneSetup.keypadTone;
  1205.     PRINT_INFORMATION(("File: Setting Prof.c <<GetKeypadToneType>
  1206.                the keypadTone is : %d n", temptoneSetup.keypadTone));
  1207.     return temptoneSetup.keypadTone;
  1208. }
  1209. /*****************************************************************************
  1210.  * FUNCTION
  1211.  *  GetWarningToneType
  1212.  * DESCRIPTION
  1213.  *  Setting warning tone
  1214.  * PARAMETERS
  1215.  *  void
  1216.  * RETURNS
  1217.  *  void
  1218.  *****************************************************************************/
  1219. pBOOL GetWarningToneType(void)
  1220. {
  1221.     /*----------------------------------------------------------------*/
  1222.     /* Local Variables                                                */
  1223.     /*----------------------------------------------------------------*/
  1224.     EXTRA_TONE temptoneSetup;
  1225.     /*----------------------------------------------------------------*/
  1226.     /* Code Body                                                      */
  1227.     /*----------------------------------------------------------------*/
  1228.     temptoneSetup.warningTone = gcurrentprofile.extraTone.warningTone;
  1229.     PRINT_INFORMATION(("File: Setting Prof.c <<GetWarningToneType>
  1230.                the warningTone is : %d n", temptoneSetup.warningTone));
  1231.     return temptoneSetup.warningTone;
  1232. }
  1233. /*****************************************************************************
  1234.  * FUNCTION
  1235.  *  GetMessageToneType
  1236.  * DESCRIPTION
  1237.  *  Setting warning tone
  1238.  * PARAMETERS
  1239.  *  void
  1240.  * RETURNS
  1241.  *  void
  1242.  *****************************************************************************/
  1243. MESSAGE_TONE_ENUM GetMessageToneType(void)
  1244. {
  1245.     /*----------------------------------------------------------------*/
  1246.     /* Local Variables                                                */
  1247.     /*----------------------------------------------------------------*/
  1248.     TONE_SETUP temptoneSetup;
  1249.     /*----------------------------------------------------------------*/
  1250.     /* Code Body                                                      */
  1251.     /*----------------------------------------------------------------*/
  1252.     temptoneSetup.messageTone = gcurrentprofile.toneSetup.messageTone;
  1253.     PRINT_INFORMATION(("File: Setting Prof.c <<GetMessageToneType>
  1254.                the messageTone is : %d n", temptoneSetup.messageTone));
  1255.     return temptoneSetup.messageTone;
  1256. }
  1257. /*****************************************************************************
  1258.  * FUNCTION
  1259.  *  GetAlarmToneType
  1260.  * DESCRIPTION
  1261.  *  Setting warning tone
  1262.  * PARAMETERS
  1263.  *  void
  1264.  * RETURNS
  1265.  *  void
  1266.  *****************************************************************************/
  1267. ALARM_TONE_ENUM GetAlarmToneType(void)
  1268. {
  1269.     /*----------------------------------------------------------------*/
  1270.     /* Local Variables                                                */
  1271.     /*----------------------------------------------------------------*/
  1272.     TONE_SETUP temptoneSetup;
  1273.     /*----------------------------------------------------------------*/
  1274.     /* Code Body                                                      */
  1275.     /*----------------------------------------------------------------*/
  1276.     temptoneSetup.alarmTone = gcurrentprofile.toneSetup.alarmTone;
  1277.     PRINT_INFORMATION(("File: Setting Prof.c <<GetAlarmToneType>
  1278.                the alarmTone is : %d n", temptoneSetup.alarmTone));
  1279.     return (ALARM_TONE_ENUM) (temptoneSetup.alarmTone);
  1280. }
  1281. /*****************************************************************************
  1282.  * FUNCTION
  1283.  *  get_lcdbacklighttimer
  1284.  * DESCRIPTION
  1285.  *  Setting lcdbacklight timer value
  1286.  * PARAMETERS
  1287.  *  void
  1288.  * RETURNS
  1289.  *  void
  1290.  *****************************************************************************/
  1291. U8 get_lcdbacklighttimer(void)
  1292. {
  1293.     /*----------------------------------------------------------------*/
  1294.     /* Local Variables                                                */
  1295.     /*----------------------------------------------------------------*/
  1296.     LIGHT tempLight;
  1297.     /*----------------------------------------------------------------*/
  1298.     /* Code Body                                                      */
  1299.     /*----------------------------------------------------------------*/
  1300. #ifdef __MMI_USB_SUPPORT__
  1301.     if (INT_USBBoot())
  1302.     {
  1303.         return MMI_PROF_GENERAL_KEYPAD_TIMER_DUR;
  1304.     }
  1305. #endif /* __MMI_USB_SUPPORT__ */ 
  1306.     tempLight.timer.setsec = gcurrentprofile.light.timer.setsec;
  1307.     PRINT_INFORMATION(("File: Setting Prof.c <<get_lcdbacklighttimer>
  1308.                the timer is %d seconds n", tempLight.timer.setsec));
  1309.     return tempLight.timer.setsec;
  1310. }
  1311. /*****************************************************************************
  1312.  * FUNCTION
  1313.  *  ActivateProfile
  1314.  * DESCRIPTION
  1315.  *  Activating a profile
  1316.  * PARAMETERS
  1317.  *  void
  1318.  * RETURNS
  1319.  *  void
  1320.  *****************************************************************************/
  1321. void ActivateProfile(void)
  1322. {
  1323.     /*----------------------------------------------------------------*/
  1324.     /* Local Variables                                                */
  1325.     /*----------------------------------------------------------------*/
  1326.     S16 error = 0;
  1327.     /*----------------------------------------------------------------*/
  1328.     /* Code Body                                                      */
  1329.     /*----------------------------------------------------------------*/
  1330.     ReadValue(NVRAM_PROFILES_ACTIVATED, &gactivatedprofile, DS_BYTE, &error);
  1331.     PRINT_INFORMATION(("Activated Profile : %d ", (int)gactivatedprofile));
  1332.     if (gactivatedprofile == 0xff)
  1333.     {
  1334.         gactivatedprofile = 0;
  1335.         WriteValue(NVRAM_PROFILES_ACTIVATED, &gactivatedprofile, DS_BYTE, &error);
  1336.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  1337.         /* SetRingerVolume(GetRingVolumeLevel()); */
  1338.         mdi_audio_set_volume_no_apply(MDI_VOLUME_MEDIA, GetRingVolumeLevel());
  1339.         SetKeyPadVolume(GetKeypadVolumeLevel());
  1340.     }
  1341.     else
  1342.     {
  1343.         memcpy(&gcurrentprofile, &gprofiles[gactivatedprofile], sizeof(PROFILE));
  1344.         /* SetRingerVolume(GetRingVolumeLevel()); */
  1345.         mdi_audio_set_volume_no_apply(MDI_VOLUME_MEDIA, GetRingVolumeLevel());
  1346.         SetKeyPadVolume(GetKeypadVolumeLevel());
  1347.     }
  1348. //KP Jerry add on 2007-03-31 start
  1349. #ifdef __MMI_PROFILE_POWER_SAVING__
  1350.     ProfileResetBackLightSetting();
  1351.     ProfilesResetKeyBacklight();
  1352.     SetGPIOLevelReq(GPIO_DEV_LED_MAINLCD, LED_LIGHT_LEVEL5);
  1353. #endif
  1354. //KP Jerry add on 2007-03-31 end
  1355.     mdi_audio_set_mic_volume();
  1356.     showAlertStatusIcons();
  1357.     change_font();
  1358. /*******************************************************/
  1359.     /* Robin 0602, Remove set AT command profile functions */
  1360.     /* AT command will query MMI when needed               */
  1361. /*******************************************************/
  1362.     /*
  1363.      * if (gactivatedprofile==5)
  1364.      * SilentModeOn();
  1365.      * else
  1366.      * SilentModeOff();
  1367.      */
  1368. }
  1369. /*****************************************************************************
  1370.  * FUNCTION
  1371.  *  ActivatefirstProfile
  1372.  * DESCRIPTION
  1373.  *  Activating the profile first time bootup
  1374.  * PARAMETERS
  1375.  *  void
  1376.  * RETURNS
  1377.  *  void
  1378.  *****************************************************************************/
  1379. void ActivatefirstProfile()
  1380. {
  1381.     /*----------------------------------------------------------------*/
  1382.     /* Local Variables                                                */
  1383.     /*----------------------------------------------------------------*/
  1384.     /*----------------------------------------------------------------*/
  1385.     /* Code Body                                                      */
  1386.     /*----------------------------------------------------------------*/
  1387.     gactivatedprofile = gprofileId;
  1388.     memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  1389. }
  1390. /*****************************************************************************
  1391.  * FUNCTION
  1392.  *  StopSilentProfileVibrator
  1393.  * DESCRIPTION
  1394.  *  Stop Silent profile Vibrator
  1395.  * PARAMETERS
  1396.  *  void
  1397.  * RETURNS
  1398.  *  void
  1399.  *****************************************************************************/
  1400. void StopSilentProfileVibrator(void)
  1401. {
  1402.     /*----------------------------------------------------------------*/
  1403.     /* Local Variables                                                */
  1404.     /*----------------------------------------------------------------*/
  1405.     /*----------------------------------------------------------------*/
  1406.     /* Code Body                                                      */
  1407.     /*----------------------------------------------------------------*/
  1408.     StopTimer(TIMER_PROFILES_TONE_PLAY);
  1409.     VibratorOff();
  1410. }
  1411. /*****************************************************************************
  1412.  * FUNCTION
  1413.  *  mmi_profiles_restore_activated_profile
  1414.  * DESCRIPTION
  1415.  *  restore audio mode & current activated profile after factory mode
  1416.  * PARAMETERS
  1417.  *  void
  1418.  * RETURNS
  1419.  *  void
  1420.  *****************************************************************************/
  1421. void mmi_profiles_restore_activated_profile(void)
  1422. {
  1423.     /*----------------------------------------------------------------*/
  1424.     /* Local Variables                                                */
  1425.     /*----------------------------------------------------------------*/
  1426.     /*----------------------------------------------------------------*/
  1427.     /* Code Body                                                      */
  1428.     /*----------------------------------------------------------------*/
  1429.     if (mmi_gpio_is_earphone_plug_in())
  1430.     {
  1431.         /* enter headset mode */
  1432.         mdi_audio_set_audio_mode(AUD_MODE_HEADSET);
  1433.         SetModeSpeechVolume();
  1434.         mmi_profiles_headset_activate_profile();
  1435.     }
  1436.     else
  1437.     {
  1438.         /* enter non-headset mode */
  1439.         mdi_audio_set_audio_mode(AUD_MODE_NORMAL);
  1440.         SetModeSpeechVolume();
  1441.         ActivateProfile();
  1442.     }
  1443. }
  1444. /*****************************************************************************
  1445.  * FUNCTION
  1446.  *  ActivateSilentProfile
  1447.  * DESCRIPTION
  1448.  *  Silent Profile
  1449.  * PARAMETERS
  1450.  *  void
  1451.  * RETURNS
  1452.  *  void
  1453.  *****************************************************************************/
  1454. void ActivateSilentProfile(void)
  1455. {
  1456.     /*----------------------------------------------------------------*/
  1457.     /* Local Variables                                                */
  1458.     /*----------------------------------------------------------------*/
  1459.     S16 error = 0;
  1460.     U16 j = 1;
  1461.     /*----------------------------------------------------------------*/
  1462.     /* Code Body                                                      */
  1463.     /*----------------------------------------------------------------*/
  1464.     ClearKeyEvents();
  1465. //KP Jerry modify on 2007-4-3 start
  1466. #ifdef __MMI_PROFILE_POWER_SAVING__
  1467. #ifdef __MMI_BT_PROFILE__
  1468.     if ((gactivatedprofile != MMI_PROFILE_SILENT) && (gprofileheadset != 1) && (gactivatedprofile != MMI_PROFILE_BT) && (gactivatedprofile != MMI_PROFILE_POWER_SAVING))
  1469. #else 
  1470.     if ((gactivatedprofile != MMI_PROFILE_SILENT) && (gprofileheadset != 1) && (gactivatedprofile != MMI_PROFILE_POWER_SAVING))
  1471. #endif
  1472. #else/*!__MMI_PROFILE_POWER_SAVING__*/
  1473. #ifdef __MMI_BT_PROFILE__
  1474.     if ((gactivatedprofile != MMI_PROFILE_SILENT) && (gprofileheadset != 1) && (gactivatedprofile != MMI_PROFILE_BT))
  1475. #else 
  1476.     if ((gactivatedprofile != MMI_PROFILE_SILENT) && (gprofileheadset != 1))
  1477. #endif
  1478. #endif/*__MMI_PROFILE_POWER_SAVING__*/
  1479. //KP Jerry modify on 2007-4-3 end
  1480.     {
  1481.         memcpy(&gcurrentprofile, &gprofiles[gactivatedprofile], sizeof(PROFILE));
  1482.         glastactivatedprofile = gactivatedprofile;
  1483.         gactivatedprofile = gprofileId = MMI_PROFILE_SILENT;
  1484.         WriteValue(NVRAM_PROFILES_ACTIVATED, &gactivatedprofile, DS_BYTE, &error);
  1485.         WriteValue(NVRAM_PROFILES_LASTACTIVATED, &glastactivatedprofile, DS_BYTE, &error);
  1486.         /* MTK brian modified to make it vibrate in silent mode, 2003/10/28 */
  1487.         gcurrentprofile.mtCallAlertTypeEnum = MMI_VIBRATION_ONLY;
  1488.         /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  1489.     #ifdef __MMI_CLAMSHELL__
  1490.         gcurrentprofile.toneSetup.coverCloseTone = COVER_CLOSE_SILENT;
  1491.         gcurrentprofile.toneSetup.coverOpenTone = COVER_OPEN_SILENT;
  1492.     #endif /* __MMI_CLAMSHELL__ */ 
  1493.         /* MTK end */
  1494.         gcurrentprofile.toneSetup.keypadTone = KEYPAD_SILENT;
  1495.         gcurrentprofile.toneSetup.messageTone = MESSAGE_SILENT;
  1496.         gcurrentprofile.toneSetup.powerOffTone = POWEROFF_SILENT;
  1497.         gcurrentprofile.toneSetup.powerOnTone = POWERON_SILENT;
  1498.         gcurrentprofile.extraTone.campOnTone = 0;
  1499.         gcurrentprofile.extraTone.errorTone = 0;
  1500.         gcurrentprofile.extraTone.connectTone = 0;
  1501.         gcurrentprofile.extraTone.warningTone = 0;
  1502.         gcurrentprofile.intelligentCallAlert = MMI_INTELLIGENT_CALL_ALERT_OFF;
  1503.         memcpy(&gprofiles[gactivatedprofile], &gcurrentprofile, sizeof(PROFILE));
  1504.         WriteRecord(NVRAM_EF_PROFILES_LID, j, &gprofiles[0], NVRAM_PROFILES_RECORD_SIZE, &error);
  1505.         DisplayPopup((U8*) GetString(STR_SILENT_ACTIVATE_MESSAGE), IMG_GLOBAL_ACTIVATED, 1, 2000, (U8) SUCCESS_TONE);
  1506. DeleteScreenIfPresent(IDLE_SCREEN_DIGIT_HANDLER_ID);
  1507.         showAlertStatusIcons();
  1508.       /************************************************/
  1509.         /* Robin 0602, Remove set AT command profile functions */
  1510.         /* AT command will query MMI when needed                   */
  1511.       /************************************************/
  1512.         /* SilentModeOn(); */
  1513.         VibratorOn();
  1514.         StartTimer(TIMER_PROFILES_TONE_PLAY, 1000, StopSilentProfileVibrator);
  1515.     }
  1516. }
  1517. /*****************************************************************************
  1518.  * FUNCTION
  1519.  *  DeactivateSilentProfile
  1520.  * DESCRIPTION
  1521.  *  DeactivateSilent Profile
  1522.  * PARAMETERS
  1523.  *  void
  1524.  * RETURNS
  1525.  *  void
  1526.  *****************************************************************************/
  1527. void DeactivateSilentProfile(void)
  1528. {
  1529.     /*----------------------------------------------------------------*/
  1530.     /* Local Variables                                                */
  1531.     /*----------------------------------------------------------------*/
  1532.     S16 error = 0;
  1533.     /*----------------------------------------------------------------*/
  1534.     /* Code Body                                                      */
  1535.     /*----------------------------------------------------------------*/
  1536.     if (gactivatedprofile == MMI_PROFILE_SILENT)
  1537.     {
  1538.         gprofileId = 0;
  1539.         gactivatedprofile = glastactivatedprofile;
  1540.         memcpy(&gcurrentprofile, &gprofiles[gactivatedprofile], sizeof(PROFILE));
  1541.         WriteValue(NVRAM_PROFILES_ACTIVATED, &gactivatedprofile, DS_BYTE, &error);
  1542.         /* SetRingerVolume(GetRingVolumeLevel()); */
  1543.         mdi_audio_set_volume_no_apply(MDI_VOLUME_MEDIA, GetRingVolumeLevel());
  1544.         SetKeyPadVolume(GetKeypadVolumeLevel());
  1545.         change_font();
  1546.         switch (gactivatedprofile)
  1547.         {
  1548.             case MMI_PROFILE_GENERAL:
  1549.                 DisplayPopup(
  1550.                     (U8*) GetString(STR_GENERAL_RESTORED_MESSAGE),
  1551.                     IMG_GLOBAL_ACTIVATED,
  1552.                     1,
  1553.                     2000,
  1554.                     (U8) SUCCESS_TONE);
  1555.                 break;
  1556.             case MMI_PROFILE_MEETING:
  1557.                 DisplayPopup(
  1558.                     (U8*) GetString(STR_MEETING_RESTORED_MESSAGE),
  1559.                     IMG_GLOBAL_ACTIVATED,
  1560.                     1,
  1561.                     2000,
  1562.                     (U8) SUCCESS_TONE);
  1563.                 break;
  1564.             case MMI_PROFILE_OUTDOOR:
  1565.                 DisplayPopup(
  1566.                     (U8*) GetString(STR_OUTDOOR_RESTORED_MESSAGE),
  1567.                     IMG_GLOBAL_ACTIVATED,
  1568.                     1,
  1569.                     2000,
  1570.                     (U8) SUCCESS_TONE);
  1571.                 break;
  1572.             case MMI_PROFILE_INDOOR:
  1573.                 DisplayPopup(
  1574.                     (U8*) GetString(STR_INDOOR_RESTORED_MESSAGE),
  1575.                     IMG_GLOBAL_ACTIVATED,
  1576.                     1,
  1577.                     2000,
  1578.                     (U8) SUCCESS_TONE);
  1579.                 break;
  1580.             case MMI_PROFILE_HEADSET:
  1581.                 /* DisplayPopup((U8*)GetString(STR_HEADSET_RESTORED_MESSAGE),IMG_GLOBAL_ACTIVATED,1,2000,(U8)SUCCESS_TONE); */
  1582.                 break;
  1583. //KP Jerry add on 2007-4-1 start
  1584. #ifdef __MMI_PROFILE_POWER_SAVING__
  1585.             case MMI_PROFILE_POWER_SAVING:
  1586.                 DisplayPopup(
  1587.                     (U8*) GetString(STR_POWER_SAVING_RESTORED_MESSAGE),
  1588.                     IMG_GLOBAL_ACTIVATED,
  1589.                     1,
  1590.                     2000,
  1591.                     (U8) SUCCESS_TONE);
  1592.                 break;
  1593. #endif
  1594. //KP Jerry add on 2007-4-1 end
  1595.             case MMI_PROFILE_SILENT:
  1596.                 /* DisplayPopup((U8*)GetString(STR_SILENT_RESTORED_MESSAGE),IMG_GLOBAL_ACTIVATED,1,2000,(U8)SUCCESS_TONE); */
  1597.                 break;
  1598.         #ifdef __MMI_BT_PROFILE__
  1599.             case MMI_PROFILE_BT:
  1600.         #endif 
  1601.                 break;
  1602.         }
  1603.         DeleteScreenIfPresent(IDLE_SCREEN_DIGIT_HANDLER_ID);
  1604.         showAlertStatusIcons();
  1605.       /************************************************/
  1606.         /* Robin 0602, Remove set AT command profile functions */
  1607.         /* AT command will query MMI when needed                   */
  1608.       /************************************************/
  1609.         /* SilentModeOff(); */
  1610.     }
  1611. }
  1612. /*************************************************************************
  1613.                Set Functions
  1614. **************************************************************************/
  1615. /*****************************************************************************
  1616.  * FUNCTION
  1617.  *  SetRingVolumeLevel
  1618.  * DESCRIPTION
  1619.  *  Setting Ring Volume Level
  1620.  * PARAMETERS
  1621.  *  volumelevel     [IN]        
  1622.  * RETURNS
  1623.  *  void
  1624.  *****************************************************************************/
  1625. S16 SetRingVolumeLevel(MMI_VOLUME_LEVEL_ENUM volumelevel)
  1626. {
  1627.     /*----------------------------------------------------------------*/
  1628.     /* Local Variables                                                */
  1629.     /*----------------------------------------------------------------*/
  1630.     S16 error = 0;
  1631.     U16 j = 1;
  1632.     MMI_VOLUME_LEVEL_ENUM ringVolumeLevel;
  1633.     /*----------------------------------------------------------------*/
  1634.     /* Code Body                                                      */
  1635.     /*----------------------------------------------------------------*/
  1636.     gprofiles[gprofileId].ringVolumeLevel = volumelevel;
  1637.     if (gactivatedprofile == gprofileId)
  1638.     {
  1639.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  1640.     }
  1641.     if (WriteRecord(
  1642.             NVRAM_EF_PROFILES_LID,
  1643.             j,
  1644.             &gprofiles[0],
  1645.             NVRAM_PROFILES_RECORD_SIZE,
  1646.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  1647.     {
  1648.         PRINT_INFORMATION(("## ERROR: SetRingVolumeLevel: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  1649.         return error;
  1650.     }
  1651. /***** restore the ring volume of activated profile******/
  1652.     ringVolumeLevel = gprofiles[gactivatedprofile].ringVolumeLevel;
  1653.     SetRingerVolume(ringVolumeLevel);
  1654.     return 0;
  1655. }
  1656. /* MTK Brian added for setting activated ring tone volume, 2003/12/02 */
  1657. /*****************************************************************************
  1658.  * FUNCTION
  1659.  *  SetActivatedRingVolumeLevel
  1660.  * DESCRIPTION
  1661.  *  Setting Ring Volume Level of the Activated Profile
  1662.  * PARAMETERS
  1663.  *  volumelevel     [IN]        
  1664.  * RETURNS
  1665.  *  void
  1666.  *****************************************************************************/
  1667. S16 SetActivatedRingVolumeLevel(MMI_VOLUME_LEVEL_ENUM volumelevel)
  1668. {
  1669.     /*----------------------------------------------------------------*/
  1670.     /* Local Variables                                                */
  1671.     /*----------------------------------------------------------------*/
  1672.     S16 error = 0;
  1673.     U16 j = 1;
  1674.     /*----------------------------------------------------------------*/
  1675.     /* Code Body                                                      */
  1676.     /*----------------------------------------------------------------*/
  1677.     gprofiles[gactivatedprofile].ringVolumeLevel = volumelevel;
  1678.     gcurrentprofile.ringVolumeLevel = volumelevel;
  1679.     if (WriteRecord(
  1680.             NVRAM_EF_PROFILES_LID,
  1681.             j,
  1682.             &gprofiles[0],
  1683.             NVRAM_PROFILES_RECORD_SIZE,
  1684.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  1685.     {
  1686.         PRINT_INFORMATION(("## ERROR: SetRingVolumeLevel: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  1687.         return error;
  1688.     }
  1689.     SetRingerVolume(volumelevel);
  1690.     return 0;
  1691. }
  1692. /*****************************************************************************
  1693.  * FUNCTION
  1694.  *  SetKeypadVolumeLevel
  1695.  * DESCRIPTION
  1696.  *  Setting Keypad Volume Level
  1697.  * PARAMETERS
  1698.  *  volumelevel     [IN]        
  1699.  * RETURNS
  1700.  *  void
  1701.  *****************************************************************************/
  1702. S16 SetKeypadVolumeLevel(MMI_VOLUME_LEVEL_ENUM volumelevel)
  1703. {
  1704.     /*----------------------------------------------------------------*/
  1705.     /* Local Variables                                                */
  1706.     /*----------------------------------------------------------------*/
  1707.     S16 error = 0;
  1708.     U16 j = 1;
  1709.     MMI_VOLUME_LEVEL_ENUM keypadVolumelevel;
  1710.     /*----------------------------------------------------------------*/
  1711.     /* Code Body                                                      */
  1712.     /*----------------------------------------------------------------*/
  1713.     gprofiles[gprofileId].keypadVolumeLevel = volumelevel;
  1714.     if (gactivatedprofile == gprofileId)
  1715.     {
  1716.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  1717.     }
  1718.     if (WriteRecord(
  1719.             NVRAM_EF_PROFILES_LID,
  1720.             j,
  1721.             &gprofiles[0],
  1722.             NVRAM_PROFILES_RECORD_SIZE,
  1723.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  1724.     {
  1725.         PRINT_INFORMATION(("## ERROR: SetKeypadVolumeLevel: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  1726.         return error;
  1727.     }
  1728. /***** restore the keypad tone volume of activated profile******/
  1729.     keypadVolumelevel = gprofiles[gactivatedprofile].keypadVolumeLevel;
  1730.     SetKeyPadVolume(keypadVolumelevel);
  1731.     return 0;
  1732. }
  1733. /* MTK Brian added for setting activated keypad volume, 2003/12/02 */
  1734. /*****************************************************************************
  1735.  * FUNCTION
  1736.  *  SetActivatedKeypadVolumeLevel
  1737.  * DESCRIPTION
  1738.  *  Setting Keypad Volume Level of the Activated Profile
  1739.  * PARAMETERS
  1740.  *  volumelevel     [IN]        
  1741.  * RETURNS
  1742.  *  void
  1743.  *****************************************************************************/
  1744. S16 SetActivatedKeypadVolumeLevel(MMI_VOLUME_LEVEL_ENUM volumelevel)
  1745. {
  1746.     /*----------------------------------------------------------------*/
  1747.     /* Local Variables                                                */
  1748.     /*----------------------------------------------------------------*/
  1749.     S16 error = 0;
  1750.     U16 j = 1;
  1751.     /*----------------------------------------------------------------*/
  1752.     /* Code Body                                                      */
  1753.     /*----------------------------------------------------------------*/
  1754.     gprofiles[gactivatedprofile].keypadVolumeLevel = volumelevel;
  1755.     gcurrentprofile.keypadVolumeLevel = volumelevel;
  1756.     if (WriteRecord(
  1757.             NVRAM_EF_PROFILES_LID,
  1758.             j,
  1759.             &gprofiles[0],
  1760.             NVRAM_PROFILES_RECORD_SIZE,
  1761.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  1762.     {
  1763.         PRINT_INFORMATION(("## ERROR: SetActivatedKeypadVolumeLevel: WriteRecord "
  1764.                            "to NVRAM failed (ecode%d)n", (int)error));
  1765.         return error;
  1766.     }
  1767.     SetKeyPadVolume(volumelevel);
  1768.     return 0;
  1769. }
  1770. /*****************************************************************************
  1771.  * FUNCTION
  1772.  *  SetMtCallAlertTypeEnum
  1773.  * DESCRIPTION
  1774.  *  Setting Call Alert Type
  1775.  * PARAMETERS
  1776.  *  callalerttype       [IN]        
  1777.  * RETURNS
  1778.  *  void
  1779.  *****************************************************************************/
  1780. S16 SetMtCallAlertTypeEnum(MMI_ALERT_TYPE callalerttype)
  1781. {
  1782.     /*----------------------------------------------------------------*/
  1783.     /* Local Variables                                                */
  1784.     /*----------------------------------------------------------------*/
  1785.     S16 error = 0;
  1786.     U16 j = 1;
  1787.     /*----------------------------------------------------------------*/
  1788.     /* Code Body                                                      */
  1789.     /*----------------------------------------------------------------*/
  1790.     /* MTK Brian modified to skip writing nvram if no change, 2003/11/26 */
  1791.     if (gprofiles[gprofileId].mtCallAlertTypeEnum != callalerttype)
  1792.     {
  1793.         gprofiles[gprofileId].mtCallAlertTypeEnum = callalerttype;
  1794.         if (WriteRecord(
  1795.                 NVRAM_EF_PROFILES_LID,
  1796.                 j,
  1797.                 &gprofiles[0],
  1798.                 NVRAM_PROFILES_RECORD_SIZE,
  1799.                 &error) < NVRAM_PROFILES_RECORD_SIZE)
  1800.         {
  1801.             PRINT_INFORMATION(("## ERROR: SetMtCallAlertTypeEnum: WriteRecord "
  1802.                                "to NVRAM failed (ecode%d)n", (int)error));
  1803.             return error;
  1804.         }
  1805.         if (gactivatedprofile == gprofileId)
  1806.         {
  1807.             memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  1808.         }
  1809.         showAlertStatusIcons();
  1810.    /************************************************/
  1811.         /* Robin 0602, Remove set AT command profile functions */
  1812.         /* AT command will query MMI when needed                   */
  1813.    /************************************************/
  1814.         /*
  1815.          * if (callalerttype == MMI_VIBRATION_ONLY || 
  1816.          * callalerttype == MMI_VIBRATION_AND_RING||
  1817.          * callalerttype == MMI_VIBRATION_THEN_RING)
  1818.          * SendSetVibrationMode(1);
  1819.          * else      
  1820.          * SendSetVibrationMode(0);
  1821.          */
  1822.     }
  1823.     return 0;
  1824. }
  1825. /*****************************************************************************
  1826.  * FUNCTION
  1827.  *  SetRingToneID
  1828.  * DESCRIPTION
  1829.  *  Setting Ring tone ID.
  1830.  * PARAMETERS
  1831.  *  ringtoneid      [IN]        
  1832.  * RETURNS
  1833.  *  void
  1834.  *****************************************************************************/
  1835. S16 SetRingToneID(U16 ringtoneid)
  1836. {
  1837.     /*----------------------------------------------------------------*/
  1838.     /* Local Variables                                                */
  1839.     /*----------------------------------------------------------------*/
  1840.     S16 error = 0;
  1841.     U16 j = 1;
  1842.     /*----------------------------------------------------------------*/
  1843.     /* Code Body                                                      */
  1844.     /*----------------------------------------------------------------*/
  1845.     gprofiles[gprofileId].toneSetup.ringTone = ringtoneid;
  1846.     if (WriteRecord(
  1847.             NVRAM_EF_PROFILES_LID,
  1848.             j,
  1849.             &gprofiles[0],
  1850.             NVRAM_PROFILES_RECORD_SIZE,
  1851.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  1852.     {
  1853.         PRINT_INFORMATION(("## ERROR: SetRingToneID: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  1854.         return error;
  1855.     }
  1856.     if (gactivatedprofile == gprofileId)
  1857.     {
  1858.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  1859.     }
  1860.     return 0;
  1861. }
  1862. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
  1863. /*****************************************************************************
  1864.  * FUNCTION
  1865.  *  ThemeManagerSetRingTone
  1866.  * DESCRIPTION
  1867.  *  
  1868.  * PARAMETERS
  1869.  *  ringtoneid      [IN]        
  1870.  * RETURNS
  1871.  *  void
  1872.  *****************************************************************************/
  1873. void ThemeManagerSetRingTone(U16 ringtoneid)
  1874. {
  1875.     /*----------------------------------------------------------------*/
  1876.     /* Local Variables                                                */
  1877.     /*----------------------------------------------------------------*/
  1878.     S16 error = 0;
  1879.     /*----------------------------------------------------------------*/
  1880.     /* Code Body                                                      */
  1881.     /*----------------------------------------------------------------*/
  1882.     gprofiles[gactivatedprofile].toneSetup.ringTone = ringtoneid;
  1883.     WriteRecord(NVRAM_EF_PROFILES_LID, 1, &gprofiles[0], NVRAM_PROFILES_RECORD_SIZE, &error);
  1884.     memcpy(&gcurrentprofile, &gprofiles[gactivatedprofile], sizeof(PROFILE));
  1885. }
  1886. /*****************************************************************************
  1887.  * FUNCTION
  1888.  *  ThemeManagerResetRingTone
  1889.  * DESCRIPTION
  1890.  *  
  1891.  * PARAMETERS
  1892.  *  void
  1893.  * RETURNS
  1894.  *  void
  1895.  *****************************************************************************/
  1896. void ThemeManagerResetRingTone(void)
  1897. {
  1898.     /*----------------------------------------------------------------*/
  1899.     /* Local Variables                                                */
  1900.     /*----------------------------------------------------------------*/
  1901.     U8 flag = 0, i;
  1902.     S16 error;
  1903.     /*----------------------------------------------------------------*/
  1904.     /* Code Body                                                      */
  1905.     /*----------------------------------------------------------------*/
  1906.     for (i = 0; i < MAX_ELEMENTS; ++i)
  1907.     {
  1908.         if (gprofiles[i].toneSetup.ringTone == CURRENT_THEME_INCOMING_CALL_TONE)
  1909.         {
  1910.             flag = 1;
  1911.             gprofiles[i].toneSetup.ringTone = MIDI_1;
  1912.         }
  1913.     }
  1914.     if (flag)
  1915.     {
  1916.         WriteRecord(NVRAM_EF_PROFILES_LID, 1, &gprofiles[0], NVRAM_PROFILES_RECORD_SIZE, &error);
  1917.         memcpy(&gcurrentprofile, &gprofiles[gactivatedprofile], sizeof(PROFILE));
  1918.     }
  1919. }
  1920. #endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */ 
  1921. /*****************************************************************************
  1922.  * FUNCTION
  1923.  *  SetLightStatus
  1924.  * DESCRIPTION
  1925.  *  Setting Light status (Color)
  1926.  * PARAMETERS
  1927.  *  backlightstatus     [IN]        
  1928.  * RETURNS
  1929.  *  void
  1930.  *****************************************************************************/
  1931. S16 SetLightStatus(MMI_LEDLIGHT_STATUS_ENUM backlightstatus)
  1932. {
  1933.     /*----------------------------------------------------------------*/
  1934.     /* Local Variables                                                */
  1935.     /*----------------------------------------------------------------*/
  1936.     S16 error = 0;
  1937.     U16 j = 1;
  1938.     /*----------------------------------------------------------------*/
  1939.     /* Code Body                                                      */
  1940.     /*----------------------------------------------------------------*/
  1941.     gprofiles[gprofileId].light.status = backlightstatus;
  1942.     if (WriteRecord(
  1943.             NVRAM_EF_PROFILES_LID,
  1944.             j,
  1945.             &gprofiles[0],
  1946.             NVRAM_PROFILES_RECORD_SIZE,
  1947.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  1948.     {
  1949.         PRINT_INFORMATION(("## ERROR: SetLightStatus: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  1950.         return error;
  1951.     }
  1952.     if (gactivatedprofile == gprofileId)
  1953.     {
  1954.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  1955.     }
  1956.     return 0;
  1957. }
  1958. /*****************************************************************************
  1959.  * FUNCTION
  1960.  *  SetRingTypeEnum
  1961.  * DESCRIPTION
  1962.  *  Setting Ring Type
  1963.  * PARAMETERS
  1964.  *  ringtype        [IN]        
  1965.  * RETURNS
  1966.  *  void
  1967.  *****************************************************************************/
  1968. S16 SetRingTypeEnum(MMI_RING_TYPE_ENUM ringtype)
  1969. {
  1970.     /*----------------------------------------------------------------*/
  1971.     /* Local Variables                                                */
  1972.     /*----------------------------------------------------------------*/
  1973.     S16 error = 0;
  1974.     U16 j = 1;
  1975.     /*----------------------------------------------------------------*/
  1976.     /* Code Body                                                      */
  1977.     /*----------------------------------------------------------------*/
  1978.     gprofiles[gprofileId].ringTypeEnum = ringtype;
  1979.     if (WriteRecord(
  1980.             NVRAM_EF_PROFILES_LID,
  1981.             j,
  1982.             &gprofiles[0],
  1983.             NVRAM_PROFILES_RECORD_SIZE,
  1984.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  1985.     {
  1986.         PRINT_INFORMATION(("## ERROR: SetRingTypeEnum: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  1987.         return error;
  1988.     }
  1989.     if (gactivatedprofile == gprofileId)
  1990.     {
  1991.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  1992.     }
  1993.     return 0;
  1994. }
  1995. #ifdef __MMI_CONNECT_NOTICE__
  1996. /*****************************************************************************
  1997.  * FUNCTION
  1998.  *  SetConnectNotice
  1999.  * DESCRIPTION
  2000.  *  Setting Connect Notice Type
  2001.  * PARAMETERS
  2002.  *  type        [IN]        
  2003.  * RETURNS
  2004.  *  void
  2005.  *****************************************************************************/
  2006. S16 SetConnectNotice(U16 type)
  2007. {
  2008.     /*----------------------------------------------------------------*/
  2009.     /* Local Variables                                                */
  2010.     /*----------------------------------------------------------------*/
  2011.     S16 error = 0;
  2012.     U16 j = 1;
  2013.     /*----------------------------------------------------------------*/
  2014.     /* Code Body                                                      */
  2015.     /*----------------------------------------------------------------*/
  2016.     gprofiles[gprofileId].extraTone.connectTone = type;
  2017.     if (WriteRecord(
  2018.             NVRAM_EF_PROFILES_LID,
  2019.             j,
  2020.             &gprofiles[0],
  2021.             NVRAM_PROFILES_RECORD_SIZE,
  2022.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2023.     {
  2024.         PRINT_INFORMATION(("## ERROR: SetConnectNoticeEnum: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2025.         return error;
  2026.     }
  2027.     if (gactivatedprofile == gprofileId)
  2028.     {
  2029.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2030.     }
  2031.     return 0;
  2032. }
  2033. #endif /* __MMI_CONNECT_NOTICE__ */ 
  2034. /*****************************************************************************
  2035.  * FUNCTION
  2036.  *  SetAnsweringMode
  2037.  * DESCRIPTION
  2038.  *  Setting Answering Mode
  2039.  * PARAMETERS
  2040.  *  answeringmode       [IN]        
  2041.  * RETURNS
  2042.  *  void
  2043.  *****************************************************************************/
  2044. S16 SetAnsweringMode(MMI_ANSWERING_MODE answeringmode)
  2045. {
  2046.     /*----------------------------------------------------------------*/
  2047.     /* Local Variables                                                */
  2048.     /*----------------------------------------------------------------*/
  2049.     S16 error = 0;
  2050.     U16 j = 1;
  2051.     /*----------------------------------------------------------------*/
  2052.     /* Code Body                                                      */
  2053.     /*----------------------------------------------------------------*/
  2054.     memcpy(&gprofiles[gprofileId].answeringMode, &answeringmode, sizeof(MMI_ANSWERING_MODE));
  2055.     if (WriteRecord(
  2056.             NVRAM_EF_PROFILES_LID,
  2057.             j,
  2058.             &gprofiles[0],
  2059.             NVRAM_PROFILES_RECORD_SIZE,
  2060.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2061.     {
  2062.         PRINT_INFORMATION(("## ERROR: SetAnsweringModeEnum: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2063.         return error;
  2064.     }
  2065.     if (gactivatedprofile == gprofileId)
  2066.     {
  2067.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2068.     }
  2069.     return 0;
  2070. }
  2071. /*****************************************************************************
  2072.  * FUNCTION
  2073.  *  SetLoudSpeaker
  2074.  * DESCRIPTION
  2075.  *  Setting Loud Speaker (On/Off)
  2076.  * PARAMETERS
  2077.  *  loudspeaker     [IN]        
  2078.  * RETURNS
  2079.  *  void
  2080.  *****************************************************************************/
  2081. S16 SetLoudSpeaker(pBOOL loudspeaker)
  2082. {
  2083.     /*----------------------------------------------------------------*/
  2084.     /* Local Variables                                                */
  2085.     /*----------------------------------------------------------------*/
  2086.     /*----------------------------------------------------------------*/
  2087.     /* Code Body                                                      */
  2088.     /*----------------------------------------------------------------*/
  2089.     if (loudspeaker == 1)
  2090.     {
  2091.         gloudSpeaker = loudspeaker;
  2092.     }
  2093.     else
  2094.     {
  2095.         gloudSpeaker = loudspeaker;
  2096.     }
  2097.     SetRingerVolume(GetRingVolumeLevel());
  2098.     SetKeyPadVolume(GetKeypadVolumeLevel());
  2099.     return 0;
  2100. }
  2101. /*****************************************************************************
  2102.  * FUNCTION
  2103.  *  SetErrorToneStatus
  2104.  * DESCRIPTION
  2105.  *  Setting Error Tone status (On/Off)
  2106.  * PARAMETERS
  2107.  *  errortonestatus     [IN]        
  2108.  * RETURNS
  2109.  *  void
  2110.  *****************************************************************************/
  2111. S16 SetErrorToneStatus(pBOOL errortonestatus)
  2112. {
  2113.     /*----------------------------------------------------------------*/
  2114.     /* Local Variables                                                */
  2115.     /*----------------------------------------------------------------*/
  2116.     S16 error = 0;
  2117.     U16 j = 1;
  2118.     /*----------------------------------------------------------------*/
  2119.     /* Code Body                                                      */
  2120.     /*----------------------------------------------------------------*/
  2121.     gprofiles[gprofileId].extraTone.errorTone = errortonestatus;
  2122.     if (WriteRecord(
  2123.             NVRAM_EF_PROFILES_LID,
  2124.             j,
  2125.             &gprofiles[0],
  2126.             NVRAM_PROFILES_RECORD_SIZE,
  2127.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2128.     {
  2129.         PRINT_INFORMATION(("## ERROR: SetErrorToneStatus: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2130.         return error;
  2131.     }
  2132.     if (gactivatedprofile == gprofileId)
  2133.     {
  2134.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2135.     }
  2136.     return 0;
  2137. }
  2138. #ifndef __MMI_CONNECT_NOTICE__
  2139. /*****************************************************************************
  2140.  * FUNCTION
  2141.  *  SetConnectToneStatus
  2142.  * DESCRIPTION
  2143.  *  Setting Connect Tone status (On/Off)
  2144.  * PARAMETERS
  2145.  *  connecttone     [IN]        
  2146.  * RETURNS
  2147.  *  void
  2148.  *****************************************************************************/
  2149. S16 SetConnectToneStatus(pBOOL connecttone)
  2150. {
  2151.     /*----------------------------------------------------------------*/
  2152.     /* Local Variables                                                */
  2153.     /*----------------------------------------------------------------*/
  2154.     S16 error = 0;
  2155.     U16 j = 1;
  2156.     /*----------------------------------------------------------------*/
  2157.     /* Code Body                                                      */
  2158.     /*----------------------------------------------------------------*/
  2159.     gprofiles[gprofileId].extraTone.connectTone = connecttone;
  2160.     if (WriteRecord(
  2161.             NVRAM_EF_PROFILES_LID,
  2162.             j,
  2163.             &gprofiles[0],
  2164.             NVRAM_PROFILES_RECORD_SIZE,
  2165.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2166.     {
  2167.         PRINT_INFORMATION(("## ERROR: SetConnectToneStatus: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2168.         return error;
  2169.     }
  2170.     if (gactivatedprofile == gprofileId)
  2171.     {
  2172.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2173.     }
  2174.     return 0;
  2175. }
  2176. #endif /* __MMI_CONNECT_NOTICE__ */ 
  2177. /*****************************************************************************
  2178.  * FUNCTION
  2179.  *  SetPowerOnToneType
  2180.  * DESCRIPTION
  2181.  *  
  2182.  * PARAMETERS
  2183.  *  tone        [IN]        
  2184.  * RETURNS
  2185.  *  void
  2186.  *****************************************************************************/
  2187. S16 SetPowerOnToneType(TONE_SETUP tone)
  2188. {
  2189.     /*----------------------------------------------------------------*/
  2190.     /* Local Variables                                                */
  2191.     /*----------------------------------------------------------------*/
  2192.     S16 error = 0;
  2193.     U16 j = 1;
  2194.     /*----------------------------------------------------------------*/
  2195.     /* Code Body                                                      */
  2196.     /*----------------------------------------------------------------*/
  2197.     gprofiles[gprofileId].toneSetup.powerOnTone = tone.powerOnTone;
  2198.     if (WriteRecord(
  2199.             NVRAM_EF_PROFILES_LID,
  2200.             j,
  2201.             &gprofiles[0],
  2202.             NVRAM_PROFILES_RECORD_SIZE,
  2203.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2204.     {
  2205.         PRINT_INFORMATION(("## ERROR: SetPowerOnToneType: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2206.         return error;
  2207.     }
  2208.     if (gactivatedprofile == gprofileId)
  2209.     {
  2210.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2211.     }
  2212.     return 0;
  2213. }
  2214. /*****************************************************************************
  2215.  * FUNCTION
  2216.  *  SetPowerOffToneType
  2217.  * DESCRIPTION
  2218.  *  
  2219.  * PARAMETERS
  2220.  *  tone        [IN]        
  2221.  * RETURNS
  2222.  *  void
  2223.  *****************************************************************************/
  2224. S16 SetPowerOffToneType(TONE_SETUP tone)
  2225. {
  2226.     /*----------------------------------------------------------------*/
  2227.     /* Local Variables                                                */
  2228.     /*----------------------------------------------------------------*/
  2229.     S16 error = 0;
  2230.     U16 j = 1;
  2231.     /*----------------------------------------------------------------*/
  2232.     /* Code Body                                                      */
  2233.     /*----------------------------------------------------------------*/
  2234.     gprofiles[gprofileId].toneSetup.powerOffTone = tone.powerOffTone;
  2235.     if (WriteRecord(
  2236.             NVRAM_EF_PROFILES_LID,
  2237.             j,
  2238.             &gprofiles[0],
  2239.             NVRAM_PROFILES_RECORD_SIZE,
  2240.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2241.     {
  2242.         PRINT_INFORMATION(("## ERROR: SetPowerOffToneType: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2243.         return error;
  2244.     }
  2245.     if (gactivatedprofile == gprofileId)
  2246.     {
  2247.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2248.     }
  2249.     return 0;
  2250. }
  2251. /* MTK brian added to wrap cover open/close tone setup, 2003/10/18 */
  2252. #ifdef __MMI_CLAMSHELL__
  2253. /*****************************************************************************
  2254.  * FUNCTION
  2255.  *  SetCoverOpenToneType
  2256.  * DESCRIPTION
  2257.  *  
  2258.  * PARAMETERS
  2259.  *  tone        [IN]        
  2260.  * RETURNS
  2261.  *  void
  2262.  *****************************************************************************/
  2263. S16 SetCoverOpenToneType(TONE_SETUP tone)
  2264. {
  2265.     /*----------------------------------------------------------------*/
  2266.     /* Local Variables                                                */
  2267.     /*----------------------------------------------------------------*/
  2268.     S16 error = 0;
  2269.     U16 j = 1;
  2270.     /*----------------------------------------------------------------*/
  2271.     /* Code Body                                                      */
  2272.     /*----------------------------------------------------------------*/
  2273.     gprofiles[gprofileId].toneSetup.coverOpenTone = tone.coverOpenTone;
  2274.     if (WriteRecord(
  2275.             NVRAM_EF_PROFILES_LID,
  2276.             j,
  2277.             &gprofiles[0],
  2278.             NVRAM_PROFILES_RECORD_SIZE,
  2279.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2280.     {
  2281.         PRINT_INFORMATION(("## ERROR: SetCoverOpenToneType: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2282.         return error;
  2283.     }
  2284.     if (gactivatedprofile == gprofileId)
  2285.     {
  2286.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2287.     }
  2288.     return 0;
  2289. }
  2290. /*****************************************************************************
  2291.  * FUNCTION
  2292.  *  SetCoverCloseToneType
  2293.  * DESCRIPTION
  2294.  *  
  2295.  * PARAMETERS
  2296.  *  tone        [IN]        
  2297.  * RETURNS
  2298.  *  void
  2299.  *****************************************************************************/
  2300. S16 SetCoverCloseToneType(TONE_SETUP tone)
  2301. {
  2302.     /*----------------------------------------------------------------*/
  2303.     /* Local Variables                                                */
  2304.     /*----------------------------------------------------------------*/
  2305.     S16 error = 0;
  2306.     U16 j = 1;
  2307.     /*----------------------------------------------------------------*/
  2308.     /* Code Body                                                      */
  2309.     /*----------------------------------------------------------------*/
  2310.     gprofiles[gprofileId].toneSetup.coverCloseTone = tone.coverCloseTone;
  2311.     if (WriteRecord(
  2312.             NVRAM_EF_PROFILES_LID,
  2313.             j,
  2314.             &gprofiles[0],
  2315.             NVRAM_PROFILES_RECORD_SIZE,
  2316.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2317.     {
  2318.         PRINT_INFORMATION(("## ERROR: SetCoverCloseToneType: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2319.         return error;
  2320.     }
  2321.     if (gactivatedprofile == gprofileId)
  2322.     {
  2323.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2324.     }
  2325.     return 0;
  2326. }
  2327. #endif /* __MMI_CLAMSHELL__ */ 
  2328. /* MTK end */
  2329. /*****************************************************************************
  2330.  * FUNCTION
  2331.  *  SetKeypadToneType
  2332.  * DESCRIPTION
  2333.  *  
  2334.  * PARAMETERS
  2335.  *  keypadtone      [IN]        
  2336.  * RETURNS
  2337.  *  void
  2338.  *****************************************************************************/
  2339. S16 SetKeypadToneType(KEYPAD_TONE_ENUM keypadtone)
  2340. {
  2341.     /*----------------------------------------------------------------*/
  2342.     /* Local Variables                                                */
  2343.     /*----------------------------------------------------------------*/
  2344.     S16 error = 0;
  2345.     U16 j = 1;
  2346.     /*----------------------------------------------------------------*/
  2347.     /* Code Body                                                      */
  2348.     /*----------------------------------------------------------------*/
  2349.     gprofiles[gprofileId].toneSetup.keypadTone = keypadtone;
  2350.     if (WriteRecord(
  2351.             NVRAM_EF_PROFILES_LID,
  2352.             j,
  2353.             &gprofiles[0],
  2354.             NVRAM_PROFILES_RECORD_SIZE,
  2355.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2356.     {
  2357.         PRINT_INFORMATION(("## ERROR: SetKeypadToneType: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2358.         return error;
  2359.     }
  2360.     if (gactivatedprofile == gprofileId)
  2361.     {
  2362.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2363.     }
  2364.     return 0;
  2365. }
  2366. /*****************************************************************************
  2367.  * FUNCTION
  2368.  *  GetIntelligentCallAert
  2369.  * DESCRIPTION
  2370.  *  
  2371.  * PARAMETERS
  2372.  *  void
  2373.  * RETURNS
  2374.  *  MMI_INTELLIGENT_CALL_ALERT_TYPE
  2375.  *****************************************************************************/
  2376. MMI_INTELLIGENT_CALL_ALERT_TYPE GetIntelligentCallAert(void)
  2377. {
  2378.     /*----------------------------------------------------------------*/
  2379.     /* Local Variables                                                */
  2380.     /*----------------------------------------------------------------*/
  2381.     MMI_INTELLIGENT_CALL_ALERT_TYPE intelligentCallAlert = gcurrentprofile.intelligentCallAlert;
  2382.     /*----------------------------------------------------------------*/
  2383.     /* Code Body                                                      */
  2384.     /*----------------------------------------------------------------*/
  2385.     PRINT_INFORMATION(("File: Setting Prof.c <<GetIntelligentCallAlert> the intelligentCallAlert is : %d n",
  2386.                        intelligentCallAlert));
  2387.     return intelligentCallAlert;
  2388. }
  2389. /*****************************************************************************
  2390.  * FUNCTION
  2391.  *  SetIntelligentCallAert
  2392.  * DESCRIPTION
  2393.  *  
  2394.  * PARAMETERS
  2395.  *  intelligentCallAlert        [IN]        
  2396.  * RETURNS
  2397.  *  void
  2398.  *****************************************************************************/
  2399. S16 SetIntelligentCallAert(MMI_INTELLIGENT_CALL_ALERT_TYPE intelligentCallAlert)
  2400. {
  2401.     /*----------------------------------------------------------------*/
  2402.     /* Local Variables                                                */
  2403.     /*----------------------------------------------------------------*/
  2404.     S16 error = 0;
  2405.     U16 j = 1;
  2406.     /*----------------------------------------------------------------*/
  2407.     /* Code Body                                                      */
  2408.     /*----------------------------------------------------------------*/
  2409.     gprofiles[gprofileId].intelligentCallAlert = intelligentCallAlert;
  2410.     if (WriteRecord(
  2411.             NVRAM_EF_PROFILES_LID,
  2412.             j,
  2413.             &gprofiles[0],
  2414.             NVRAM_PROFILES_RECORD_SIZE,
  2415.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2416.     {
  2417.         PRINT_INFORMATION(("## ERROR: SetIntelligentCallAert: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2418.         return error;
  2419.     }
  2420.     if (gactivatedprofile == gprofileId)
  2421.     {
  2422.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2423.     }
  2424.     return 0;
  2425. }
  2426. /*****************************************************************************
  2427.  * FUNCTION
  2428.  *  SetMessageToneType
  2429.  * DESCRIPTION
  2430.  *  Setting Connect Tone status (On/Off)
  2431.  * PARAMETERS
  2432.  *  tone        [IN]        
  2433.  * RETURNS
  2434.  *  void
  2435.  *****************************************************************************/
  2436. S16 SetMessageToneType(TONE_SETUP tone)
  2437. {
  2438.     /*----------------------------------------------------------------*/
  2439.     /* Local Variables                                                */
  2440.     /*----------------------------------------------------------------*/
  2441.     S16 error = 0;
  2442.     U16 j = 1;
  2443.     /*----------------------------------------------------------------*/
  2444.     /* Code Body                                                      */
  2445.     /*----------------------------------------------------------------*/
  2446.     gprofiles[gprofileId].toneSetup.messageTone = tone.messageTone;
  2447.     if (WriteRecord(
  2448.             NVRAM_EF_PROFILES_LID,
  2449.             j,
  2450.             &gprofiles[0],
  2451.             NVRAM_PROFILES_RECORD_SIZE,
  2452.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2453.     {
  2454.         PRINT_INFORMATION(("## ERROR: SetMessageToneType: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2455.         return error;
  2456.     }
  2457.     if (gactivatedprofile == gprofileId)
  2458.     {
  2459.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2460.     }
  2461.     return 0;
  2462. }
  2463. /*****************************************************************************
  2464.  * FUNCTION
  2465.  *  SetAlarmToneID
  2466.  * DESCRIPTION
  2467.  *  
  2468.  * PARAMETERS
  2469.  *  id      [IN]        
  2470.  * RETURNS
  2471.  *  void
  2472.  *****************************************************************************/
  2473. S16 SetAlarmToneID(U16 id)
  2474. {
  2475.     /*----------------------------------------------------------------*/
  2476.     /* Local Variables                                                */
  2477.     /*----------------------------------------------------------------*/
  2478.     S16 error = 0;
  2479.     U16 j = 1;
  2480.     /*----------------------------------------------------------------*/
  2481.     /* Code Body                                                      */
  2482.     /*----------------------------------------------------------------*/
  2483.     gprofiles[gprofileId].toneSetup.alarmTone = id;
  2484.     if (WriteRecord(
  2485.             NVRAM_EF_PROFILES_LID,
  2486.             j,
  2487.             &gprofiles[0],
  2488.             NVRAM_PROFILES_RECORD_SIZE,
  2489.             &error) < NVRAM_PROFILES_RECORD_SIZE)
  2490.     {
  2491.         PRINT_INFORMATION(("## ERROR: SetAlarmToneType: WriteRecord " "to NVRAM failed (ecode%d)n", (int)error));
  2492.         return error;
  2493.     }
  2494.     if (gactivatedprofile == gprofileId)
  2495.     {
  2496.         memcpy(&gcurrentprofile, &gprofiles[gprofileId], sizeof(PROFILE));
  2497.     }
  2498.     return 0;
  2499. }
  2500. #ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__      /* ritesh */
  2501. /*****************************************************************************
  2502.  * FUNCTION
  2503.  *  ThemeManagerSetAlarmTone
  2504.  * DESCRIPTION
  2505.  *  
  2506.  * PARAMETERS
  2507.  *  ringtoneid      [IN]        
  2508.  * RETURNS
  2509.  *  void
  2510.  *****************************************************************************/
  2511. void ThemeManagerSetAlarmTone(U16 ringtoneid)
  2512. {
  2513.     /*----------------------------------------------------------------*/
  2514.     /* Local Variables                                                */
  2515.     /*----------------------------------------------------------------*/
  2516.     /* PMT SHARIQ DLT_PATCH 20060814 START */
  2517. #if 0
  2518. /* under construction !*/
  2519. /* under construction !*/
  2520. /* under construction !*/
  2521. /* under construction !*/
  2522. /* under construction !*/