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

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.  *  Modification Notice:
  37.  *  --------------------------
  38.  *  This software is modified by MediaTek Inc. and the information contained
  39.  *  herein is confidential. The software may not be copied and the information
  40.  *  contained herein may not be used or disclosed except with the written
  41.  *  permission of MediaTek Inc. (C) 2001
  42.  *
  43.  *******************************************************************************/
  44.  /*******************************************************************************
  45.  * Filename:
  46.  * ---------
  47.  *   CommonStubs.c
  48.  *
  49.  * Project:
  50.  * --------
  51.  *   Maui_Software
  52.  *
  53.  * Description:
  54.  * ------------
  55.  *  .......
  56.  *
  57.  * Author:
  58.  * -------
  59.  * -------
  60.  *
  61.  *------------------------------------------------------------------------------
  62.  * $Log$
  63.  *
  64.  * removed!
  65.  * removed!
  66.  * 
  67.  *
  68.  * removed!
  69.  * removed!
  70.  * 
  71.  *
  72.  * removed!
  73.  * removed!
  74.  * 
  75.  *
  76.  * removed!
  77.  * removed!
  78.  * 
  79.  *
  80.  * removed!
  81.  * removed!
  82.  * 
  83.  *
  84.  * removed!
  85.  * removed!
  86.  * 
  87.  *
  88.  * removed!
  89.  * removed!
  90.  * 
  91.  *
  92.  * removed!
  93.  * removed!
  94.  * 
  95.  *
  96.  * removed!
  97.  * removed!
  98.  * 
  99.  *
  100.  * removed!
  101.  * removed!
  102.  * 
  103.  *
  104.  * removed!
  105.  * removed!
  106.  * 
  107.  *
  108.  * removed!
  109.  * removed!
  110.  * 
  111.  *
  112.  *******************************************************************************/
  113. /**
  114.  * Copyright Notice
  115.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  116.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  117.  *  (It is illegal to remove this copyright notice from this software or any
  118.  *  portion of it)
  119.  */
  120. /**************************************************************
  121.    FILENAME : CommonStubs.c
  122.    PURPOSE     : Stubs for Call Management application
  123.    REMARKS     : nil
  124.    AUTHOR      : Subramanya BG
  125.    DATE     : Nov 12,02
  126. **************************************************************/
  127. #include "stdC.h"
  128. #include "MMI_Features.h"
  129. #include "L4Dr.h"
  130. #include "L4Dr1.h"
  131. #include "PixtelDataTypes.h"
  132. #include "GlobalDefs.h"
  133. #include "DebugInitDef.h"
  134. #include "MMI_trc.h"
  135. #include "wgui_status_icons.h"
  136. #include "TimerEvents.h"
  137. #include "gpioInc.h"
  138. #include "ProfilesEnum.h"
  139. #include "ProfilesDefs.h"
  140. #include "ProfileGprots.h"
  141. #include "SettingProfile.h"
  142. #include "SettingGprots.h"
  143. #include "PhoneBookDef.h"
  144. #include "PhoneBookTypes.h"
  145. #include "PhoneBookGprot.h"
  146. #include "VolumeHandler.h"
  147. #include "mdi_datatype.h"
  148. #include "mdi_audio.h"
  149. #include "AudioInc.h"
  150. #include "wgui_categories_CM.h"
  151. #include "CallManagementIdDef.h"
  152. #include "CallManagementStruct.h"
  153. #include "CallManagementGprot.h"
  154. #include "CallStructureManagementProt.h"
  155. #include "PsCallHelperGprot.h"
  156. #include "OutgoingCallHelperProt.h"
  157. #include "OutgoingCallManagementProt.h"
  158. #ifdef __CTM_SUPPORT__
  159. #include "TextPhoneDef.h"
  160. #endif /* __CTM_SUPPORT__ */ 
  161. #include "CommonStubsProt.h"
  162. #ifdef __MMI_BT_HP_SUPPORT__
  163. #include "BTMMIHPGProts.h"
  164. #endif 
  165. #ifdef __MMI_BT_SUPPORT__
  166. #include "BTMMIScrGProts.h"
  167. #endif 
  168. /* Begin: added by Tim for sound recorder in call */
  169. #ifdef __MMI_SOUND_RECORDER__
  170. extern void mmi_sndrec_entry_from_call(void);
  171. #endif 
  172. /* End: added by Tim for sound recorder in call */
  173. //static U16 gMyRing;
  174. //static U16 gBackLight;
  175. //static U16 gHFreeHeldFlag=FALSE;
  176. //static pBOOL gDtmfFlag = TRUE;
  177. //static pBOOL gIsSilent=FALSE;
  178. //static pBOOL gPhoneinMute=FALSE;
  179. //static pBOOL gLSpkNowOff=FALSE;
  180. //static pBOOL gIsInternalAlert=FALSE;
  181. //static pBOOL gVoiceRecordingFlag=FALSE;
  182. //static MMI_ALERT_TYPE gAlertType;
  183. /*****************************************************************************
  184.  * FUNCTION
  185.  *  IsPhoneInMute
  186.  * DESCRIPTION
  187.  *  This function informs whethere the phone is in mute or not.
  188.  *  
  189.  *  This is a part of other hardware application.
  190.  * PARAMETERS
  191.  *  void
  192.  *  U16(?)      [OUT]       
  193.  * RETURNS
  194.  *  returns TRUE if muted else FALSE
  195.  *****************************************************************************/
  196. U16 IsPhoneInMute(void)
  197. {
  198.     /*----------------------------------------------------------------*/
  199.     /* Local Variables                                                */
  200.     /*----------------------------------------------------------------*/
  201.     /*----------------------------------------------------------------*/
  202.     /* Code Body                                                      */
  203.     /*----------------------------------------------------------------*/
  204.     return cm_p->alert_info.IsMute;
  205. }
  206. /*****************************************************************************
  207.  * FUNCTION
  208.  *  MutethePhone
  209.  * DESCRIPTION
  210.  *  This function mutes the phone i,e currently changing the global flag.
  211.  *  
  212.  *  This is a part of other hardware application.
  213.  * PARAMETERS
  214.  *  void
  215.  *  changes(?)      [OUT]       The value of gPhoneinMute.
  216.  * RETURNS
  217.  *  void
  218.  *****************************************************************************/
  219. void MutethePhone(void)
  220. {
  221.     /*----------------------------------------------------------------*/
  222.     /* Local Variables                                                */
  223.     /*----------------------------------------------------------------*/
  224.     /*----------------------------------------------------------------*/
  225.     /* Code Body                                                      */
  226.     /*----------------------------------------------------------------*/
  227.     cm_p->alert_info.IsMute = TRUE;
  228.     MuteOnMicrophone();
  229.     ShowStatusIcon(STATUS_ICON_MUTE);
  230.     UpdateStatusIcons();
  231. }
  232. /*****************************************************************************
  233.  * FUNCTION
  234.  *  UnMutethePhone
  235.  * DESCRIPTION
  236.  *  This function informs whethere the phone is in mute or not.
  237.  *  
  238.  *  This is a part of other hardware application.
  239.  * PARAMETERS
  240.  *  void
  241.  *  U16(?)      [OUT]       
  242.  * RETURNS
  243.  *  returns TRUE if muted else FALSE(?)
  244.  *****************************************************************************/
  245. void UnMutethePhone(void)
  246. {
  247.     /*----------------------------------------------------------------*/
  248.     /* Local Variables                                                */
  249.     /*----------------------------------------------------------------*/
  250.     /*----------------------------------------------------------------*/
  251.     /* Code Body                                                      */
  252.     /*----------------------------------------------------------------*/
  253.     cm_p->alert_info.IsMute = FALSE;
  254.     MuteOffMicrophone();
  255.     HideStatusIcon(STATUS_ICON_MUTE);
  256.     UpdateStatusIcons();
  257. }
  258. /*****************************************************************************
  259.  * FUNCTION
  260.  *  IsPhoneInSilent
  261.  * DESCRIPTION
  262.  *  This function informs whethere the phone is silent or not.
  263.  *  
  264.  *  This is a part of other hardware application.
  265.  * PARAMETERS
  266.  *  void
  267.  *  U16(?)      [OUT]       
  268.  * RETURNS
  269.  *  returns TRUE if silent else FALSE
  270.  *****************************************************************************/
  271. pBOOL IsPhoneInSilent(void)
  272. {
  273.     /*----------------------------------------------------------------*/
  274.     /* Local Variables                                                */
  275.     /*----------------------------------------------------------------*/
  276.     /*----------------------------------------------------------------*/
  277.     /* Code Body                                                      */
  278.     /*----------------------------------------------------------------*/
  279.     return cm_p->alert_info.IsSilent;
  280. }
  281. /*****************************************************************************
  282.  * FUNCTION
  283.  *  UnSilencethePhone
  284.  * DESCRIPTION
  285.  *  This function silences the phone
  286.  *  
  287.  *  This is a part of other hardware application.
  288.  * PARAMETERS
  289.  *  void
  290.  * RETURNS
  291.  *  void
  292.  *****************************************************************************/
  293. void UnSilencethePhone(void)
  294. {
  295.     /*----------------------------------------------------------------*/
  296.     /* Local Variables                                                */
  297.     /*----------------------------------------------------------------*/
  298.     /*----------------------------------------------------------------*/
  299.     /* Code Body                                                      */
  300.     /*----------------------------------------------------------------*/
  301.     cm_p->alert_info.IsSilent = FALSE;
  302. }
  303. /*****************************************************************************
  304.  * FUNCTION
  305.  *  SetLSpkNowOff
  306.  * DESCRIPTION
  307.  *  
  308.  * PARAMETERS
  309.  *  flag        [IN]        
  310.  * RETURNS
  311.  *  void
  312.  *****************************************************************************/
  313. void SetLSpkNowOff(pBOOL flag)
  314. {
  315.     /*----------------------------------------------------------------*/
  316.     /* Local Variables                                                */
  317.     /*----------------------------------------------------------------*/
  318.     /*----------------------------------------------------------------*/
  319.     /* Code Body                                                      */
  320.     /*----------------------------------------------------------------*/
  321.     cm_p->alert_info.IsLoudSpk = flag;
  322. }
  323. /*****************************************************************************
  324.  * FUNCTION
  325.  *  GetLSpkNowOff
  326.  * DESCRIPTION
  327.  *  
  328.  * PARAMETERS
  329.  *  void
  330.  * RETURNS
  331.  *  
  332.  *****************************************************************************/
  333. pBOOL GetLSpkNowOff(void)
  334. {
  335.     /*----------------------------------------------------------------*/
  336.     /* Local Variables                                                */
  337.     /*----------------------------------------------------------------*/
  338.     /*----------------------------------------------------------------*/
  339.     /* Code Body                                                      */
  340.     /*----------------------------------------------------------------*/
  341.     return cm_p->alert_info.IsLoudSpk;
  342. }
  343. /*****************************************************************************
  344.  * FUNCTION
  345.  *  SetVoiceRecordingFlag
  346.  * DESCRIPTION
  347.  *  
  348.  * PARAMETERS
  349.  *  flag        [IN]        
  350.  * RETURNS
  351.  *  void
  352.  *****************************************************************************/
  353. void SetVoiceRecordingFlag(pBOOL flag)
  354. {
  355.     /*----------------------------------------------------------------*/
  356.     /* Local Variables                                                */
  357.     /*----------------------------------------------------------------*/
  358.     /*----------------------------------------------------------------*/
  359.     /* Code Body                                                      */
  360.     /*----------------------------------------------------------------*/
  361.     cm_p->alert_info.IsRecord = flag;
  362. }
  363. /*****************************************************************************
  364.  * FUNCTION
  365.  *  GetVoiceRecordingFlag
  366.  * DESCRIPTION
  367.  *  
  368.  * PARAMETERS
  369.  *  void
  370.  * RETURNS
  371.  *  
  372.  *****************************************************************************/
  373. pBOOL GetVoiceRecordingFlag(void)
  374. {
  375.     /*----------------------------------------------------------------*/
  376.     /* Local Variables                                                */
  377.     /*----------------------------------------------------------------*/
  378.     /*----------------------------------------------------------------*/
  379.     /* Code Body                                                      */
  380.     /*----------------------------------------------------------------*/
  381.     return cm_p->alert_info.IsRecord;
  382. }
  383. /*****************************************************************************
  384.  * FUNCTION
  385.  *  CMSetupAlertForMT
  386.  * DESCRIPTION
  387.  *  
  388.  * PARAMETERS
  389.  *  void
  390.  * RETURNS
  391.  *  void
  392.  *****************************************************************************/
  393. void CMSetupAlertForMT(void)
  394. {
  395.     /*----------------------------------------------------------------*/
  396.     /* Local Variables                                                */
  397.     /*----------------------------------------------------------------*/
  398.     PHB_CM_INTERFACE *PhoneNumberStruct;
  399.     CM_CALL_HANDLE tmp;
  400. #ifdef __MMI_INCOMING_CALL_VIDEO__
  401.     U16 imgId;
  402. #endif 
  403. #ifdef __MMI_PROFILE_ALERT_TYPE_DOMINANT__
  404.     MMI_ALERT_TYPE alert_type;
  405. #endif 
  406.     /*----------------------------------------------------------------*/
  407.     /* Code Body                                                      */
  408.     /*----------------------------------------------------------------*/
  409.     tmp = GetIncomingCallHandle();
  410.     PhoneNumberStruct = GetCMPhoneBookStruct();
  411.     cm_p->alert_info.RingToneId = PhoneNumberStruct->ringtoneId;
  412.     cm_p->alert_info.BacklightPatternId = PhoneNumberStruct->backlightId;
  413.     cm_p->alert_info.AlertType = PhoneNumberStruct->alertType;
  414. #ifdef __MMI_INCOMING_CALL_VIDEO__
  415.     imgId = GetCallImgId(tmp);
  416.     if (((imgId & 0x8000) || ((imgId & 0x3fff) >= VDO_ID_PHB_MTCALL_1)) && (imgId & 0x4000))
  417.         /* user defined video file or system default video resource */
  418.         /* use video sound as ring tone */
  419.     {
  420.         cm_p->alert_info.RingToneId = CM_RINGTONE_VIDEO;
  421.     }
  422.     else
  423. #endif /* __MMI_INCOMING_CALL_VIDEO__ */ 
  424.         /* phb not set ring tone => use profile default */
  425.     if (cm_p->alert_info.RingToneId == 0)
  426.     {
  427.         cm_p->alert_info.RingToneId = GetRingToneID();
  428.     }
  429.     /* phb not set backlight pattern => use profile default */
  430.     if (cm_p->alert_info.BacklightPatternId == 0)
  431.     {
  432.         cm_p->alert_info.BacklightPatternId = GetLightStatus();
  433.     }
  434.     /* phb not set alert type => use profile default */
  435.     if (cm_p->alert_info.AlertType == MMI_ALERT_NONE)
  436.     {
  437.         cm_p->alert_info.AlertType = GetMtCallAlertTypeEnum();
  438.     }
  439. #ifdef __MMI_PROFILE_ALERT_TYPE_DOMINANT__
  440.     /* get alert type from profile */
  441.     alert_type = GetMtCallAlertTypeEnum();
  442.     /* if alert type is vibration only or silent, do not ring according to the caller group */
  443.     if (alert_type == MMI_VIBRATION_ONLY || alert_type == MMI_SILENT)
  444.     {
  445.         cm_p->alert_info.AlertType = alert_type;
  446.     }
  447. #endif /* __MMI_PROFILE_ALERT_TYPE_DOMINANT__ */ 
  448. #ifdef __MMI_CM_DATA_CALL_ONLY_PLAY_TONE__
  449.     if (GetCallType(tmp) == CM_DATA_CALL)
  450.     {
  451.         cm_p->alert_info.RingToneId = TONE_DATA_CALL;
  452.     }
  453.     if (GetPreviousCallWAP() == TRUE)
  454.     {
  455.         SetPreviousCallWAP(FALSE);
  456.         cm_p->alert_info.RingToneId = TONE_DATA_CALL;
  457.     }
  458. #endif /* __MMI_CM_DATA_CALL_ONLY_PLAY_TONE__ */ 
  459. }
  460. /*****************************************************************************
  461.  * FUNCTION
  462.  *  ShowIncomingCallIndication
  463.  * DESCRIPTION
  464.  *  This function is called to Show incoming call indication
  465.  * PARAMETERS
  466.  *  void
  467.  * RETURNS
  468.  *  void
  469.  *****************************************************************************/
  470. void ShowIncomingCallIndication(void)
  471. {
  472.     /*----------------------------------------------------------------*/
  473.     /* Local Variables                                                */
  474.     /*----------------------------------------------------------------*/
  475.     /*----------------------------------------------------------------*/
  476.     /* Code Body                                                      */
  477.     /*----------------------------------------------------------------*/
  478.     /* before show incoming call indication, it must entered incoming call screen 
  479.        which will already suspend audio, no need to stop again */
  480.     /* StopRingtoneOrVibrator(); */
  481.     PRINT_INFORMATION(("ShowIncomingCallIndicationn"));
  482.     CMSetupAlertForMT();
  483.     StartRingtoneOrVibrator();
  484.     SetRingingFlag(TRUE);
  485.     if (GetCCBSFlag() == TRUE)
  486.     {
  487.         StartTimer(CM_CCBS_NOTIFYDURATION_TIMER, CM_CCBS_NOTIFY_TIMEOUT, StopIncomingCallIndication);
  488.     }
  489. }
  490. /*****************************************************************************
  491.  * FUNCTION
  492.  *  StopIncomingCallIndication
  493.  * DESCRIPTION
  494.  *  This function is called to Stop incoming call indication
  495.  * PARAMETERS
  496.  *  void
  497.  * RETURNS
  498.  *  void
  499.  *****************************************************************************/
  500. void StopIncomingCallIndication(void)
  501. {
  502.     /*----------------------------------------------------------------*/
  503.     /* Local Variables                                                */
  504.     /*----------------------------------------------------------------*/
  505.     /*----------------------------------------------------------------*/
  506.     /* Code Body                                                      */
  507.     /*----------------------------------------------------------------*/
  508.     if (GetCallWaitFlag() && (!GetWait2RingCallFlag()))
  509.     {
  510.         /* stop waiting call indication */
  511.         SetCallWaitFlag(FALSE);
  512.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_StopRing1));
  513.         AudioStopReq(TONE_CALL_WAITING);
  514.     #if defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__)
  515.         mmi_bt_stop_hf_ring_req();
  516.     #endif 
  517.         SetNoTwiceRingFlag(FALSE);
  518.     }
  519.     else
  520.     {
  521.         /* stop incoming call indication */
  522.         if (GetWait2RingCallFlag())
  523.         {
  524.             SetWait2RingCallFlag(FALSE);
  525.             SetNoTwiceRingFlag(FALSE);
  526.         }
  527.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_StopRing2));
  528.         StopRingtoneOrVibrator();
  529.     }
  530.     if (GetAutoAnswerFlag() == TRUE)
  531.     {
  532.         StopTimer(CM_AUTOANSWER_NOTIFYDURATION_TIMER);
  533.         SetAutoAnswerFlag(FALSE);
  534.     }
  535.     if (GetCCBSFlag() == TRUE)
  536.     {
  537.         StopTimer(CM_CCBS_NOTIFYDURATION_TIMER);
  538.     }
  539.     SetRingAfterVibFlag(FALSE);
  540.     SetRingingFlag(FALSE);
  541.     if (GetExitScrnID() == ITEMSCR_INCOMING_CALL && GetTotalCallCount() == 1)
  542.     {
  543.     #ifdef __MMI_INCOMING_CALL_VIDEO__
  544.         CM_CALL_HANDLE handle;
  545.         U16 imgId;
  546.         handle = GetIncomingCallHandle();
  547.         imgId = GetCallImgId(handle);
  548.         /* pause video */
  549.         if ((imgId & 0x8000) || ((imgId & 0x3fff) >= VDO_ID_PHB_MTCALL_1))
  550.         {
  551.             StopCategory17Video();
  552.         }
  553.         else
  554.     #endif /* __MMI_INCOMING_CALL_VIDEO__ */ 
  555.             MOMTHideAnimation();
  556.     }
  557. }
  558. /*****************************************************************************
  559.  * FUNCTION
  560.  *  CMPlayMTRingTone
  561.  * DESCRIPTION
  562.  *  This function is called to play ring or vibrator
  563.  *  according to current setting
  564.  * PARAMETERS
  565.  *  tone        [IN]        
  566.  * RETURNS
  567.  *  void
  568.  *****************************************************************************/
  569. void CMPlayMTRingTone(U16 tone)
  570. {
  571.     /*----------------------------------------------------------------*/
  572.     /* Local Variables                                                */
  573.     /*----------------------------------------------------------------*/
  574.     /*----------------------------------------------------------------*/
  575.     /* Code Body                                                      */
  576.     /*----------------------------------------------------------------*/
  577. #ifdef __MMI_INCOMING_CALL_VIDEO__
  578.     if (tone != CM_RINGTONE_VIDEO)
  579. #endif 
  580.         StartRingTone(tone);
  581. }
  582. /*****************************************************************************
  583.  * FUNCTION
  584.  *  StartRingtoneOrVibrator
  585.  * DESCRIPTION
  586.  *  This function is called to play ring or vibrator
  587.  *  according to current setting
  588.  * PARAMETERS
  589.  *  void
  590.  * RETURNS
  591.  *  void
  592.  *****************************************************************************/
  593. void StartRingtoneOrVibrator(void)
  594. {
  595. #if defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__)
  596.     /*----------------------------------------------------------------*/
  597.     /* Local Variables                                                */
  598.     /*----------------------------------------------------------------*/
  599.     /*----------------------------------------------------------------*/
  600.     /* Code Body                                                      */
  601.     /*----------------------------------------------------------------*/
  602.     if (mmi_bt_is_aud2hf() == MMI_TRUE)
  603.     {
  604.         mmi_bt_start_hf_ring_req();
  605.     }
  606. #endif /* defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__) */ 
  607.     switch (cm_p->alert_info.AlertType)
  608.     {
  609.         case MMI_RING:
  610.             /* StartRingTone (cm_p->alert_info.RingToneId); */
  611.             CMPlayMTRingTone(cm_p->alert_info.RingToneId);
  612.             break;
  613.         case MMI_VIBRATION_ONLY:
  614.             VibratorOn();
  615.             break;
  616.         case MMI_VIBRATION_AND_RING:
  617.             VibratorOn();
  618.       /************************************************/
  619.             /* Robin 0602, Remove set AT command profile functions */
  620.             /* AT command will query MMI when needed                   */
  621.       /************************************************/
  622.             /* NSC This API is not correct not integrated wit Profiles Silent Mode */
  623.             /*
  624.              * if(IsPhoneInSilent())
  625.              * SilentModeOff();
  626.              */
  627.             /* StartRingTone (cm_p->alert_info.RingToneId); */
  628.             CMPlayMTRingTone(cm_p->alert_info.RingToneId);
  629.             break;
  630.         case MMI_VIBRATION_THEN_RING:
  631.             VibratorThenRing();
  632.             break;
  633.         case MMI_SILENT:
  634.             break;
  635.         case MMI_ALERT_NONE:
  636.             break;
  637.         default:
  638.             /* StartRingTone (cm_p->alert_info.RingToneId); */
  639.             CMPlayMTRingTone(cm_p->alert_info.RingToneId);
  640.             break;
  641.     }
  642.     PlayPatternCallerGroup((MMI_LEDLIGHT_STATUS_ENUM) cm_p->alert_info.BacklightPatternId);
  643. }
  644. /*****************************************************************************
  645.  * FUNCTION
  646.  *  StopRingtoneOrVibrator
  647.  * DESCRIPTION
  648.  *  This function stops RingTone or Vibrarator depending on Alert Type
  649.  * PARAMETERS
  650.  *  void
  651.  * RETURNS
  652.  *  void
  653.  *****************************************************************************/
  654. void StopRingtoneOrVibrator(void)
  655. {
  656.     /*----------------------------------------------------------------*/
  657.     /* Local Variables                                                */
  658.     /*----------------------------------------------------------------*/
  659.     /*----------------------------------------------------------------*/
  660.     /* Code Body                                                      */
  661.     /*----------------------------------------------------------------*/
  662. #if defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__)
  663.     if (mmi_bt_is_aud2hf() == MMI_TRUE)
  664.     {
  665.         mmi_bt_stop_hf_ring_req();
  666.     }
  667. #endif /* defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__) */ 
  668.     switch (cm_p->alert_info.AlertType)
  669.     {
  670.         case MMI_RING:
  671.             StopRingTone(cm_p->alert_info.RingToneId);
  672.             break;
  673.         case MMI_VIBRATION_ONLY:
  674.             VibratorOff();
  675.             break;
  676.         case MMI_VIBRATION_AND_RING:
  677.             StopRingTone(cm_p->alert_info.RingToneId);
  678.             VibratorOff();
  679.             break;
  680.         case MMI_VIBRATION_THEN_RING:
  681.             /* NSC Does not make the mobile go back into Silent Mode */
  682.             StopTimer(CM_ALERT_NOTIFYDURATION_TIMER);
  683.             VibratorOff();
  684.             StopRingTone(cm_p->alert_info.RingToneId);
  685.             break;
  686.         case MMI_SILENT:
  687.             break;
  688.         case MMI_ALERT_NONE:
  689.             break;
  690.         default:
  691.             break;
  692.     }
  693.     StopPatternCallerGroup((MMI_LEDLIGHT_STATUS_ENUM) cm_p->alert_info.BacklightPatternId);
  694. }
  695. #ifdef __MMI_INTELLIGENT_CALL_ALERT__
  696. U16 intelligent_call_alert_ring_tone;
  697. U8 is_intelligent_call_alert_playing_text = 0;
  698. /*****************************************************************************
  699.  * FUNCTION
  700.  *  PlayIncomingCallTextHandler
  701.  * DESCRIPTION
  702.  *  
  703.  * PARAMETERS
  704.  *  result      [IN]        
  705.  * RETURNS
  706.  *  void
  707.  *****************************************************************************/
  708. void PlayIncomingCallTextHandler(mdi_result result)
  709. {
  710.     /*----------------------------------------------------------------*/
  711.     /* Local Variables                                                */
  712.     /*----------------------------------------------------------------*/
  713.     /*----------------------------------------------------------------*/
  714.     /* Code Body                                                      */
  715.     /*----------------------------------------------------------------*/
  716.     is_intelligent_call_alert_playing_text = 0;
  717.     if (result == MDI_AUDIO_END_OF_FILE)
  718.     {
  719.         AudioPlayToneWithCallBack(intelligent_call_alert_ring_tone, GetRingTypeEnum(), INCOMING_CALL_TONE);
  720.     }
  721. }
  722. #endif /* __MMI_INTELLIGENT_CALL_ALERT__ */ 
  723. /*****************************************************************************
  724.  * FUNCTION
  725.  *  StartRingTone
  726.  * DESCRIPTION
  727.  *  This function statrs the ringtone
  728.  *  
  729.  *  This is a part of other hardware application.
  730.  * PARAMETERS
  731.  *  ringTone        [IN]        
  732.  *  ringtone(?)     [IN]        Index
  733.  * RETURNS
  734.  *  void
  735.  *****************************************************************************/
  736. void StartRingTone(U16 ringTone)
  737. {
  738.     /*----------------------------------------------------------------*/
  739.     /* Local Variables                                                */
  740.     /*----------------------------------------------------------------*/
  741.     /*----------------------------------------------------------------*/
  742.     /* Code Body                                                      */
  743.     /*----------------------------------------------------------------*/
  744.     if (ringTone < MAX_TONE_ID)
  745.     {
  746.         AudioPlayToneWithCallBack(ringTone, GetRingTypeEnum(), INCOMING_CALL_TONE);
  747.     }
  748.     else if (!IsSilentModeActivated())
  749.     {
  750.     #ifdef __MMI_INTELLIGENT_CALL_ALERT__
  751.         U16 text[(MAX_NAME + MAX_CM_NUMBER) / 2 + 1];
  752.         U16 count;
  753.         S32 text_len;
  754.         MMI_INTELLIGENT_CALL_ALERT_TYPE isIntelligentCallAlertOn = GetIntelligentCallAert();
  755.         if (isIntelligentCallAlertOn == MMI_INTELLIGENT_CALL_ALERT_ON)
  756.         {
  757.             for (count = 0; count < MAX_CALLS; count++)
  758.             {
  759.                 if (CM_INCOMING_STATE == cm_p->state_info.AllCalls[count].curr_state)
  760.                 {
  761.                     text[0] = 0;
  762.                 #ifdef DIGIT_TONE_SUPPORT
  763.                     pfnUnicodeStrcpy((S8*) text, (S8*) cm_p->state_info.AllCalls[count].number);
  764.                 #endif 
  765.                 #if defined(SIMPLE_TTS) || defined(DIGIT_TONE_SUPPORT)
  766.                     pfnUnicodeStrcat((S8*) text, (S8*) cm_p->state_info.AllCalls[count].pBname);
  767.                 #endif 
  768.                     text[(MAX_NAME + MAX_CM_NUMBER) / 2] = 0;
  769.                     break;
  770.                 }
  771.             }
  772.             text_len = pfnUnicodeStrlen((S8*) text);
  773.             if (text_len > 0 &&
  774.                 mdi_audio_play_text_with_vol_path(
  775.                     (U8*) text,
  776.                     pfnUnicodeStrlen((S8*) text),
  777.                     100,
  778.                     NULL,
  779.                     PlayIncomingCallTextHandler,
  780.                     GetRingVolumeLevel(),
  781.                     MDI_DEVICE_SPEAKER_BOTH) == MDI_AUDIO_SUCCESS)
  782.             {
  783.                 intelligent_call_alert_ring_tone = ringTone;
  784.                 is_intelligent_call_alert_playing_text = 1;
  785.             }
  786.             else
  787.             {
  788.                 AudioPlayToneWithCallBack(ringTone, GetRingTypeEnum(), INCOMING_CALL_TONE);
  789.             }
  790.         }
  791.         else
  792.     #endif /* __MMI_INTELLIGENT_CALL_ALERT__ */ 
  793.             AudioPlayToneWithCallBack(ringTone, GetRingTypeEnum(), INCOMING_CALL_TONE);
  794.         /* AudioPlayReq(ringTone,GetRingTypeEnum()); */
  795.     }
  796. }
  797. /*****************************************************************************
  798.  * FUNCTION
  799.  *  StopRingTone
  800.  * DESCRIPTION
  801.  *  This function stops the ringtone
  802.  *  
  803.  *  This is a part of other hardware application.
  804.  * PARAMETERS
  805.  *  ringTone        [IN]        
  806.  * RETURNS
  807.  *  void
  808.  *****************************************************************************/
  809. void StopRingTone(U16 ringTone)
  810. {
  811.     /*----------------------------------------------------------------*/
  812.     /* Local Variables                                                */
  813.     /*----------------------------------------------------------------*/
  814.     /*----------------------------------------------------------------*/
  815.     /* Code Body                                                      */
  816.     /*----------------------------------------------------------------*/
  817.     if (ringTone < MAX_TONE_ID)
  818.     {
  819.     #ifdef __MMI_INTELLIGENT_CALL_ALERT__
  820.         if (is_intelligent_call_alert_playing_text)
  821.         {
  822.             mdi_audio_stop_all();
  823.         }
  824.         else
  825.     #endif /* __MMI_INTELLIGENT_CALL_ALERT__ */ 
  826.             AudioStopReq(ringTone);
  827.     }
  828.     else
  829.     {
  830.         mdi_audio_stop_all();
  831.     }
  832. }
  833. /*****************************************************************************
  834.  * FUNCTION
  835.  *  VibratorThenRing
  836.  * DESCRIPTION
  837.  *  This function is called for Vibrator Then Ring indication
  838.  * PARAMETERS
  839.  *  void
  840.  * RETURNS
  841.  *  void
  842.  *****************************************************************************/
  843. void VibratorThenRing(void)
  844. {
  845.     /*----------------------------------------------------------------*/
  846.     /* Local Variables                                                */
  847.     /*----------------------------------------------------------------*/
  848.     /*----------------------------------------------------------------*/
  849.     /* Code Body                                                      */
  850.     /*----------------------------------------------------------------*/
  851.     VibratorOn();
  852.     StartTimer(CM_ALERT_NOTIFYDURATION_TIMER, VIB_THEN_RING_DURATION, StopVibratorPlayRing);
  853. }
  854. /*****************************************************************************
  855.  * FUNCTION
  856.  *  StopVibratorPlayRing
  857.  * DESCRIPTION
  858.  *  This function is called for StopVibrator PlayRing
  859.  * PARAMETERS
  860.  *  void
  861.  * RETURNS
  862.  *  void
  863.  *****************************************************************************/
  864. #ifdef __MMI_INCOMING_CALL_VIDEO__
  865. extern void EnableCategory17Audio(void);
  866. #endif 
  867. void StopVibratorPlayRing(void)
  868. {
  869.     /*----------------------------------------------------------------*/
  870.     /* Local Variables                                                */
  871.     /*----------------------------------------------------------------*/
  872.     /*----------------------------------------------------------------*/
  873.     /* Code Body                                                      */
  874.     /*----------------------------------------------------------------*/
  875.     StopTimer(CM_ALERT_NOTIFYDURATION_TIMER);
  876.     VibratorOff();
  877.     /* StartRingTone (cm_p->alert_info.RingToneId); */
  878. #ifdef __MMI_INCOMING_CALL_VIDEO__
  879.     if (cm_p->alert_info.RingToneId == CM_RINGTONE_VIDEO)
  880.     {
  881.         /* turn on audio path */
  882.         EnableCategory17Audio();
  883.         SetRingAfterVibFlag(TRUE);
  884.     }
  885. #endif /* __MMI_INCOMING_CALL_VIDEO__ */ 
  886.     CMPlayMTRingTone(cm_p->alert_info.RingToneId);
  887. }
  888. /*****************************************************************************
  889.  * FUNCTION
  890.  *  PlayConnectNotice
  891.  * DESCRIPTION
  892.  *  This function is wrapper to Play Ring Tone
  893.  * PARAMETERS
  894.  *  void
  895.  * RETURNS
  896.  *  void
  897.  *****************************************************************************/
  898. #ifdef __MMI_CONNECT_NOTICE__
  899. void PlayConnectNotice(void)
  900. {
  901.     /*----------------------------------------------------------------*/
  902.     /* Local Variables                                                */
  903.     /*----------------------------------------------------------------*/
  904.     /*----------------------------------------------------------------*/
  905.     /* Code Body                                                      */
  906.     /*----------------------------------------------------------------*/
  907.     switch (GetConnectNoticeType())
  908.     {
  909.         case MMI_NOTICE_NONE:
  910.             break;
  911.         case MMI_NOTICE_TONE_ONLY:
  912.             playRequestedTone(CONNECT_TONE);
  913.             break;
  914.         case MMI_NOTICE_VIB_ONLY:
  915.             PlayVibratorOnce();
  916.             break;
  917.         case MMI_NOTICE_TONE_AND_VIB:
  918.             playRequestedTone(CONNECT_TONE);
  919.             PlayVibratorOnce();
  920.             break;
  921.     }
  922. }
  923. #endif /* __MMI_CONNECT_NOTICE__ */ 
  924. /*****************************************************************************
  925.  * FUNCTION
  926.  *  GetRingAfterVibFlag
  927.  * DESCRIPTION
  928.  *  This function returns state of alerts
  929.  *  
  930.  *  This is a part of other hardware application.
  931.  * PARAMETERS
  932.  *  void
  933.  *  TRUE(?)     [OUT]       Or FALSE
  934.  * RETURNS
  935.  *  pBOOL
  936.  *****************************************************************************/
  937. pBOOL GetRingAfterVibFlag(void)
  938. {
  939.     /*----------------------------------------------------------------*/
  940.     /* Local Variables                                                */
  941.     /*----------------------------------------------------------------*/
  942.     /*----------------------------------------------------------------*/
  943.     /* Code Body                                                      */
  944.     /*----------------------------------------------------------------*/
  945.     return cm_p->alert_info.IsRingAfterVib;
  946. }
  947. /*****************************************************************************
  948.  * FUNCTION
  949.  *  SetRingAfterVibFlag
  950.  * DESCRIPTION
  951.  *  This function checks to see if need to ring again
  952.  * PARAMETERS
  953.  *  truth       [IN]        
  954.  *  TRUE(?)     [OUT]       Or FALSE
  955.  * RETURNS
  956.  *  pBOOL(?)
  957.  *****************************************************************************/
  958. void SetRingAfterVibFlag(pBOOL truth)
  959. {
  960.     /*----------------------------------------------------------------*/
  961.     /* Local Variables                                                */
  962.     /*----------------------------------------------------------------*/
  963.     /*----------------------------------------------------------------*/
  964.     /* Code Body                                                      */
  965.     /*----------------------------------------------------------------*/
  966.     cm_p->alert_info.IsRingAfterVib = truth;
  967. }
  968. /*****************************************************************************
  969.  * FUNCTION
  970.  *  GetSpeechFlag
  971.  * DESCRIPTION
  972.  *  This function returns state of alerts
  973.  *  
  974.  *  This is a part of other hardware application.
  975.  * PARAMETERS
  976.  *  void
  977.  *  TRUE(?)     [OUT]       Or FALSE
  978.  * RETURNS
  979.  *  pBOOL
  980.  *****************************************************************************/
  981. pBOOL GetSpeechFlag(void)
  982. {
  983.     /*----------------------------------------------------------------*/
  984.     /* Local Variables                                                */
  985.     /*----------------------------------------------------------------*/
  986.     /*----------------------------------------------------------------*/
  987.     /* Code Body                                                      */
  988.     /*----------------------------------------------------------------*/
  989.     return cm_p->alert_info.IsSpeechOn;
  990. }
  991. /*****************************************************************************
  992.  * FUNCTION
  993.  *  SetSpeechFlag
  994.  * DESCRIPTION
  995.  *  This function checks to see if remote is alerting
  996.  * PARAMETERS
  997.  *  truth       [IN]        
  998.  *  TRUE(?)     [OUT]       Or FALSE
  999.  * RETURNS
  1000.  *  pBOOL(?)
  1001.  *****************************************************************************/
  1002. void SetSpeechFlag(pBOOL truth)
  1003. {
  1004.     /*----------------------------------------------------------------*/
  1005.     /* Local Variables                                                */
  1006.     /*----------------------------------------------------------------*/
  1007.     /*----------------------------------------------------------------*/
  1008.     /* Code Body                                                      */
  1009.     /*----------------------------------------------------------------*/
  1010.     cm_p->alert_info.IsSpeechOn = truth;
  1011. }
  1012. /*****************************************************************************
  1013.  * FUNCTION
  1014.  *  SetRingingFlag
  1015.  * DESCRIPTION
  1016.  *  This function checks to see if remote is alerting
  1017.  * PARAMETERS
  1018.  *  truth       [IN]        
  1019.  *  TRUE(?)     [OUT]       Or FALSE
  1020.  * RETURNS
  1021.  *  pBOOL(?)
  1022.  *****************************************************************************/
  1023. void SetRingingFlag(pBOOL truth)
  1024. {
  1025.     /*----------------------------------------------------------------*/
  1026.     /* Local Variables                                                */
  1027.     /*----------------------------------------------------------------*/
  1028.     /*----------------------------------------------------------------*/
  1029.     /* Code Body                                                      */
  1030.     /*----------------------------------------------------------------*/
  1031.     PRINT_INFORMATION(("SetRingingFlag: %dn", truth));
  1032.     cm_p->alert_info.IsRinging = truth;
  1033. }
  1034. /*****************************************************************************
  1035.  * FUNCTION
  1036.  *  GetRingingFlag
  1037.  * DESCRIPTION
  1038.  *  This function returns state of internal alerts indication
  1039.  *  
  1040.  *  This is a part of other hardware application.
  1041.  * PARAMETERS
  1042.  *  void
  1043.  *  TRUE(?)     [OUT]       Or FALSE
  1044.  * RETURNS
  1045.  *  pBOOL
  1046.  *****************************************************************************/
  1047. pBOOL GetRingingFlag(void)
  1048. {
  1049.     /*----------------------------------------------------------------*/
  1050.     /* Local Variables                                                */
  1051.     /*----------------------------------------------------------------*/
  1052.     /*----------------------------------------------------------------*/
  1053.     /* Code Body                                                      */
  1054.     /*----------------------------------------------------------------*/
  1055.     return cm_p->alert_info.IsRinging;
  1056. }
  1057. /*****************************************************************************
  1058.  * FUNCTION
  1059.  *  GetInternalAlert
  1060.  * DESCRIPTION
  1061.  *  This function returns state of internal alerts indication
  1062.  *  
  1063.  *  This is a part of other hardware application.
  1064.  * PARAMETERS
  1065.  *  void
  1066.  *  TRUE(?)     [OUT]       Or FALSE
  1067.  * RETURNS
  1068.  *  pBOOL
  1069.  *****************************************************************************/
  1070. pBOOL GetInternalAlert(void)
  1071. {
  1072.     /*----------------------------------------------------------------*/
  1073.     /* Local Variables                                                */
  1074.     /*----------------------------------------------------------------*/
  1075.     /*----------------------------------------------------------------*/
  1076.     /* Code Body                                                      */
  1077.     /*----------------------------------------------------------------*/
  1078.     return cm_p->alert_info.IsInternalAlert;
  1079. }
  1080. /*****************************************************************************
  1081.  * FUNCTION
  1082.  *  SetInternalAlert
  1083.  * DESCRIPTION
  1084.  *  This function checks to see if USSD is supported in the phone/network
  1085.  *  
  1086.  *  This is a part of other hardware application.
  1087.  * PARAMETERS
  1088.  *  truth       [IN]        
  1089.  *  TRUE(?)     [OUT]       Or FALSE
  1090.  * RETURNS
  1091.  *  pBOOL(?)
  1092.  *****************************************************************************/
  1093. void SetInternalAlert(pBOOL truth)
  1094. {
  1095.     /*----------------------------------------------------------------*/
  1096.     /* Local Variables                                                */
  1097.     /*----------------------------------------------------------------*/
  1098.     /*----------------------------------------------------------------*/
  1099.     /* Code Body                                                      */
  1100.     /*----------------------------------------------------------------*/
  1101.     cm_p->alert_info.IsInternalAlert = truth;
  1102. }
  1103. /*****************************************************************************
  1104.  * FUNCTION
  1105.  *  PlayInternalOutgoingTone
  1106.  * DESCRIPTION
  1107.  *  Stops playing waiting call tone
  1108.  * PARAMETERS
  1109.  *  void
  1110.  * RETURNS
  1111.  *  void
  1112.  *****************************************************************************/
  1113. void PlayInternalOutgoingTone(void)
  1114. {
  1115.     /*----------------------------------------------------------------*/
  1116.     /* Local Variables                                                */
  1117.     /*----------------------------------------------------------------*/
  1118.     /*----------------------------------------------------------------*/
  1119.     /* Code Body                                                      */
  1120.     /*----------------------------------------------------------------*/
  1121.     SetInternalAlert(TRUE);
  1122.     StartRingTone(TONE_RINGING_CALL_GSM);
  1123. }
  1124. /*****************************************************************************
  1125.  * FUNCTION
  1126.  *  StopInternalOutgoingTone
  1127.  * DESCRIPTION
  1128.  *  Stops playing waiting call tone
  1129.  * PARAMETERS
  1130.  *  void
  1131.  * RETURNS
  1132.  *  void
  1133.  *****************************************************************************/
  1134. void StopInternalOutgoingTone(void)
  1135. {
  1136.     /*----------------------------------------------------------------*/
  1137.     /* Local Variables                                                */
  1138.     /*----------------------------------------------------------------*/
  1139.     /*----------------------------------------------------------------*/
  1140.     /* Code Body                                                      */
  1141.     /*----------------------------------------------------------------*/
  1142.     SetInternalAlert(FALSE);
  1143.     AudioStopReq(TONE_RINGING_CALL_GSM);
  1144. }
  1145. /*****************************************************************************
  1146.  * FUNCTION
  1147.  *  PsCBackPlayInternalTone
  1148.  * DESCRIPTION
  1149.  *  This function plays GSMtone
  1150.  * PARAMETERS
  1151.  *  info        [?]     
  1152.  * RETURNS
  1153.  *  void
  1154.  *****************************************************************************/
  1155. void PsCBackPlayInternalTone(void *info)
  1156. {
  1157.     /*----------------------------------------------------------------*/
  1158.     /* Local Variables                                                */
  1159.     /*----------------------------------------------------------------*/
  1160.     U8 flag = DeriveInternalAlrtIndVal(info);
  1161.     /*----------------------------------------------------------------*/
  1162.     /* Code Body                                                      */
  1163.     /*----------------------------------------------------------------*/
  1164.     if (flag)
  1165.     {
  1166.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_PlayInternalTone));
  1167.         PlayInternalOutgoingTone();
  1168.     }
  1169. }
  1170. /*****************************************************************************
  1171.  * FUNCTION
  1172.  *  SetDTMFFlag
  1173.  * DESCRIPTION
  1174.  *  Sets the DTMF Flag
  1175.  * PARAMETERS
  1176.  *  dtmfFlag        [IN]        
  1177.  *  TRUE(?)         [IN]        For set, FALSE for not set
  1178.  * RETURNS
  1179.  *  void
  1180.  *****************************************************************************/
  1181. void SetDTMFFlag(pBOOL dtmfFlag)
  1182. {
  1183.     /*----------------------------------------------------------------*/
  1184.     /* Local Variables                                                */
  1185.     /*----------------------------------------------------------------*/
  1186.     /*----------------------------------------------------------------*/
  1187.     /* Code Body                                                      */
  1188.     /*----------------------------------------------------------------*/
  1189.     cm_p->alert_info.DTMF = dtmfFlag;
  1190. }
  1191. /*****************************************************************************
  1192.  * FUNCTION
  1193.  *  GetDTMFFlag
  1194.  * DESCRIPTION
  1195.  *  Gets the DTMF Flag Status
  1196.  * PARAMETERS
  1197.  *  void
  1198.  *  TRUE(?)     [OUT]       For set, FALSE for not set
  1199.  * RETURNS
  1200.  *  void
  1201.  *****************************************************************************/
  1202. pBOOL GetDTMFFlag(void)
  1203. {
  1204.     /*----------------------------------------------------------------*/
  1205.     /* Local Variables                                                */
  1206.     /*----------------------------------------------------------------*/
  1207.     /*----------------------------------------------------------------*/
  1208.     /* Code Body                                                      */
  1209.     /*----------------------------------------------------------------*/
  1210.     return cm_p->alert_info.DTMF;
  1211. }
  1212. /*****************************************************************************
  1213.  * FUNCTION
  1214.  *  DTMFFunction
  1215.  * DESCRIPTION
  1216.  *  This function enables or Disables the DTMF
  1217.  * PARAMETERS
  1218.  *  void
  1219.  * RETURNS
  1220.  *  void
  1221.  *****************************************************************************/
  1222. void DTMFFunction(void)
  1223. {
  1224.     /*----------------------------------------------------------------*/
  1225.     /* Local Variables                                                */
  1226.     /*----------------------------------------------------------------*/
  1227.     /*----------------------------------------------------------------*/
  1228.     /* Code Body                                                      */
  1229.     /*----------------------------------------------------------------*/
  1230.     if (GetDTMFFlag() == TRUE)
  1231.     {
  1232.         SetDTMFFlag(FALSE);
  1233.         ChangeLeftSoftkey(STR_GLOBAL_OFF, IMG_SCR1002_OFF_LSK);
  1234.     }
  1235.     else
  1236.     {
  1237.         SetDTMFFlag(TRUE);
  1238.         ChangeLeftSoftkey(STR_GLOBAL_ON, IMG_SCR1002_ON_LSK);
  1239.     }
  1240.     Hint2024DTMF(GetCurrHiliteID());
  1241.     RedrawCategoryFunction();
  1242.     HiliteM2024DTMF();
  1243. }
  1244. /*****************************************************************************
  1245.  * FUNCTION
  1246.  *  SetHFreeHeld
  1247.  * DESCRIPTION
  1248.  *  Sets the HFreeHeld Flag
  1249.  * PARAMETERS
  1250.  *  HFreeHeldFlag       [IN]        
  1251.  *  Flag(?)             [IN]        Value to set
  1252.  * RETURNS
  1253.  *  void
  1254.  *****************************************************************************/
  1255. void SetHFreeHeld(BOOL HFreeHeldFlag)
  1256. {
  1257.     /*----------------------------------------------------------------*/
  1258.     /* Local Variables                                                */
  1259.     /*----------------------------------------------------------------*/
  1260.     /*----------------------------------------------------------------*/
  1261.     /* Code Body                                                      */
  1262.     /*----------------------------------------------------------------*/
  1263.     /* TRUE: current LSpk, show HHeld as RSK,
  1264.        FALSE: current no LSpk, show HFree as RSK */
  1265.     cm_p->alert_info.IsHFree = HFreeHeldFlag;
  1266. }
  1267. /*****************************************************************************
  1268.  * FUNCTION
  1269.  *  GetHFreeHeld
  1270.  * DESCRIPTION
  1271.  *  Gets the HFreeHeld Flag
  1272.  * PARAMETERS
  1273.  *  void
  1274.  *  Flag(?)     [OUT]       Value
  1275.  * RETURNS
  1276.  *  void
  1277.  *****************************************************************************/
  1278. U16 GetHFreeHeld(void)
  1279. {
  1280.     /*----------------------------------------------------------------*/
  1281.     /* Local Variables                                                */
  1282.     /*----------------------------------------------------------------*/
  1283.     /*----------------------------------------------------------------*/
  1284.     /* Code Body                                                      */
  1285.     /*----------------------------------------------------------------*/
  1286.     return cm_p->alert_info.IsHFree;
  1287. }
  1288. /*****************************************************************************
  1289.  * FUNCTION
  1290.  *  LoudSpeakerFunction
  1291.  * DESCRIPTION
  1292.  *  This function enables the Loud Speaker
  1293.  * PARAMETERS
  1294.  *  void
  1295.  * RETURNS
  1296.  *  void
  1297.  *****************************************************************************/
  1298. void LoudSpeakerFunction(void)
  1299. {
  1300.     /*----------------------------------------------------------------*/
  1301.     /* Local Variables                                                */
  1302.     /*----------------------------------------------------------------*/
  1303.     /*----------------------------------------------------------------*/
  1304.     /* Code Body                                                      */
  1305.     /*----------------------------------------------------------------*/
  1306.     if (GetHFreeHeld() == FALSE)
  1307.     {
  1308.         SetHFreeHeld(TRUE);
  1309.         if (GetExitScrnID() == SCR_CM_ACTIVECALLSCREEN)
  1310.         {
  1311.             /* in active screen */
  1312.             ChangeRightSoftkey(STR_SCR1002_LOUDSP_H_HELD_RSK, IMG_SCR1002_LOUDSP_RSK);
  1313.         }
  1314.         EnableHandsFree();
  1315.         SetLoudSpeaker(TRUE);
  1316.     }
  1317.     else
  1318.     {
  1319.         SetHFreeHeld(FALSE);
  1320.         if (GetExitScrnID() == SCR_CM_ACTIVECALLSCREEN)
  1321.         {
  1322.             /* in active screen */
  1323.             ChangeRightSoftkey(STR_SCR1002_LOUDSP_H_FREE_RSK, IMG_SCR1002_LOUDSP_RSK);
  1324.         }
  1325.         DisbleHandsFree();
  1326.         SetLoudSpeaker(FALSE);
  1327.     }
  1328.     EntryScrLoudSpNotifyScreen();
  1329. }
  1330. /*****************************************************************************
  1331.  * FUNCTION
  1332.  *  OptionMuteorUnMutetheCall
  1333.  * DESCRIPTION
  1334.  *  This handles the Mute functionality in Options
  1335.  *  
  1336.  *  This toggles the functionality btw Mute & Unmute.
  1337.  * PARAMETERS
  1338.  *  void
  1339.  * RETURNS
  1340.  *  void
  1341.  *****************************************************************************/
  1342. void OptionMuteorUnMutetheCall(void)
  1343. {
  1344.     /*----------------------------------------------------------------*/
  1345.     /* Local Variables                                                */
  1346.     /*----------------------------------------------------------------*/
  1347.     /*----------------------------------------------------------------*/
  1348.     /* Code Body                                                      */
  1349.     /*----------------------------------------------------------------*/
  1350.     if (IsPhoneInMute())
  1351.     {
  1352.         UnMutethePhone();
  1353.         ChangeLeftSoftkey(STR_GLOBAL_ON, IMG_SCR1002_ON_LSK);
  1354.     }
  1355.     else
  1356.     {
  1357.         MutethePhone();
  1358.         ChangeLeftSoftkey(STR_GLOBAL_OFF, IMG_SCR1002_OFF_LSK);
  1359.     }
  1360.     Hint2020Mute(GetCurrHiliteID());
  1361.     RedrawCategoryFunction();
  1362.     HiliteM2020Mute();
  1363. }
  1364. /*****************************************************************************
  1365.  * FUNCTION
  1366.  *  IsSimControlProcedure
  1367.  * DESCRIPTION
  1368.  *  This function is a stub for checking sim control proc.
  1369.  *  
  1370.  *  This is a part of other application
  1371.  * PARAMETERS
  1372.  *  buf     [IN]        
  1373.  * RETURNS
  1374.  *  void
  1375.  *****************************************************************************/
  1376. pBOOL IsSimControlProcedure(PU8 buf)
  1377. {
  1378.     /*----------------------------------------------------------------*/
  1379.     /* Local Variables                                                */
  1380.     /*----------------------------------------------------------------*/
  1381.     /*----------------------------------------------------------------*/
  1382.     /* Code Body                                                      */
  1383.     /*----------------------------------------------------------------*/
  1384.     return FALSE;
  1385. }
  1386. /*****************************************************************************
  1387.  * FUNCTION
  1388.  *  IsManufactuerSpecific
  1389.  * DESCRIPTION
  1390.  *  This function is a stub for checking manufactuer specific string
  1391.  *  
  1392.  *  This is a part of other application
  1393.  * PARAMETERS
  1394.  *  buf     [IN]        
  1395.  * RETURNS
  1396.  *  void
  1397.  *****************************************************************************/
  1398. pBOOL IsManufactuerSpecific(PU8 buf)
  1399. {
  1400.     /*----------------------------------------------------------------*/
  1401.     /* Local Variables                                                */
  1402.     /*----------------------------------------------------------------*/
  1403.     /*----------------------------------------------------------------*/
  1404.     /* Code Body                                                      */
  1405.     /*----------------------------------------------------------------*/
  1406.     return FALSE;
  1407. }
  1408. /*****************************************************************************
  1409.  * FUNCTION
  1410.  *  SetSideVolumeKeysForCM
  1411.  * DESCRIPTION
  1412.  *  Sets Key Handlers for Volume Key in CM
  1413.  * PARAMETERS
  1414.  *  void
  1415.  * RETURNS
  1416.  *  void
  1417.  *****************************************************************************/
  1418. void SetSideVolumeKeysForCM(void)
  1419. {
  1420.     /*----------------------------------------------------------------*/
  1421.     /* Local Variables                                                */
  1422.     /*----------------------------------------------------------------*/
  1423.     /*----------------------------------------------------------------*/
  1424.     /* Code Body                                                      */
  1425.     /*----------------------------------------------------------------*/
  1426.     SetKeyHandler(DummyAforSideKeyHandling, KEY_VOL_UP, KEY_EVENT_DOWN);
  1427.     SetKeyHandler(DummyCforSideKeyHandling, KEY_VOL_DOWN, KEY_EVENT_DOWN);
  1428. #ifdef __CTM_SUPPORT__
  1429.     if (ctm_p->status == FALSE)
  1430. #endif /* __CTM_SUPPORT__ */ 
  1431.     {
  1432.     SetKeyHandler(DummyBforSideKeyHandling, KEY_VOL_UP, KEY_LONG_PRESS);
  1433. #ifdef __MMI_IN_CALL_CAMERA_KEY_START_SOUND_RECORD__
  1434.     SetKeyHandler(DummyBforSideKeyHandling, KEY_CAMERA, KEY_EVENT_UP);
  1435. #endif 
  1436.         SetKeyHandler(DummyDforSideKeyHandling, KEY_VOL_DOWN, KEY_LONG_PRESS);
  1437.     }
  1438.     SetKeyHandler(MMI_dummy_function, KEY_VOL_UP, KEY_REPEAT);
  1439.     SetKeyHandler(MMI_dummy_function, KEY_VOL_DOWN, KEY_REPEAT);
  1440. }
  1441. /*****************************************************************************
  1442.  * FUNCTION
  1443.  *  DummyAforSideKeyHandling
  1444.  * DESCRIPTION
  1445.  *  Sets Key Handler for Volume Up Key in CM
  1446.  * PARAMETERS
  1447.  *  void
  1448.  * RETURNS
  1449.  *  void
  1450.  *****************************************************************************/
  1451. void DummyAforSideKeyHandling(void)
  1452. {
  1453.     /*----------------------------------------------------------------*/
  1454.     /* Local Variables                                                */
  1455.     /*----------------------------------------------------------------*/
  1456.     /*----------------------------------------------------------------*/
  1457.     /* Code Body                                                      */
  1458.     /*----------------------------------------------------------------*/
  1459.     SetKeyHandler(SetKeyPadVolUp, KEY_VOL_UP, KEY_EVENT_UP);
  1460. }
  1461. /*****************************************************************************
  1462.  * FUNCTION
  1463.  *  DummyBforSideKeyHandling
  1464.  * DESCRIPTION
  1465.  *  Sets Key Handler for Volume Up Key in CM
  1466.  * PARAMETERS
  1467.  *  void
  1468.  * RETURNS
  1469.  *  void
  1470.  *****************************************************************************/
  1471. void DummyBforSideKeyHandling(void)
  1472. {
  1473.     /*----------------------------------------------------------------*/
  1474.     /* Local Variables                                                */
  1475.     /*----------------------------------------------------------------*/
  1476.     /*----------------------------------------------------------------*/
  1477.     /* Code Body                                                      */
  1478.     /*----------------------------------------------------------------*/
  1479.     ClearKeyHandler(KEY_VOL_UP, KEY_EVENT_UP);
  1480. #ifdef __MMI_IN_CALL_CAMERA_KEY_START_SOUND_RECORD__
  1481.     ClearKeyHandler(KEY_VOL_UP, KEY_LONG_PRESS);
  1482.     ClearKeyHandler(KEY_CAMERA, KEY_EVENT_UP);
  1483. #endif /* __MMI_IN_CALL_CAMERA_KEY_START_SOUND_RECORD__ */ 
  1484.     SetKeyPadStartVoiceRecordLongPress();
  1485. }
  1486. /*****************************************************************************
  1487.  * FUNCTION
  1488.  *  DummyCforSideKeyHandling
  1489.  * DESCRIPTION
  1490.  *  Sets Key Handler for Volume Down Key in CM
  1491.  * PARAMETERS
  1492.  *  void
  1493.  * RETURNS
  1494.  *  void
  1495.  *****************************************************************************/
  1496. void DummyCforSideKeyHandling(void)
  1497. {
  1498.     /*----------------------------------------------------------------*/
  1499.     /* Local Variables                                                */
  1500.     /*----------------------------------------------------------------*/
  1501.     /*----------------------------------------------------------------*/
  1502.     /* Code Body                                                      */
  1503.     /*----------------------------------------------------------------*/
  1504.     SetKeyHandler(SetKeyPadVolDown, KEY_VOL_DOWN, KEY_EVENT_UP);
  1505. }
  1506. /*****************************************************************************
  1507.  * FUNCTION
  1508.  *  DummyDforSideKeyHandling
  1509.  * DESCRIPTION
  1510.  *  Sets Key Handler for Volume Down Key in CM
  1511.  * PARAMETERS
  1512.  *  void
  1513.  * RETURNS
  1514.  *  void
  1515.  *****************************************************************************/
  1516. void DummyDforSideKeyHandling(void)
  1517. {
  1518.     /*----------------------------------------------------------------*/
  1519.     /* Local Variables                                                */
  1520.     /*----------------------------------------------------------------*/
  1521.     /*----------------------------------------------------------------*/
  1522.     /* Code Body                                                      */
  1523.     /*----------------------------------------------------------------*/
  1524.     ClearKeyHandler(KEY_VOL_DOWN, KEY_EVENT_UP);
  1525.     SetKeyPadStopVoiceRecordLongPress();
  1526. }
  1527. /*****************************************************************************
  1528.  * FUNCTION
  1529.  *  SetKeyPadStartVoiceRecordLongPress
  1530.  * DESCRIPTION
  1531.  *  To stop voice memo recording
  1532.  * PARAMETERS
  1533.  *  void
  1534.  * RETURNS
  1535.  *  void
  1536.  *****************************************************************************/
  1537. void SetKeyPadStartVoiceRecordLongPress(void)
  1538. {
  1539.     /*----------------------------------------------------------------*/
  1540.     /* Local Variables                                                */
  1541.     /*----------------------------------------------------------------*/
  1542.     /*----------------------------------------------------------------*/
  1543.     /* Code Body                                                      */
  1544.     /*----------------------------------------------------------------*/
  1545.     if (GetTotalActiveCallCount() > 0)
  1546.     {
  1547.     #ifdef __MMI_SOUND_RECORDER__
  1548.         /* Begin: added by Tim for sound recorder in call */
  1549.         mmi_sndrec_entry_from_call();
  1550.         /* End: added by Tim for sound recorder in call */
  1551.     #else /* __MMI_SOUND_RECORDER__ */ 
  1552.         MakePsStartVoiceRecord();
  1553.     #endif /* __MMI_SOUND_RECORDER__ */ 
  1554.     }
  1555. }
  1556. /*****************************************************************************
  1557.  * FUNCTION
  1558.  *  SetKeyPadStopVoiceRecordLongPress
  1559.  * DESCRIPTION
  1560.  *  To stop voice memo recording
  1561.  * PARAMETERS
  1562.  *  void
  1563.  * RETURNS
  1564.  *  void
  1565.  *****************************************************************************/
  1566. void SetKeyPadStopVoiceRecordLongPress(void)
  1567. {
  1568.     /*----------------------------------------------------------------*/
  1569.     /* Local Variables                                                */
  1570.     /*----------------------------------------------------------------*/
  1571.     /*----------------------------------------------------------------*/
  1572.     /* Code Body                                                      */
  1573.     /*----------------------------------------------------------------*/
  1574.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_StopRecord));
  1575.     SetVoiceRecordingFlag(FALSE);
  1576.     HideStatusIcon(STATUS_ICON_VOICE_RECORD);
  1577.     UpdateStatusIcons();
  1578. #ifdef __MMI_SOUND_RECORDER__
  1579.     // Begin: added by Tim for sound recorder in call
  1580.     //      mdi_audio_stop_record();
  1581.     // End: added by Tim for sound recorder in call
  1582. #else /* __MMI_SOUND_RECORDER__ */ 
  1583.     MakePsStopVoiceRecord();
  1584. #endif /* __MMI_SOUND_RECORDER__ */ 
  1585. }