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

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.  * Filename:
  37.  * ---------
  38.  *  CPHSProtocolHandlers.c
  39.  *
  40.  * Project:
  41.  * --------
  42.  *  MAUI
  43.  *
  44.  * Description:
  45.  * ------------
  46.  *  
  47.  *
  48.  * Author:
  49.  * -------
  50.  *  
  51.  *
  52.  *==============================================================================
  53.  *             HISTORY
  54.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  55.  *------------------------------------------------------------------------------
  56.  * removed!
  57.  *
  58.  * removed!
  59.  * removed!
  60.  * removed!
  61.  *
  62.  * removed!
  63.  * removed!
  64.  * removed!
  65.  *
  66.  * removed!
  67.  * removed!
  68.  * removed!
  69.  *
  70.  * removed!
  71.  * removed!
  72.  * removed!
  73.  *
  74.  * removed!
  75.  * removed!
  76.  * removed!
  77.  *
  78.  * removed!
  79.  * removed!
  80.  * removed!
  81.  *
  82.  * removed!
  83.  * removed!
  84.  * removed!
  85.  *
  86.  * removed!
  87.  * removed!
  88.  * removed!
  89.  *
  90.  * removed!
  91.  * removed!
  92.  * removed!
  93.  *
  94.  * removed!
  95.  * removed!
  96.  * removed!
  97.  *
  98.  * removed!
  99.  * removed!
  100.  * removed!
  101.  *
  102.  *------------------------------------------------------------------------------
  103.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  104.  *==============================================================================
  105.  *******************************************************************************/
  106. /**
  107.  * Copyright Notice
  108.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  109.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  110.  *  (It is illegal to remove this copyright notice from this software or any
  111.  *  portion of it)
  112.  */
  113. /**************************************************************
  114.    FILENAME : CPHSProtocolHandlers.c
  115.    PURPOSE     : COMMON PCN HANDSET SPECIFICATION
  116.    REMARKS     : nil
  117.    AUTHOR      : NEERAJ SHARMA
  118.    DATE     : Aug 6,03
  119. **************************************************************/
  120. #include "stdC.h"
  121. #include "L4Dr1.h"
  122. #include "L4Dr.h"
  123. #include "CSP.h"
  124. #include "InfoNum.h"
  125. #include "EventsGprot.h"
  126. #include "ProtocolEvents.h"
  127. #include "CPHSProtocolHandlers.h"
  128. #include "DebugInitDef.h"
  129. #include "SimDetectionGprot.h"
  130. #include "wgui_status_icons.h"
  131. #include "PixtelDataTypes.h"
  132. #include "SettingGprots.h"
  133. //micha0309
  134. //#include "LineSwitchGprot.h"  //MTK add, Robin 1028 for boot up MSG_ID_MMI_CPHS_DISPLAY_ALS_IND event handler
  135. #include "CallSetup.h"
  136. #ifdef __MMI_SML_MENU__
  137. #include "PersonalizationDef.h"
  138. #include "PersonalizationProt.h"
  139. extern mmi_sml_menu_struct g_sml_context;
  140. #endif /* __MMI_SML_MENU__ */
  141. extern void InitialiseInformationArray(U8 noInfoNum, l4csmu_info_num_struct *infoNum);
  142. /* void testcsp(void)
  143.    {
  144.    U8 csp[22];
  145.    csp[0]=0x01;
  146.    csp[1]=0xFF;
  147.    csp[2]=0x02;
  148.    csp[3]=0xFF;
  149.    csp[4]=0x03;
  150.    csp[5]=0xFF;
  151.    csp[6]=0x04;
  152.    csp[7]=0xFF;
  153.    csp[8]=0x05;
  154.    csp[9]=0x10;
  155.    csp[10]=0x06;
  156.    csp[11]=0x7F;
  157.    csp[12]=0x07;
  158.    csp[13]=0xFF;
  159.    csp[14]=0x08;
  160.    csp[15]=0xFF;
  161.    csp[16]=0x09;
  162.    csp[17]=0xF8;
  163.    csp[18]=0xC0;
  164.    csp[19]=0x0E;
  165.    csp[20]=0xD5;
  166.    csp[21]=0xFF;
  167.    InitialiseCSPInfoArray(csp);
  168.    } */
  169. /*
  170.  * void testInfoNum(void)
  171.  * {
  172.  * l4csmu_info_num_struct info[12];
  173.  * memset(info,0,sizeof(info));
  174.  * info[0].alpha_id_size=strlen("TRAVEL");
  175.  * memcpy(info[0].alpha_id,"TRAVEL",info[0].alpha_id_size);
  176.  * info[0].ton_npi=0xFF;
  177.  * info[0].index_level=1;
  178.  * 
  179.  * info[1].alpha_id_size=strlen("TAXIS");
  180.  * memcpy(info[1].alpha_id,"TAXIS",info[1].alpha_id_size);
  181.  * info[1].ton_npi=0xFF;
  182.  * info[1].index_level=2;
  183.  * 
  184.  * info[2].alpha_id_size=strlen("Computercabs");
  185.  * memcpy(info[2].alpha_id,"Computercabs",info[2].alpha_id_size);
  186.  * info[2].ton_npi=1;
  187.  * info[2].digit_size=4;
  188.  * strcpy(info[2].digit,"111");
  189.  * info[2].index_level=3;
  190.  * info[2].network_specific=1;
  191.  * info[2].premium_rate=1;
  192.  * 
  193.  * 
  194.  * info[3].alpha_id_size=strlen("Dial-a-cab");
  195.  * memcpy(info[3].alpha_id,"Dial-a-cab",info[3].alpha_id_size);
  196.  * info[3].ton_npi=1;
  197.  * info[3].digit_size=4;
  198.  * strcpy(info[3].digit,"132");
  199.  * info[3].index_level=3;
  200.  * info[3].network_specific=1;
  201.  * 
  202.  * info[4].alpha_id_size=strlen("AIRPORTS");
  203.  * memcpy(info[4].alpha_id,"AIRPORTS",info[4].alpha_id_size);
  204.  * info[4].ton_npi=0xFF;
  205.  * info[4].index_level=2;
  206.  * 
  207.  * 
  208.  * info[5].alpha_id_size=strlen("Heathrow");
  209.  * memcpy(info[5].alpha_id,"Heathrow",info[5].alpha_id_size);
  210.  * info[5].ton_npi=0x1;
  211.  * info[5].digit_size=4;
  212.  * strcpy(info[5].digit,"345");
  213.  * info[5].index_level=3;
  214.  * 
  215.  * info[6].alpha_id_size=strlen("Gatwick");
  216.  * memcpy(info[6].alpha_id,"Gatwick",strlen("info[6].alpha_id_size"));
  217.  * info[6].ton_npi=0x1;
  218.  * info[6].digit_size=4;
  219.  * strcpy(info[6].digit,"651");
  220.  * info[6].index_level=3;
  221.  * 
  222.  * info[7].alpha_id_size=strlen("WEATHER");
  223.  * memcpy(info[7].alpha_id,"WEATHER",info[7].alpha_id_size);
  224.  * info[7].ton_npi=0xFF;
  225.  * info[7].index_level=1;
  226.  * 
  227.  * info[8].alpha_id_size=strlen("North");
  228.  * memcpy(info[8].alpha_id,"North",info[8].alpha_id_size);
  229.  * info[8].ton_npi=0x1;
  230.  * info[8].digit_size=4;
  231.  * strcpy(info[8].digit,"323");
  232.  * info[8].index_level=2;
  233.  * 
  234.  * info[9].alpha_id_size=strlen("South");
  235.  * memcpy(info[9].alpha_id,"South",info[9].alpha_id_size);
  236.  * info[9].ton_npi=0x1;
  237.  * info[9].digit_size=4;
  238.  * strcpy(info[9].digit,"597");
  239.  * info[9].index_level=2;
  240.  * 
  241.  * info[10].alpha_id_size=strlen("ENTERTAINMENT");
  242.  * memcpy(info[10].alpha_id,"ENTERTAINMENT",info[10].alpha_id_size);
  243.  * info[10].ton_npi=0xFF;
  244.  * info[10].index_level=1;
  245.  * 
  246.  * info[11].alpha_id_size=strlen("Ticketmaster");
  247.  * memcpy(info[11].alpha_id,"Ticketmaster",info[11].alpha_id_size);
  248.  * info[11].ton_npi=0x1;
  249.  * info[11].digit_size=4;
  250.  * strcpy(info[11].digit,"562");
  251.  * info[11].index_level=2;
  252.  * 
  253.  * InitialiseInformationArray(12, info);
  254.  * }
  255.  */
  256. /*****************************************************************************
  257.  * FUNCTION
  258.  *  InitCPHS
  259.  * DESCRIPTION
  260.  *  Initialises CPHS
  261.  * PARAMETERS
  262.  *  void
  263.  * RETURNS
  264.  *  void
  265.  *****************************************************************************/
  266. void InitCPHS(void)
  267. {
  268.     /*----------------------------------------------------------------*/
  269.     /* Local Variables                                                */
  270.     /*----------------------------------------------------------------*/
  271.     /*----------------------------------------------------------------*/
  272.     /* Code Body                                                      */
  273.     /*----------------------------------------------------------------*/
  274.     ClearCSPArray();
  275.     SetProtocolEventHandler(CPHSDisplayCFUInd, PRT_MSG_ID_MMI_CPHS_DISPLAY_CFU_IND);
  276.     SetProtocolEventHandler(CPHSMMInfoInd, PRT_MSG_ID_MMI_CPHS_MMI_INFO_IND);
  277.     //MTK modify, Robin 1028. Moved here from  InitLineSwitch() because MSG_ID_MMI_CPHS_DISPLAY_ALS_IND comes before InitAllApplication()
  278.     //micha0309
  279.     SetProtocolEventHandler(CALLSETLineInUseRsp, PRT_MMI_CPHS_DISPLAY_ALS_IND);
  280.     /* testInfoNum(); */
  281.     //      testcsp();
  282.     //      CSPModifyHiliteHandlers();
  283. }
  284. /*****************************************************************************
  285.  * FUNCTION
  286.  *  CPHSDisplayCFUInd
  287.  * DESCRIPTION
  288.  *  Protocol Handler for CFU Ind
  289.  * PARAMETERS
  290.  *  msgPtr      [IN]        Data from L4
  291.  * RETURNS
  292.  *  void
  293.  *****************************************************************************/
  294. void CPHSDisplayCFUInd(void *msgPtr)
  295. {
  296. #ifdef __MMI_CFU_SEPARATE_LINE__        /* MTK 1111, Robin CFU regardless Line ID */
  297.     /*----------------------------------------------------------------*/
  298.     /* Local Variables                                                */
  299.     /*----------------------------------------------------------------*/
  300.     static U8 StatusCFULine1 = 0;
  301.     static U8 StatusCFULine2 = 0;
  302. #endif /* __MMI_CFU_SEPARATE_LINE__ */ 
  303.     mmi_cphs_display_cfu_ind_struct *MsgCfuInd;
  304.     /*----------------------------------------------------------------*/
  305.     /* Code Body                                                      */
  306.     /*----------------------------------------------------------------*/
  307.     MsgCfuInd = (mmi_cphs_display_cfu_ind_struct*) msgPtr;
  308. #ifdef __MMI_CFU_SEPARATE_LINE__        /* MTK 1111, Robin CFU regardless Line ID */
  309.     HideStatusIcon(STATUS_ICON_CALL_DIVERT_L1);
  310.     HideStatusIcon(STATUS_ICON_CALL_DIVERT_L2);
  311.     HideStatusIcon(STATUS_ICON_CALL_DIVERT_L1L2);
  312.     if (MsgCfuInd->action == 1)
  313.     {
  314.         if (MsgCfuInd->line_num == 0)
  315.         {
  316.             StatusCFULine1 = 1;
  317.         }
  318.         else if (MsgCfuInd->line_num == 1)
  319.         {
  320.             StatusCFULine2 = 1;
  321.         }
  322.     }
  323.     else
  324.     {
  325.         if (MsgCfuInd->line_num == 0)
  326.         {
  327.             StatusCFULine1 = 0;
  328.         }
  329.         else if (MsgCfuInd->line_num == 1)
  330.         {
  331.             StatusCFULine2 = 0;
  332.         }
  333.     }
  334.     if ((StatusCFULine1) && (!StatusCFULine2))
  335.     {
  336.         ShowStatusIcon(STATUS_ICON_CALL_DIVERT_L1);
  337.     }
  338.     else if ((!StatusCFULine1) && (StatusCFULine2))
  339.     {
  340.         ShowStatusIcon(STATUS_ICON_CALL_DIVERT_L2);
  341.     }
  342.     else if ((StatusCFULine1) && (StatusCFULine2))
  343.     {
  344.         ShowStatusIcon(STATUS_ICON_CALL_DIVERT_L1L2);
  345.     }
  346.     UpdateStatusIcons();
  347. #else /* __MMI_CFU_SEPARATE_LINE__ */ 
  348.     if (MsgCfuInd->action == 1)
  349.     {
  350.         ShowStatusIcon(STATUS_ICON_CALL_DIVERT_L1L2);
  351.     }
  352.     else
  353.     {
  354.         HideStatusIcon(STATUS_ICON_CALL_DIVERT_L1L2);
  355.     }
  356.     UpdateStatusIcons();
  357. #endif /* __MMI_CFU_SEPARATE_LINE__ */ 
  358. }
  359. /*****************************************************************************
  360.  * FUNCTION
  361.  *  CPHSMMInfoInd
  362.  * DESCRIPTION
  363.  *  Protocol Handler for MMI Info Ind
  364.  * PARAMETERS
  365.  *  msgPtr      [IN]        Data from L4
  366.  * RETURNS
  367.  *  void
  368.  *****************************************************************************/
  369. #if ( (defined __MMI_EONS_SUPPORT__) && (defined MMI_ON_HARDWARE_P) )
  370. extern kal_bool is_sim_replaced(void);
  371. extern void eons_replace_opn_by_pnn_for_hplmn_req(void);
  372. #endif /* ( (defined __MMI_EONS_SUPPORT__) && (defined MMI_ON_HARDWARE_P) ) */ 
  373. void CPHSMMInfoInd(void *msgPtr)
  374. {
  375.     /*----------------------------------------------------------------*/
  376.     /* Local Variables                                                */
  377.     /*----------------------------------------------------------------*/
  378.     mmi_cphs_mmi_info_ind_struct *mmiIndoInd;
  379.     /*----------------------------------------------------------------*/
  380.     /* Code Body                                                      */
  381.     /*----------------------------------------------------------------*/
  382.     mmiIndoInd = (mmi_cphs_mmi_info_ind_struct*) msgPtr;
  383.     PRINT_INFORMATION(("<<CPHS>> Recieved CPHS MMI Info Ind"));
  384. #ifdef __CPHS_FEATURE_DEFAULT_OFF__
  385.     mmi_frm_hide_menu_item(MENU_LINE_SWCH);
  386. #endif
  387. #ifdef __MMI_SS_CF_ALLCOND_MENU__
  388.     mmi_frm_hide_menu_item(MENU8239_CALFWD_VOICECALL_ALLCOND);
  389. #endif
  390.     if (mmiIndoInd->is_valid_csp
  391. #ifdef MMI_ON_HARDWARE_P
  392.     && sim_service_table_query(SERVICE_CSP) == SERVICE_SUPPORT
  393. #endif
  394.     )
  395.     {
  396.         InitialiseCSPInfoArray(mmiIndoInd->csp);
  397.     }
  398.     if (mmiIndoInd->no_info_num
  399. #ifdef MMI_ON_HARDWARE_P
  400.     && sim_service_table_query(SERVICE_INFO_NUM) == SERVICE_SUPPORT
  401. #endif
  402.     )
  403.     {
  404.         InitialiseInformationArray(mmiIndoInd->no_info_num, mmiIndoInd->info_num);
  405.     }
  406.     /* diamond, 2006/03/14 Additional check for sim service table */
  407.     mmi_cphs_puct_check(mmiIndoInd->is_puct_valid);
  408.     mmi_cphs_sim_lock_check();
  409.     ServiceIndicationStringDisplay(mmiIndoInd);
  410. #ifdef __MMI_SML_MENU__
  411.     /* SIM-ME-Lock auto lock check */
  412.     g_sml_context.autolock_nibble = 0;
  413.     if (mmiIndoInd->is_autolock_enable)
  414.     {
  415.         g_sml_context.autolock_nibble |= 0x01;
  416.         if (mmiIndoInd->autolock_result)
  417.         {
  418.             g_sml_context.autolock_nibble |= 0x10;
  419.         }
  420.     }
  421.     if (mmi_bootup_is_searching_or_idle_reached())
  422.     {
  423.         /* Prevent from entering idle screen then receive CPHS indication */
  424.         mmi_sml_display_auto_locked_notification();
  425.     }
  426. #endif /* __MMI_SML_MENU__ */
  427. #if ( (defined __MMI_EONS_SUPPORT__) && (defined MMI_ON_HARDWARE_P) )
  428.     if (!is_sim_replaced())
  429.     {
  430.         eons_replace_opn_by_pnn_for_hplmn_req();    /* replace opn string */
  431.     }
  432. #endif /* ( (defined __MMI_EONS_SUPPORT__) && (defined MMI_ON_HARDWARE_P) ) */ 
  433.     GetSettingOptionsStatus();
  434. }