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

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.  *   PsCallHelper.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.  * Consider "Waiting call -> Incoming call" situation, speech must be turned off.
  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.  *******************************************************************************/
  161. /**
  162.  * Copyright Notice
  163.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  164.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  165.  *  (It is illegal to remove this copyright notice from this software or any
  166.  *  portion of it)
  167.  */
  168. /**************************************************************
  169.    FILENAME : PsCallHelper.c
  170.    PURPOSE     : Call Management application
  171.    REMARKS     : nil
  172.    AUTHOR      : Subramanya BG
  173.    DATE     : Nov 12,02
  174. **************************************************************/
  175. #include "stdC.h"
  176. #include "MMI_Features.h"
  177. #include "L4Dr.h"
  178. #include "L4Dr1.h"
  179. #include "PixtelDataTypes.h"
  180. #include "GlobalConstants.h"
  181. #include "GlobalDefs.h"
  182. #include "DebugInitDef.h"
  183. #include "ProtocolEvents.h"
  184. #include "EventsGprot.h"
  185. #include "HistoryGprot.h"
  186. #include "QueueGprot.h"
  187. #include "CommonScreens.h"
  188. #include "Wgui_categories.h"
  189. #include "Wgui_status_icons.h"
  190. #include "KeyBrd.h"
  191. #include "GSM7BitDefaultAlphabet.h"
  192. #include "MMI_trc.h"
  193. #ifdef __MMI_TOUCH_SCREEN__
  194. #include "wgui_touch_screen.h"
  195. #endif 
  196. #include "SettingsGexdcl.h"
  197. #include "CallSetup.h"
  198. #include "ManageCallMain.h"
  199. #include "Mdi_datatype.h"
  200. #include "Mdi_audio.h"
  201. #ifdef __MMI_SOUND_RECORDER__
  202. #include "mdi_datatype.h"
  203. #include "mdi_audio.h"
  204. #include "SoundRecorderDef.h"
  205. #include "SoundRecorderProt.h"
  206. #endif /* __MMI_SOUND_RECORDER__ */ 
  207. #include "CallmanagementIdDef.h"
  208. #include "CallManagementStruct.h"
  209. #include "CallStructureManagementProt.h"
  210. #include "CallManagementGprot.h"
  211. #include "CommonStubsProt.h"
  212. #include "CmErrorTypes.h"
  213. #include "CmErrorHandlersProt.h"
  214. #include "PsCallHelperDef.h"
  215. #include "mmiapi_struct.h"
  216. #include "IncomingCallManagementProt.h"
  217. #include "OutgoingCallHelperProt.h"
  218. #include "OutgoingCallManagementProt.h"
  219. #include "PsCallHelperGprot.h"
  220. #ifdef __MMI_BT_HP_SUPPORT__
  221. #include "BTMMIHPGprots.h"
  222. #endif 
  223. #ifdef __MMI_BT_SUPPORT__
  224. #include "BTMMIScrGprots.h"
  225. #endif 
  226. #ifdef __MMI_BG_SOUND_EFFECT__
  227. #include "BGSoundGProt.h"
  228. #endif 
  229. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  230. #include "ddl.h"
  231. #include "jcerror.h"
  232. #include "jdd_tapi.h"
  233. #endif
  234. S8 gUSSDbuf[MAX_DIGITS_USSD * ENCODING_LENGTH];
  235. extern U16 gSSEvent;
  236. extern MMI_BOOL gSSEventNotifyPresent;
  237. extern U16 gSSEventNotify;
  238. /*****************************************************************************
  239.  * FUNCTION
  240.  *  MakePsInitiateCall
  241.  * DESCRIPTION
  242.  *  Helper function to Invoke Stack function or pass
  243.  *  the msg structure that can be understandable to Protocol stack.
  244.  *  This is the stack function call to request outgoing call
  245.  *  
  246.  *  We are currently assuming our own msg structure and passing to NSW Task Queue.
  247.  * PARAMETERS
  248.  *  MsgStruct       [?]         
  249.  *  callBack        [?]         
  250.  *  This(?)         [IN]        Contains Telephone number of the outgoing call)
  251.  * RETURNS
  252.  *  void
  253.  *****************************************************************************/
  254. void MakePsInitiateCall(U8 *MsgStruct, void *callBack)
  255. {
  256.     /*----------------------------------------------------------------*/
  257.     /* Local Variables                                                */
  258.     /*----------------------------------------------------------------*/
  259.     U16 length;
  260.     U8 IPNum[MAX_IP_NUMBER_LEN + 1];
  261.     /*----------------------------------------------------------------*/
  262.     /* Code Body                                                      */
  263.     /*----------------------------------------------------------------*/
  264.     if (MsgStruct)
  265.     {
  266.         ClearKeyEvents();
  267.         SetDialIndication(FALSE);
  268.         memset((PS8) IPNum, 0, MAX_IP_NUMBER_LEN + 1);
  269.     #ifdef __IP_NUMBER__
  270.         if (GetTempUseIPNumber())
  271.         {
  272.             GetCurrIPNumber(IPNum);
  273.         }
  274.     #endif /* __IP_NUMBER__ */ 
  275.         length = strlen((PS8) MsgStruct);
  276.         MakePsSSVUSSDReq(MsgStruct, (PU8) IPNum, length, (void*)PsCBackSetCallFeatures);
  277.     }
  278.     return;
  279. }
  280. /*****************************************************************************
  281.  * FUNCTION
  282.  *  MakePsSSVUSSDReq
  283.  * DESCRIPTION
  284.  *  Helper function to Invoke Stack function or pass
  285.  *  the msg structure that can be understandable to Protocol stack.
  286.  *  This is the stack function call to request outgoing call
  287.  *  
  288.  *  We are currently assuming our own msg structure and passing to NSW Task Queue.
  289.  * PARAMETERS
  290.  *  MsgStruct       [?]         
  291.  *  IPNum           [?]         
  292.  *  length          [IN]        
  293.  *  callBack        [?]         
  294.  *  This(?)         [IN]        Contains Telephone number of the outgoing call)
  295.  * RETURNS
  296.  *  void
  297.  *****************************************************************************/
  298. void MakePsSSVUSSDReq(U8 *MsgStruct, U8 *IPNum, U16 length, void *callBack)
  299. {
  300.     /*----------------------------------------------------------------*/
  301.     /* Local Variables                                                */
  302.     /*----------------------------------------------------------------*/
  303.     MYQUEUE Message;
  304.     MMI_PARSE_STR *strParse;
  305.     /*----------------------------------------------------------------*/
  306.     /* Code Body                                                      */
  307.     /*----------------------------------------------------------------*/
  308.     ClearInputEventHandler(MMI_DEVICE_ALL);
  309. #ifdef __MMI_TOUCH_SCREEN__
  310.     wgui_clear_pen_handlers();
  311. #endif 
  312.     /* PARSE_SS_REQ */
  313.     Message.oslSrcId = MOD_MMI;
  314.     Message.oslDestId = MOD_L4C;
  315.     Message.oslMsgId = PRT_USSDVSS_REQ;
  316.     Message.oslPeerBuffPtr = NULL;
  317.     if (MsgStruct)
  318.     {
  319.         strParse = (MMI_PARSE_STR*) OslConstructDataPtr(sizeof(MMI_PARSE_STR));
  320.         memset(strParse->input, 0, MAX_DIGITS_USSD);
  321.         strParse->length = (U8) length;
  322.         memcpy(strParse->input, MsgStruct, strParse->length);
  323.         strParse->dcs = 0x0f;
  324.         memcpy(strParse->ip_string, IPNum, sizeof(strParse->ip_string));
  325.         Message.oslDataPtr = (oslParaType*) strParse;
  326.     }
  327.     else
  328.     {
  329.         Message.oslDataPtr = NULL;
  330.     }
  331.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_USSDVSS_RSP);
  332.     OslMsgSendExtQueue(&Message);
  333.     return;
  334. }
  335. /*****************************************************************************
  336.  * FUNCTION
  337.  *  MakePsCallAcceptIncoming
  338.  * DESCRIPTION
  339.  *  Makes call to Protcol Stack to Accept Incoming Call
  340.  *  
  341.  *  The call back registers a handler with the event dynamically
  342.  * PARAMETERS
  343.  *  callBack        [?]     
  344.  * RETURNS
  345.  *  void
  346.  *****************************************************************************/
  347. void MakePsCallAcceptIncoming(void *callBack)
  348. {
  349.     /*----------------------------------------------------------------*/
  350.     /* Local Variables                                                */
  351.     /*----------------------------------------------------------------*/
  352.     MYQUEUE Message;
  353.     FuncPtr fptrKeyEnd, fptrKeyRsk;
  354.     /*----------------------------------------------------------------*/
  355.     /* Code Body                                                      */
  356.     /*----------------------------------------------------------------*/
  357.     /* ATA_REQ */
  358.     Message.oslSrcId = MOD_MMI;
  359.     Message.oslDestId = MOD_L4C;
  360.     Message.oslMsgId = PRT_INCOMINGCALL_ACCEPT_EVENT;
  361.     Message.oslDataPtr = NULL;
  362.     Message.oslPeerBuffPtr = NULL;
  363.     /* preserve END and RSK key handler */
  364.     fptrKeyEnd = GetKeyHandler(KEY_END, KEY_EVENT_DOWN);
  365.     fptrKeyRsk = GetKeyHandler(KEY_RSK, KEY_EVENT_UP);
  366.     ClearInputEventHandler(MMI_DEVICE_ALL);
  367. #ifdef __MMI_TOUCH_SCREEN__
  368.     wgui_clear_pen_handlers();
  369. #endif 
  370.     SetKeyHandler(fptrKeyEnd, KEY_END, KEY_EVENT_DOWN);
  371.     SetKeyHandler(fptrKeyRsk, KEY_RSK, KEY_EVENT_UP);
  372.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_INCOMINGCALL_ACCEPT_SUCCESS);
  373.     OslMsgSendExtQueue(&Message);
  374.     return;
  375. }
  376. /*****************************************************************************
  377.  * FUNCTION
  378.  *  MakePsAthRequest
  379.  * DESCRIPTION
  380.  *  Sends ECT request to Protocol stack
  381.  * PARAMETERS
  382.  *  callBack        [?]         
  383.  *  callback(?)     [IN]        To register with response
  384.  * RETURNS
  385.  *  void
  386.  *****************************************************************************/
  387. void MakePsAthRequest(void *callBack)
  388. {
  389.     /*----------------------------------------------------------------*/
  390.     /* Local Variables                                                */
  391.     /*----------------------------------------------------------------*/
  392.     MYQUEUE Message;
  393.     MMI_ATH_REQ *athReq;
  394.     /*----------------------------------------------------------------*/
  395.     /* Code Body                                                      */
  396.     /*----------------------------------------------------------------*/
  397.     /* if auto-rejected, the flag will be false and it should not clear key handler */
  398.     if (GetClearKeyFlag() == TRUE)
  399.     {
  400.         ClearInputEventHandler(MMI_DEVICE_ALL);
  401.     #ifdef __MMI_TOUCH_SCREEN__
  402.         wgui_clear_pen_handlers();
  403.     #endif 
  404.     }
  405.     else
  406.     {
  407.         SetClearKeyFlag(TRUE);
  408.     }
  409.     /* ATH_REQ */
  410.     Message.oslSrcId = MOD_MMI;
  411.     Message.oslDestId = MOD_L4C;
  412.     Message.oslMsgId = PRT_ATH_REQ;
  413.     Message.oslPeerBuffPtr = NULL;
  414.     athReq = (MMI_ATH_REQ*) OslConstructDataPtr(sizeof(MMI_ATH_REQ));
  415.     Message.oslDataPtr = (oslParaType*) athReq;
  416.     if (GetCallAbortReqSentFlag())
  417.     {
  418.         /* set abort MO flag */
  419.         athReq->op_code = L4C_DISCONNECT_MO;
  420.     }
  421.     else
  422.     {
  423.         athReq->op_code = L4C_DISCONNECT_NONE;
  424.     }
  425.     if (GetCurrentState() == CM_INCOMING_STATE)
  426.     {
  427.         SetAllCallsHangupFlag();
  428.     }
  429.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_ATH_REQ_SUCCESS);
  430.     OslMsgSendExtQueue(&Message);
  431.     return;
  432. }
  433. /* Start by Julia: Drop call refinement */
  434. /*****************************************************************************
  435.  * FUNCTION
  436.  *  MakePsReleaseCompleteRequest
  437.  * DESCRIPTION
  438.  *  Send relese complete message to L4C to strictly releasae the disconnecting call
  439.  *  
  440.  *  It is for drop call refinement
  441.  * PARAMETERS
  442.  *  handle      [IN]        
  443.  * RETURNS
  444.  *  void
  445.  *****************************************************************************/
  446. void MakePsReleaseCompleteRequest(CM_CALL_HANDLE handle)
  447. {
  448.     /*----------------------------------------------------------------*/
  449.     /* Local Variables                                                */
  450.     /*----------------------------------------------------------------*/
  451.     MYQUEUE Message;
  452.     MMI_RELCOMP_REQ *relcompReq;
  453.     /*----------------------------------------------------------------*/
  454.     /* Code Body                                                      */
  455.     /*----------------------------------------------------------------*/
  456.     ClearInputEventHandler(MMI_DEVICE_ALL);
  457. #ifdef __MMI_TOUCH_SCREEN__
  458.     wgui_clear_pen_handlers();
  459. #endif 
  460.     Message.oslSrcId = MOD_MMI;
  461.     Message.oslDestId = MOD_L4C;
  462.     Message.oslMsgId = PRT_RELCOMP_EVENT;
  463.     relcompReq = (MMI_RELCOMP_REQ*) OslConstructDataPtr(sizeof(MMI_RELCOMP_REQ));
  464.     Message.oslDataPtr = (oslParaType*) relcompReq;
  465.     relcompReq->call_id = (U8) handle;
  466.     Message.oslPeerBuffPtr = NULL;
  467.     OslMsgSendExtQueue(&Message);
  468.     return;
  469. }
  470. /* End by Julia */
  471. /*****************************************************************************
  472.  * FUNCTION
  473.  *  MakePsSendUDUB
  474.  * DESCRIPTION
  475.  *  Makes call to Protcol Stack to Send User Determined User Busy
  476.  *  
  477.  *  The call back registers a handler with the event dynamically
  478.  * PARAMETERS
  479.  *  callBack        [?]     
  480.  * RETURNS
  481.  *  void
  482.  *****************************************************************************/
  483. void MakePsSendUDUB(void *callBack)
  484. {
  485.     /*----------------------------------------------------------------*/
  486.     /* Local Variables                                                */
  487.     /*----------------------------------------------------------------*/
  488.     MYQUEUE Message;
  489.     MMI_CC_CHLD_REQ *udubReq;
  490.     /*----------------------------------------------------------------*/
  491.     /* Code Body                                                      */
  492.     /*----------------------------------------------------------------*/
  493.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsSendUDUB));
  494.     /* if auto-rejected, the flag will be false and it should not clear key handler */
  495.     if (GetClearKeyFlag() == TRUE)
  496.     {
  497.         ClearInputEventHandler(MMI_DEVICE_ALL);
  498.     #ifdef __MMI_TOUCH_SCREEN__
  499.         wgui_clear_pen_handlers();
  500.     #endif 
  501.     }
  502.     else
  503.     {
  504.         SetClearKeyFlag(TRUE);
  505.     }
  506.     
  507.     SetChldReqSent(CM_UDUB_REQ_SENT);
  508.     Message.oslSrcId = MOD_MMI;
  509.     Message.oslDestId = MOD_L4C;
  510.     Message.oslMsgId = PRT_UDUB_REQ;
  511.     udubReq = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  512.     udubReq->opcode = CSMCC_REL_HELD_OR_UDUB;
  513.     Message.oslDataPtr = (oslParaType*) udubReq;
  514.     Message.oslPeerBuffPtr = NULL;
  515.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_UDUB_RES_SUCCESS);
  516.     SetProtocolEventHandler((PsFuncPtr) CheckFailureChld, PRT_END_CHLD_RSP);
  517.     OslMsgSendExtQueue(&Message);
  518.     return;
  519. }
  520. /*****************************************************************************
  521.  * FUNCTION
  522.  *  MakePsHangupallActiveAcceptOtherRequest
  523.  * DESCRIPTION
  524.  *  Helper function to Invoke Stack function or pass
  525.  *  the msg structure that can be understandable to Protocol stack.
  526.  *  This is the stack function call to request the Hangup of all Active calls
  527.  *  
  528.  *  We are currently assuming our own msg structure and passing to NSW Task Queue.
  529.  * PARAMETERS
  530.  *  callBack        [?]         
  531.  *  request(?)      [IN]        To drop all Active calls)
  532.  * RETURNS
  533.  *  void
  534.  *****************************************************************************/
  535. void MakePsHangupallActiveAcceptOtherRequest(void *callBack)
  536. {
  537.     /*----------------------------------------------------------------*/
  538.     /* Local Variables                                                */
  539.     /*----------------------------------------------------------------*/
  540.     MYQUEUE Message;
  541.     MMI_CC_CHLD_REQ *hangUp;
  542.     /*----------------------------------------------------------------*/
  543.     /* Code Body                                                      */
  544.     /*----------------------------------------------------------------*/
  545.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsHangupallActiveAcceptOtherRequest));
  546.     ClearInputEventHandler(MMI_DEVICE_ALL);
  547. #ifdef __MMI_TOUCH_SCREEN__
  548.     wgui_clear_pen_handlers();
  549. #endif 
  550.     SetChldReqSent(CM_HANGUPALLACTIVE_REQ_SENT);
  551.     Message.oslSrcId = MOD_MMI;
  552.     Message.oslDestId = MOD_L4C;
  553.     Message.oslMsgId = PRT_ENDALLACTIVE_EVENT;
  554.     hangUp = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  555.     hangUp->opcode = CSMCC_REL_ACTIVE_AND_ACCEPT;
  556.     Message.oslDataPtr = (oslParaType*) hangUp;
  557.     Message.oslPeerBuffPtr = NULL;
  558.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_ENDALLACTIVEREQ_SUCCESS);
  559.     SetProtocolEventHandler((PsFuncPtr) CBackHangupAllActiveAcceptOther, PRT_END_CHLD_RSP);
  560.     OslMsgSendExtQueue(&Message);
  561.     return;
  562. }
  563. /*****************************************************************************
  564.  * FUNCTION
  565.  *  MakePsEndSelectiveCall
  566.  * DESCRIPTION
  567.  *  Makes call to Protcol Stack to end a Selective Active Call
  568.  *  
  569.  *  The call back registers a handler with the event dynamically
  570.  *  The handle describes the call to end
  571.  * PARAMETERS
  572.  *  callBack        [?]         
  573.  *  handle          [IN]        
  574.  *  U16(?)          [IN]        
  575.  * RETURNS
  576.  *  void
  577.  *****************************************************************************/
  578. void MakePsEndSelectiveCall(void *callBack, CM_CALL_HANDLE handle)
  579. {
  580.     /*----------------------------------------------------------------*/
  581.     /* Local Variables                                                */
  582.     /*----------------------------------------------------------------*/
  583.     MYQUEUE Message;
  584.     MMI_CC_CHLD_REQ *hangupReq;
  585.     /*----------------------------------------------------------------*/
  586.     /* Code Body                                                      */
  587.     /*----------------------------------------------------------------*/
  588.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsEndSelectiveCall, handle));
  589.     ClearInputEventHandler(MMI_DEVICE_ALL);
  590. #ifdef __MMI_TOUCH_SCREEN__
  591.     wgui_clear_pen_handlers();
  592. #endif 
  593.     SetChldReqSent(CM_ENDSELECTIVE_REQ_SENT);
  594.     Message.oslSrcId = MOD_MMI;
  595.     Message.oslDestId = MOD_L4C;
  596.     Message.oslMsgId = PRT_CALLENDSPECIFIC_EVENT;
  597.     /* if (GetCurrentState () == CM_OUTGOING_STATE)
  598.        {
  599.        SetKeyHandler(DropRequest,KEY_LSK, KEY_EVENT_UP);
  600.        SetKeyHandler(DropRequest,KEY_END, KEY_EVENT_DOWN);
  601.        } */
  602.     hangupReq = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  603.     if (GetCurrentState() != CM_OUTGOING_STATE && GetCallState(handle) == CM_ACTIVE_STATE)
  604.     {
  605.         hangupReq->opcode = CSMCC_REL_SPECIFIC_ACTIVE_CALL;
  606.     }
  607.     else
  608.     {
  609.         hangupReq->opcode = CSMCC_REL_SPECIFIC_CALL;
  610.     }
  611.     hangupReq->call_id = (U8) handle;
  612.     Message.oslDataPtr = (oslParaType*) hangupReq;
  613.     Message.oslPeerBuffPtr = NULL;
  614.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_CALLENDSPECIFIC_SUCCESS);
  615.     SetProtocolEventHandler((PsFuncPtr) CheckFailureChld, PRT_END_CHLD_RSP);
  616.     OslMsgSendExtQueue(&Message);
  617.     return;
  618. }
  619. /*****************************************************************************
  620.  * FUNCTION
  621.  *  MakePsActiveHold
  622.  * DESCRIPTION
  623.  *  Makes call to Protcol Stack to Retrieve Held Call
  624.  *  
  625.  *  The call back registers a handler with the event dynamically
  626.  * PARAMETERS
  627.  *  callBack        [?]     
  628.  * RETURNS
  629.  *  void
  630.  *****************************************************************************/
  631. void MakePsActiveHold(void *callBack)
  632. {
  633.     /*----------------------------------------------------------------*/
  634.     /* Local Variables                                                */
  635.     /*----------------------------------------------------------------*/
  636.     MYQUEUE Message;
  637.     MMI_CC_CHLD_REQ *retrReq;
  638.     /*----------------------------------------------------------------*/
  639.     /* Code Body                                                      */
  640.     /*----------------------------------------------------------------*/
  641.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsActiveHold));
  642.     ClearInputEventHandler(MMI_DEVICE_ALL);
  643. #ifdef __MMI_TOUCH_SCREEN__
  644.     wgui_clear_pen_handlers();
  645. #endif 
  646.     Message.oslSrcId = MOD_MMI;
  647.     Message.oslDestId = MOD_L4C;
  648.     Message.oslMsgId = PRT_RETRIEVECALL_EVENT;
  649.     retrReq = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  650.     retrReq->opcode = CSMCC_HOLD_ACTIVE_AND_ACCEPT;
  651.     Message.oslDataPtr = (oslParaType*) retrReq;
  652.     Message.oslPeerBuffPtr = NULL;
  653.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_END_CHLD_RSP);
  654.     OslMsgSendExtQueue(&Message);
  655.     return;
  656. }
  657. /*****************************************************************************
  658.  * FUNCTION
  659.  *  MakePsSplitRequest
  660.  * DESCRIPTION
  661.  *  Helper function to Invoke Stack function or pass
  662.  *  the msg structure that can be understandable to Protocol stack.
  663.  *  This is the stack function call to request the split of particular call in a group of active calls.
  664.  *  
  665.  *  We are currently assuming our own msg structure and passing to NSW Task Queue.
  666.  * PARAMETERS
  667.  *  nCallHandle     [IN]        
  668.  *  request(?)      [IN]        Is made by sending a particular call's call handle)
  669.  * RETURNS
  670.  *  void
  671.  *****************************************************************************/
  672. void MakePsSplitRequest(CM_CALL_HANDLE nCallHandle)
  673. {
  674.     /*----------------------------------------------------------------*/
  675.     /* Local Variables                                                */
  676.     /*----------------------------------------------------------------*/
  677.     MYQUEUE Message;
  678.     MMI_CC_CHLD_REQ *splitReq;
  679.     /*----------------------------------------------------------------*/
  680.     /* Code Body                                                      */
  681.     /*----------------------------------------------------------------*/
  682.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsSplitRequest, nCallHandle));
  683.     ClearInputEventHandler(MMI_DEVICE_ALL);
  684. #ifdef __MMI_TOUCH_SCREEN__
  685.     wgui_clear_pen_handlers();
  686. #endif 
  687.     Message.oslSrcId = MOD_MMI;
  688.     Message.oslDestId = MOD_L4C;
  689.     Message.oslMsgId = PRT_SPLITCALL_EVENT;
  690.     splitReq = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  691.     splitReq->opcode = CSMCC_HOLD_ACTIVE_EXCEPT_SPECIFIC_CALL;
  692.     splitReq->call_id = (U8) nCallHandle;
  693.     Message.oslDataPtr = (oslParaType*) splitReq;
  694.     Message.oslPeerBuffPtr = NULL;
  695.     SetProtocolEventHandler(SplitReqSucess, PRT_END_CHLD_RSP);
  696.     OslMsgSendExtQueue(&Message);
  697.     return;
  698. }
  699. /*****************************************************************************
  700.  * FUNCTION
  701.  *  MakePsConfCallRequest
  702.  * DESCRIPTION
  703.  *  Helper function to Invoke Stack function or pass
  704.  *  the msg structure that can be understandable to Protocol stack.
  705.  *  This is the stack function call to request the Conference of the calls
  706.  *  
  707.  *  We are currently assuming our own msg structure and passing to NSW Task Queue.
  708.  * PARAMETERS
  709.  *  void
  710.  *  void(?)     [IN]        (request to Conference i.e all the calls become active)
  711.  * RETURNS
  712.  *  void
  713.  *****************************************************************************/
  714. void MakePsConfCallRequest(void)
  715. {
  716.     /*----------------------------------------------------------------*/
  717.     /* Local Variables                                                */
  718.     /*----------------------------------------------------------------*/
  719.     MYQUEUE Message;
  720.     MMI_CC_CHLD_REQ *confReq;
  721.     /*----------------------------------------------------------------*/
  722.     /* Code Body                                                      */
  723.     /*----------------------------------------------------------------*/
  724.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsConfCallRequest));
  725.     ClearInputEventHandler(MMI_DEVICE_ALL);
  726. #ifdef __MMI_TOUCH_SCREEN__
  727.     wgui_clear_pen_handlers();
  728. #endif 
  729.     Message.oslSrcId = MOD_MMI;
  730.     Message.oslDestId = MOD_L4C;
  731.     Message.oslMsgId = PRT_CONFCALL_EVENT;
  732.     confReq = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  733.     confReq->opcode = CSMCC_ADD_HELD_CALL;
  734.     Message.oslDataPtr = (oslParaType*) confReq;
  735.     Message.oslPeerBuffPtr = NULL;
  736.     SetProtocolEventHandler(ConfReqSucess, PRT_END_CHLD_RSP);
  737.     OslMsgSendExtQueue(&Message);
  738.     return;
  739. }
  740. /*****************************************************************************
  741.  * FUNCTION
  742.  *  MakePsEctRequest
  743.  * DESCRIPTION
  744.  *  Sends ECT request to Protocol stack
  745.  * PARAMETERS
  746.  *  void
  747.  * RETURNS
  748.  *  void
  749.  *****************************************************************************/
  750. void MakePsEctRequest(void)
  751. {
  752.     /*----------------------------------------------------------------*/
  753.     /* Local Variables                                                */
  754.     /*----------------------------------------------------------------*/
  755.     MYQUEUE Message;
  756.     MMI_CC_CHLD_REQ *ectReq;
  757.     /*----------------------------------------------------------------*/
  758.     /* Code Body                                                      */
  759.     /*----------------------------------------------------------------*/
  760.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsEctRequest));
  761.     ClearInputEventHandler(MMI_DEVICE_ALL);
  762. #ifdef __MMI_TOUCH_SCREEN__
  763.     wgui_clear_pen_handlers();
  764. #endif 
  765.     Message.oslSrcId = MOD_MMI;
  766.     Message.oslDestId = MOD_L4C;
  767.     Message.oslMsgId = PRT_ECT_REQ;
  768.     ectReq = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  769.     ectReq->opcode = CSMCC_EXPLICIT_CALL_TRANSFER;
  770.     Message.oslDataPtr = (oslParaType*) ectReq;
  771.     Message.oslPeerBuffPtr = NULL;
  772.     SetProtocolEventHandler(EctReqSucess, PRT_END_CHLD_RSP);
  773.     OslMsgSendExtQueue(&Message);
  774.     return;
  775. }
  776. /*****************************************************************************
  777.  * FUNCTION
  778.  *  MakePsActivateCCBS
  779.  * DESCRIPTION
  780.  *  Makes call to Protcol Stack to Activate CCBS
  781.  *  
  782.  *  The call back registers a handler with the event dynamically
  783.  * PARAMETERS
  784.  *  callBack        [?]     
  785.  * RETURNS
  786.  *  void
  787.  *****************************************************************************/
  788. void MakePsActivateCCBS(void *callBack)
  789. {
  790.     /*----------------------------------------------------------------*/
  791.     /* Local Variables                                                */
  792.     /*----------------------------------------------------------------*/
  793.     MYQUEUE Message;
  794.     MMI_CC_CHLD_REQ *ccbsReq;
  795.     /*----------------------------------------------------------------*/
  796.     /* Code Body                                                      */
  797.     /*----------------------------------------------------------------*/
  798.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsActivateCCBS));
  799.     ClearInputEventHandler(MMI_DEVICE_ALL);
  800. #ifdef __MMI_TOUCH_SCREEN__
  801.     wgui_clear_pen_handlers();
  802. #endif 
  803.     Message.oslSrcId = MOD_MMI;
  804.     Message.oslDestId = MOD_L4C;
  805.     Message.oslMsgId = PRT_CCBS_ACTIVATE_REQ;
  806.     ccbsReq = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  807.     ccbsReq->opcode = CSMCC_ACTIVATE_CCBS_CALL;
  808.     Message.oslDataPtr = (oslParaType*) ccbsReq;
  809.     Message.oslPeerBuffPtr = NULL;
  810.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_END_CHLD_RSP);
  811.     OslMsgSendExtQueue(&Message);
  812.     return;
  813. }
  814. /*****************************************************************************
  815.  * FUNCTION
  816.  *  MakePsHangupallRequest
  817.  * DESCRIPTION
  818.  *  Helper function to Invoke Stack function or pass
  819.  *  the msg structure that can be understandable to Protocol stack.
  820.  *  This is the stack function call to request the Hangup of all calls
  821.  *  
  822.  *  We are currently assuming our own msg structure and passing to NSW Task Queue.
  823.  * PARAMETERS
  824.  *  callBack        [?]         
  825.  *  request(?)      [IN]        To drop all the calls)
  826.  * RETURNS
  827.  *  void
  828.  *****************************************************************************/
  829. void MakePsHangupallRequest(void *callBack)
  830. {
  831.     /*----------------------------------------------------------------*/
  832.     /* Local Variables                                                */
  833.     /*----------------------------------------------------------------*/
  834.     MYQUEUE Message;
  835.     MMI_CC_CHLD_REQ *hangUp;
  836.     /*----------------------------------------------------------------*/
  837.     /* Code Body                                                      */
  838.     /*----------------------------------------------------------------*/
  839.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsHangupallRequest));
  840.     ClearInputEventHandler(MMI_DEVICE_ALL);
  841. #ifdef __MMI_TOUCH_SCREEN__
  842.     wgui_clear_pen_handlers();
  843. #endif 
  844.     SetChldReqSent(CM_HANGUPALL_REQ_SENT);
  845.     Message.oslSrcId = MOD_MMI;
  846.     Message.oslDestId = MOD_L4C;
  847.     Message.oslMsgId = PRT_ENDALLCALL_EVENT;
  848.     hangUp = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  849.     hangUp->opcode = CSMCC_REL_ALL_EXCEPT_WAITING_CALL;
  850.     Message.oslDataPtr = (oslParaType*) hangUp;
  851.     Message.oslPeerBuffPtr = NULL;
  852.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_ENDALLCALLREQ_SUCCESS);
  853.     SetProtocolEventHandler((PsFuncPtr) CheckFailureChld, PRT_END_CHLD_RSP);
  854.     OslMsgSendExtQueue(&Message);
  855.     return;
  856. }
  857. /*****************************************************************************
  858.  * FUNCTION
  859.  *  MakePsSwapCallRequest
  860.  * DESCRIPTION
  861.  *  Helper function to Invoke Stack function or pass
  862.  *  the msg structure that can be understandable to Protocol stack.
  863.  *  This is the stack function call to request the Swap of the calls
  864.  *  
  865.  *  We are currently assuming our own msg structure and passing to NSW Task Queue.
  866.  * PARAMETERS
  867.  *  callBack        [?]     
  868.  * RETURNS
  869.  *  void
  870.  *****************************************************************************/
  871. void MakePsSwapCallRequest(void *callBack)
  872. {
  873.     /*----------------------------------------------------------------*/
  874.     /* Local Variables                                                */
  875.     /*----------------------------------------------------------------*/
  876.     MYQUEUE Message;
  877.     MMI_CC_CHLD_REQ *swapReq;
  878.     /*----------------------------------------------------------------*/
  879.     /* Code Body                                                      */
  880.     /*----------------------------------------------------------------*/
  881.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsSwapCallRequest));
  882.     ClearInputEventHandler(MMI_DEVICE_ALL);
  883. #ifdef __MMI_TOUCH_SCREEN__
  884.     wgui_clear_pen_handlers();
  885. #endif 
  886.     Message.oslSrcId = MOD_MMI;
  887.     Message.oslDestId = MOD_L4C;
  888.     Message.oslMsgId = PRT_SWAPCALL_EVENT;
  889.     swapReq = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  890.     swapReq->opcode = CSMCC_SWAP_CALL;
  891.     Message.oslDataPtr = (oslParaType*) swapReq;
  892.     Message.oslPeerBuffPtr = NULL;
  893.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_END_CHLD_RSP);
  894.     OslMsgSendExtQueue(&Message);
  895.     return;
  896. }
  897. /*****************************************************************************
  898.  * FUNCTION
  899.  *  MakePsSendRelHeld
  900.  * DESCRIPTION
  901.  *  Helper function to Invoke Stack function or pass
  902.  *  the msg structure that can be understandable to Protocol stack.
  903.  *  This is the stack function call to request the Release of the held calls
  904.  *  
  905.  *  We are currently assuming our own msg structure and passing to NSW Task Queue.
  906.  * PARAMETERS
  907.  *  callBack        [?]     
  908.  * RETURNS
  909.  *  void
  910.  *****************************************************************************/
  911. void MakePsSendRelHeld(void *callBack)
  912. {
  913.     /*----------------------------------------------------------------*/
  914.     /* Local Variables                                                */
  915.     /*----------------------------------------------------------------*/
  916.     MYQUEUE Message;
  917.     MMI_CC_CHLD_REQ *relHeldReq;
  918.     /*----------------------------------------------------------------*/
  919.     /* Code Body                                                      */
  920.     /*----------------------------------------------------------------*/
  921.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsSendRelHeld));
  922.     ClearInputEventHandler(MMI_DEVICE_ALL);
  923. #ifdef __MMI_TOUCH_SCREEN__
  924.     wgui_clear_pen_handlers();
  925. #endif 
  926.     SetChldReqSent(CM_UDUB_REQ_SENT);
  927.     Message.oslSrcId = MOD_MMI;
  928.     Message.oslDestId = MOD_L4C;
  929.     Message.oslMsgId = PRT_UDUB_REQ;
  930.     relHeldReq = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  931.     relHeldReq->opcode = CSMCC_REL_HELD;
  932.     Message.oslDataPtr = (oslParaType*) relHeldReq;
  933.     Message.oslPeerBuffPtr = NULL;
  934.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_UDUB_RES_SUCCESS);
  935.     SetProtocolEventHandler((PsFuncPtr) CheckFailureChld, PRT_END_CHLD_RSP);
  936.     OslMsgSendExtQueue(&Message);
  937.     return;
  938. }
  939. /*****************************************************************************
  940.  * FUNCTION
  941.  *  MakePsHangupallActiveRequest
  942.  * DESCRIPTION
  943.  *  Helper function to Invoke Stack function or pass
  944.  *  the msg structure that can be understandable to Protocol stack.
  945.  *  This is the stack function call to request the Hangup of all Active calls
  946.  *  
  947.  *  We are currently assuming our own msg structure and passing to NSW Task Queue.
  948.  * PARAMETERS
  949.  *  callBack        [?]         
  950.  *  request(?)      [IN]        To drop all Active calls)
  951.  * RETURNS
  952.  *  void
  953.  *****************************************************************************/
  954. void MakePsHangupallActiveRequest(void *callBack)
  955. {
  956.     /*----------------------------------------------------------------*/
  957.     /* Local Variables                                                */
  958.     /*----------------------------------------------------------------*/
  959.     MYQUEUE Message;
  960.     MMI_CC_CHLD_REQ *hangUp;
  961.     /*----------------------------------------------------------------*/
  962.     /* Code Body                                                      */
  963.     /*----------------------------------------------------------------*/
  964.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsHangupallActiveRequest));
  965.     ClearInputEventHandler(MMI_DEVICE_ALL);
  966. #ifdef __MMI_TOUCH_SCREEN__
  967.     wgui_clear_pen_handlers();
  968. #endif 
  969.     SetChldReqSent(CM_HANGUPALLACTIVE_REQ_SENT);
  970.     Message.oslSrcId = MOD_MMI;
  971.     Message.oslDestId = MOD_L4C;
  972.     Message.oslMsgId = PRT_ENDALLACTIVE_EVENT;
  973.     hangUp = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  974.     hangUp->opcode = CSMCC_REL_ACTIVE;
  975.     Message.oslDataPtr = (oslParaType*) hangUp;
  976.     Message.oslPeerBuffPtr = NULL;
  977.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_ENDALLACTIVEREQ_SUCCESS);
  978.     SetProtocolEventHandler((PsFuncPtr) CBackHangupAllActive, PRT_END_CHLD_RSP);
  979.     OslMsgSendExtQueue(&Message);
  980.     return;
  981. }
  982. /*****************************************************************************
  983.  * FUNCTION
  984.  *  MakePsHangupallCallsRequest
  985.  * DESCRIPTION
  986.  *  Helper function to Invoke Stack function or pass
  987.  *  the msg structure that can be understandable to Protocol stack.
  988.  *  This is the stack function call to request the Hangup of all calls
  989.  *  
  990.  *  We are currently assuming our own msg structure and passing to NSW Task Queue.
  991.  * PARAMETERS
  992.  *  callBack        [?]         
  993.  *  request(?)      [IN]        To drop all the calls)
  994.  * RETURNS
  995.  *  void
  996.  *****************************************************************************/
  997. void MakePsHangupallCallsRequest(void *callBack)
  998. {
  999.     /*----------------------------------------------------------------*/
  1000.     /* Local Variables                                                */
  1001.     /*----------------------------------------------------------------*/
  1002.     MYQUEUE Message;
  1003.     MMI_CC_CHLD_REQ *hangUp;
  1004.     /*----------------------------------------------------------------*/
  1005.     /* Code Body                                                      */
  1006.     /*----------------------------------------------------------------*/
  1007.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsHangupallCallsRequest));
  1008.     ClearInputEventHandler(MMI_DEVICE_ALL);
  1009. #ifdef __MMI_TOUCH_SCREEN__
  1010.     wgui_clear_pen_handlers();
  1011. #endif 
  1012.     SetChldReqSent(CM_HANGUPALL_REQ_SENT);
  1013.     Message.oslSrcId = MOD_MMI;
  1014.     Message.oslDestId = MOD_L4C;
  1015.     Message.oslMsgId = PRT_ENDALLCALL_EVENT;
  1016.     hangUp = (MMI_CC_CHLD_REQ*) OslConstructDataPtr(sizeof(MMI_CC_CHLD_REQ));
  1017.     hangUp->opcode = CSMCC_REL_ALL;
  1018.     Message.oslDataPtr = (oslParaType*) hangUp;
  1019.     Message.oslPeerBuffPtr = NULL;
  1020.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_ENDALLCALLREQ_SUCCESS);
  1021.     SetProtocolEventHandler((PsFuncPtr) CheckFailureChld, PRT_END_CHLD_RSP);
  1022.     OslMsgSendExtQueue(&Message);
  1023.     return;
  1024. }
  1025. /*****************************************************************************
  1026.  * FUNCTION
  1027.  *  MakePsCallDeflect
  1028.  * DESCRIPTION
  1029.  *  Makes call to Protcol Stack to deflect incoming Call
  1030.  *  
  1031.  *  The call back registers a handler with the event dynamically
  1032.  * PARAMETERS
  1033.  *  callBack                [?]         
  1034.  *  CallDeflectNumber       [IN]        
  1035.  * RETURNS
  1036.  *  void
  1037.  *****************************************************************************/
  1038. void MakePsCallDeflect(void *callBack, PU8 CallDeflectNumber)
  1039. {
  1040.     /*----------------------------------------------------------------*/
  1041.     /* Local Variables                                                */
  1042.     /*----------------------------------------------------------------*/
  1043.     MYQUEUE Message;
  1044.     MMI_CALL_DEFLECT_REQ *calldeflect;
  1045.     /*----------------------------------------------------------------*/
  1046.     /* Code Body                                                      */
  1047.     /*----------------------------------------------------------------*/
  1048.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsCallDeflect));
  1049.     ClearInputEventHandler(MMI_DEVICE_ALL);
  1050. #ifdef __MMI_TOUCH_SCREEN__
  1051.     wgui_clear_pen_handlers();
  1052. #endif 
  1053.     Message.oslSrcId = MOD_MMI;
  1054.     Message.oslDestId = MOD_L4C;
  1055.     Message.oslMsgId = PRT_CALL_DEFLECT_REQ;
  1056.     calldeflect = (MMI_CALL_DEFLECT_REQ*) OslConstructDataPtr(sizeof(MMI_CALL_DEFLECT_REQ));
  1057.     if (CallDeflectNumber[0] == '+')
  1058.     {
  1059.         calldeflect->dest.type = CSMCC_INTERNATIONAL_ADDR;
  1060.         strcpy((S8*) calldeflect->dest.number, (S8*) CallDeflectNumber + 1);
  1061.     }
  1062.     else
  1063.     {
  1064.         calldeflect->dest.type = CSMCC_DEFAULT_ADDR_TYPE;
  1065.         strcpy((S8*) calldeflect->dest.number, (S8*) CallDeflectNumber);
  1066.     }
  1067.     calldeflect->dest.length = strlen((PS8) calldeflect->dest.number);
  1068.     calldeflect->sub_addr_flag = KAL_FALSE;
  1069.     memset((void*)&(calldeflect->sub_dest), 0, sizeof(calldeflect->sub_dest));
  1070.     Message.oslDataPtr = (oslParaType*) calldeflect;
  1071.     Message.oslPeerBuffPtr = NULL;
  1072.     SetProtocolEventHandler((PsFuncPtr) callBack, PRT_CALL_DEFLECT_RSP);
  1073.     OslMsgSendExtQueue(&Message);
  1074.     return;
  1075. }
  1076. /*****************************************************************************
  1077.  * FUNCTION
  1078.  *  MakePsGetCallList
  1079.  * DESCRIPTION
  1080.  *  Makes call to Protcol Stack to get call list
  1081.  * PARAMETERS
  1082.  *  callBack        [?]     
  1083.  * RETURNS
  1084.  *  void
  1085.  *****************************************************************************/
  1086. void MakePsGetCallList(void *callBack)
  1087. {
  1088.     /*----------------------------------------------------------------*/
  1089.     /* Local Variables                                                */
  1090.     /*----------------------------------------------------------------*/
  1091.     MYQUEUE Message;
  1092.     /*----------------------------------------------------------------*/
  1093.     /* Code Body                                                      */
  1094.     /*----------------------------------------------------------------*/
  1095.     Message.oslSrcId = MOD_MMI;
  1096.     Message.oslDestId = MOD_L4C;
  1097.     Message.oslMsgId = PTR_GET_CALL_LIST_REQ;
  1098.     Message.oslDataPtr = NULL;
  1099.     Message.oslPeerBuffPtr = NULL;
  1100.     SetProtocolEventHandler((PsFuncPtr) callBack, PTR_GET_CALL_LIST_RSP);
  1101.     OslMsgSendExtQueue(&Message);
  1102.     return;
  1103. }
  1104. /*****************************************************************************
  1105.  * FUNCTION
  1106.  *  MakePsDropUSSDReq
  1107.  * DESCRIPTION
  1108.  *  Aborts SS string request
  1109.  * PARAMETERS
  1110.  *  callBack        [IN]        
  1111.  *  callback(?)     [IN]        To register with response
  1112.  * RETURNS
  1113.  *  void
  1114.  *****************************************************************************/
  1115. void MakePsDropUSSDReq(PsFuncPtr callBack)
  1116. {
  1117.     /*----------------------------------------------------------------*/
  1118.     /* Local Variables                                                */
  1119.     /*----------------------------------------------------------------*/
  1120.     MYQUEUE Message;
  1121.     /*----------------------------------------------------------------*/
  1122.     /* Code Body                                                      */
  1123.     /*----------------------------------------------------------------*/
  1124.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsDropUSSDReq));
  1125.     ResetCFCondStage();
  1126.     /* Amanda, background abort should not clear key handler */
  1127.     if (callBack != NULL)
  1128.     {
  1129.         ClearInputEventHandler(MMI_DEVICE_ALL);
  1130.     #ifdef __MMI_TOUCH_SCREEN__
  1131.         wgui_clear_pen_handlers();
  1132.     #endif 
  1133.     }
  1134.     Message.oslSrcId = MOD_MMI;
  1135.     Message.oslDestId = MOD_L4C;
  1136.     Message.oslMsgId = PRT_SS_STRING_ABORT_REQ;
  1137.     Message.oslPeerBuffPtr = NULL;
  1138.     Message.oslDataPtr = NULL;
  1139.     SetProtocolEventHandler(callBack, PRT_SS_STRING_ABORT_RSP);
  1140.     OslMsgSendExtQueue(&Message);
  1141.     return;
  1142. }
  1143. /*****************************************************************************
  1144.  * FUNCTION
  1145.  *  MakePsSendDTMFTone
  1146.  * DESCRIPTION
  1147.  *  Helper function to start sending a dtmf tone
  1148.  * PARAMETERS
  1149.  *  MsgStruct       [?]         
  1150.  *  U8(?)           [IN]        * This contains digit to send to pstack
  1151.  * RETURNS
  1152.  *  void
  1153.  *****************************************************************************/
  1154. void MakePsSendDTMFTone(U16 *MsgStruct)
  1155. {
  1156.     /*----------------------------------------------------------------*/
  1157.     /* Local Variables                                                */
  1158.     /*----------------------------------------------------------------*/
  1159.     /*----------------------------------------------------------------*/
  1160.     /* Code Body                                                      */
  1161.     /*----------------------------------------------------------------*/
  1162.     if (MsgStruct)
  1163.     {
  1164.         MYQUEUE Message;
  1165.         MMI_DTMF_DIGIT *dtmf;
  1166.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsSendDTMFTone));
  1167.         Message.oslSrcId = MOD_MMI;
  1168.         Message.oslDestId = MOD_L4C;
  1169.         Message.oslMsgId = PRT_DTMF_START_REQ;
  1170.         dtmf = (MMI_DTMF_DIGIT*) OslConstructDataPtr(sizeof(MMI_DTMF_DIGIT));
  1171.         dtmf->digit = MapDtmfEnum2Ascii(*MsgStruct);    /* the actuall digit */
  1172.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_MakePsSendDTMFTone, dtmf->digit));
  1173.         Message.oslDataPtr = (oslParaType*) dtmf;
  1174.         Message.oslPeerBuffPtr = NULL;
  1175.         OslMsgSendExtQueue(&Message);
  1176.     }
  1177.     return;
  1178. }
  1179. /*****************************************************************************
  1180.  * FUNCTION
  1181.  *  MakePsStopDTMFTone
  1182.  * DESCRIPTION
  1183.  *  Helper function to stop dtmf tone
  1184.  * PARAMETERS
  1185.  *  void
  1186.  * RETURNS
  1187.  *  void
  1188.  *****************************************************************************/
  1189. void MakePsStopDTMFTone(void)
  1190. {
  1191.     /*----------------------------------------------------------------*/
  1192.     /* Local Variables                                                */
  1193.     /*----------------------------------------------------------------*/
  1194.     MYQUEUE Message;
  1195.     /*----------------------------------------------------------------*/
  1196.     /* Code Body                                                      */
  1197.     /*----------------------------------------------------------------*/
  1198.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsStopDTMFTone));
  1199.     Message.oslSrcId = MOD_MMI;
  1200.     Message.oslDestId = MOD_L4C;
  1201.     Message.oslMsgId = PRT_DTMF_STOP_REQ;
  1202.     Message.oslDataPtr = NULL;
  1203.     Message.oslPeerBuffPtr = NULL;
  1204.     OslMsgSendExtQueue(&Message);
  1205.     return;
  1206. }
  1207. /*****************************************************************************
  1208.  * FUNCTION
  1209.  *  MakePsSendDTMFString
  1210.  * DESCRIPTION
  1211.  *  Helper function to start sending a dtmf tone
  1212.  * PARAMETERS
  1213.  *  MsgStruct       [?]         
  1214.  *  This(?)         [IN]        Contains digit to send to pstack
  1215.  * RETURNS
  1216.  *  void
  1217.  *****************************************************************************/
  1218. void MakePsSendDTMFString(U8 *MsgStruct)
  1219. {
  1220.     /*----------------------------------------------------------------*/
  1221.     /* Local Variables                                                */
  1222.     /*----------------------------------------------------------------*/
  1223.     MYQUEUE Message;
  1224.     MMI_DTMF_CONFIRM_REQ *dtmf;
  1225.     /*----------------------------------------------------------------*/
  1226.     /* Code Body                                                      */
  1227.     /*----------------------------------------------------------------*/
  1228.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsSendDTMFString));
  1229.     Message.oslSrcId = MOD_MMI;
  1230.     Message.oslDestId = MOD_L4C;
  1231.     Message.oslMsgId = PRT_DTMF_CONFIRM_REQ;
  1232.     dtmf = (MMI_DTMF_CONFIRM_REQ*) OslConstructDataPtr(sizeof(MMI_DTMF_CONFIRM_REQ));
  1233.     strcpy((void*)dtmf->digit, (void*)MsgStruct);
  1234.     Message.oslDataPtr = (oslParaType*) dtmf;
  1235.     Message.oslPeerBuffPtr = NULL;
  1236.     OslMsgSendExtQueue(&Message);
  1237.     return;
  1238. }
  1239. /*****************************************************************************
  1240.  * FUNCTION
  1241.  *  MakePsReverseSpeechStatusAux
  1242.  * DESCRIPTION
  1243.  *  Makes call to Protcol Stack to send USSD data to n/w
  1244.  *  
  1245.  *  The call back registers a handler with the event dynamically
  1246.  *  info describes the data to transparently send to n/w
  1247.  * PARAMETERS
  1248.  *  status      [IN]        
  1249.  *  void(?)     [IN]        *, void*
  1250.  * RETURNS
  1251.  *  void
  1252.  *****************************************************************************/
  1253. void MakePsReverseSpeechStatusAux(pBOOL speechOn, U8 type)
  1254. {
  1255.     if (speechOn == KAL_TRUE)
  1256.     {
  1257.         if (type == MDI_AUDIO_SPEECH_APP_ID_GSM && mdi_audio_speech_get_app_id() != MDI_AUDIO_SPEECH_APP_ID_GSM)
  1258.         {
  1259.             mdi_audio_speech_session_start(MDI_AUDIO_SPEECH_APP_ID_GSM);
  1260.         }
  1261.         else if (type == MDI_AUDIO_SPEECH_APP_ID_WCDMA && mdi_audio_speech_get_app_id() != MDI_AUDIO_SPEECH_APP_ID_WCDMA)
  1262.         {
  1263.             mdi_audio_speech_session_start(MDI_AUDIO_SPEECH_APP_ID_WCDMA);
  1264.         }
  1265.         mdi_audio_speech_codec_start(); 
  1266.     }
  1267.     else
  1268.     {
  1269.         if ((type == MDI_AUDIO_SPEECH_APP_ID_GSM && 
  1270.          mdi_audio_speech_get_app_id() == MDI_AUDIO_SPEECH_APP_ID_GSM) ||
  1271.             (type == MDI_AUDIO_SPEECH_APP_ID_WCDMA && 
  1272.             mdi_audio_speech_get_app_id() == MDI_AUDIO_SPEECH_APP_ID_WCDMA))
  1273.         {
  1274.             mdi_audio_speech_codec_stop(); 
  1275.         
  1276.             if ((GetTotalCallCount() == 0 ||(GetTotalCallCount() == 1 && GetCurrentState() == CM_INCOMING_STATE)) && type == MDI_AUDIO_SPEECH_APP_ID_GSM)
  1277.             {
  1278.             mdi_audio_speech_session_stop(MDI_AUDIO_SPEECH_APP_ID_GSM);
  1279.             } 
  1280.             else if ((GetTotalCallCount() == 0 ||(GetTotalCallCount() == 1 && GetCurrentState() == CM_INCOMING_STATE)) && type == MDI_AUDIO_SPEECH_APP_ID_WCDMA)
  1281.             {
  1282.                 mdi_audio_speech_session_stop(MDI_AUDIO_SPEECH_APP_ID_WCDMA);
  1283.             }
  1284.         }
  1285.     }
  1286. }
  1287. /*****************************************************************************
  1288.  * FUNCTION
  1289.  *  MakePsReverseSpeechStatus
  1290.  * DESCRIPTION
  1291.  *  Makes call to Protcol Stack to send USSD data to n/w
  1292.  *  
  1293.  *  The call back registers a handler with the event dynamically
  1294.  *  info describes the data to transparently send to n/w
  1295.  * PARAMETERS
  1296.  *  status      [IN]        
  1297.  *  void(?)     [IN]        *, void*
  1298.  * RETURNS
  1299.  *  void
  1300.  *****************************************************************************/
  1301. void MakePsReverseSpeechStatus(pBOOL status, U8 type)
  1302. {
  1303.     /*----------------------------------------------------------------*/
  1304.     /* Local Variables                                                */
  1305.     /*----------------------------------------------------------------*/
  1306.     BOOL speechOn;
  1307.     /*----------------------------------------------------------------*/
  1308.     /* Code Body                                                      */
  1309.     /*----------------------------------------------------------------*/
  1310.     if (status == TRUE)
  1311.     {
  1312.         if (GetInternalAlert() == TRUE)
  1313.         {
  1314.             StopInternalOutgoingTone();
  1315.         }
  1316.         speechOn = KAL_TRUE;
  1317.     }
  1318.     else
  1319.     {
  1320.         speechOn = KAL_FALSE;
  1321.     #ifdef __MMI_SOUND_RECORDER__
  1322.         mmi_sndrec_auto_record_switch(MMI_FALSE);
  1323.     #endif
  1324.     
  1325.         /* Stop background sound effect before speech off */
  1326.     #if defined(__MMI_BG_SOUND_EFFECT__)
  1327.         mmi_bgsnd_util_switch_speech(MMI_FALSE);
  1328.     #endif 
  1329.         if (IsPhoneInMute())
  1330.         {
  1331.             UnMutethePhone();
  1332.         }
  1333.     }
  1334. #ifdef __MMI_BT_HP_SUPPORT__
  1335.     /* Turn on/off BT speech channel */
  1336.     if (KAL_TRUE == speechOn)
  1337.     {
  1338.         if (mmi_bt_is_aud2hf() == MMI_TRUE && mmi_bt_is_answer_by_ag() == MMI_FALSE)
  1339.         {
  1340.             mmi_bt_turn_on_speech_req(KAL_TRUE);
  1341.         }
  1342.         //mdi_audio_set_speech_mode(KAL_TRUE);
  1343.         MakePsReverseSpeechStatusAux(speechOn, type);
  1344.     }
  1345.     else
  1346.     {
  1347.         //mdi_audio_set_speech_mode(KAL_FALSE);
  1348.         MakePsReverseSpeechStatusAux(speechOn, type);
  1349.         if (mmi_bt_is_aud2hf() == MMI_TRUE || mmi_bt_is_incall_aud_swap2bt() == MMI_TRUE)
  1350.         {
  1351.             mmi_bt_turn_on_speech_req(MMI_FALSE);
  1352.         }
  1353.     }
  1354.     mmi_bt_set_answer_by_ag_flag(MMI_FALSE);
  1355. #elif defined(__MMI_BT_SUPPORT__) && !defined(__MMI_BT_PROFILE__)
  1356.     /* Turn on/off BT speech channel */
  1357.     if (KAL_TRUE == speechOn)
  1358.     {
  1359.         if (mmi_bt_is_aud2hf() == MMI_TRUE)
  1360.         {
  1361.             mmi_bt_turn_on_speech_req(KAL_TRUE);
  1362.         }
  1363.         //mdi_audio_set_speech_mode(KAL_TRUE);
  1364.         MakePsReverseSpeechStatusAux(speechOn, type);
  1365.     }
  1366.     else
  1367.     {
  1368.         //mdi_audio_set_speech_mode(KAL_FALSE);
  1369.         MakePsReverseSpeechStatusAux(speechOn, type);
  1370.         if (mmi_bt_is_aud2hf() == MMI_TRUE || mmi_bt_is_incall_aud_swap2bt() == MMI_TRUE)
  1371.         {
  1372.             mmi_bt_turn_on_speech_req(MMI_FALSE);
  1373.         }
  1374.     }
  1375. #else 
  1376.     MakePsReverseSpeechStatusAux(speechOn, type);
  1377.     //mdi_audio_set_speech_mode(speechOn);
  1378. #endif 
  1379.     /* Start background sound effect after speech on */
  1380. #if defined(__MMI_BG_SOUND_EFFECT__)
  1381.     if (KAL_TRUE == speechOn)
  1382.     {
  1383.         mmi_bgsnd_util_switch_speech(MMI_TRUE);
  1384.     }
  1385. #endif /* defined(__MMI_BG_SOUND_EFFECT__) */ 
  1386. #ifdef __MMI_SOUND_RECORDER__
  1387.     if(KAL_TRUE == speechOn)
  1388.     {
  1389.         mmi_sndrec_auto_record_switch(MMI_TRUE);
  1390.     }
  1391. #endif /* __MMI_SOUND_RECORDER__ */
  1392. }
  1393. /*****************************************************************************
  1394.  * FUNCTION
  1395.  *  MakePsStartVoiceRecord
  1396.  * DESCRIPTION
  1397.  *  Sends start voice record request to Protocol stack
  1398.  * PARAMETERS
  1399.  *  void
  1400.  * RETURNS
  1401.  *  void
  1402.  *****************************************************************************/
  1403. void MakePsStartVoiceRecord(void)
  1404. {
  1405. #ifdef MMI_ON_HARDWARE_P
  1406.     /*----------------------------------------------------------------*/
  1407.     /* Local Variables                                                */
  1408.     /*----------------------------------------------------------------*/
  1409. #ifdef __MMI_SOUND_RECORDER__
  1410.     U8 file_name[60];
  1411.     /*----------------------------------------------------------------*/
  1412.     /* Code Body                                                      */
  1413.     /*----------------------------------------------------------------*/
  1414.     mmi_sndrec_get_new_file_name((UI_string_type) file_name);
  1415.     mdi_audio_start_record((void*)file_name, MDI_FORMAT_GSM_EFR, NULL, (mdi_callback) StartVoiceRecordReqSucess);
  1416.     return;
  1417. #endif /* __MMI_SOUND_RECORDER__ */ 
  1418. #ifdef __MMI_VOICE_MEMO__
  1419.     {
  1420.         MYQUEUE Message;
  1421.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsStartVoiceRecord));
  1422.         Message.oslSrcId = MOD_MMI;
  1423.         Message.oslDestId = MOD_L4C;
  1424.         Message.oslMsgId = PRT_START_VOICERECORD_REQ;
  1425.         Message.oslPeerBuffPtr = NULL;
  1426.         Message.oslDataPtr = NULL;
  1427.         SetProtocolEventHandler(StartVoiceRecordReqSucess, PRT_START_VOICERECORD_RSP);
  1428.         SetProtocolEventHandler(VoiceRecordFinishHandler, PRT_VOICERECORD_FINISH_IND);
  1429.         OslMsgSendExtQueue(&Message);
  1430.     }
  1431. #endif /* __MMI_VOICE_MEMO__ */ 
  1432. #endif /* MMI_ON_HARDWARE_P */ 
  1433. }
  1434. /*****************************************************************************
  1435.  * FUNCTION
  1436.  *  MakePsStopVoiceRecord
  1437.  * DESCRIPTION
  1438.  *  Sends stop voice record request to Protocol stack
  1439.  * PARAMETERS
  1440.  *  void
  1441.  * RETURNS
  1442.  *  void
  1443.  *****************************************************************************/
  1444. void MakePsStopVoiceRecord(void)
  1445. {
  1446. #ifdef MMI_ON_HARDWARE_P
  1447.     /*----------------------------------------------------------------*/
  1448.     /* Local Variables                                                */
  1449.     /*----------------------------------------------------------------*/
  1450.     /*----------------------------------------------------------------*/
  1451.     /* Code Body                                                      */
  1452.     /*----------------------------------------------------------------*/
  1453. #ifdef __MMI_SOUND_RECORDER__
  1454.     mdi_audio_stop_record();
  1455.     return;
  1456. #endif /* __MMI_SOUND_RECORDER__ */ 
  1457. #ifdef __MMI_VOICE_MEMO__
  1458.     {
  1459.         MYQUEUE Message;
  1460.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_MakePsStopVoiceRecord));
  1461.         Message.oslSrcId = MOD_MMI;
  1462.         Message.oslDestId = MOD_L4C;
  1463.         Message.oslMsgId = PRT_STOP_VOICERECORD_REQ;
  1464.         Message.oslPeerBuffPtr = NULL;
  1465.         Message.oslDataPtr = NULL;
  1466.         /* SetProtocolEventHandler (StopVoiceRecordReqSucess,
  1467.            PRT_STOP_VOICERECORD_RSP); */
  1468.         SetProtocolEventHandler(NULL, PRT_VOICERECORD_FINISH_IND);
  1469.         OslMsgSendExtQueue(&Message);
  1470.     }
  1471. #endif /* __MMI_VOICE_MEMO__ */ 
  1472. #endif /* MMI_ON_HARDWARE_P */ 
  1473. }
  1474. /*****************************************************************************
  1475.  * FUNCTION
  1476.  *  StartVoiceRecordReqSucess
  1477.  * DESCRIPTION
  1478.  *  gets the response of Start Voice Record
  1479.  *  
  1480.  *  We are assuming that the protocol stack sends the Sucess response for the Conference request
  1481.  *  without any structure.
  1482.  * PARAMETERS
  1483.  *  MsgStruct       [?]         
  1484.  *  This(?)         [IN]        Contains Null)
  1485.  * RETURNS
  1486.  *  void
  1487.  *****************************************************************************/
  1488. void StartVoiceRecordReqSucess(void *MsgStruct)
  1489. {
  1490.     /*----------------------------------------------------------------*/
  1491.     /* Local Variables                                                */
  1492.     /*----------------------------------------------------------------*/
  1493.     S32 result;
  1494.     /*----------------------------------------------------------------*/
  1495.     /* Code Body                                                      */
  1496.     /*----------------------------------------------------------------*/
  1497.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_FUNC_StartVoiceRecordReqSucess));
  1498.     result = (S32) MsgStruct;
  1499. #ifdef __MMI_SOUND_RECORDER__
  1500.     if (result == MDI_AUDIO_SUCCESS)
  1501.     {
  1502.         SetVoiceRecordingFlag(TRUE);
  1503.         ShowStatusIcon(STATUS_ICON_VOICE_RECORD);
  1504.         UpdateStatusIcons();
  1505.     }
  1506.     else if (result == MDI_AUDIO_TERMINATED)
  1507.     {
  1508.         /* do nothing */
  1509.     }
  1510.     else if (result == MDI_AUDIO_DISC_FULL)
  1511.     {
  1512.         VoiceRecordFinishHandler(NULL);
  1513.         DisplayPopup(
  1514.             (U8*) GetString((U16) mmi_sndrec_get_res_string((U8) result)),
  1515.             IMG_GLOBAL_UNFINISHED,
  1516.             0,
  1517.             2000,
  1518.             ERROR_TONE_IN_CALL);
  1519.     }
  1520.     else
  1521.     {
  1522.         DisplayPopup(
  1523.             (U8*) GetString((U16) mmi_sndrec_get_res_string((U8) result)),
  1524.             IMG_GLOBAL_UNFINISHED,
  1525.             0,
  1526.             2000,
  1527.             ERROR_TONE_IN_CALL);
  1528.     }
  1529.     return;
  1530. #else /* __MMI_SOUND_RECORDER__ */ 
  1531.     {
  1532.         mmi_vm_record_rsp_struct *rsp = (mmi_vm_record_rsp_struct*) MsgStruct;
  1533.         if (rsp->result)
  1534.         {
  1535.             SetVoiceRecordingFlag(TRUE);
  1536.             ShowStatusIcon(STATUS_ICON_VOICE_RECORD);
  1537.             UpdateStatusIcons();
  1538.         }
  1539.     }
  1540. #endif /* __MMI_SOUND_RECORDER__ */ 
  1541. }
  1542. /*****************************************************************************
  1543.  * FUNCTION
  1544.  *  VoiceRecordFinishHandler
  1545.  * DESCRIPTION
  1546.  *  gets the indication of Voice Record has completed
  1547.  *  
  1548.  *  We are assuming that the protocol stack sends the Sucess response for the Conference request
  1549.  *  without any structure.
  1550.  * PARAMETERS
  1551.  *  MsgStruct       [?]         
  1552.  *  This(?)         [IN]        Contains Null)
  1553.  * RETURNS
  1554.  *  void
  1555.  *****************************************************************************/
  1556. void VoiceRecordFinishHandler(void *MsgStruct)
  1557. {
  1558.     /*----------------------------------------------------------------*/
  1559.     /* Local Variables                                                */
  1560.     /*----------------------------------------------------------------*/
  1561.     /*----------------------------------------------------------------*/
  1562.     /* Code Body                                                      */
  1563.     /*----------------------------------------------------------------*/
  1564.     SetVoiceRecordingFlag(FALSE);
  1565.     HideStatusIcon(STATUS_ICON_VOICE_RECORD);
  1566.     UpdateStatusIcons();
  1567. }
  1568. /*****************************************************************************
  1569.  * FUNCTION
  1570.  *  DeriveAndSetCallFeatures
  1571.  * DESCRIPTION
  1572.  *  Function derives call features such as CUG, CLIP etc.
  1573.  * PARAMETERS
  1574.  *  info            [?]         
  1575.  *  Response(?)     [IN]        Structure from CHLD
  1576.  * RETURNS
  1577.  *  pBOOL
  1578.  *****************************************************************************/
  1579. pBOOL DeriveAndSetCallFeatures(void *info)
  1580. {
  1581.     /*----------------------------------------------------------------*/
  1582.     /* Local Variables                                                */
  1583.     /*----------------------------------------------------------------*/
  1584.     MMI_PARSE_STR_RSP *rsp;
  1585.     /*----------------------------------------------------------------*/
  1586.     /* Code Body                                                      */
  1587.     /*----------------------------------------------------------------*/
  1588.     rsp = (MMI_PARSE_STR_RSP*) info;
  1589.     SetCCFlag(TRUE);
  1590.     //chepi for time being.. dependent on pluto
  1591.     //if(L4C_OK==rsp->result.flag)
  1592.     if (1 == rsp->result.flag)
  1593.     {
  1594.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_DeriveAndSetCallFeatures, rsp->info.opcode));
  1595.         if (CC_OPERATION == rsp->info.opcode || SS_OPERATION == rsp->info.opcode || SIM_OPERATION == rsp->info.opcode)
  1596.         {
  1597.             if (CC_OPERATION != rsp->info.opcode)
  1598.             {
  1599.                 SetCCFlag(FALSE);
  1600.             }
  1601.             return TRUE;
  1602.         }
  1603.     }
  1604.     SetCCFlag(FALSE);
  1605.     return FALSE;
  1606. }
  1607. /*****************************************************************************
  1608.  * FUNCTION
  1609.  *  DeriveOutgoingCallIdRsp
  1610.  * DESCRIPTION
  1611.  *  Derives call ID for Outgoing call
  1612.  * PARAMETERS
  1613.  *  info        [?]         
  1614.  *  cause       [?]         
  1615.  *  Call(?)     [OUT]       ID
  1616.  * RETURNS
  1617.  *  U8
  1618.  *****************************************************************************/
  1619. S16 DeriveOutgoingCallIdRsp(void *info, U16 *cause)
  1620. {
  1621.     /*----------------------------------------------------------------*/
  1622.     /* Local Variables                                                */
  1623.     /*----------------------------------------------------------------*/
  1624.     MMI_DIAL_IND *rsp;
  1625.     /*----------------------------------------------------------------*/
  1626.     /* Code Body                                                      */
  1627.     /*----------------------------------------------------------------*/
  1628.     rsp = (MMI_DIAL_IND*) info;
  1629.     if (rsp->result.flag == L4C_OK)
  1630.     {
  1631.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_DeriveOutgoingCallIdRsp1, rsp->call_id));
  1632.         return rsp->call_id;
  1633.     }
  1634.     else
  1635.     {
  1636.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_DeriveOutgoingCallIdRsp2));
  1637.         *cause = rsp->result.cause;
  1638. #if defined (JATAAYU_SUPPORT) && defined (WAP_SUPPORT)
  1639. mmi_jdd_tapi_make_call_result(mmi_jdd_tapi_get_makecall_error_code(*cause));
  1640. #endif
  1641.         return -1;
  1642.     }
  1643. }
  1644. /*****************************************************************************
  1645.  * FUNCTION
  1646.  *  DeriveCallHandle
  1647.  * DESCRIPTION
  1648.  *  Derives call ID for End  call
  1649.  * PARAMETERS
  1650.  *  info        [?]         
  1651.  *  Call(?)     [OUT]       ID
  1652.  * RETURNS
  1653.  *  U8
  1654.  *****************************************************************************/
  1655. CM_CALL_HANDLE DeriveCallHandle(void *info)
  1656. {
  1657.     /*----------------------------------------------------------------*/
  1658.     /* Local Variables                                                */
  1659.     /*----------------------------------------------------------------*/
  1660.     /*----------------------------------------------------------------*/
  1661.     /* Code Body                                                      */
  1662.     /*----------------------------------------------------------------*/
  1663.     return (CM_CALL_HANDLE) ((MMI_RELEASE_IND*) info)->call_id;
  1664. }
  1665. /*****************************************************************************
  1666.  * FUNCTION
  1667.  *  DeriveCallInfo
  1668.  * DESCRIPTION
  1669.  *  Makes mapping between L4 strucutre to our strucutre
  1670.  * PARAMETERS
  1671.  *  info        [?]     
  1672.  *  incmg       [?]     
  1673.  * RETURNS
  1674.  *  void
  1675.  *****************************************************************************/
  1676. void DeriveCallInfo(void *info, IncomingCall *incmg)
  1677. {
  1678.     /*----------------------------------------------------------------*/
  1679.     /* Local Variables                                                */
  1680.     /*----------------------------------------------------------------*/
  1681.     MMI_INCOMING *inc;
  1682.     U8 flag = 0x10;
  1683.     /*----------------------------------------------------------------*/
  1684.     /* Code Body                                                      */
  1685.     /*----------------------------------------------------------------*/
  1686.     inc = (MMI_INCOMING*) info;
  1687.     memset(incmg, '', sizeof(IncomingCall));
  1688.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_DeriveCallInfo, inc->call_id));
  1689.     incmg->callHandle = inc->call_id;
  1690.     incmg->callType = inc->call_type;
  1691.     if (inc->num.number[0] != '')
  1692.     {
  1693.         if ((flag) & (inc->num.type))
  1694.         {
  1695.             strcpy((PS8) incmg->Number, "+");
  1696.         }
  1697.         strcat((PS8) incmg->Number, (PS8) (inc->num.number));
  1698.     }
  1699.     if ((inc->sub_addr.number[0] != '') &&
  1700.         (strlen((PS8) inc->sub_addr.number) + strlen((PS8) incmg->Number) < MAX_NUMBER / ENCODING_LENGTH - 1))
  1701.     {
  1702.         strcat((PS8) incmg->Number, "-");
  1703.         strcat((PS8) incmg->Number, (PS8) inc->sub_addr.number);
  1704.     }
  1705.     if (inc->auto_answer == KAL_TRUE)
  1706.     {
  1707.         SetPriorityCall(TRUE);
  1708.     }
  1709.     else
  1710.     {
  1711.         SetPriorityCall(FALSE);
  1712.     }
  1713.     return;
  1714. }
  1715. /*****************************************************************************
  1716.  * FUNCTION
  1717.  *  DeriveCcbsCallInfo
  1718.  * DESCRIPTION
  1719.  *  Makes mapping between L4 strucutre to our strucutre
  1720.  * PARAMETERS
  1721.  *  info        [?]     
  1722.  *  incmg       [?]     
  1723.  * RETURNS
  1724.  *  void
  1725.  *****************************************************************************/
  1726. void DeriveCcbsCallInfo(void *info, IncomingCall *incmg)
  1727. {
  1728.     /*----------------------------------------------------------------*/
  1729.     /* Local Variables                                                */
  1730.     /*----------------------------------------------------------------*/
  1731.     MMI_CCBS_IND *inc;
  1732.     U8 flag = 0x10;
  1733.     /*----------------------------------------------------------------*/
  1734.     /* Code Body                                                      */
  1735.     /*----------------------------------------------------------------*/
  1736.     inc = (MMI_CCBS_IND*) info;
  1737.     memset(incmg, '', sizeof(IncomingCall));
  1738.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_DeriveCallInfo, inc->call_id));
  1739.     incmg->callHandle = inc->call_id;
  1740.     incmg->callType = CM_VOICE_CALL;
  1741.     if (inc->number_present)
  1742.     {
  1743.         if ((flag) & (inc->addr.type))
  1744.         {
  1745.             strcpy((PS8) incmg->Number, "+");
  1746.         }
  1747.         strcat((PS8) incmg->Number, (PS8) (inc->addr.number));
  1748.     }
  1749.     if ((inc->sub_addr_present) &&
  1750.         (strlen((PS8) inc->sub_addr.number) + strlen((PS8) incmg->Number) < MAX_NUMBER / ENCODING_LENGTH - 1))
  1751.     {
  1752.         strcat((PS8) incmg->Number, "-");
  1753.         strcat((PS8) incmg->Number, (PS8) inc->sub_addr.number);
  1754.     }
  1755.     return;
  1756. }
  1757. /*****************************************************************************
  1758.  * FUNCTION
  1759.  *  DeriveCallInfoFromWait
  1760.  * DESCRIPTION
  1761.  *  Makes mapping between L4 strucutre to our strucutre
  1762.  * PARAMETERS
  1763.  *  info        [?]     
  1764.  *  incmg       [?]     
  1765.  * RETURNS
  1766.  *  void
  1767.  *****************************************************************************/
  1768. void DeriveCallInfoFromWait(void *info, IncomingCall *incmg)
  1769. {
  1770.     /*----------------------------------------------------------------*/
  1771.     /* Local Variables                                                */
  1772.     /*----------------------------------------------------------------*/
  1773.     MMI_CALL_WAIT *wait;
  1774.     U8 flag = 0x10;
  1775.     /*----------------------------------------------------------------*/
  1776.     /* Code Body                                                      */
  1777.     /*----------------------------------------------------------------*/
  1778.     memset(incmg, '', sizeof(IncomingCall));
  1779.     wait = (MMI_CALL_WAIT*) info;
  1780.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_DeriveCallInfoFromWait, wait->call_id));
  1781.     incmg->callType = wait->call_mode;
  1782.     incmg->callHandle = wait->call_id;
  1783.     if (wait->num.number[0] != '')
  1784.     {
  1785.         if ((flag) & (wait->num.type))
  1786.         {
  1787.             strcpy((PS8) incmg->Number, "+");
  1788.         }
  1789.         strcat((PS8) incmg->Number, (PS8) (wait->num.number));
  1790.     }
  1791.     return;
  1792. }
  1793. /*****************************************************************************
  1794.  * FUNCTION
  1795.  *  DeriveSSEvent
  1796.  * DESCRIPTION
  1797.  *  Function derives call features such as CUG, CLIP etc.
  1798.  * PARAMETERS
  1799.  *  info            [?]         
  1800.  *  Response(?)     [IN]        Structure from CHLD
  1801.  * RETURNS
  1802.  *  void
  1803.  *****************************************************************************/
  1804. void DeriveSSEvent(void *info)
  1805. {
  1806.     /*----------------------------------------------------------------*/
  1807.     /* Local Variables                                                */
  1808.     /*----------------------------------------------------------------*/
  1809.     MMI_NOTIFY_SS *rsp;
  1810.     /*----------------------------------------------------------------*/
  1811.     /* Code Body                                                      */
  1812.     /*----------------------------------------------------------------*/
  1813.     rsp = (MMI_NOTIFY_SS*) info;
  1814.     gSSEvent = rsp->type;
  1815. gSSEventNotifyPresent = rsp->notification_present;
  1816. gSSEventNotify = rsp->notification;
  1817.     return;
  1818. }
  1819. /*****************************************************************************
  1820.  * FUNCTION
  1821.  *  GetStrDisplayForId
  1822.  * DESCRIPTION
  1823.  *  Function derives call features such as CUG, CLIP etc.
  1824.  * PARAMETERS
  1825.  *  event           [IN]        
  1826.  *  Response(?)     [IN]        Structure from CHLD
  1827.  * RETURNS
  1828.  *  void
  1829.  *****************************************************************************/
  1830. U16 GetStrDisplayForId(U16 event)
  1831. {
  1832.     /*----------------------------------------------------------------*/
  1833.     /* Local Variables                                                */
  1834.     /*----------------------------------------------------------------*/
  1835.     /*----------------------------------------------------------------*/
  1836.     /* Code Body                                                      */
  1837.     /*----------------------------------------------------------------*/
  1838.     switch (event)
  1839.     {
  1840.         case CSMCC_NOTIFY_CFC:
  1841.             return STR_NFY_CALL_FWDNG_CONDITIONAL;
  1842.         case CSMCC_NOTIFY_CFU:
  1843.             return STR_NFY_CALL_FWDNG_UNCONDITIONAL;
  1844.         case CSMCC_NOTIFY_CF_CFU:
  1845.             return STR_NFY_CALL_FWDED_UNCONDITIONAL;
  1846.         case CSMCC_NOTIFY_CF_CFC:
  1847.             return STR_NFY_CALL_FWDED_CONDITIONAL;
  1848.         case CSMCC_NOTIFY_CF_CFB:
  1849.             return STR_NFY_CALL_BUSY_FORWARDED;
  1850.         case CSMCC_NOTIFY_CF_CFNRY:
  1851.             return STR_NFY_CALL_FWDED_NOREPLY;
  1852.         case CSMCC_NOTIFY_CF_CFNRC:
  1853.             return STR_NFY_CALL_FWDED_NOT_REACHABLE;
  1854.         case CSMCC_NOTIFY_CF:
  1855.             return STR_NFY_CALL_FWDED;
  1856.         case CSMCC_NOTIFY_BAC:
  1857.             return STR_NFY_CALL_ALL_BARRED;
  1858.         case CSMCC_NOTIFY_BAOC:
  1859.             return STR_NFY_CALL_ALL_OUTGOING_BARRED;
  1860.         case CSMCC_NOTIFY_BAIC:
  1861.             return STR_NFY_CALL_ALL_INCOMING_BARRED;
  1862.         case CSMCC_NOTIFY_CW:
  1863.             return STR_NFY_CALL_WTG;
  1864.         case CSMCC_NOTIFY_CALL_HELD:
  1865.             return STR_NFY_CALL_HLD;
  1866.         case CSMCC_NOTIFY_CALL_RETRIEVED:
  1867.             return STR_NFY_CALL_RTVD;
  1868.         case CSMCC_NOTIFY_MPTY:
  1869.             return STR_NFY_CALL_CONF;
  1870.         case CSMCC_NOTIFY_CUG:
  1871.             return STR_NFY_CALL_CUG;
  1872.         case CSMCC_NOTIFY_ECT_ACTIVE:
  1873.             return STR_NFY_CALL_CTFAC;
  1874.         default:
  1875.             return 0;
  1876.     }
  1877. }
  1878. /*****************************************************************************
  1879.  * FUNCTION
  1880.  *  DeriveCcmValue
  1881.  * DESCRIPTION
  1882.  *  Derives ACM value from the PS value
  1883.  * PARAMETERS
  1884.  *  info        [?]         
  1885.  *  ACM(?)      [IN]        Value struct
  1886.  *  U16(?)      [OUT]       
  1887.  * RETURNS
  1888.  *  U8
  1889.  *****************************************************************************/
  1890. U32 DeriveCcmValue(void *info)
  1891. {
  1892.     /*----------------------------------------------------------------*/
  1893.     /* Local Variables                                                */
  1894.     /*----------------------------------------------------------------*/
  1895.     MMI_CCM_STRUCT *ccmStruct;
  1896.     /*----------------------------------------------------------------*/
  1897.     /* Code Body                                                      */
  1898.     /*----------------------------------------------------------------*/
  1899.     ccmStruct = (MMI_CCM_STRUCT*) info;
  1900.     MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_DeriveCcmValue, ccmStruct->ccm));
  1901.     if (ccmStruct->warning)
  1902.     {
  1903.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_DeriveCcmWarning));
  1904.     }
  1905.     return ccmStruct->ccm;
  1906. }
  1907. /*****************************************************************************
  1908.  * FUNCTION
  1909.  *  DeriveInternalAlrtIndVal
  1910.  * DESCRIPTION
  1911.  *  Derives value of internal Alert indication message
  1912.  * PARAMETERS
  1913.  *  info            [?]         
  1914.  *  Internal(?)     [IN]        Alert Indication structure
  1915.  *  Value(?)        [OUT]       (BOOL) of msg
  1916.  * RETURNS
  1917.  *  U8
  1918.  *****************************************************************************/
  1919. U8 DeriveInternalAlrtIndVal(void *info)
  1920. {
  1921.     /*----------------------------------------------------------------*/
  1922.     /* Local Variables                                                */
  1923.     /*----------------------------------------------------------------*/
  1924.     /*----------------------------------------------------------------*/
  1925.     /* Code Body                                                      */
  1926.     /*----------------------------------------------------------------*/
  1927.     return ((MMI_CC_INTERNAL_ALERT_IND*) info)->alert;
  1928. }
  1929. /*****************************************************************************
  1930.  * FUNCTION
  1931.  *  CheckStatusOfSpeech
  1932.  * DESCRIPTION
  1933.  *  Helper to check is speech is set or not
  1934.  *  
  1935.  *  The call back registers a handler with the event dynamically
  1936.  *  info describes the data to transparently send to n/w
  1937.  * PARAMETERS
  1938.  *  info                [?]         
  1939.  *  Indication(?)       [IN]        Structure
  1940.  * RETURNS
  1941.  *  void
  1942.  *****************************************************************************/
  1943. pBOOL CheckStatusOfSpeech(void *info, U8* type)
  1944. {
  1945.     /*----------------------------------------------------------------*/
  1946.     /* Local Variables                                                */
  1947.     /*----------------------------------------------------------------*/
  1948. #if defined(__GSM_RAT__) || defined(__WCDMA_RAT__)
  1949.     U8 temp;
  1950. #endif
  1951.     /*----------------------------------------------------------------*/
  1952.     /* Code Body                                                      */
  1953.     /*----------------------------------------------------------------*/
  1954.     *type = MDI_AUDIO_SPEECH_APP_ID_GSM;
  1955. #if defined(__GSM_RAT__) || defined(__WCDMA_RAT__) 
  1956.     temp = ((MMI_SPEECH_IND*) info)->rat;
  1957.     switch (temp)
  1958.     {
  1959.         case RAT_UMTS:
  1960.          *type = MDI_AUDIO_SPEECH_APP_ID_WCDMA;
  1961.          break;
  1962.         default:
  1963.          *type = MDI_AUDIO_SPEECH_APP_ID_GSM;
  1964.          break;
  1965.     }
  1966. #endif
  1967.     return ((MMI_SPEECH_IND*) info)->on_off;
  1968. }
  1969. /*****************************************************************************
  1970.  * FUNCTION
  1971.  *  DeriveUSSDData
  1972.  * DESCRIPTION
  1973.  *  Function derives data in USSN, USSR, and USSD messages
  1974.  * PARAMETERS
  1975.  *  dcs             [IN]        
  1976.  *  ussd_string     [?]         
  1977.  * RETURNS
  1978.  *  void
  1979.  *****************************************************************************/
  1980. void DeriveUSSDData(U8 dcs, U8 *ussd_string)
  1981. {
  1982.     /*----------------------------------------------------------------*/
  1983.     /* Local Variables                                                */
  1984.     /*----------------------------------------------------------------*/
  1985.     U16 ussrLen = 0;
  1986.     U8 *tempStr = NULL;
  1987.     /*----------------------------------------------------------------*/
  1988.     /* Code Body                                                      */
  1989.     /*----------------------------------------------------------------*/
  1990.     if (dcs == MMI_UCS2_DCS)
  1991.     {
  1992.         ussrLen = (U16) pfnUnicodeStrlen((PS8) ussd_string);
  1993.         ussrLen = ussrLen * 2;
  1994.     }
  1995.     else
  1996.     {
  1997.         ussrLen = strlen((PS8) ussd_string);
  1998.     }
  1999.     tempStr = CovertStringForPlatform(ussd_string, ussrLen, dcs, &ussrLen);
  2000.     if (ussrLen >= MAX_DIGITS_USSD)
  2001.     {
  2002.         ussrLen = MAX_DIGITS_USSD - 1;
  2003.     }
  2004.     memset((void*)gUSSDbuf, 0, MAX_DIGITS_USSD * ENCODING_LENGTH);
  2005.     if (tempStr != NULL)
  2006.     {
  2007.         pfnUnicodeStrncpy((PS8) gUSSDbuf, (PS8) tempStr, ussrLen);
  2008.         OslMfree(tempStr);
  2009.     }
  2010.     return;
  2011. }
  2012. /*****************************************************************************
  2013.  * FUNCTION
  2014.  *  DeriveUSSNbuf
  2015.  * DESCRIPTION
  2016.  *  Function derives USSN
  2017.  * PARAMETERS
  2018.  *  info            [?]         
  2019.  *  Response(?)     [IN]        Structure from CHLD
  2020.  * RETURNS
  2021.  *  void
  2022.  *****************************************************************************/
  2023. void DeriveUSSNbuf(void *info)
  2024. {
  2025.     /*----------------------------------------------------------------*/
  2026.     /* Local Variables                                                */
  2027.     /*----------------------------------------------------------------*/
  2028.     /*----------------------------------------------------------------*/
  2029.     /* Code Body                                                      */
  2030.     /*----------------------------------------------------------------*/
  2031.     DeriveUSSDData(((MMI_SS_USSN_IND_STRUCT*) info)->dcs, ((MMI_SS_USSN_IND_STRUCT*) info)->ussd_string);
  2032.     return;
  2033. }
  2034. /*****************************************************************************
  2035.  * FUNCTION
  2036.  *  DeriveUSSRbuf
  2037.  * DESCRIPTION
  2038.  *  Function derives USSR
  2039.  * PARAMETERS
  2040.  *  info            [?]         
  2041.  *  Response(?)     [IN]        Structure from CHLD
  2042.  * RETURNS
  2043.  *  void
  2044.  *****************************************************************************/
  2045. void DeriveUSSRbuf(void *info)
  2046. {
  2047.     /*----------------------------------------------------------------*/
  2048.     /* Local Variables                                                */
  2049.     /*----------------------------------------------------------------*/
  2050.     /*----------------------------------------------------------------*/
  2051.     /* Code Body                                                      */
  2052.     /*----------------------------------------------------------------*/
  2053.     DeriveUSSDData(((MMI_SS_USSR_IND_STRUCT*) info)->dcs, ((MMI_SS_USSR_IND_STRUCT*) info)->ussd_string);
  2054. }
  2055. /*****************************************************************************
  2056.  * FUNCTION
  2057.  *  DeriveUSSDbuf
  2058.  * DESCRIPTION
  2059.  *  Function derives USSN
  2060.  * PARAMETERS
  2061.  *  info            [?]         
  2062.  *  Response(?)     [IN]        Structure from CHLD
  2063.  * RETURNS
  2064.  *  void
  2065.  *****************************************************************************/
  2066. void DeriveUSSDbuf(void *info)
  2067. {
  2068.     /*----------------------------------------------------------------*/
  2069.     /* Local Variables                                                */
  2070.     /*----------------------------------------------------------------*/
  2071.     /*----------------------------------------------------------------*/
  2072.     /* Code Body                                                      */
  2073.     /*----------------------------------------------------------------*/
  2074.     DeriveUSSDData(((MMI_SS_USSD_RSP*) info)->dcs, ((MMI_SS_USSD_RSP*) info)->ussd_str);
  2075. }
  2076. /*****************************************************************************
  2077.  * FUNCTION
  2078.  *  CheckChldRequestSuccess
  2079.  * DESCRIPTION
  2080.  *  checks for failure of CHLD from PS
  2081.  * PARAMETERS
  2082.  *  info        [?]         
  2083.  *  cause       [?]         
  2084.  *  true(?)     [OUT]       For success false for failure
  2085.  *  CHLD(?)     [IN]        Rsp structure
  2086.  * RETURNS
  2087.  *  pBOOL
  2088.  *****************************************************************************/
  2089. pBOOL CheckChldRequestSuccess(void *info, U16 *cause)
  2090. {
  2091.     /*----------------------------------------------------------------*/
  2092.     /* Local Variables                                                */
  2093.     /*----------------------------------------------------------------*/
  2094.     MMI_CHLD_RSP *chldRsp;
  2095.     /*----------------------------------------------------------------*/
  2096.     /* Code Body                                                      */
  2097.     /*----------------------------------------------------------------*/
  2098.     chldRsp = (MMI_CHLD_RSP*) info;
  2099.     if (chldRsp->result == KAL_TRUE)
  2100.     {
  2101.         *cause = 0;
  2102.         return TRUE;
  2103.     }
  2104.     else
  2105.     {
  2106.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_CheckChldRequestSuccess));
  2107.         *cause = chldRsp->cause;
  2108.         return FALSE;
  2109.     }
  2110. }
  2111. /*****************************************************************************
  2112.  * FUNCTION
  2113.  *  CheckFailureChld
  2114.  * DESCRIPTION
  2115.  *  function detemines if CHLD request for end calls has failed
  2116.  * PARAMETERS
  2117.  *  info            [?]         
  2118.  *  Response(?)     [IN]        Structure from CHLD
  2119.  * RETURNS
  2120.  *  void
  2121.  *****************************************************************************/
  2122. void CheckFailureChld(void *info)
  2123. {
  2124.     /*----------------------------------------------------------------*/
  2125.     /* Local Variables                                                */
  2126.     /*----------------------------------------------------------------*/
  2127.     U16 result;
  2128.     /*----------------------------------------------------------------*/
  2129.     /* Code Body                                                      */
  2130.     /*----------------------------------------------------------------*/
  2131.     if (CheckChldRequestSuccess(info, &result))
  2132.     {
  2133.         SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  2134.         SetChldReqSent(CM_ACTION_NONE);
  2135.         return;
  2136.     }
  2137.     else
  2138.     {
  2139.         MMI_TRACE((MMI_TRACE_G5_CM, MMI_CM_INFO_CheckFailureChld, result));
  2140.         switch (GetChldReqSent())
  2141.         {
  2142.             case CM_HANGUPALLHLD_REQ_SENT:
  2143.             case CM_HANGUPALLACTIVE_REQ_SENT:
  2144.             case CM_HANGUPALL_REQ_SENT:
  2145.             case CM_ENDSELECTIVE_REQ_SENT:
  2146.                 ResetAllHangupFlag();
  2147.                 break;
  2148.             default:
  2149.                 return;
  2150.         }
  2151.         SetChldReqSent(CM_ACTION_NONE);
  2152.         SetProtocolEventHandler(PsCBackNetworkCallDropped, PRT_NWRK_CALL_RELEASE);
  2153.         ShowCallManagementErrorMessage(result);
  2154.     }
  2155.     return;
  2156. }
  2157. /*****************************************************************************
  2158.  * FUNCTION
  2159.  *  CheckCallDeflectSuccess
  2160.  * DESCRIPTION
  2161.  *  Function checks to see if the Call Deflect rsp was successful
  2162.  * PARAMETERS
  2163.  *  info            [?]         
  2164.  *  cause           [?]         
  2165.  *  Response(?)     [IN]        Structure
  2166.  * RETURNS
  2167.  *  void
  2168.  *****************************************************************************/
  2169. U16 CheckCallDeflectSuccess(void *info, U16 *cause)
  2170. {
  2171.     /*----------------------------------------------------------------*/
  2172.     /* Local Variables                                                */
  2173.     /*----------------------------------------------------------------*/
  2174.     MMI_CALL_DEFLECT_RSP *rsp;
  2175.     /*----------------------------------------------------------------*/
  2176.     /* Code Body                                                      */
  2177.     /*----------------------------------------------------------------*/
  2178.     rsp = (MMI_CALL_DEFLECT_RSP*) info;
  2179.     if (rsp->result == TRUE)
  2180.     {
  2181.         *cause = 0;
  2182.         return TRUE;
  2183.     }
  2184.     else
  2185.     {
  2186.         if (rsp->cause == ERR_NORMAL_CALL_CLR)
  2187.             *cause = ERR_L4C_GEN_CAUSE;
  2188.         else
  2189.         *cause = rsp->cause;
  2190.         return FALSE;
  2191.     }
  2192. }
  2193. /*****************************************************************************
  2194.  * FUNCTION
  2195.  *  CheckAtaSuccess
  2196.  * DESCRIPTION
  2197.  *  Function checks to see if the ATA rsp was successful
  2198.  * PARAMETERS
  2199.  *  info            [?]         
  2200.  *  cause           [?]         
  2201.  *  Response(?)     [IN]        Structure from CHLD
  2202.  * RETURNS
  2203.  *  void
  2204.  *****************************************************************************/
  2205. U16 CheckAtaSuccess(void *info, U16 *cause)
  2206. {
  2207.     /*----------------------------------------------------------------*/
  2208.     /* Local Variables                                                */
  2209.     /*----------------------------------------------------------------*/
  2210.     MMI_ATA_RSP *rsp;
  2211.     /*----------------------------------------------------------------*/
  2212.     /* Code Body                                                      */
  2213.     /*----------------------------------------------------------------*/
  2214.     rsp = (MMI_ATA_RSP*) info;
  2215.     if (rsp->result.flag == L4C_OK)
  2216.     {
  2217.         *cause = 0;
  2218.         return TRUE;
  2219.     }
  2220.     else
  2221.     {
  2222.         /* can not answer MT data call thru MMI */
  2223.         if (rsp->result.cause == CM_L4C_GEN_CAUSE && rsp->call_mode == SINGLE_DATA_CALL)
  2224.         {
  2225.             *cause = ERR_CM_MT_DATA_CALL;
  2226.         }
  2227.         else
  2228.         {
  2229.             *cause = rsp->result.cause;
  2230.         }
  2231.         return FALSE;
  2232.     }
  2233. }
  2234. /*****************************************************************************
  2235.  * FUNCTION
  2236.  *  CheckRspCcbsFlag
  2237.  * DESCRIPTION
  2238.  *  checks for CCBS Flag in Disconnect Response from PS
  2239.  * PARAMETERS
  2240.  *  info        [?]         
  2241.  *  true(?)     [OUT]       For success false for failure
  2242.  *  CHLD(?)     [IN]        Rsp structure
  2243.  * RETURNS
  2244.  *  pBOOL
  2245.  *****************************************************************************/
  2246. pBOOL CheckRspCcbsFlag(void *info)
  2247. {
  2248.     /*----------------------------------------------------------------*/
  2249.     /* Local Variables                                                */
  2250.     /*----------------------------------------------------------------*/
  2251.     /*----------------------------------------------------------------*/
  2252.     /* Code Body                                                      */
  2253.     /*----------------------------------------------------------------*/
  2254.     return ((MMI_CC_CALL_DISCONNECT_IND*) info)->ccbs;
  2255. }
  2256. /*****************************************************************************
  2257.  * FUNCTION
  2258.  *  CBackDropUSSDReq
  2259.  * DESCRIPTION
  2260.  *  Aborts SS string request
  2261.  * PARAMETERS
  2262.  *  info            [?]         
  2263.  *  callback(?)     [IN]        To register with response
  2264.  * RETURNS
  2265.  *  void
  2266.  *****************************************************************************/
  2267. void CBackDropUSSDReq(void *info)
  2268. {
  2269.     /*----------------------------------------------------------------*/
  2270.     /* Local Variables                                                */
  2271.     /*----------------------------------------------------------------*/
  2272.     /*----------------------------------------------------------------*/
  2273.     /* Code Body                                                      */
  2274.     /*----------------------------------------------------------------*/
  2275.     if (((MMI_SS_ABORT_RSP*) (info))->result == TRUE)
  2276.     {
  2277.         GoBackHistory();
  2278.     }
  2279.     else
  2280.     {
  2281.         ShowCallManagementErrorMessage(ERR_L4C_GEN_CAUSE);
  2282.     }
  2283. }
  2284. /*****************************************************************************
  2285.  * FUNCTION
  2286.  *  CBackDropUSSDReqEND
  2287.  * DESCRIPTION
  2288.  *  Aborts SS string request on END Key
  2289.  * PARAMETERS
  2290.  *  info            [?]         
  2291.  *  callback(?)     [IN]        To register with response
  2292.  * RETURNS
  2293.  *  void
  2294.  *****************************************************************************/
  2295. void CBackDropUSSDReqEND(void *info)
  2296. {
  2297.     /*----------------------------------------------------------------*/
  2298.     /* Local Variables                                                */
  2299.     /*----------------------------------------------------------------*/
  2300.     /*----------------------------------------------------------------*/
  2301.     /* Code Body                                                      */
  2302.     /*----------------------------------------------------------------*/
  2303.     if (((MMI_SS_ABORT_RSP*) (info))->result == TRUE)
  2304.     {
  2305.         if (isInCall())
  2306.         {
  2307.             GoBackHistory();
  2308.         }
  2309.         else
  2310.         {
  2311.             DisplayIdleScreen();
  2312.         }
  2313.     }
  2314.     else
  2315.     {
  2316.         ShowCallManagementErrorMessage(ERR_L4C_GEN_CAUSE);
  2317.     }
  2318. }
  2319. /*****************************************************************************
  2320.  * FUNCTION
  2321.  *  MapDtmfEnum2Ascii
  2322.  * DESCRIPTION
  2323.  *  Function maps keycode from enum value to ascii equiv.
  2324.  * PARAMETERS
  2325.  *  digit           [IN]        
  2326.  *  Ascii(?)        [OUT]       Equivalent
  2327.  *  DTMF(?)         [IN]        Keycode digit
  2328.  * RETURNS
  2329.  *  U8
  2330.  *****************************************************************************/
  2331. U8 MapDtmfEnum2Ascii(U16 digit)
  2332. {
  2333.     /*----------------------------------------------------------------*/
  2334.     /* Local Variables                                                */
  2335.     /*----------------------------------------------------------------*/
  2336.     /*----------------------------------------------------------------*/
  2337.     /* Code Body                                                      */
  2338.     /*----------------------------------------------------------------*/
  2339.     switch (digit)
  2340.     {
  2341.         case KEY_0:
  2342.             return '0';
  2343.         case KEY_1:
  2344.             return '1';
  2345.         case KEY_2:
  2346.             return '2';
  2347.         case KEY_3:
  2348.             return '3';
  2349.         case KEY_4:
  2350.             return '4';
  2351.         case KEY_5:
  2352.             return '5';
  2353.         case KEY_6:
  2354.             return '6';
  2355.         case KEY_7:
  2356.             return '7';
  2357.         case KEY_8:
  2358.             return '8';
  2359.         case KEY_9:
  2360.             return '9';
  2361.         case KEY_STAR:
  2362.             return '*';
  2363.         case KEY_POUND:
  2364.             return '#';
  2365.         default:
  2366.             return KEY_INVALID;
  2367.     }
  2368. }