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

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.  *   OutgoingCallmanagement.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.  * removed!
  113.  * removed!
  114.  * 
  115.  *
  116.  * removed!
  117.  * removed!
  118.  * 
  119.  *
  120.  * removed!
  121.  * removed!
  122.  * 
  123.  *
  124.  * removed!
  125.  * removed!
  126.  * 
  127.  *
  128.  * removed!
  129.  * removed!
  130.  * 
  131.  *
  132.  * removed!
  133.  * removed!
  134.  * 
  135.  *
  136.  * removed!
  137.  * removed!
  138.  * 
  139.  *
  140.  * removed!
  141.  * removed!
  142.  * 
  143.  *
  144.  * removed!
  145.  * removed!
  146.  * 
  147.  *
  148.  * removed!
  149.  * removed!
  150.  * 
  151.  *
  152.  * removed!
  153.  * removed!
  154.  * 
  155.  *
  156.  * removed!
  157.  * removed!
  158.  * 
  159.  *
  160.  * removed!
  161.  * removed!
  162.  * 
  163.  *
  164.  * removed!
  165.  * removed!
  166.  * 
  167.  *
  168.  * removed!
  169.  * removed!
  170.  * 
  171.  *
  172.  * removed!
  173.  * removed!
  174.  * 
  175.  *
  176.  * removed!
  177.  * removed!
  178.  * 
  179.  *
  180.  * removed!
  181.  * removed!
  182.  * 
  183.  *
  184.  * removed!
  185.  * removed!
  186.  * 
  187.  *
  188.  * removed!
  189.  * removed!
  190.  * 
  191.  *
  192.  * removed!
  193.  * removed!
  194.  * 
  195.  *
  196.  * removed!
  197.  * removed!
  198.  * 
  199.  *
  200.  * removed!
  201.  * removed!
  202.  * 
  203.  *
  204.  * removed!
  205.  * removed!
  206.  * 
  207.  *
  208.  * removed!
  209.  * removed!
  210.  * 
  211.  *
  212.  * removed!
  213.  * removed!
  214.  * 
  215.  *
  216.  * removed!
  217.  * removed!
  218.  * 
  219.  *
  220.  * removed!
  221.  * removed!
  222.  * 
  223.  *
  224.  * removed!
  225.  * removed!
  226.  * 
  227.  *
  228.  * removed!
  229.  * removed!
  230.  * 
  231.  *
  232.  * removed!
  233.  * removed!
  234.  * 
  235.  *
  236.  * removed!
  237.  * removed!
  238.  * 
  239.  *
  240.  * removed!
  241.  * removed!
  242.  * 
  243.  *
  244.  * removed!
  245.  * removed!
  246.  * 
  247.  *
  248.  * removed!
  249.  * removed!
  250.  * 
  251.  *
  252.  * removed!
  253.  * removed!
  254.  * 
  255.  *
  256.  * removed!
  257.  * removed!
  258.  * 
  259.  *
  260.  * removed!
  261.  * removed!
  262.  * 
  263.  *
  264.  * removed!
  265.  * removed!
  266.  * 
  267.  *
  268.  * removed!
  269.  * removed!
  270.  * 
  271.  *
  272.  * removed!
  273.  * removed!
  274.  * 
  275.  *
  276.  * removed!
  277.  * removed!
  278.  * 
  279.  *
  280.  * removed!
  281.  * removed!
  282.  * 
  283.  *
  284.  * removed!
  285.  * removed!
  286.  * 
  287.  *
  288.  * removed!
  289.  * removed!
  290.  * 
  291.  *
  292.  * removed!
  293.  * removed!
  294.  * 
  295.  *
  296.  * removed!
  297.  * removed!
  298.  * 
  299.  *
  300.  * removed!
  301.  * removed!
  302.  * 
  303.  *
  304.  * removed!
  305.  * removed!
  306.  * 
  307.  *
  308.  * removed!
  309.  * removed!
  310.  * 
  311.  *
  312.  * removed!
  313.  * removed!
  314.  * 
  315.  *
  316.  * removed!
  317.  * removed!
  318.  * 
  319.  *
  320.  * removed!
  321.  * removed!
  322.  * 
  323.  *
  324.  * removed!
  325.  * removed!
  326.  * 
  327.  *
  328.  * removed!
  329.  * removed!
  330.  * 
  331.  *
  332.  * removed!
  333.  * removed!
  334.  * 
  335.  *
  336.  * removed!
  337.  * removed!
  338.  * 
  339.  *
  340.  * removed!
  341.  * removed!
  342.  * 
  343.  *
  344.  * removed!
  345.  * removed!
  346.  * 
  347.  *
  348.  * removed!
  349.  * removed!
  350.  * 
  351.  *
  352.  * removed!
  353.  * removed!
  354.  * 
  355.  *
  356.  * removed!
  357.  * removed!
  358.  * 
  359.  *
  360.  * removed!
  361.  * removed!
  362.  * Apply new bootup revise APIs
  363.  *
  364.  * removed!
  365.  * removed!
  366.  * 
  367.  *
  368.  * removed!
  369.  * removed!
  370.  * 
  371.  *
  372.  * removed!
  373.  * removed!
  374.  * 
  375.  *
  376.  * removed!
  377.  * removed!
  378.  * 
  379.  *
  380.  * removed!
  381.  * removed!
  382.  * 
  383.  *
  384.  * removed!
  385.  * removed!
  386.  * 
  387.  *
  388.  * removed!
  389.  * removed!
  390.  * 
  391.  *
  392.  * removed!
  393.  * removed!
  394.  * 
  395.  *
  396.  * removed!
  397.  * removed!
  398.  * 
  399.  *
  400.  * removed!
  401.  * removed!
  402.  * 
  403.  *
  404.  *******************************************************************************/
  405. /**
  406.  * Copyright Notice
  407.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  408.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  409.  *  (It is illegal to remove this copyright notice from this software or any
  410.  *  portion of it)
  411.  */
  412. /**************************************************************
  413.    FILENAME : OutgoingCallmanagement.c
  414.    PURPOSE     : Call Management application
  415.    REMARKS     : nil
  416.    AUTHOR      : Subramanya BG
  417.    DATE     : Nov 11,02
  418. **************************************************************/
  419. #include "stdC.h"
  420. #include "MMI_Features.h"
  421. #include "L4Dr.h"
  422. #include "L4Dr1.h"
  423. #include "PixtelDataTypes.h"
  424. #include "DebugInitDef.h"
  425. #include "ProtocolEvents.h"
  426. #include "EventsGprot.h"
  427. #include "HistoryGprot.h"
  428. #include "SubLCDHistoryGprot.h"
  429. #include "GlobalDefs.h"
  430. #include "GlobalScrEnum.h"
  431. #include "KeyBrd.h"
  432. #include "TimerEvents.h"
  433. #include "CommonScreens.h"
  434. #include "wgui.h"
  435. #include "Wgui_categories_popup.h"
  436. #include "wgui_categories_CM.h"
  437. #include "DateTimeGprot.h"
  438. /* micha0521 */
  439. #include "SATDefs.h"
  440. #include "SATGProts.h"
  441. #include "SimDetectionGexdcl.h"
  442. #include "gpioInc.h"
  443. #include "CSP.h"
  444. #include "CallSetUp.h"
  445. #include "ProfileGprots.h"
  446. #include "ManageCallMain.h"
  447. #include "PhoneBookDef.h"
  448. #include "PhoneBookGprot.h"
  449. #include "MessagesExDcl.h"
  450. #include "MessagesResourceData.h"
  451. #include "SMSApi.h"
  452. #include "AlarmFrameworkProt.h"
  453. #include "mdi_datatype.h"
  454. #include "mdi_audio.h"
  455. #ifdef __MMI_VOICE_MEMO__
  456. #include "VoiceMemoProt.h"
  457. #endif 
  458. #ifdef __MMI_SOUND_RECORDER__
  459. #include "SoundRecorderProt.h"
  460. #endif 
  461. #ifdef __MMI_AUDIO_PLAYER__
  462. #include "AudioPlayerProt.h"
  463. #endif 
  464. #ifdef __MMI_BT_HP_SUPPORT__
  465. #include "BTMMIHPGprots.h"
  466. #endif 
  467. #ifdef __MMI_BT_SUPPORT__
  468. #include "BTMMIScrGprots.h"
  469. #endif 
  470. #ifdef __CTM_SUPPORT__
  471. #include "TextPhoneDef.h"
  472. #include "TextPhoneProt.h"
  473. #endif /* __CTM_SUPPORT__ */ 
  474. #ifdef __MMI_VOIP__
  475. #include "VoIPGProt.h"
  476. #endif
  477. #include "CallManagementIdDef.h"
  478. #include "CallManagementStruct.h"
  479. #include "CallStructureManagementProt.h"
  480. #include "CmErrorTypes.h"
  481. #include "CmErrorHandlersProt.h"
  482. #include "HistoryHelperProt.h"
  483. #include "CommonStubsProt.h"
  484. #include "PsCallHelperDef.h"
  485. #include "mmiapi_struct.h"
  486. #include "PsCallHelperGprot.h"
  487. #include "RedialHelperGProt.h"
  488. #include "CallManagementGprot.h"
  489. #include "IncomingCallManagementProt.h"
  490. #include "OutgoingCallHelperProt.h"
  491. #include "OutgoingCallManagementProt.h"
  492. /* micha1115 */
  493. #include "CallSetUpEnum.h"
  494. #include "SimDetectionGprot.h"
  495. #define TEMP_NO 10
  496. #define SCR_TEXT_LEN 50
  497. static OUTGOING_CALL gCurrOutcall;  /* This is a global variable usefull till the */
  498. static PU8 gcallList[MAX_CALLS];
  499. static U16 gcallListImage[MAX_CALLS];
  500. static U16 gcallListlen = 0;
  501. static U16 gHilitedCall = 0;
  502. static U8 gListOperation = 0;
  503. U16 gtmpOutgoingIndex;
  504. extern MYTIME gTimeStructForCallDuration;
  505. extern const U16 CMIdleScreenDigits[];
  506. extern S8 DTMFPadCallBuffer[MAX_DIGITS_USSD];
  507. extern PU8 gdispnameForSubLCD;
  508. extern void MMIProcessActionMsg(void);
  509. #if defined(__MMI_PHB_CALL_SHOW_PICTURE_FROM_FILE__)
  510. extern S8 *mmi_phb_image_get_path_from_id(U16 index);
  511. #endif 
  512. /*****************************************************************************
  513.  * FUNCTION
  514.  *  ReinitializeOutgoingCall
  515.  * DESCRIPTION
  516.  *  To ReInitialize the Outgoing Call Management Application
  517.  * PARAMETERS
  518.  *  void
  519.  * RETURNS
  520.  *  void
  521.  *****************************************************************************/
  522. void ReinitializeOutgoingCall(void)
  523. {
  524.     /*----------------------------------------------------------------*/
  525.     /* Local Variables                                                */
  526.     /*----------------------------------------------------------------*/
  527.     /*----------------------------------------------------------------*/
  528.     /* Code Body                                                      */
  529.     /*----------------------------------------------------------------*/
  530.     SetDialIndication(FALSE);
  531. #ifdef __IP_NUMBER__
  532.     SetTempUseIPNumber(FALSE);
  533. #endif 
  534.     SetProtocolEventHandler(PsCBackPlayInternalTone, PRT_PLAY_GSM_TONE);
  535.     SetProtocolEventHandler(OutgoingCallConnected, PRT_OUTGOINGCALL_CONNECTED);
  536.     SetProtocolEventHandler(PsCbackOutgoingCallIdSync, PRT_OUTGOINGCALL_EVENT_RSP);
  537.     SetProtocolEventHandler(PsCBackUSSDResponse, PRT_USSD_RES_SUCCESS);
  538.     #ifdef MMI_ON_HARDWARE_P
  539.     SetProtocolEventHandler(MakeCallReqInd, PRT_MMI_MAKE_CALL_REQ_IND);
  540. #endif /* MMI_ON_HARDWARE_P */
  541. }
  542. /*****************************************************************************
  543.  * FUNCTION
  544.  *  InitOutGoingCall
  545.  * DESCRIPTION
  546.  *  To Initialize the Outgoing Call Management Application
  547.  *  
  548.  *  This function sets up the handlers required for event flow and
  549.  *  application management.This function is invoked from InitIncomingCall.
  550.  * PARAMETERS
  551.  *  void
  552.  * RETURNS
  553.  *  void
  554.  *****************************************************************************/
  555. void InitOutGoingCall(void)
  556. {
  557.     /*----------------------------------------------------------------*/
  558.     /* Local Variables                                                */
  559.     /*----------------------------------------------------------------*/
  560.     /*----------------------------------------------------------------*/
  561.     /* Code Body                                                      */
  562.     /*----------------------------------------------------------------*/
  563.     ReinitializeOutgoingCall();
  564.     SetHiliteHandler(MITEM2011_CM_S_ACTIVE_END, HiliteM2019AllActiveEnd);
  565.     SetHiliteHandler(MITEM2011_CM_END_SINGLE, HiliteM2011EndSingle);
  566.     SetHiliteHandler(MITEM2011_CM_INC_END_SINGLE, HiliteM2011IncEndSingle);
  567.     SetHiliteHandler(MITEM2019_CM_ALL_ACTIVE_END, HiliteM2019AllActiveEnd);
  568.     SetHiliteHandler(MITEM2020_CM_ALL_HELD_END, HiliteM2020AllHeldEnd);
  569.     SetHiliteHandler(MITEM2050_CM_END_HELD_ENDALL_HELD, HiliteM2020AllHeldEnd);
  570.     SetHiliteHandler(MITEM2011_CM_END, HiliteM2016AllCallEnd);
  571.     SetHiliteHandler(MITEM2011_CM_END_ALL, HiliteM2016AllCallEnd);
  572.     SetHiliteHandler(MITEM2016_CM_ALL_CALL_END, HiliteM2016AllCallEnd);
  573.     SetHiliteHandler(MITEM_OUTGOING_REJECT, HiliteIncomingReject);
  574.     SetHiliteHandler(MITEM2010_CM_ACTIVE_HOLD, HiliteM2010ActiveHold);
  575.     SetHiliteHandler(MITEM2010_CM_M_ACTIVE_HOLD, HiliteM2010ActiveHold);
  576.     SetHiliteHandler(MITEM2012_CM_HELD_RETRIEVE, HiliteM2012HeldRetrieve);
  577.     SetHiliteHandler(MITEM2012_CM_M_HELD_RETRIEVE, HiliteM2012HeldRetrieve);
  578.     SetHiliteHandler(MITEM2014_CM_CALL_SWAP, HiliteM2014Swap);
  579.     SetHiliteHandler(MITEM2015_CM_CALL_CONFER, HiliteM2015Conference);
  580.     SetHiliteHandler(MITEM2017_CM_CALL_TRANSFER, HiliteM2017Transfer);
  581.     SetHiliteHandler(MITEM2018_CM_CALL_SPLIT, HiliteM2018Split);
  582.     SetHiliteHandler(MITEM2031_CM_PBOOK, HiliteM2031PBookAppEntry);
  583.     SetHiliteHandler(MITEM2032_CM_SMS, HiliteM2032MsgAppEntry);
  584. #ifdef __MMI_VOICE_MEMO__
  585.     SetHiliteHandler(MITEM2022_CM_VOICE_MEMO, HiliteM2022VoiceMemo);
  586. #endif 
  587. #ifdef __MMI_SOUND_RECORDER__
  588.     SetHiliteHandler(MITEM2026_CM_SOUND_RECORDER, HiliteM2026SoundRecorder);
  589. #endif 
  590. #ifdef __MMI_AUDIO_PLAYER__
  591.     SetHiliteHandler(MITEM2025_CM_AUDIO_PLAYER, HiliteM2025AudioPlayer);
  592. #endif 
  593. #if defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__)
  594.     SetHiliteHandler(MITEM_CM_BT_SETPATH, HiliteBTCMSetPath);
  595. #endif 
  596.     SetHiliteHandler(MITEM2020_CM_MUTE, HiliteM2020Mute);
  597.     SetHiliteHandler(MITEM2024_CM_DTMF, HiliteM2024DTMF);
  598.     SetHiliteHandler(MITEM2021_CM_NEWCALL, HiliteM2021NewCall);
  599. #ifdef __CTM_SUPPORT__
  600.     SetHiliteHandler(MITEM2027_CM_CTM, HiliteM2027CTM);
  601. #endif 
  602.     SetHintHandler(MITEM2020_CM_MUTE, Hint2020Mute);
  603.     SetHintHandler(MITEM2024_CM_DTMF, Hint2024DTMF);
  604. }
  605. /*****************************************************************************
  606.  * FUNCTION
  607.  *  HiliteM2011EndSingle
  608.  * DESCRIPTION
  609.  *  hilite handler to invoke End Single function call
  610.  * PARAMETERS
  611.  *  void
  612.  * RETURNS
  613.  *  void
  614.  *****************************************************************************/
  615. void HiliteM2011EndSingle(void)
  616. {
  617.     /*----------------------------------------------------------------*/
  618.     /* Local Variables                                                */
  619.     /*----------------------------------------------------------------*/
  620.     /*----------------------------------------------------------------*/
  621.     /* Code Body                                                      */
  622.     /*----------------------------------------------------------------*/
  623.     PRINT_INFORMATION(("n 2011 End Single n"));
  624.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  625.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  626. #ifdef __GPRS_MODE__
  627.     SetLeftSoftkeyFunction(HangupHilited, KEY_EVENT_UP);
  628. #else 
  629.     SetLeftSoftkeyFunction(EndSingleAndGoBack, KEY_EVENT_UP);
  630. #endif 
  631.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  632. }
  633. /*****************************************************************************
  634.  * FUNCTION
  635.  *  HiliteM2011IncEndSingle
  636.  * DESCRIPTION
  637.  *  hilite handler to invoke End Single function call
  638.  *  when MT call present
  639.  * PARAMETERS
  640.  *  void
  641.  * RETURNS
  642.  *  void
  643.  *****************************************************************************/
  644. void HiliteM2011IncEndSingle(void)
  645. {
  646.     /*----------------------------------------------------------------*/
  647.     /* Local Variables                                                */
  648.     /*----------------------------------------------------------------*/
  649.     /*----------------------------------------------------------------*/
  650.     /* Code Body                                                      */
  651.     /*----------------------------------------------------------------*/
  652.     PRINT_INFORMATION(("n 2011 End Single n"));
  653.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  654.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  655.     SetLeftSoftkeyFunction(EndSingleAndGoBack, KEY_EVENT_UP);
  656.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  657. }
  658. /*****************************************************************************
  659.  * FUNCTION
  660.  *  HiliteM2011SingleActiveEnd
  661.  * DESCRIPTION
  662.  *  Hilite function for selecting active call to end
  663.  *  
  664.  *  In case there is only one active call the incoming call must be accepted
  665.  *  otherwise a screen to select an active call to end must be Shown
  666.  * PARAMETERS
  667.  *  void
  668.  * RETURNS
  669.  *  void
  670.  *****************************************************************************/
  671. void HiliteM2011SingleActiveEnd(void)
  672. {
  673.     /*----------------------------------------------------------------*/
  674.     /* Local Variables                                                */
  675.     /*----------------------------------------------------------------*/
  676.     /*----------------------------------------------------------------*/
  677.     /* Code Body                                                      */
  678.     /*----------------------------------------------------------------*/
  679.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  680.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  681.     SetLeftSoftkeyFunction(EndSingleActiveAndGoBack, KEY_EVENT_UP);
  682.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  683. }
  684. /*****************************************************************************
  685.  * FUNCTION
  686.  *  HiliteM2019AllActiveEnd
  687.  * DESCRIPTION
  688.  *  hilite handler to invoke function that hangup all the active call
  689.  * PARAMETERS
  690.  *  void
  691.  * RETURNS
  692.  *  void
  693.  *****************************************************************************/
  694. void HiliteM2019AllActiveEnd(void)
  695. {
  696.     /*----------------------------------------------------------------*/
  697.     /* Local Variables                                                */
  698.     /*----------------------------------------------------------------*/
  699.     /*----------------------------------------------------------------*/
  700.     /* Code Body                                                      */
  701.     /*----------------------------------------------------------------*/
  702.     PRINT_INFORMATION(("n 2019 AllActiveEnd n"));
  703.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  704.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  705.     SetLeftSoftkeyFunction(HangupallActive, KEY_EVENT_UP);
  706.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  707. }
  708. /*****************************************************************************
  709.  * FUNCTION
  710.  *  HiliteM2020AllHeldEnd
  711.  * DESCRIPTION
  712.  *  hilite handler to invoke the function that hangup all the heldcall
  713.  * PARAMETERS
  714.  *  void
  715.  * RETURNS
  716.  *  void
  717.  *****************************************************************************/
  718. void HiliteM2020AllHeldEnd(void)
  719. {
  720.     /*----------------------------------------------------------------*/
  721.     /* Local Variables                                                */
  722.     /*----------------------------------------------------------------*/
  723.     /*----------------------------------------------------------------*/
  724.     /* Code Body                                                      */
  725.     /*----------------------------------------------------------------*/
  726.     PRINT_INFORMATION(("n 2020 AllHeldEnd n"));
  727.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  728.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  729.     SetLeftSoftkeyFunction(HangupallHeld, KEY_EVENT_UP);
  730.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  731. }
  732. /*****************************************************************************
  733.  * FUNCTION
  734.  *  HiliteM2016AllCallEnd
  735.  * DESCRIPTION
  736.  *  hilite handler to invoke the hangup of all the calls
  737.  * PARAMETERS
  738.  *  void
  739.  * RETURNS
  740.  *  void
  741.  *****************************************************************************/
  742. void HiliteM2016AllCallEnd(void)
  743. {
  744.     /*----------------------------------------------------------------*/
  745.     /* Local Variables                                                */
  746.     /*----------------------------------------------------------------*/
  747.     /*----------------------------------------------------------------*/
  748.     /* Code Body                                                      */
  749.     /*----------------------------------------------------------------*/
  750.     PRINT_INFORMATION(("n 2016 AllCallEnd n"));
  751.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  752.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  753.     SetLeftSoftkeyFunction(KbCBackEndAllCallsExceptIncoming, KEY_EVENT_UP);
  754.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  755. }
  756. /*****************************************************************************
  757.  * FUNCTION
  758.  *  HiliteIncomingReject
  759.  * DESCRIPTION
  760.  *  hilite handler to incoming reject call
  761.  * PARAMETERS
  762.  *  void
  763.  * RETURNS
  764.  *  void
  765.  *****************************************************************************/
  766. void HiliteIncomingReject(void)
  767. {
  768.     /*----------------------------------------------------------------*/
  769.     /* Local Variables                                                */
  770.     /*----------------------------------------------------------------*/
  771.     /*----------------------------------------------------------------*/
  772.     /* Code Body                                                      */
  773.     /*----------------------------------------------------------------*/
  774.     PRINT_INFORMATION(("n HiliteIncomingRejectn"));
  775.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  776.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  777.     SetLeftSoftkeyFunction(KbCBackCallIncomingRejected, KEY_EVENT_UP);
  778.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  779. }
  780. /*****************************************************************************
  781.  * FUNCTION
  782.  *  HiliteM2010ActiveHold
  783.  * DESCRIPTION
  784.  *  hilite handler to invoke the hold function call
  785.  * PARAMETERS
  786.  *  void
  787.  * RETURNS
  788.  *  void
  789.  *****************************************************************************/
  790. void HiliteM2010ActiveHold(void)
  791. {
  792.     /*----------------------------------------------------------------*/
  793.     /* Local Variables                                                */
  794.     /*----------------------------------------------------------------*/
  795.     /*----------------------------------------------------------------*/
  796.     /* Code Body                                                      */
  797.     /*----------------------------------------------------------------*/
  798.     PRINT_INFORMATION(("n 2010 ActiveHoldn"));
  799.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  800.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  801.     SetLeftSoftkeyFunction(MakeActiveCallHold, KEY_EVENT_UP);
  802.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  803. }
  804. /*****************************************************************************
  805.  * FUNCTION
  806.  *  HiliteM2012HeldRetrieve
  807.  * DESCRIPTION
  808.  *  hilite handler to invoke the Retrieve function call
  809.  * PARAMETERS
  810.  *  void
  811.  * RETURNS
  812.  *  void
  813.  *****************************************************************************/
  814. void HiliteM2012HeldRetrieve(void)
  815. {
  816.     /*----------------------------------------------------------------*/
  817.     /* Local Variables                                                */
  818.     /*----------------------------------------------------------------*/
  819.     /*----------------------------------------------------------------*/
  820.     /* Code Body                                                      */
  821.     /*----------------------------------------------------------------*/
  822.     PRINT_INFORMATION(("n 2012 HeldRetrieve n"));
  823.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  824.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  825.     SetLeftSoftkeyFunction(RetrieveHeldCall, KEY_EVENT_UP);
  826.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  827. }
  828. /*****************************************************************************
  829.  * FUNCTION
  830.  *  HiliteM2014Swap
  831.  * DESCRIPTION
  832.  *  hilite handler to invoke the Swap function call
  833.  * PARAMETERS
  834.  *  void
  835.  * RETURNS
  836.  *  void
  837.  *****************************************************************************/
  838. void HiliteM2014Swap(void)
  839. {
  840.     /*----------------------------------------------------------------*/
  841.     /* Local Variables                                                */
  842.     /*----------------------------------------------------------------*/
  843.     /*----------------------------------------------------------------*/
  844.     /* Code Body                                                      */
  845.     /*----------------------------------------------------------------*/
  846.     PRINT_INFORMATION(("n 2014 Swap n"));
  847.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  848.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  849.     SetLeftSoftkeyFunction(SwapCall, KEY_EVENT_UP);
  850.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  851. }
  852. /*****************************************************************************
  853.  * FUNCTION
  854.  *  HiliteM2015Conference
  855.  * DESCRIPTION
  856.  *  hilite handler to invoke the Conference function call
  857.  * PARAMETERS
  858.  *  void
  859.  * RETURNS
  860.  *  void
  861.  *****************************************************************************/
  862. void HiliteM2015Conference(void)
  863. {
  864.     /*----------------------------------------------------------------*/
  865.     /* Local Variables                                                */
  866.     /*----------------------------------------------------------------*/
  867.     /*----------------------------------------------------------------*/
  868.     /* Code Body                                                      */
  869.     /*----------------------------------------------------------------*/
  870.     PRINT_INFORMATION(("n 2015 Conference n"));
  871.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  872.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  873.     SetLeftSoftkeyFunction(ConferenceCall, KEY_EVENT_UP);
  874.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  875. }
  876. /*****************************************************************************
  877.  * FUNCTION
  878.  *  HiliteM2017Transfer
  879.  * DESCRIPTION
  880.  *  hilite handler to invoke the function that transfer the call
  881.  *  
  882.  *  yet to  implement
  883.  * PARAMETERS
  884.  *  void
  885.  * RETURNS
  886.  *  void
  887.  *****************************************************************************/
  888. void HiliteM2017Transfer(void)
  889. {
  890.     /*----------------------------------------------------------------*/
  891.     /* Local Variables                                                */
  892.     /*----------------------------------------------------------------*/
  893.     /*----------------------------------------------------------------*/
  894.     /* Code Body                                                      */
  895.     /*----------------------------------------------------------------*/
  896.     PRINT_INFORMATION(("n 2017 Transfer n"));
  897.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  898.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  899.     SetLeftSoftkeyFunction(TransferCall, KEY_EVENT_UP);
  900.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  901. }
  902. /*****************************************************************************
  903.  * FUNCTION
  904.  *  HiliteM2018Split
  905.  * DESCRIPTION
  906.  *  hilite handler to invoke the Split function call
  907.  * PARAMETERS
  908.  *  void
  909.  * RETURNS
  910.  *  void
  911.  *****************************************************************************/
  912. void HiliteM2018Split(void)
  913. {
  914.     /*----------------------------------------------------------------*/
  915.     /* Local Variables                                                */
  916.     /*----------------------------------------------------------------*/
  917.     /*----------------------------------------------------------------*/
  918.     /* Code Body                                                      */
  919.     /*----------------------------------------------------------------*/
  920.     PRINT_INFORMATION(("n 2018 Split n"));
  921.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  922.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  923. #ifdef __GPRS_MODE__
  924.     SetLeftSoftkeyFunction(SplitHilited, KEY_EVENT_UP);
  925. #else 
  926.     SetLeftSoftkeyFunction(SplitAndGoBack, KEY_EVENT_UP);
  927. #endif 
  928.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  929. }
  930. /*****************************************************************************
  931.  * FUNCTION
  932.  *  DummyEnterPhbFrmActiveCall
  933.  * DESCRIPTION
  934.  *  set CM screen flag before go to PHB application
  935.  * PARAMETERS
  936.  *  void
  937.  * RETURNS
  938.  *  void
  939.  *****************************************************************************/
  940. void DummyEnterPhbFrmActiveCall(void)
  941. {
  942.     /*----------------------------------------------------------------*/
  943.     /* Local Variables                                                */
  944.     /*----------------------------------------------------------------*/
  945.     /*----------------------------------------------------------------*/
  946.     /* Code Body                                                      */
  947.     /*----------------------------------------------------------------*/
  948.     SetCMScrnFlag(FALSE);
  949.     mmi_phb_call_enter_from_active_call();
  950.     DeleteScreenIfPresent(SCR1003_CM_ACTIVECALLOPTIONS);    
  951. }
  952. /*****************************************************************************
  953.  * FUNCTION
  954.  *  HiliteM2031PBookAppEntry
  955.  * DESCRIPTION
  956.  *  hilite handler to invoke the Pbook app entry
  957.  * PARAMETERS
  958.  *  void
  959.  * RETURNS
  960.  *  void
  961.  *****************************************************************************/
  962. void HiliteM2031PBookAppEntry(void)
  963. {
  964.     /*----------------------------------------------------------------*/
  965.     /* Local Variables                                                */
  966.     /*----------------------------------------------------------------*/
  967.     /*----------------------------------------------------------------*/
  968.     /* Code Body                                                      */
  969.     /*----------------------------------------------------------------*/
  970.     PRINT_INFORMATION(("n 2031 PBookAppEntry n"));
  971.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  972.     SetKeyHandler(DummyEnterPhbFrmActiveCall, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  973.     SetLeftSoftkeyFunction(DummyEnterPhbFrmActiveCall, KEY_EVENT_UP);
  974.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  975. }
  976. /*****************************************************************************
  977.  * FUNCTION
  978.  *  DummyPreEntryScrMessagesMenuList
  979.  * DESCRIPTION
  980.  *  set CM screen flag before go to SMS application
  981.  * PARAMETERS
  982.  *  void
  983.  * RETURNS
  984.  *  void
  985.  *****************************************************************************/
  986. void DummyPreEntryScrMessagesMenuList(void)
  987. {
  988.     /*----------------------------------------------------------------*/
  989.     /* Local Variables                                                */
  990.     /*----------------------------------------------------------------*/
  991.     /*----------------------------------------------------------------*/
  992.     /* Code Body                                                      */
  993.     /*----------------------------------------------------------------*/
  994.     SetCMScrnFlag(FALSE);
  995.     PreEntryScrMessagesMenuList();
  996.     DeleteScreenIfPresent(SCR1003_CM_ACTIVECALLOPTIONS);    
  997. }
  998. /*****************************************************************************
  999.  * FUNCTION
  1000.  *  HiliteM2032MsgAppEntry
  1001.  * DESCRIPTION
  1002.  *  hilite handler to invoke the Msg App Entry function
  1003.  * PARAMETERS
  1004.  *  void
  1005.  * RETURNS
  1006.  *  void
  1007.  *****************************************************************************/
  1008. void HiliteM2032MsgAppEntry(void)
  1009. {
  1010.     /*----------------------------------------------------------------*/
  1011.     /* Local Variables                                                */
  1012.     /*----------------------------------------------------------------*/
  1013.     /*----------------------------------------------------------------*/
  1014.     /* Code Body                                                      */
  1015.     /*----------------------------------------------------------------*/
  1016.     PRINT_INFORMATION(("n 2032 MsgAppEntry n"));
  1017.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  1018.     SetKeyHandler(DummyPreEntryScrMessagesMenuList, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1019.     SetLeftSoftkeyFunction(DummyPreEntryScrMessagesMenuList, KEY_EVENT_UP);
  1020.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1021. }
  1022. #ifdef __MMI_VOICE_MEMO__
  1023. /*****************************************************************************
  1024.  * FUNCTION
  1025.  *  DummyEntryVoiceMemoInCall
  1026.  * DESCRIPTION
  1027.  *  set CM screen flag before go to Voice Memo application
  1028.  * PARAMETERS
  1029.  *  void
  1030.  * RETURNS
  1031.  *  void
  1032.  *****************************************************************************/
  1033. void DummyEntryVoiceMemoInCall(void)
  1034. {
  1035.     /*----------------------------------------------------------------*/
  1036.     /* Local Variables                                                */
  1037.     /*----------------------------------------------------------------*/
  1038.     /*----------------------------------------------------------------*/
  1039.     /* Code Body                                                      */
  1040.     /*----------------------------------------------------------------*/
  1041.     SetCMScrnFlag(FALSE);
  1042.     EntryVoiceMemoInCall();
  1043.     DeleteScreenIfPresent(SCR1003_CM_ACTIVECALLOPTIONS);    
  1044. }
  1045. /*****************************************************************************
  1046.  * FUNCTION
  1047.  *  HiliteM2022VoiceMemo
  1048.  * DESCRIPTION
  1049.  *  hilite handler to invoke the VoiceMemo function
  1050.  * PARAMETERS
  1051.  *  void
  1052.  * RETURNS
  1053.  *  void
  1054.  *****************************************************************************/
  1055. void HiliteM2022VoiceMemo(void)
  1056. {
  1057.     /*----------------------------------------------------------------*/
  1058.     /* Local Variables                                                */
  1059.     /*----------------------------------------------------------------*/
  1060.     /*----------------------------------------------------------------*/
  1061.     /* Code Body                                                      */
  1062.     /*----------------------------------------------------------------*/
  1063.     PRINT_INFORMATION(("n 2022 Voice Memo n"));
  1064.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1065.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  1066.     SetLeftSoftkeyFunction(DummyEntryVoiceMemoInCall, KEY_EVENT_UP);
  1067.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1068. }
  1069. #endif /* __MMI_VOICE_MEMO__ */ 
  1070. #ifdef __MMI_SOUND_RECORDER__
  1071. /*****************************************************************************
  1072.  * FUNCTION
  1073.  *  DummyEntrySoundRecorderInCall
  1074.  * DESCRIPTION
  1075.  *  set CM screen flag before go to Sound Recorder application
  1076.  * PARAMETERS
  1077.  *  void
  1078.  * RETURNS
  1079.  *  void
  1080.  *****************************************************************************/
  1081. void DummyEntrySoundRecorderInCall(void)
  1082. {
  1083.     /*----------------------------------------------------------------*/
  1084.     /* Local Variables                                                */
  1085.     /*----------------------------------------------------------------*/
  1086.     /*----------------------------------------------------------------*/
  1087.     /* Code Body                                                      */
  1088.     /*----------------------------------------------------------------*/
  1089.     SetCMScrnFlag(FALSE);
  1090.     mmi_sndrec_entry_in_call();
  1091.     DeleteScreenIfPresent(SCR1003_CM_ACTIVECALLOPTIONS);
  1092. }
  1093. /*****************************************************************************
  1094.  * FUNCTION
  1095.  *  HiliteM2026SoundRecorder
  1096.  * DESCRIPTION
  1097.  *  hilite handler to invoke the VoiceMemo function
  1098.  * PARAMETERS
  1099.  *  void
  1100.  * RETURNS
  1101.  *  void
  1102.  *****************************************************************************/
  1103. void HiliteM2026SoundRecorder(void)
  1104. {
  1105.     /*----------------------------------------------------------------*/
  1106.     /* Local Variables                                                */
  1107.     /*----------------------------------------------------------------*/
  1108.     /*----------------------------------------------------------------*/
  1109.     /* Code Body                                                      */
  1110.     /*----------------------------------------------------------------*/
  1111.     PRINT_INFORMATION(("n 2026 Sound Recorder n"));
  1112.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1113.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  1114.     SetLeftSoftkeyFunction(DummyEntrySoundRecorderInCall, KEY_EVENT_UP);
  1115.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1116. }
  1117. #endif /* __MMI_SOUND_RECORDER__ */ 
  1118. #ifdef __MMI_AUDIO_PLAYER__
  1119. /*****************************************************************************
  1120.  * FUNCTION
  1121.  *  DummyEntryAudioPlayerInCall
  1122.  * DESCRIPTION
  1123.  *  set CM screen flag before go to Audio Player application
  1124.  * PARAMETERS
  1125.  *  void
  1126.  * RETURNS
  1127.  *  void
  1128.  *****************************************************************************/
  1129. void DummyEntryAudioPlayerInCall(void)
  1130. {
  1131.     /*----------------------------------------------------------------*/
  1132.     /* Local Variables                                                */
  1133.     /*----------------------------------------------------------------*/
  1134.     /*----------------------------------------------------------------*/
  1135.     /* Code Body                                                      */
  1136.     /*----------------------------------------------------------------*/
  1137.     SetCMScrnFlag(FALSE);
  1138.     mmi_audply_entry_main();
  1139.     DeleteScreenIfPresent(SCR1003_CM_ACTIVECALLOPTIONS);    
  1140. }
  1141. /*****************************************************************************
  1142.  * FUNCTION
  1143.  *  HiliteM2025AudioPlayer
  1144.  * DESCRIPTION
  1145.  *  hilite handler to invoke the AudioPlayer function
  1146.  * PARAMETERS
  1147.  *  void
  1148.  * RETURNS
  1149.  *  void
  1150.  *****************************************************************************/
  1151. void HiliteM2025AudioPlayer(void)
  1152. {
  1153.     /*----------------------------------------------------------------*/
  1154.     /* Local Variables                                                */
  1155.     /*----------------------------------------------------------------*/
  1156.     /*----------------------------------------------------------------*/
  1157.     /* Code Body                                                      */
  1158.     /*----------------------------------------------------------------*/
  1159.     PRINT_INFORMATION(("n 2025 Audio Player n"));
  1160.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1161.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  1162.     SetLeftSoftkeyFunction(DummyEntryAudioPlayerInCall, KEY_EVENT_UP);
  1163.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1164. }
  1165. #endif /* __MMI_AUDIO_PLAYER__ */ 
  1166. #if defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__)
  1167. /*****************************************************************************
  1168.  * FUNCTION
  1169.  *  HiliteBTCMSetPath
  1170.  * DESCRIPTION
  1171.  *  
  1172.  * PARAMETERS
  1173.  *  void
  1174.  * RETURNS
  1175.  *  void
  1176.  *****************************************************************************/
  1177. void HiliteBTCMSetPath(void)
  1178. {
  1179.     /*----------------------------------------------------------------*/
  1180.     /* Local Variables                                                */
  1181.     /*----------------------------------------------------------------*/
  1182.     /*----------------------------------------------------------------*/
  1183.     /* Code Body                                                      */
  1184.     /*----------------------------------------------------------------*/
  1185.     PRINT_INFORMATION(("n CM--BT Set Voice Path n"));
  1186.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1187.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  1188.     SetLeftSoftkeyFunction(ProcessBTSetVoicePath, KEY_EVENT_UP);
  1189.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1190. }
  1191. /*****************************************************************************
  1192.  * FUNCTION
  1193.  *  ProcessBTSetVoicePath
  1194.  * DESCRIPTION
  1195.  *  
  1196.  * PARAMETERS
  1197.  *  void
  1198.  * RETURNS
  1199.  *  void
  1200.  *****************************************************************************/
  1201. void ProcessBTSetVoicePath(void)
  1202. {
  1203.     /*----------------------------------------------------------------*/
  1204.     /* Local Variables                                                */
  1205.     /*----------------------------------------------------------------*/
  1206.     /*----------------------------------------------------------------*/
  1207.     /* Code Body                                                      */
  1208.     /*----------------------------------------------------------------*/
  1209.     if (mmi_bt_is_incall_aud_swap2bt() == MMI_TRUE)
  1210.     {
  1211.         /* Current voice path in BT, shall transfer to AG */
  1212.         mmi_bt_switch_voice_path_incall(MMI_FALSE);
  1213.     #if 0
  1214. /* under construction !*/
  1215. /* under construction !*/
  1216. /* under construction !*/
  1217. /* under construction !*/
  1218. /* under construction !*/
  1219. /* under construction !*/
  1220. /* under construction !*/
  1221. /* under construction !*/
  1222.     #endif /* 0 */ 
  1223.     }
  1224.     else
  1225.     {
  1226.         /* Current voice path in AG, shall transfer to BT */
  1227.         mmi_bt_switch_voice_path_incall(MMI_TRUE);
  1228.     #if 0
  1229. /* under construction !*/
  1230. /* under construction !*/
  1231. /* under construction !*/
  1232. /* under construction !*/
  1233. /* under construction !*/
  1234. /* under construction !*/
  1235. /* under construction !*/
  1236. /* under construction !*/
  1237.     #endif /* 0 */ 
  1238.     }
  1239. }
  1240. #endif /* defined(__MMI_BT_HP_SUPPORT__) || defined(__MMI_BT_SUPPORT__) */ 
  1241. /*****************************************************************************
  1242.  * FUNCTION
  1243.  *  HiliteM2020Mute
  1244.  * DESCRIPTION
  1245.  *  hilite handler to invoke the Mute function
  1246.  * PARAMETERS
  1247.  *  void
  1248.  * RETURNS
  1249.  *  void
  1250.  *****************************************************************************/
  1251. void HiliteM2020Mute(void)
  1252. {
  1253.     /*----------------------------------------------------------------*/
  1254.     /* Local Variables                                                */
  1255.     /*----------------------------------------------------------------*/
  1256.     /*----------------------------------------------------------------*/
  1257.     /* Code Body                                                      */
  1258.     /*----------------------------------------------------------------*/
  1259.     PRINT_INFORMATION(("n 2020 Mute n"));
  1260.     if (IsPhoneInMute())
  1261.     {
  1262.         ChangeLeftSoftkey(STR_GLOBAL_OFF, IMG_SCR1002_OFF_LSK);
  1263.     }
  1264.     else
  1265.     {
  1266.         ChangeLeftSoftkey(STR_GLOBAL_ON, IMG_SCR1002_ON_LSK);
  1267.     }
  1268.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1269.     SetLeftSoftkeyFunction(OptionMuteorUnMutetheCall, KEY_EVENT_UP);
  1270.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1271. }
  1272. /*****************************************************************************
  1273.  * FUNCTION
  1274.  *  HiliteM2024DTMF
  1275.  * DESCRIPTION
  1276.  *  hilite handler to invoke the DTMF function
  1277.  * PARAMETERS
  1278.  *  void
  1279.  * RETURNS
  1280.  *  void
  1281.  *****************************************************************************/
  1282. void HiliteM2024DTMF(void)
  1283. {
  1284.     /*----------------------------------------------------------------*/
  1285.     /* Local Variables                                                */
  1286.     /*----------------------------------------------------------------*/
  1287.     /*----------------------------------------------------------------*/
  1288.     /* Code Body                                                      */
  1289.     /*----------------------------------------------------------------*/
  1290.     PRINT_INFORMATION(("n 2024 DTMF n"));
  1291.     if (GetDTMFFlag() == TRUE)
  1292.     {
  1293.         ChangeLeftSoftkey(STR_GLOBAL_OFF, IMG_SCR1002_OFF_LSK);
  1294.     }
  1295.     else
  1296.     {
  1297.         ChangeLeftSoftkey(STR_GLOBAL_ON, IMG_SCR1002_ON_LSK);
  1298.     }
  1299.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1300.     SetLeftSoftkeyFunction(DTMFFunction, KEY_EVENT_UP);
  1301.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1302. }
  1303. #ifdef __CTM_SUPPORT__
  1304. /*****************************************************************************
  1305.  * FUNCTION
  1306.  *  HiliteM2027CTM
  1307.  * DESCRIPTION
  1308.  *  hilite handler to invoke the CTM connection
  1309.  * PARAMETERS
  1310.  *  void
  1311.  * RETURNS
  1312.  *  void
  1313.  *****************************************************************************/
  1314. void HiliteM2027CTM(void)
  1315. {
  1316.     /*----------------------------------------------------------------*/
  1317.     /* Local Variables                                                */
  1318.     /*----------------------------------------------------------------*/
  1319.     /*----------------------------------------------------------------*/
  1320.     /* Code Body                                                      */
  1321.     /*----------------------------------------------------------------*/
  1322.     PRINT_INFORMATION(("n 2027 CTM n"));
  1323.     ChangeLeftSoftkey(STR_GLOBAL_OK, 0);
  1324.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1325.     SetLeftSoftkeyFunction(mmi_ctm_connect, KEY_EVENT_UP);
  1326.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1327. }
  1328. #endif /* __CTM_SUPPORT__ */ 
  1329. /*****************************************************************************
  1330.  * FUNCTION
  1331.  *  HiliteM2023LoudSp
  1332.  * DESCRIPTION
  1333.  *  hilite handler to invoke the LoudSpeaker function
  1334.  * PARAMETERS
  1335.  *  void
  1336.  * RETURNS
  1337.  *  void
  1338.  *****************************************************************************/
  1339. void HiliteM2023LoudSp(void)
  1340. {
  1341.     /*----------------------------------------------------------------*/
  1342.     /* Local Variables                                                */
  1343.     /*----------------------------------------------------------------*/
  1344.     /*----------------------------------------------------------------*/
  1345.     /* Code Body                                                      */
  1346.     /*----------------------------------------------------------------*/
  1347.     PRINT_INFORMATION(("n 2023 Loud Speaker n"));
  1348.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1349.     SetLeftSoftkeyFunction(LoudSpeakerFunction /* fromOptions */ , KEY_EVENT_UP);
  1350.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  1351.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1352. }
  1353. /*****************************************************************************
  1354.  * FUNCTION
  1355.  *  HiliteM2021NewCall
  1356.  * DESCRIPTION
  1357.  *  hilite handler to invoke the NewCall function
  1358.  * PARAMETERS
  1359.  *  void
  1360.  * RETURNS
  1361.  *  void
  1362.  *****************************************************************************/
  1363. void HiliteM2021NewCall(void)
  1364. {
  1365.     /*----------------------------------------------------------------*/
  1366.     /* Local Variables                                                */
  1367.     /*----------------------------------------------------------------*/
  1368.     /*----------------------------------------------------------------*/
  1369.     /* Code Body                                                      */
  1370.     /*----------------------------------------------------------------*/
  1371.     PRINT_INFORMATION(("n 2021 New Call n"));
  1372.     ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1373.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_SCR1003_LSK);
  1374.     SetLeftSoftkeyFunction(EnterScreenAndHandleDigit, KEY_EVENT_UP);
  1375.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1376. }
  1377. /*****************************************************************************
  1378.  * FUNCTION
  1379.  *  Hint2020Mute
  1380.  * DESCRIPTION
  1381.  *  hint handler to get mute status
  1382.  * PARAMETERS
  1383.  *  index       [IN]        
  1384.  * RETURNS
  1385.  *  void
  1386.  *****************************************************************************/
  1387. void Hint2020Mute(U16 index)
  1388. {
  1389.     /*----------------------------------------------------------------*/
  1390.     /* Local Variables                                                */
  1391.     /*----------------------------------------------------------------*/
  1392.     /*----------------------------------------------------------------*/
  1393.     /* Code Body                                                      */
  1394.     /*----------------------------------------------------------------*/
  1395.     if (IsPhoneInMute() == TRUE)
  1396.     {
  1397.         pfnUnicodeStrcpy((S8*) hintData[index], (S8*) GetString(STR_GLOBAL_ON));
  1398.     }
  1399.     else
  1400.     {
  1401.         pfnUnicodeStrcpy((S8*) hintData[index], (S8*) GetString(STR_GLOBAL_OFF));
  1402.     }
  1403.     return;
  1404. }
  1405. /*****************************************************************************
  1406.  * FUNCTION
  1407.  *  Hint2024DTMF
  1408.  * DESCRIPTION
  1409.  *  hint handler to get dtmf status
  1410.  * PARAMETERS
  1411.  *  index       [IN]        
  1412.  * RETURNS
  1413.  *  void
  1414.  *****************************************************************************/
  1415. void Hint2024DTMF(U16 index)
  1416. {
  1417.     /*----------------------------------------------------------------*/
  1418.     /* Local Variables                                                */
  1419.     /*----------------------------------------------------------------*/
  1420.     /*----------------------------------------------------------------*/
  1421.     /* Code Body                                                      */
  1422.     /*----------------------------------------------------------------*/
  1423.     if (GetDTMFFlag() == TRUE)
  1424.     {
  1425.         pfnUnicodeStrcpy((S8*) hintData[index], (S8*) GetString(STR_GLOBAL_ON));
  1426.     }
  1427.     else
  1428.     {
  1429.         pfnUnicodeStrcpy((S8*) hintData[index], (S8*) GetString(STR_GLOBAL_OFF));
  1430.     }
  1431.     return;
  1432. }
  1433. /*****************************************************************************
  1434.  * FUNCTION
  1435.  *  MakeMOForAT
  1436.  * DESCRIPTION
  1437.  *  Makes MO Call from AT Command
  1438.  * PARAMETERS
  1439.  *  num             [IN]        
  1440.  *  length          [IN]        
  1441.  *  callType        [IN]        
  1442.  * RETURNS
  1443.  *  void
  1444.  *****************************************************************************/
  1445. void MakeMOForAT(PS8 num, U8 length, U8 callType)
  1446. {
  1447.     /*----------------------------------------------------------------*/
  1448.     /* Local Variables                                                */
  1449.     /*----------------------------------------------------------------*/
  1450.     PHB_CM_INTERFACE phb_data;
  1451.     /*----------------------------------------------------------------*/
  1452.     /* Code Body                                                      */
  1453.     /*----------------------------------------------------------------*/
  1454.     if (GetCurrentState() == CM_OUTGOING_STATE)
  1455.     {
  1456.         if (cm_p->redial_info.RedialTimer == TRUE)
  1457.         {
  1458.             /* stop redialing */
  1459.             ResetRedialAttempts();
  1460.             SetCurrentState(CM_IDLE_STATE);
  1461.         }
  1462.         else
  1463.         {
  1464.             /* already MO, ignore it */
  1465.             return;
  1466.         }
  1467.     }
  1468.     memset(&gCurrOutcall, 0, sizeof(OUTGOING_CALL));
  1469.     if (strlen((void*)num) > MAX_DIGIT)
  1470.     {
  1471.         PRINT_INFORMATION(("XXX Number too big XXX n"));
  1472.         ShowCallManagementErrorMessage(ERR_INVALID_NUMBER_FORMAT);
  1473.         return;
  1474.     }
  1475.     if (length > 0)
  1476.     {
  1477.         AnsiiToUnicodeString((PS8) gCurrOutcall.Number, (PS8) num);
  1478.     }
  1479.     SetPreviousState((CALL_STATE) GetCurrentState());
  1480.     SetCurrentState(CM_OUTGOING_STATE);
  1481.     gtmpOutgoingIndex = GetFirstFreeIndex();
  1482.     AddNewCallInfo(
  1483.         (PU8) gCurrOutcall.Number,
  1484.         GetCurrentState(),
  1485.         GetPreviousState(),
  1486.         CM_CALL_MO,
  1487.         (CM_CALL_HANDLE) (gtmpOutgoingIndex + 1),
  1488.         callType);
  1489.     SetCCFlag(TRUE);
  1490.     SetDialIndication(FALSE);
  1491.     /* MO call */
  1492.     /* look up dialed number from phonebook first anyway */
  1493.     if (length > 0)
  1494.     {
  1495.     phb_data = mmi_phb_call_get_data_for_call_mgnt((PU8) gCurrOutcall.Number, FALSE);
  1496.     SetCMPhoneBookStruct(&phb_data);
  1497.     SetOutgoingNamefromPhonebook();
  1498.     }    
  1499.     if (callType == CM_CSD_CALL)
  1500.     {
  1501.         stopRequestedTone(MESSAGE_TONE);
  1502.     }
  1503. #ifdef __MMI_BT_PROFILE__
  1504.     else
  1505.     {
  1506.         /* stop audio background play before sco link */
  1507.         mdi_audio_suspend_background_play();
  1508.         /* establish sco link here */
  1509.         mmi_profiles_bt_call_start_callback();
  1510.     }
  1511. #endif /* __MMI_BT_PROFILE__ */ 
  1512.     AlmDisableExpiryHandler();
  1513.     SetProtocolEventHandler(OutgoingCallConnected, PRT_OUTGOINGCALL_CONNECTED);
  1514.     OutgoingProcessCMEvent(CM_PS_SHOW_OUTGOING_CALL_SCREEN, NULL);
  1515. }
  1516. /*****************************************************************************
  1517.  * FUNCTION
  1518.  *  OutgoingProcessCMEvent
  1519.  * DESCRIPTION
  1520.  *  This is the Entry function for all the Events while the Call-Management application
  1521.  *  is Active.
  1522.  *  
  1523.  *  This function handles the events from both keyboard and protocol stack.
  1524.  *  The keyboard events have KB in there defination and Protocol has PS.
  1525.  * PARAMETERS
  1526.  *  inEvenType      [IN]        
  1527.  *  MsgStruct       [?]         
  1528.  *  pointer(?)      [IN]        To the event's associated structure)
  1529.  * RETURNS
  1530.  *  void
  1531.  *****************************************************************************/
  1532. void OutgoingProcessCMEvent(CM_EVENT_TYPES inEvenType, void *MsgStruct)
  1533. {
  1534.     /*----------------------------------------------------------------*/
  1535.     /* Local Variables                                                */
  1536.     /*----------------------------------------------------------------*/
  1537.     ACTION_RESULT result = CM_CALL_FAILURE;
  1538.     /*----------------------------------------------------------------*/
  1539.     /* Code Body                                                      */
  1540.     /*----------------------------------------------------------------*/
  1541.     PRINT_INFORMATION(("XXX In OutgoingProcessCMEventn"));
  1542.     switch (inEvenType)
  1543.     {
  1544.         case CM_PS_SHOW_OUTGOING_CALL_SCREEN:
  1545.             ProcessShowOutgoingCallScreen();
  1546.             break;
  1547.         case CM_PS_SHOW_REQUESTING_CALL_SCREEN:
  1548.             if (GetActiveScreenId() == SCR_CM_REQUESTINGUSSD)
  1549.             {
  1550.                 /* current active screen is SS requesting, display and remove previous*/
  1551.                 EntryScrUSSDReq();
  1552.                 RemoveSSReqScr();
  1553.                 SetDelScrnIDCallbackHandler(SCR_CM_REQUESTINGUSSD, (HistoryDelCBPtr) SSReqHistoryDelHdlr);                
  1554.             }
  1555.             else if (IsScreenPresent(SCR_CM_REQUESTINGUSSD))
  1556.             {
  1557.                 /* SS requesting screen is in history, do nothing */
  1558.             }
  1559.             else
  1560.             {
  1561.                 /* current active screen is NOT SS requesting, not in history also, display requesting screen*/
  1562.                 EntryScrUSSDReq();
  1563.             }
  1564.             
  1565.             /* if (IsScreenPresent(CM_SCR_MARKER) == FALSE)
  1566.                AddMarkerToHistory(); */
  1567.             break;
  1568.         case CM_PS_USSD_RECVD:
  1569.             ProcessUSSDrecieved(MsgStruct);
  1570.             break;
  1571.         case CM_KB_OUTGOINGCALL:
  1572.             /* MO SEND key */
  1573.             result = ProcessKBOutgoingEvent(MsgStruct);
  1574.             break;
  1575.         case CM_PS_CALLCONNECTED:
  1576.             /* connect ind */
  1577.             result = ProcessPSCallconnectedEvent(MsgStruct);
  1578.             break;
  1579.         case CM_KB_HANGUPREQ:
  1580.             /* 1X send, drop single call */
  1581.             result = ProcessKBHangupReqEvent(MsgStruct);
  1582.             break;
  1583.         case CM_PS_HANGUPSUC:
  1584.             result = ProcessPSHangupSucEvent(MsgStruct);
  1585.             break;
  1586.         case CM_KB_HANGUPALLREQ:
  1587.             /* END key in CM */
  1588.             result = ProcessKBHangupallReqEvent(MsgStruct);
  1589.             break;
  1590.         case CM_PS_HANGUPALLSUC:
  1591.             result = ProcessPSHangupallSucEvent(MsgStruct);
  1592.             break;
  1593.         case CM_KB_HANGUPALLACTREQ:
  1594.             /* Menu End All Active */
  1595.             result = ProcessKBHangupallActReqEvent(MsgStruct);
  1596.             break;
  1597.         case CM_PS_HANGUPALLACTSUC:
  1598.             result = ProcessPSHangupallActSucEvent(MsgStruct);
  1599.             break;
  1600.         case CM_KB_HANGUPALLHLDREQ:
  1601.             result = ProcessKBHangupallHldReqEvent(MsgStruct);
  1602.             break;
  1603.         case CM_PS_HANGUPALLHLDSUC:
  1604.             result = ProcessPSHangupallHldSucEvent(MsgStruct);
  1605.             break;
  1606.         case CM_KB_HOLDREQ:
  1607.             result = ProcessKBHoldReqEvent(MsgStruct);
  1608.             break;
  1609.         case CM_PS_HOLDSUC:
  1610.             result = ProcessPSHoldSucEvent(MsgStruct);
  1611.             break;
  1612.         case CM_KB_RETRIEVEREQ:
  1613.             result = ProcessKBRetrieveReqEvent(MsgStruct);
  1614.             break;
  1615.         case CM_PS_RETRIEVESUC:
  1616.             result = ProcessPSRetrieveSucEvent(MsgStruct);
  1617.             break;
  1618.         case CM_KB_SWAPREQ:
  1619.             result = ProcessKBSwapReqEvent(MsgStruct);
  1620.             break;
  1621.         case CM_PS_SWAPSUC:
  1622.             result = ProcessPSSwapSucEvent(MsgStruct);
  1623.             break;
  1624.         case CM_KB_CONFREQ:
  1625.             result = ProcessKBConfReqEvent(MsgStruct);
  1626.             break;
  1627.         case CM_PS_CONFSUC:
  1628.             result = ProcessPSConfSucEvent(MsgStruct);
  1629.             break;
  1630.         case CM_KB_SPLITREQ:
  1631.             result = ProcessKBSplitReqEvent(MsgStruct);
  1632.             break;
  1633.         case CM_PS_SPLITSUC:
  1634.             result = ProcessPSSplitSucEvent(MsgStruct);
  1635.             break;
  1636.         case CM_KB_ECT_REQ:
  1637.             result = ProcessKBEctReqEvent(MsgStruct);
  1638.             break;
  1639.              case CM_PS_ECT_SUC:
  1640.                result=ProcessPSEctSuccessful(MsgStruct);
  1641.                break; 
  1642.         case CM_KB_CALL_DEFLECT_REQ:
  1643.             MakePsCallDeflect((void*)PsCBackCallDeflected, (PU8) MsgStruct);
  1644.             ShowCategory302Screen(NULL);
  1645.             break;
  1646.         case CM_PS_INCOMING_CALL_DEFLECT:
  1647.             ShowCategory302Screen(NULL);
  1648.             break;
  1649.         default:
  1650.             PRINT_INFORMATION(("n CM Event Handler does not exist n"));
  1651.             break;
  1652.     }
  1653.     PRINT_INFORMATION_2((MMI_TRACE_G5_CM, "*-------[OutgoingCallManagement.c] OutgoingProcessCMEvent: result = "
  1654.                          " %d-------*n", (int)result));
  1655. }
  1656. /*****************************************************************************
  1657.  * FUNCTION
  1658.  *  ProcessShowOutgoingCallScreen
  1659.  * DESCRIPTION
  1660.  *  This is the function to show outgoing call only when the Call list is recieved
  1661.  *  
  1662.  *  This invokes the protocol function if the state is in Idle/hold state.
  1663.  *  In Active state,it makes the request to hold and after success it initiates the call.
  1664.  * PARAMETERS
  1665.  *  void
  1666.  *  void(?)                 [IN]        *(this points to OUTGOING_CALL structure)
  1667.  *  ACTION_RESULT(?)        [OUT]       
  1668.  * RETURNS
  1669.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.(?)
  1670.  *****************************************************************************/
  1671. void ProcessShowOutgoingCallScreen(void)
  1672. {
  1673.     /*----------------------------------------------------------------*/
  1674.     /* Local Variables                                                */
  1675.     /*----------------------------------------------------------------*/
  1676.     /*----------------------------------------------------------------*/
  1677.     /* Code Body                                                      */
  1678.     /*----------------------------------------------------------------*/
  1679.     PRINT_INFORMATION(("XXX In ProcessShowOutgoingCallScreen n"));
  1680.     switch (GetPreviousState())
  1681.     {
  1682.         case CM_IDLE_STATE:
  1683.             /* do not have to suspend audio for CSD call */
  1684.             EntryScr1001OutgoingCall();
  1685.             if (GetOutgoingCallType() != CM_CSD_CALL)
  1686.             {
  1687.                 mdi_audio_suspend_background_play();
  1688.             }
  1689.             if (IsScreenPresent(CM_SCR_MARKER) == FALSE)
  1690.             {
  1691.                 AddMarkerToHistory();
  1692.             }
  1693.             break;
  1694.         case CM_INCOMING_STATE:
  1695.         case CM_HOLD_STATE:
  1696.         case CM_ACTIVE_STATE:
  1697.             EntryScr1001OutgoingCall();
  1698.             if (GetOutgoingCallOrigin() == CM_CALL_MO_STK)
  1699.             {
  1700.                 AddMarkerToHistory();
  1701.             }
  1702.             break;
  1703.         default:
  1704.             PRINT_INFORMATION(("n KBOutgoingEvent CM State Machine is in incorrect state n"));
  1705.             break;
  1706.     }
  1707. }
  1708. /*****************************************************************************
  1709.  * FUNCTION
  1710.  *  ProcessKBOutgoingEvent
  1711.  * DESCRIPTION
  1712.  *  This is the function to process Keyboard(Request) Event CM_KB_OUTGOINGCALL.
  1713.  *  
  1714.  *  This invokes the protocol function if the state is in Idle/hold state.
  1715.  *  In Active state,it makes the request to hold and after success it initiates the call.
  1716.  * PARAMETERS
  1717.  *  MsgStruct               [?]         
  1718.  *  ACTION_RESULT(?)        [OUT]       
  1719.  *  this(?)                 [IN]        Points to OUTGOING_CALL structure)
  1720.  * RETURNS
  1721.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  1722.  *****************************************************************************/
  1723. ACTION_RESULT ProcessKBOutgoingEvent(void *MsgStruct)
  1724. {
  1725.     /*----------------------------------------------------------------*/
  1726.     /* Local Variables                                                */
  1727.     /*----------------------------------------------------------------*/
  1728.     /*----------------------------------------------------------------*/
  1729.     /* Code Body                                                      */
  1730.     /*----------------------------------------------------------------*/
  1731.     memcpy(&gCurrOutcall, MsgStruct, sizeof(OUTGOING_CALL));
  1732.     switch (GetCurrentState())
  1733.     {
  1734.         case CM_IDLE_STATE:
  1735.             if (AllowMoreCalls() && DTMFPadCallBuffer[0] != 0)
  1736.             {
  1737.                 SetPreviousState(CM_IDLE_STATE);
  1738.                 SetCurrentState(CM_OUTGOING_STATE);
  1739.                 gtmpOutgoingIndex = GetFirstFreeIndex();
  1740.                 AddNewCallInfo(
  1741.                     gCurrOutcall.Number,
  1742.                     CM_OUTGOING_STATE,
  1743.                     CM_IDLE_STATE,
  1744.                     CM_CALL_MO,
  1745.                     (CM_CALL_HANDLE) (gtmpOutgoingIndex + 1),
  1746.                     CSMCC_VOICE_CALL);
  1747.                 MakePsInitiateCall((PU8) DTMFPadCallBuffer, (void*)OutgoingCallConnected);
  1748.             }
  1749.             else
  1750.             {
  1751.                 ShowCallManagementErrorMessage(NO_ACTIVE_CALL);
  1752.                 return CM_CALL_FAILURE;
  1753.             }
  1754.             break;
  1755.         case CM_OUTGOING_STATE:
  1756.             PRINT_INFORMATION(("XXX In ProcessKBOutgoingEvent already outgoing, can't make MOn"));
  1757.             ShowCallManagementErrorMessage(ERR_L4C_GEN_CAUSE);
  1758.             return CM_CALL_FAILURE;
  1759.         case CM_INCOMING_STATE:
  1760.         case CM_HOLD_STATE:
  1761.         case CM_ACTIVE_STATE:
  1762.             /* send SS when MT call and previous USSR seession exists,
  1763.                need to abort previous session */
  1764.             DeleteScreenIfPresent(ITEM_SCR_USSN_MSG);
  1765.             DeleteScreenIfPresent(ITEM_SCR_USSR_EDIT);
  1766.             if (AllowMoreCalls())
  1767.             {
  1768.                 SetPreviousState(GetCurrentState());
  1769.                 SetCurrentState(CM_OUTGOING_STATE);
  1770.                 gtmpOutgoingIndex = GetFirstFreeIndex();
  1771.                 AddNewCallInfo(
  1772.                     gCurrOutcall.Number,
  1773.                     GetCurrentState(),
  1774.                     CM_IDLE_STATE,
  1775.                     CM_CALL_MO,
  1776.                     (CM_CALL_HANDLE) (gtmpOutgoingIndex + 1),
  1777.                     CSMCC_VOICE_CALL);
  1778.                 MakePsInitiateCall((PU8) DTMFPadCallBuffer, (void*)OutgoingCallConnected);
  1779.             }
  1780.             else
  1781.             {
  1782.                 ShowCallManagementErrorMessage(NO_ACTIVE_CALL);
  1783.                 return CM_CALL_FAILURE;
  1784.             }
  1785.             break;
  1786.         default:
  1787.             PRINT_INFORMATION(("n KBOutgoingEvent CM State m/c Corrupted n"));
  1788.             return CM_CALL_FAILURE;
  1789.     }
  1790.     return CM_CALL_SUCCESS;
  1791. }
  1792. /*****************************************************************************
  1793.  * FUNCTION
  1794.  *  ProcessPSCallconnectedEvent
  1795.  * DESCRIPTION
  1796.  *  This is the function to process Protocol(Response) Event CM_PS_CALLCONNECTED.
  1797.  *  
  1798.  *  This change the state of the call to ACTIVE & also changes the
  1799.  *  state of the State m/c.
  1800.  * PARAMETERS
  1801.  *  MsgStruct               [?]         
  1802.  *  ACTION_RESULT(?)        [OUT]       
  1803.  *  this(?)                 [IN]        Points to CM_CALL_HANDLE of the call which requested CM_KB_OUTGOINGCALL)
  1804.  * RETURNS
  1805.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  1806.  *****************************************************************************/
  1807. ACTION_RESULT ProcessPSCallconnectedEvent(void *MsgStruct)
  1808. {
  1809.     /*----------------------------------------------------------------*/
  1810.     /* Local Variables                                                */
  1811.     /*----------------------------------------------------------------*/
  1812.     CM_CALL_HANDLE callHandle;
  1813.     CM_CALL_HANDLE *handle;
  1814.     /*----------------------------------------------------------------*/
  1815.     /* Code Body                                                      */
  1816.     /*----------------------------------------------------------------*/
  1817.     handle = (CM_CALL_HANDLE*) MsgStruct;
  1818.     callHandle = *handle;
  1819.     //SetCallHandleForStartTimeUpdate(callHandle);
  1820.     if (callHandle == -1)
  1821.     {
  1822.         PRINT_INFORMATION(("n PSCallconnectedEvent Getting the Connected Handle has -1 n"));
  1823.         return CM_CALL_FAILURE;
  1824.     }
  1825.     switch (GetCurrentState())
  1826.     {
  1827.         case CM_IDLE_STATE:
  1828.             PRINT_INFORMATION(("n PSCallconnectedEvent CM_IDLE_STATE not handled still n"));
  1829.             break;
  1830.         case CM_OUTGOING_STATE:
  1831.             MakeHold();
  1832.             SetPreviousState(GetCurrentState());
  1833.             SetCurrentState(CM_ACTIVE_STATE);
  1834.             SetCallState(gtmpOutgoingIndex, CM_ACTIVE_STATE, FALSE);
  1835.             if (GetWapCallPresent())
  1836.             {
  1837.                 ShowSubLCDScreen(EntrySubLcdScr1002ActiveCall);
  1838.                 CMGetExactTime(UpdateCallStartTimeforWapCall);
  1839.                 /* in wap call => no marker in history */
  1840.                 if (IsScreenPresent(CM_SCR_MARKER))
  1841.                 {
  1842.                     DeleteNScrId(CM_SCR_MARKER);
  1843.                     GoBackHistory();
  1844.                 }
  1845.                 else
  1846.                 {
  1847.                     GoBackHistory();
  1848.                 }
  1849.                 break;
  1850.             }
  1851.             if (GetTotalCallCount() > 1)
  1852.             {
  1853.                 CM_CALL_HANDLE handle;
  1854.                 handle = GetIncomingCallHandle();
  1855.                 if (handle != -1)
  1856.                 {
  1857.                     PHB_CM_INTERFACE phb_data;
  1858.                     SetPreviousState(CM_ACTIVE_STATE);
  1859.                     SetCurrentState(CM_INCOMING_STATE);
  1860.                     if (GetNotifySSFlag() == TRUE)
  1861.                     {
  1862.                         SetNotifySSFlag(FALSE);
  1863.                         SetCbackAfterSS(NULL);
  1864.                     }
  1865.                     /* initiate call start time without get into active call screen */
  1866.                     CMGetExactTime(UpdateCallStartTimeforWapCall);
  1867.                     /* MT call caller picture, ringtone...will be overwrite by MO call, 
  1868.                        it needs to be restored after MO call connected */
  1869.                     phb_data = mmi_phb_call_get_data_for_call_mgnt(GetCallNumber(handle), FALSE);
  1870.                 #ifdef __MMI_INCOMING_CALL_VIDEO__
  1871.                     /* waiting call and ccbs invoke can't use video for display */
  1872.                     if (GetTotalCallCount() > 0 || GetCCBSFlag() == TRUE)
  1873.                     {
  1874.                         phb_data.videoId = 0;
  1875.                     }
  1876.                 #endif /* __MMI_INCOMING_CALL_VIDEO__ */ 
  1877.                     SetCMPhoneBookStruct(&phb_data);
  1878.                     GoBackToHistory(ITEMSCR_INCOMING_CALL);
  1879.                 }
  1880.                 else
  1881.                 {
  1882.                     GoBackToHistory(SCR_CM_ACTIVECALLSCREEN);
  1883.                 }
  1884.             }
  1885.             else
  1886.             {
  1887.                 if (IsScreenPresent(SCR_CM_ACTIVECALLSCREEN))
  1888.                 {
  1889.                     /* check if entering SMS application in call */
  1890.                     if (IsScreenPresent(SCR_ID_MSG_MAIN_MENU_NO_MMS))
  1891.                     {
  1892.                         mmi_frm_sms_delete_action_pending();
  1893.                     }
  1894.                     GoBackToHistory(SCR_CM_ACTIVECALLSCREEN);
  1895.                 }
  1896.                 else
  1897.                 {
  1898.                     EntryScr1002ActiveCall();
  1899.                     /* check if entering SMS application in call */
  1900.                     if (IsScreenPresent(SCR_ID_MSG_MAIN_MENU_NO_MMS))
  1901.                     {
  1902.                         mmi_frm_sms_delete_action_pending();
  1903.                     }
  1904.                     DeleteUptoCmScreen();
  1905.                 }
  1906.             }
  1907.             break;
  1908.         case CM_INCOMING_STATE:
  1909.             PRINT_INFORMATION(("n PSCallconnectedEvent CM_INCOMING_STATE not handled still n"));
  1910.             break;
  1911.         case CM_ACTIVE_STATE:
  1912.             PRINT_INFORMATION(("n PSCallconnectedEvent CM_ACTIVE_STATE not handled still n"));
  1913.             break;
  1914.         case CM_HOLD_STATE:
  1915.             PRINT_INFORMATION(("n PSCallconnectedEvent CM_HOLD_STATE not handled still n"));
  1916.             break;
  1917.         default:
  1918.             PRINT_INFORMATION(("n PSCallconnectedEvent CM State m/c Corrupted n"));
  1919.             return CM_CALL_FAILURE;
  1920.     }
  1921.     return CM_CALL_SUCCESS;
  1922. }
  1923. /*****************************************************************************
  1924.  * FUNCTION
  1925.  *  ProcessKBHangupReqEvent
  1926.  * DESCRIPTION
  1927.  *  This is the function to process Keyboard(Request) Event CM_KB_HANGUPREQ.
  1928.  *  
  1929.  *  This Sets the flag CM_HANGUP_REQUESTED and invoke the protocol function irrespective of the state.
  1930.  *  The chances of this being invoked in idle state is very less.
  1931.  * PARAMETERS
  1932.  *  MsgStruct               [?]         
  1933.  *  ACTION_RESULT(?)        [OUT]       
  1934.  *  this(?)                 [IN]        Points to CM_CALL_HANDLE of the call to get dropped)
  1935.  * RETURNS
  1936.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  1937.  *****************************************************************************/
  1938. ACTION_RESULT ProcessKBHangupReqEvent(void *MsgStruct)
  1939. {
  1940.     /*----------------------------------------------------------------*/
  1941.     /* Local Variables                                                */
  1942.     /*----------------------------------------------------------------*/
  1943.     CM_CALL_HANDLE handle;
  1944.     CALL_STATE state;
  1945.     /*----------------------------------------------------------------*/
  1946.     /* Code Body                                                      */
  1947.     /*----------------------------------------------------------------*/
  1948.     PRINT_INFORMATION(("XXX In ProcessKBHangupReqEventn"));
  1949.     if (GetInternalAlert() == TRUE)
  1950.     {
  1951.         StopInternalOutgoingTone();
  1952.     }
  1953.     handle = *((CM_CALL_HANDLE*) MsgStruct);
  1954.     state = GetCallState(handle);
  1955.     switch (GetCurrentState())
  1956.     {
  1957.         case CM_IDLE_STATE:
  1958.             PRINT_INFORMATION(("nKBHangupEvent CM_IDLE_STATE not handled still n"));
  1959.             break;
  1960.         case CM_OUTGOING_STATE:
  1961.             SetCallflag(handle, CM_HANGUP_REQUESTED, TRUE);
  1962.             if (state == CM_ACTIVE_STATE || state == CM_HOLD_STATE || state == CM_INCOMING_STATE)
  1963.             {
  1964.                 /* Start by Julia: Drop call refinement */
  1965.                 SetCallState(handle, CM_DISCONNECTING_STATE, TRUE);
  1966.                 //EntryScr1001OutgoingCall();
  1967.                 // End by Julia
  1968.                 MakePsEndSelectiveCall((void*)HangupReqSucess, handle);
  1969.             }
  1970.             else if ((GetDialIndication() == FALSE) || (GetOutgoingCallType() == CM_CSD_CALL))
  1971.             {
  1972.                 SetCallAbortReqSentFlag(TRUE);
  1973.                 /* Start by Julia: Drop call refinement */
  1974.                 handle = GetOutgoingCallHandle();
  1975.                 SetCallState(handle, CM_DISCONNECTING_STATE, TRUE);
  1976.                 //EntryScr1001OutgoingCall();
  1977.                 // End by Julia
  1978.                 MakePsAthRequest((void*)PsCBackOutgoingCallEnded);
  1979.             }
  1980.             else
  1981.             {
  1982.                 /* Start by Julia: Drop call refinement */
  1983.                 SetCallState(handle, CM_DISCONNECTING_STATE, TRUE);
  1984.                 //EntryScr1001OutgoingCall();
  1985.                 // End by Julia
  1986.                 MakePsEndSelectiveCall((void*)HangupReqSucess, handle);
  1987.             }
  1988.             break;
  1989.         case CM_INCOMING_STATE:
  1990.             // Start by Julia: Drop call refinement
  1991.             // Drop call refinement is not applicable when waiting call exists
  1992.             SetCallflag(handle, CM_HANGUP_REQUESTED, TRUE);
  1993.             MakePsEndSelectiveCall((void*)HangupReqSucess, handle);
  1994.             break;
  1995.             /* End by Julia */
  1996.         case CM_ACTIVE_STATE:
  1997.         case CM_HOLD_STATE:
  1998.             SetCallflag(handle, CM_HANGUP_REQUESTED, TRUE);
  1999.             /* Start by Julia: Drop call refinement */
  2000.             SetCallState(handle, CM_DISCONNECTING_STATE, TRUE);
  2001.             //EntryScr1002ActiveCall();
  2002.             // End by Julia
  2003.             MakePsEndSelectiveCall((void*)HangupReqSucess, handle);
  2004.             break;
  2005.         default:
  2006.             PRINT_INFORMATION(("n KBHangupEvent CM State m/c Corrupted n"));
  2007.             return CM_CALL_FAILURE;
  2008.     }
  2009.     return CM_CALL_SUCCESS;
  2010. }
  2011. /*****************************************************************************
  2012.  * FUNCTION
  2013.  *  ProcessPSHangupSucEvent
  2014.  * DESCRIPTION
  2015.  *  This is the function to process Protocol(Response) Event CM_PS_HANGUPSUC.
  2016.  *  
  2017.  *  This resets the CM_HANGUP_REQUESTED flag and then change the states of the call to IDLE
  2018.  *  if necessary it also changes the state of the State m/c.
  2019.  * PARAMETERS
  2020.  *  MsgStruct               [?]         
  2021.  *  ACTION_RESULT(?)        [OUT]       
  2022.  *  this(?)                 [IN]        Points to CM_CALL_HANDLE of the call which requested CM_KB_HANGUPREQ)
  2023.  * RETURNS
  2024.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  2025.  *****************************************************************************/
  2026. ACTION_RESULT ProcessPSHangupSucEvent(void *MsgStruct)
  2027. {
  2028.     /*----------------------------------------------------------------*/
  2029.     /* Local Variables                                                */
  2030.     /*----------------------------------------------------------------*/
  2031.     CM_CALL_HANDLE *handle;
  2032.     U8 flag = FALSE;
  2033.     /*----------------------------------------------------------------*/
  2034.     /* Code Body                                                      */
  2035.     /*----------------------------------------------------------------*/
  2036.     PRINT_INFORMATION(("XXX In ProcessPSHangupSucEvent XXX"));
  2037.     PRINT_INFORMATION(("n X@X@X@X!!n"));
  2038.     handle = (CM_CALL_HANDLE*) MsgStruct;
  2039.     if ((*handle == -1) || (GetMMIStructIndexof(*handle) == -1))
  2040.     {
  2041.         PRINT_INFORMATION(("nBad call handle -1 in HangupSucn"));
  2042.     #ifdef __MMI_VOIP__
  2043.         /* call back voip to connect voip */
  2044.         if ((mmi_voip_app_total_call() != 0) && (mmi_voip_app_get_conn_flag() == MMI_VOIP_CALL_CONN_VOIP))
  2045.         {
  2046.             mmi_voip_app_set_conn_flag(MMI_VOIP_CALL_CONN_NONE);
  2047.             mmi_voip_entry_ans_to_conn_voip();
  2048.         }
  2049.     #endif /* __MMI_VOIP__ */
  2050.         return CM_CALL_FAILURE;
  2051.     }
  2052.     switch (GetCurrentState())
  2053.     {
  2054.         case CM_IDLE_STATE:
  2055.             PRINT_INFORMATION(("n PSHangupSucEvent CM_IDLE_STATE not handled still n"));
  2056.             break;
  2057.         case CM_OUTGOING_STATE:
  2058.             PRINT_INFORMATION(("XXX In ProcessPSHangupSucEvent : Outgoing StateXXX"));
  2059.             LogCallInfoForCallHistory(*handle);
  2060.             if (GetCallState(*handle) == CM_OUTGOING_STATE)
  2061.             {
  2062.                 PRINT_INFORMATION(("XXX In ProcessPSHangupSucEvent : Call being dropped is outgoingXXX"));
  2063.                 flag = TRUE;
  2064.                 GetEndTimeAndNotifyCallAborted();
  2065.                 if (GetOutgoingCallOrigin() == CM_CALL_MO_STK)
  2066.                 {
  2067.                     SATCallExitCause(SAT_CALL_DISCONNECT_BEFORE_CONNECT);
  2068.                 }
  2069.             }
  2070.             else
  2071.             {
  2072.                 GetEndTimeAndNotifyEndCallDuration(*handle);
  2073.             }
  2074.         #ifdef __IP_NUMBER__
  2075.             SetTempUseIPNumber(FALSE);
  2076.         #endif 
  2077.             ResetCallflag((*handle), CM_HANGUP_REQUESTED, TRUE);
  2078.             SetCallState((*handle), CM_IDLE_STATE, TRUE);
  2079.             if (GetTotalCallCount() == 0)
  2080.             {
  2081.                 PRINT_INFORMATION(("XXX In ProcessPSHangupSucEvent :GetTotalCallCount=0XXX"));
  2082.                 SetPreviousState(GetCurrentState());
  2083.                 SetCurrentState(CM_IDLE_STATE);
  2084.             }
  2085.             else
  2086.             {
  2087.                 PRINT_INFORMATION(("XXX In ProcessPSHangupSucEvent :GetTotalCallCount not 0 XXX"));
  2088.                 if (flag)
  2089.                 {
  2090.                     SetCurrentState(GetPreviousState());
  2091.                     SetPreviousState(CM_OUTGOING_STATE);
  2092.                 }
  2093.                 else if (CM_OUTGOING_STATE == GetCurrentState())
  2094.                 {
  2095.                     break;
  2096.                 }
  2097.                 if (GetTotalCallCount() == GetTotalHoldCallCount())
  2098.                 {
  2099.                     SetPreviousState(GetCurrentState());
  2100.                     SetCurrentState(CM_HOLD_STATE);
  2101.                 }
  2102.             }
  2103.             break;
  2104.         case CM_INCOMING_STATE:
  2105.             PRINT_INFORMATION(("XXX In ProcessPSHangupSucEvent : Incoming StateXXX"));
  2106.             LogCallInfoForCallHistory(*handle);
  2107.             /* rel active and accept waiting but waiting is released by network */
  2108.             if (GetIncomingCallHandle() == *handle)
  2109.             {
  2110.                 SetCurrentState(GetPreviousState());
  2111.                 SetPreviousState(CM_INCOMING_STATE);
  2112.                 SetCallState((*handle), CM_IDLE_STATE, TRUE);
  2113.             }
  2114.             else
  2115.             {
  2116.                 GetEndTimeAndNotifyEndCallDuration(*handle);
  2117.                 SetCallState((*handle), CM_IDLE_STATE, TRUE);
  2118.                 if (GetTotalActiveCallCount() != 0)
  2119.                 {
  2120.                     SetPreviousState(CM_ACTIVE_STATE);
  2121.                 }
  2122.                 else if (GetTotalHoldCallCount() != 0)
  2123.                 {
  2124.                     SetPreviousState(CM_HOLD_STATE);
  2125.                 }
  2126.             }
  2127.             break;
  2128.         case CM_HOLD_STATE:
  2129.         case CM_ACTIVE_STATE:
  2130.             PRINT_INFORMATION(("XXX In ProcessPSHangupSucEvent : HOLD/Active StateXXX"));
  2131.             LogCallInfoForCallHistory(*handle);
  2132.             GetEndTimeAndNotifyEndCallDuration(*handle);
  2133.             ResetCallflag((*handle), CM_HANGUP_REQUESTED, TRUE);
  2134.             SetCallState((*handle), CM_IDLE_STATE, TRUE);
  2135.             if (GetTotalCallCount() == 0)
  2136.             {
  2137.                 SetPreviousState(GetCurrentState());
  2138.                 SetCurrentState(CM_IDLE_STATE);
  2139.             }
  2140.             else if ((GetTotalActiveCallCount() == 0) && (GetTotalCallCount() == GetTotalHoldCallCount()))
  2141.             {
  2142.                 SetPreviousState(GetCurrentState());
  2143.                 SetCurrentState(CM_HOLD_STATE);
  2144.             }
  2145.             break;
  2146.         default:
  2147.             PRINT_INFORMATION(("n PSHangupSucEvent CM State m/c Corrupted n"));
  2148.         #ifdef __MMI_VOIP__
  2149.             /* call back voip to connect voip */
  2150.             if ((mmi_voip_app_total_call() != 0) && (mmi_voip_app_get_conn_flag() == MMI_VOIP_CALL_CONN_VOIP))
  2151.             {
  2152.                 mmi_voip_app_set_conn_flag(MMI_VOIP_CALL_CONN_NONE);
  2153.                 mmi_voip_entry_ans_to_conn_voip();
  2154.             }
  2155.         #endif /* __MMI_VOIP__ */
  2156.             return CM_CALL_FAILURE;
  2157.     }
  2158. #ifdef __MMI_VOIP__
  2159.     /* call back voip to connect voip */
  2160.     if ((mmi_voip_app_total_call() != 0) && (mmi_voip_app_get_conn_flag() == MMI_VOIP_CALL_CONN_VOIP))
  2161.     {
  2162.         mmi_voip_app_set_conn_flag(MMI_VOIP_CALL_CONN_NONE);
  2163.         mmi_voip_entry_ans_to_conn_voip();
  2164.     }
  2165. #endif /* __MMI_VOIP__ */
  2166.     return CM_CALL_SUCCESS;
  2167. }
  2168. /*****************************************************************************
  2169.  * FUNCTION
  2170.  *  ProcessKBHangupallReqEvent
  2171.  * DESCRIPTION
  2172.  *  This is the function to process Keyboard(Request) Event CM_KB_HANGUPALLREQ.
  2173.  *  
  2174.  *  This Sets the flag CM_HANGUP_REQUESTED to all the calls
  2175.  *  Invoke the protocol function irrespective of the state.
  2176.  *  This is always Invoked in Active state.
  2177.  * PARAMETERS
  2178.  *  MsgStruct               [?]         
  2179.  *  ACTION_RESULT(?)        [OUT]       
  2180.  *  this(?)                 [IN]        Points to NULL as the Hangup is requested on all calls)
  2181.  * RETURNS
  2182.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  2183.  *****************************************************************************/
  2184. ACTION_RESULT ProcessKBHangupallReqEvent(void *MsgStruct)
  2185. {
  2186.     /*----------------------------------------------------------------*/
  2187.     /* Local Variables                                                */
  2188.     /*----------------------------------------------------------------*/
  2189.     /*----------------------------------------------------------------*/
  2190.     /* Code Body                                                      */
  2191.     /*----------------------------------------------------------------*/
  2192.     switch (GetCurrentState())
  2193.     {
  2194.         case CM_IDLE_STATE:
  2195.             PRINT_INFORMATION(("n KBHangupallReqEvent CM_IDLE_STATE not handled still n"));
  2196.             break;
  2197.         case CM_INCOMING_STATE:
  2198.             // Start by Julia: Drop call refinement
  2199.             // Drop call refinement is not applicable when waiting call exists
  2200.             SetAllHangupFlag();
  2201.             MakePsHangupallRequest((void*)HangupallReqSucess);
  2202.             break;
  2203.             /* End by Julia */
  2204.         case CM_OUTGOING_STATE:
  2205.         case CM_HOLD_STATE:
  2206.         case CM_ACTIVE_STATE:
  2207.             SetAllHangupFlag();
  2208.             /* Start by Julia: Drop call refinement */
  2209.             SetAllExceptWaitingCallState(CM_DISCONNECTING_STATE);
  2210.             //EntryScr1002ActiveCall();
  2211.             // End by Julia
  2212.             MakePsHangupallRequest((void*)HangupallReqSucess);
  2213.             break;
  2214.         default:
  2215.             PRINT_INFORMATION(("n KBHangupallReqEvent CM State m/c Corrupted n"));
  2216.             return CM_CALL_FAILURE;
  2217.     }
  2218.     return CM_CALL_SUCCESS;
  2219. }
  2220. /*****************************************************************************
  2221.  * FUNCTION
  2222.  *  ProcessPSHangupallSucEvent
  2223.  * DESCRIPTION
  2224.  *  This is the function to process Protocol(Response) Event CM_PS_HANGUPALLSUC.
  2225.  *  
  2226.  *  This resets the CM_HANGUP_REQUESTED flag & change the state of the all calls
  2227.  *  to IDLE.It also changes the state m/c to IDLE.
  2228.  * PARAMETERS
  2229.  *  MsgStruct               [?]         
  2230.  *  ACTION_RESULT(?)        [OUT]       
  2231.  *  this(?)                 [IN]        Is Null as the request CM_KB_HANGUPALLREQ is on all calls)
  2232.  * RETURNS
  2233.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  2234.  *****************************************************************************/
  2235. ACTION_RESULT ProcessPSHangupallSucEvent(void *MsgStruct)
  2236. {
  2237.     /*----------------------------------------------------------------*/
  2238.     /* Local Variables                                                */
  2239.     /*----------------------------------------------------------------*/
  2240.     CM_CALL_HANDLE *handle;
  2241.     CALL_STATE state;
  2242.     /*----------------------------------------------------------------*/
  2243.     /* Code Body                                                      */
  2244.     /*----------------------------------------------------------------*/
  2245.     handle = (CM_CALL_HANDLE*) MsgStruct;
  2246.     /* Start by Julia: Drop call refinement */
  2247.     if ((*handle) == -1 || GetMMIStructIndexof(*handle) == -1)
  2248.     {
  2249.         /* call already dropped */
  2250.         PRINT_INFORMATION(("nBad call handle -1 in HangupAllSucn"));
  2251.     #ifdef __MMI_VOIP__
  2252.         /* call back voip to connect voip */
  2253.         if ((mmi_voip_app_total_call() != 0) && (mmi_voip_app_get_conn_flag() == MMI_VOIP_CALL_CONN_VOIP))
  2254.         {
  2255.             mmi_voip_app_set_conn_flag(MMI_VOIP_CALL_CONN_NONE);
  2256.             mmi_voip_entry_ans_to_conn_voip();
  2257.         }
  2258.     #endif /* __MMI_VOIP__ */
  2259.         return CM_CALL_FAILURE;
  2260.     }
  2261.     /* End by Julia */
  2262.     LogCallInfoForCallHistory(*handle);
  2263.     state = GetCallState(*handle);
  2264.     if (state != CM_STATE_UNKNOWN)
  2265.     {
  2266.         /* incoming call will be handled in SetCallState */
  2267.         if (state != CM_INCOMING_STATE)
  2268.         {
  2269.             GetEndTimeAndNotifyEndCallDuration(*handle);
  2270.         }
  2271.         SetCallState((*handle), CM_IDLE_STATE, TRUE);
  2272.     }
  2273.     if (GetTotalActiveCallCount() + GetTotalHoldCallCount() > 0)
  2274.     {
  2275.     #ifdef __MMI_VOIP__
  2276.         /* call back voip to connect voip */
  2277.         if ((mmi_voip_app_total_call() != 0) && (mmi_voip_app_get_conn_flag() == MMI_VOIP_CALL_CONN_VOIP))
  2278.         {
  2279.             mmi_voip_app_set_conn_flag(MMI_VOIP_CALL_CONN_NONE);
  2280.             mmi_voip_entry_ans_to_conn_voip();
  2281.         }
  2282.     #endif /* __MMI_VOIP__ */
  2283.         return CM_CALL_SUCCESS;
  2284.     }
  2285.     switch (GetCurrentState())
  2286.     {
  2287.         case CM_IDLE_STATE:
  2288.             PRINT_INFORMATION(("n PSHangupallSucEvent CM_IDLE_STATE not handled still n"));
  2289.             break;
  2290.         case CM_INCOMING_STATE:
  2291.         case CM_OUTGOING_STATE:
  2292.         case CM_HOLD_STATE:
  2293.         case CM_ACTIVE_STATE:
  2294.             if (GetTotalCallCount() == 0)
  2295.             {
  2296.                 SetPreviousState(GetCurrentState());
  2297.                 SetCurrentState(CM_IDLE_STATE);
  2298.             }
  2299.             else if (state == CM_INCOMING_STATE || state == CM_OUTGOING_STATE)
  2300.             {
  2301.                 SetCurrentState(GetPreviousState());
  2302.                 SetPreviousState(state);
  2303.             }
  2304.             break;
  2305.         default:
  2306.             PRINT_INFORMATION(("n PSHangupallSucEvent CM State m/c Corrupted n"));
  2307.         #ifdef __MMI_VOIP__
  2308.             /* call back voip to connect voip */
  2309.             if ((mmi_voip_app_total_call() != 0) && (mmi_voip_app_get_conn_flag() == MMI_VOIP_CALL_CONN_VOIP))
  2310.             {
  2311.                 mmi_voip_app_set_conn_flag(MMI_VOIP_CALL_CONN_NONE);
  2312.                 mmi_voip_entry_ans_to_conn_voip();
  2313.             }
  2314.         #endif /* __MMI_VOIP__ */
  2315.             return CM_CALL_FAILURE;
  2316.     }
  2317. #ifdef __MMI_VOIP__
  2318.     /* call back voip to connect voip */
  2319.     if ((mmi_voip_app_total_call() != 0) && (mmi_voip_app_get_conn_flag() == MMI_VOIP_CALL_CONN_VOIP))
  2320.     {
  2321.         mmi_voip_app_set_conn_flag(MMI_VOIP_CALL_CONN_NONE);
  2322.         mmi_voip_entry_ans_to_conn_voip();
  2323.     }
  2324. #endif /* __MMI_VOIP__ */
  2325.     return CM_CALL_SUCCESS;
  2326. }
  2327. /*****************************************************************************
  2328.  * FUNCTION
  2329.  *  ProcessKBHangupallActReqEvent
  2330.  * DESCRIPTION
  2331.  *  This is the function to process Keyboard(Request) Event CM_KB_HANGUPALLACTREQ.
  2332.  *  
  2333.  *  This Sets the flag CM_HANGUP_REQUESTED to all the Active calls
  2334.  *  Invoke the protocol function irrespective of the state.
  2335.  *  This is always Invoked in Active state as active call take precedence over held call.
  2336.  * PARAMETERS
  2337.  *  MsgStruct               [?]         
  2338.  *  ACTION_RESULT(?)        [OUT]       
  2339.  *  this(?)                 [IN]        Points to NULL as the Hangup is requested on all Active calls)
  2340.  * RETURNS
  2341.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  2342.  *****************************************************************************/
  2343. ACTION_RESULT ProcessKBHangupallActReqEvent(void *MsgStruct)
  2344. {
  2345.     /*----------------------------------------------------------------*/
  2346.     /* Local Variables                                                */
  2347.     /*----------------------------------------------------------------*/
  2348.     /*----------------------------------------------------------------*/
  2349.     /* Code Body                                                      */
  2350.     /*----------------------------------------------------------------*/
  2351.     switch (GetCurrentState())
  2352.     {
  2353.         case CM_IDLE_STATE:
  2354.             PRINT_INFORMATION(("n KBHangupallActReqEvent CM_IDLE_STATE not handled still n"));
  2355.             break;
  2356.         case CM_OUTGOING_STATE:
  2357.             PRINT_INFORMATION(("n KBHangupallActReqEvent CM_OUTGOING_STATE not handled still n"));
  2358.             break;
  2359.         case CM_INCOMING_STATE:
  2360.             // Start by Julia: Drop call refinement
  2361.             // Drop call refinement is not applicable when waiting call exists
  2362.             SetAllActHangupFlag();
  2363.             MakePsHangupallActiveRequest((void*)HangupallActReqSucess);
  2364.             break;
  2365.             /* End by Julia */
  2366.         case CM_ACTIVE_STATE:
  2367.             SetAllActHangupFlag();
  2368.             /* Start by Julia: Drop call refinement */
  2369.             SetAllActiveCallState(CM_DISCONNECTING_STATE);
  2370.             //EntryScr1002ActiveCall();
  2371.             // End by Julia
  2372.             MakePsHangupallActiveRequest((void*)HangupallActReqSucess);
  2373.             break;
  2374.         case CM_HOLD_STATE:
  2375.             PRINT_INFORMATION(("n KBHangupallActReqEvent CM_HOLD_STATE not handled still n"));
  2376.             break;
  2377.         default:
  2378.             PRINT_INFORMATION(("n KBHangupallActReqEvent CM State m/c Corrupted n"));
  2379.             return CM_CALL_FAILURE;
  2380.     }
  2381.     return CM_CALL_SUCCESS;
  2382. }
  2383. /*****************************************************************************
  2384.  * FUNCTION
  2385.  *  ProcessPSHangupallActSucEvent
  2386.  * DESCRIPTION
  2387.  *  This is the function to process Protocol(Response) Event CM_PS_HANGUPALLACTSUC.
  2388.  *  
  2389.  *  This resets the CM_HANGUP_REQUESTED flag & change the state of the all Active calls
  2390.  *  to IDLE.If necessary,It also changes the state of the state m/c.
  2391.  * PARAMETERS
  2392.  *  MsgStruct               [?]         
  2393.  *  ACTION_RESULT(?)        [OUT]       
  2394.  *  this(?)                 [IN]        Is Null as the request CM_KB_HANGUPALLACTREQ is on all Active calls)
  2395.  * RETURNS
  2396.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  2397.  *****************************************************************************/
  2398. ACTION_RESULT ProcessPSHangupallActSucEvent(void *MsgStruct)
  2399. {
  2400.     /*----------------------------------------------------------------*/
  2401.     /* Local Variables                                                */
  2402.     /*----------------------------------------------------------------*/
  2403.     CM_CALL_HANDLE *handle;
  2404.     /*----------------------------------------------------------------*/
  2405.     /* Code Body                                                      */
  2406.     /*----------------------------------------------------------------*/
  2407.     PRINT_INFORMATION(("n *** In ProcessPSHangupallActSucEventn"));
  2408.     handle = (CM_CALL_HANDLE*) MsgStruct;
  2409.     /* Start by Julia: Drop call refinement */
  2410.     if ((*handle) == -1)
  2411.     {
  2412.         PRINT_INFORMATION(("nBad call handle -1 in HangupAllActSucn"));
  2413.         return CM_CALL_FAILURE;
  2414.     }
  2415.     /* End by Julia */
  2416.     LogCallInfoForCallHistory(*handle);
  2417.     GetEndTimeAndNotifyEndCallDuration(*handle);
  2418.     SetCallState(*handle, CM_IDLE_STATE, TRUE);
  2419.     if (GetTotalActiveCallCount() >= 1)
  2420.     {
  2421.         return CM_CALL_SUCCESS;
  2422.     }
  2423.     switch (GetCurrentState())
  2424.     {
  2425.         case CM_IDLE_STATE:
  2426.             PRINT_INFORMATION(("n PSHangupallActSucEvent CM_IDLE_STATE not handled still n"));
  2427.             break;
  2428.         case CM_OUTGOING_STATE:
  2429.             PRINT_INFORMATION(("n PSHangupallActSucEvent CM_OUTGOING_STATE not handled still n"));
  2430.             break;
  2431.         case CM_INCOMING_STATE:
  2432.         case CM_ACTIVE_STATE:
  2433.             MakeAllActHangup();
  2434.             if (GetTotalCallCount() == 0)
  2435.             {
  2436.                 SetPreviousState(GetCurrentState());
  2437.                 SetCurrentState(CM_IDLE_STATE);
  2438.             }
  2439.             break;
  2440.         case CM_HOLD_STATE:
  2441.             PRINT_INFORMATION(("n PSHangupallActSucEvent CM_HOLD_STATE not handled still n"));
  2442.             break;
  2443.         default:
  2444.             PRINT_INFORMATION(("n Illegal state to be in  n"));
  2445.             return CM_CALL_FAILURE;
  2446.     }
  2447.     return CM_CALL_SUCCESS;
  2448. }
  2449. /*****************************************************************************
  2450.  * FUNCTION
  2451.  *  ProcessKBHangupallHldReqEvent
  2452.  * DESCRIPTION
  2453.  *  This is the function to process Keyboard(Request) Event CM_KB_HANGUPALLHLDREQ.
  2454.  *  
  2455.  *  This Sets the flag CM_HANGUP_REQUESTED to all the Hold/Held calls
  2456.  *  Invoke the protocol function irrespective of the state.
  2457.  *  This is Invoked in Active or Hold state.
  2458.  * PARAMETERS
  2459.  *  MsgStruct               [?]         
  2460.  *  ACTION_RESULT(?)        [OUT]       
  2461.  *  this(?)                 [IN]        Points to NULL as the Hangup is requested on all Hold State calls)
  2462.  * RETURNS
  2463.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  2464.  *****************************************************************************/
  2465. ACTION_RESULT ProcessKBHangupallHldReqEvent(void *MsgStruct)
  2466. {
  2467.     /*----------------------------------------------------------------*/
  2468.     /* Local Variables                                                */
  2469.     /*----------------------------------------------------------------*/
  2470.     /*----------------------------------------------------------------*/
  2471.     /* Code Body                                                      */
  2472.     /*----------------------------------------------------------------*/
  2473.     SetAllHldHangupFlag();
  2474.     // Start by Julia: Drop call refinement
  2475.     // Drop call refinement is not applicable when waiting call exists
  2476.     if (GetCurrentState() != CM_INCOMING_STATE)
  2477.     {
  2478.         SetAllHeldCallState(CM_DISCONNECTING_STATE);
  2479.         /* EntryScr1002ActiveCall(); */
  2480.     }
  2481.     /* End by Julia */
  2482.     MakePsSendRelHeld((void*)HangupallHldReqSucess);
  2483.     return CM_CALL_SUCCESS;
  2484. }
  2485. /*****************************************************************************
  2486.  * FUNCTION
  2487.  *  ProcessPSHangupallHldSucEvent
  2488.  * DESCRIPTION
  2489.  *  This is the function to process Protocol(Response) Event CM_PS_HANGUPALLHLDSUC.
  2490.  *  
  2491.  *  This resets the CM_HANGUP_REQUESTED flag & change the state of the all held calls
  2492.  *  to IDLE.If necessary,It also changes the state of the state m/c.
  2493.  * PARAMETERS
  2494.  *  MsgStruct               [?]         
  2495.  *  ACTION_RESULT(?)        [OUT]       
  2496.  *  this(?)                 [IN]        Is Null as the request CM_KB_HANGUPALLHLDREQ is on all Held/Hold state calls)
  2497.  * RETURNS
  2498.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  2499.  *****************************************************************************/
  2500. ACTION_RESULT ProcessPSHangupallHldSucEvent(void *MsgStruct)
  2501. {
  2502.     /*----------------------------------------------------------------*/
  2503.     /* Local Variables                                                */
  2504.     /*----------------------------------------------------------------*/
  2505.     CM_CALL_HANDLE *handle;
  2506.     /*----------------------------------------------------------------*/
  2507.     /* Code Body                                                      */
  2508.     /*----------------------------------------------------------------*/
  2509.     handle = (CM_CALL_HANDLE*) MsgStruct;
  2510.     /* Start by Julia: Drop call refinement */
  2511.     if ((*handle) == -1)
  2512.     {
  2513.         PRINT_INFORMATION(("nBad call handle -1 in HangupAllHldSucn"));
  2514.         return CM_CALL_FAILURE;
  2515.     }
  2516.     /* End by Julia */
  2517.     LogCallInfoForCallHistory(*handle);
  2518.     GetEndTimeAndNotifyEndCallDuration(*handle);
  2519.     SetCallState((*handle), CM_IDLE_STATE, TRUE);
  2520.     if (GetTotalHoldCallCount() > 0)
  2521.     {
  2522.         return CM_CALL_SUCCESS;
  2523.     }
  2524.     switch (GetCurrentState())
  2525.     {
  2526.         case CM_IDLE_STATE:
  2527.             PRINT_INFORMATION(("n PSHangupallHldSucEvent CM_IDLE_STATE not handled still n"));
  2528.             break;
  2529.         case CM_OUTGOING_STATE:
  2530.             PRINT_INFORMATION(("n PSHangupallHldSucEvent CM_OUTGOING_STATE not handled still n"));
  2531.             break;
  2532.         case CM_INCOMING_STATE:
  2533.             PRINT_INFORMATION(("n PSHangupallHldSucEvent CM_INCOMING_STATE not handled still n"));
  2534.             break;
  2535.         case CM_ACTIVE_STATE:
  2536.         case CM_HOLD_STATE:
  2537.             if (GetTotalCallCount() == 0)
  2538.             {
  2539.                 SetPreviousState(GetCurrentState());
  2540.                 SetCurrentState(CM_IDLE_STATE);
  2541.             }
  2542.             break;
  2543.         default:
  2544.             PRINT_INFORMATION(("n PSHangupallHldSucEvent CM State m/c Corrupted n"));
  2545.             return CM_CALL_FAILURE;
  2546.     }
  2547.     return CM_CALL_SUCCESS;
  2548. }
  2549. /*****************************************************************************
  2550.  * FUNCTION
  2551.  *  ProcessKBHoldReqEvent
  2552.  * DESCRIPTION
  2553.  *  This is the function to process Keyboard(Request) Event CM_KB_HOLDREQ.
  2554.  *  
  2555.  *  This Sets the flag CM_HOLD_REQUESTED to all the active call
  2556.  *  Invoke the protocol function irrespective of the state.
  2557.  *  The chances of this being invoked in Idle or Hold  state is very less.
  2558.  * PARAMETERS
  2559.  *  MsgStruct               [?]         
  2560.  *  ACTION_RESULT(?)        [OUT]       
  2561.  *  this(?)                 [IN]        Points to NULL as the hold is request on all active calls)
  2562.  * RETURNS
  2563.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  2564.  *****************************************************************************/
  2565. ACTION_RESULT ProcessKBHoldReqEvent(void *MsgStruct)
  2566. {
  2567.     /*----------------------------------------------------------------*/
  2568.     /* Local Variables                                                */
  2569.     /*----------------------------------------------------------------*/
  2570. U8 flag;
  2571.     /*----------------------------------------------------------------*/
  2572.     /* Code Body                                                      */
  2573.     /*----------------------------------------------------------------*/
  2574.     if (GetChldReqSent() != CM_ACTION_NONE)
  2575.     {
  2576.         return CM_CALL_FAILURE;
  2577.     }
  2578.     flag = GetAllCallFlags();
  2579.     if (((flag & CM_SWAP_REQUESTED) != 0) || 
  2580.      ((flag & CM_CONF_REQUESTED) != 0) ||
  2581.      ((flag & CM_ECT_REQUESTED) != 0))
  2582.     {
  2583.         return CM_CALL_FAILURE;
  2584.     }
  2585.     switch (GetCurrentState())
  2586.     {
  2587.         case CM_IDLE_STATE:
  2588.             PRINT_INFORMATION(("n KBHoldReqEvent CM_IDLE_STATE not handled still n"));
  2589.             break;
  2590.         case CM_OUTGOING_STATE:
  2591.             PRINT_INFORMATION(("n KBHoldReqEvent CM_OUTGOING_STATE not handled still n"));
  2592.             break;
  2593.         case CM_INCOMING_STATE:
  2594.             PRINT_INFORMATION(("n KBHoldReqEvent CM_INCOMING_STATE not handled still n"));
  2595.             break;
  2596.         case CM_ACTIVE_STATE:
  2597.             SetHoldFlag();
  2598.             MakePsActiveHold((void*)HoldReqSucess);
  2599.             break;
  2600.         case CM_HOLD_STATE:
  2601.             PRINT_INFORMATION(("n KBHoldReqEvent CM_HOLD_STATE not handled still n"));
  2602.             break;
  2603.         default:
  2604.             PRINT_INFORMATION(("n KBHoldReqEvent CM State m/c Corrupted n"));
  2605.             return CM_CALL_FAILURE;
  2606.     }
  2607.     return CM_CALL_SUCCESS;
  2608. }
  2609. /*****************************************************************************
  2610.  * FUNCTION
  2611.  *  ProcessPSHoldSucEvent
  2612.  * DESCRIPTION
  2613.  *  This is the function to process Protocol(Response) Event CM_PS_HOLDSUC.
  2614.  *  
  2615.  *  This resets the CM_HOLD_REQUESTED flag & change the state of the call from
  2616.  *  ACTIVE to HOLD if necessary it also changes the state of the State m/c.
  2617.  * PARAMETERS
  2618.  *  MsgStruct               [?]         
  2619.  *  ACTION_RESULT(?)        [OUT]       
  2620.  *  this(?)                 [IN]        Is Null as the request CM_KB_HOLDREQ is on all active call)
  2621.  * RETURNS
  2622.  *  This returns CM_CALL_SUCCESS if success or CM_CALL_FAILURE if failure.
  2623.  *****************************************************************************/
  2624. ACTION_RESULT ProcessPSHoldSucEvent(void *MsgStruct)
  2625. {
  2626.     /*----------------------------------------------------------------*/
  2627.     /* Local Variables                                                */
  2628.     /*----------------------------------------------------------------*/
  2629.     /*----------------------------------------------------------------*/
  2630.     /* Code Body                                                      */
  2631.     /*----------------------------------------------------------------*/
  2632.     switch (GetCurrentState())
  2633.     {
  2634.         case CM_IDLE_STATE:
  2635.             PRINT_INFORMATION(("n PSHoldSucEvent CM_IDLE_STATE not handled still n"));
  2636.             break;
  2637.         case CM_OUTGOING_STATE:
  2638.             PRINT_INFORMATION(("n PSHoldSucEvent CM_OUTGOING_STATE not handled still n"));
  2639.             break;
  2640.         case CM_INCOMING_STATE:
  2641.             PRINT_INFORMATION(("n PSHoldSucEvent CM_INCOMING_STATE n"));
  2642.             MakeHold();
  2643.             EntryScr1005NotifyHoldSucess();
  2644.             SyncCallList();
  2645.             break;
  2646.         case CM_ACTIVE_STATE:
  2647.             PRINT_INFORMATION(("n PSHoldSucEvent CM_ACTIVE_STATE n"));
  2648.             MakeHold();
  2649.             EntryScr1005NotifyHoldSucess();
  2650.             break;
  2651.         case CM_HOLD_STATE:
  2652.             PRINT_INFORMATION(("n HoldSucEvent CM_HOLD_STATE not handled still n"));
  2653.             break;
  2654.         default:
  2655.             PRINT_INFORMATION(("n PSHoldSucEvent CM State m/c Corrupted n"));
  2656.             return CM_CALL_FAILURE;
  2657.     }
  2658.     return CM_CALL_SUCCESS;
  2659. }