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

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.  * SAT.c
  39.  *
  40.  * Project:
  41.  * --------
  42.  *   MAUI
  43.  *
  44.  * Description:
  45.  * ------------
  46.  *   SIM application toolkit related functions
  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.  * removed!
  103.  * removed!
  104.  * removed!
  105.  *
  106.  * removed!
  107.  * removed!
  108.  * removed!
  109.  *
  110.  * removed!
  111.  * removed!
  112.  * removed!
  113.  *
  114.  * removed!
  115.  * removed!
  116.  * removed!
  117.  *
  118.  * removed!
  119.  * removed!
  120.  * removed!
  121.  *
  122.  * removed!
  123.  * removed!
  124.  * removed!
  125.  *
  126.  * removed!
  127.  * removed!
  128.  * removed!
  129.  *
  130.  * removed!
  131.  * removed!
  132.  * removed!
  133.  *
  134.  * removed!
  135.  * removed!
  136.  * removed!
  137.  *
  138.  * removed!
  139.  * removed!
  140.  * removed!
  141.  *
  142.  * removed!
  143.  * removed!
  144.  * removed!
  145.  *
  146.  * removed!
  147.  * removed!
  148.  * removed!
  149.  *
  150.  * removed!
  151.  * removed!
  152.  * removed!
  153.  *
  154.  * removed!
  155.  * removed!
  156.  * removed!
  157.  *
  158.  * removed!
  159.  * removed!
  160.  * removed!
  161.  *
  162.  * removed!
  163.  * removed!
  164.  * removed!
  165.  *
  166.  * removed!
  167.  * removed!
  168.  * removed!
  169.  *
  170.  * removed!
  171.  * removed!
  172.  * removed!
  173.  *
  174.  * removed!
  175.  * removed!
  176.  * removed!
  177.  *
  178.  * removed!
  179.  * removed!
  180.  * removed!
  181.  *
  182.  * removed!
  183.  * removed!
  184.  * removed!
  185.  *
  186.  * removed!
  187.  * removed!
  188.  * removed!
  189.  *
  190.  * removed!
  191.  * removed!
  192.  * removed!
  193.  *
  194.  * removed!
  195.  * removed!
  196.  * removed!
  197.  *
  198.  * removed!
  199.  * removed!
  200.  * removed!
  201.  *
  202.  * removed!
  203.  * removed!
  204.  * removed!
  205.  *
  206.  * removed!
  207.  * removed!
  208.  * removed!
  209.  *
  210.  * removed!
  211.  * removed!
  212.  * removed!
  213.  *
  214.  * removed!
  215.  * removed!
  216.  * removed!
  217.  *
  218.  * removed!
  219.  * removed!
  220.  * removed!
  221.  *
  222.  * removed!
  223.  * removed!
  224.  * removed!
  225.  *
  226.  * removed!
  227.  * removed!
  228.  * removed!
  229.  *
  230.  * removed!
  231.  * removed!
  232.  * removed!
  233.  *
  234.  * removed!
  235.  * removed!
  236.  * removed!
  237.  *
  238.  * removed!
  239.  * removed!
  240.  * removed!
  241.  *
  242.  * removed!
  243.  * removed!
  244.  * removed!
  245.  *
  246.  * removed!
  247.  * removed!
  248.  * removed!
  249.  *
  250.  * removed!
  251.  * removed!
  252.  * removed!
  253.  *
  254.  * removed!
  255.  * removed!
  256.  * removed!
  257.  *
  258.  * removed!
  259.  * removed!
  260.  * removed!
  261.  *
  262.  * removed!
  263.  * removed!
  264.  * removed!
  265.  *
  266.  * removed!
  267.  * removed!
  268.  * removed!
  269.  *
  270.  * removed!
  271.  * removed!
  272.  * removed!
  273.  *
  274.  * removed!
  275.  * removed!
  276.  * removed!
  277.  *
  278.  * removed!
  279.  * removed!
  280.  * removed!
  281.  *
  282.  * removed!
  283.  * removed!
  284.  * removed!
  285.  *
  286.  * removed!
  287.  * removed!
  288.  * removed!
  289.  *
  290.  * removed!
  291.  * removed!
  292.  * removed!
  293.  *
  294.  * removed!
  295.  * removed!
  296.  * removed!
  297.  *
  298.  * removed!
  299.  * removed!
  300.  * removed!
  301.  *
  302.  * removed!
  303.  * removed!
  304.  * removed!
  305.  *
  306.  * removed!
  307.  * removed!
  308.  * removed!
  309.  *
  310.  * removed!
  311.  * removed!
  312.  * removed!
  313.  *
  314.  * removed!
  315.  * removed!
  316.  * removed!
  317.  *
  318.  * removed!
  319.  * removed!
  320.  * removed!
  321.  *
  322.  * removed!
  323.  * removed!
  324.  * removed!
  325.  *
  326.  * removed!
  327.  * removed!
  328.  * removed!
  329.  *
  330.  * removed!
  331.  * removed!
  332.  * removed!
  333.  *
  334.  * removed!
  335.  * removed!
  336.  * removed!
  337.  *
  338.  * removed!
  339.  * removed!
  340.  * removed!
  341.  *
  342.  * removed!
  343.  * removed!
  344.  * removed!
  345.  *
  346.  * removed!
  347.  * removed!
  348.  * removed!
  349.  *
  350.  * removed!
  351.  * removed!
  352.  * removed!
  353.  *
  354.  * removed!
  355.  * removed!
  356.  * removed!
  357.  *
  358.  * removed!
  359.  * removed!
  360.  * removed!
  361.  *
  362.  * removed!
  363.  * removed!
  364.  * removed!
  365.  *
  366.  * removed!
  367.  * removed!
  368.  * removed!
  369.  *
  370.  * removed!
  371.  * removed!
  372.  * removed!
  373.  *
  374.  * removed!
  375.  * removed!
  376.  * removed!
  377.  *
  378.  * removed!
  379.  * removed!
  380.  * removed!
  381.  *
  382.  * removed!
  383.  * removed!
  384.  * removed!
  385.  *
  386.  *------------------------------------------------------------------------------
  387.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  388.  *============================================================================== 
  389.  *******************************************************************************/
  390. /**
  391.  * Copyright Notice
  392.  * ?2002 - 2003, Pixtel Communications, Inc., 1489 43rd Ave. W.,
  393.  * Vancouver, B.C. V6M 4K8 Canada. All Rights Reserved.
  394.  *  (It is illegal to remove this copyright notice from this software or any
  395.  *  portion of it)
  396.  */
  397. /**************************************************************
  398.    FILENAME : SAT.c
  399.    PURPOSE     : SAT Application
  400.    REMARKS     : nil
  401.    AUTHOR      : NEERAJ SHARMA
  402.    DATE     : Mar 24,03
  403. **************************************************************/
  404. #ifndef __SAT_MMI_UNIT_TEST__
  405. // #define __SAT_MMI_UNIT_TEST__ // for icon debug
  406. #endif 
  407. #include "stdC.h"
  408. #include "L4Dr1.h"
  409. #include "L4Dr.h"
  410. #include "MMI_features.h"
  411. #include "FrameworkStruct.h"
  412. /* micha0125,  modify key event handler, change on all IsInSATScreen. */
  413. #include"KeyBrd.h"
  414. #include "SATDefs.h"
  415. #include "SATStruct.h"
  416. #include "SATGProts.h"
  417. #include "SATProts.h"
  418. #include "ProtocolEvents.h"
  419. #include "TimerEvents.h"
  420. #include "CallManagementStruct.h"
  421. #include "CallManagementGprot.h"
  422. #include "GSM7BitDefaultAlphabet.h"
  423. #include "CommonScreens.h"
  424. #include "NVRAMType.h"
  425. #include "NVRAMProt.h"
  426. #include "NVRAMEnum.h"
  427. #include "SSCStringHandle.h"
  428. #include "gdi_include.h"
  429. #include "lcd_sw_rnd.h"
  430. #include "QueueGprot.h"
  431. #include "BootUp.h"
  432. #include "PowerOnChargerProt.h"
  433. #include "SimDetectionDef.h"
  434. #include "SimDetectionGexdcl.h"
  435. #include "SimDetectionGprot.h"
  436. #include "sat_def.h"
  437. #include "wgui_categories_inputs.h"
  438. /* micha0901 */
  439. #include "wgui_categories_popup.h"
  440. #include "CallManagementStruct.h"
  441. #include "CallStructureManagementProt.h"
  442. /* micha1012 */
  443. #include "AlarmFrameworkProt.h"
  444. #include "gpioInc.h"
  445. #include "DebugInitDef.h"
  446. #include "CallHistoryGProts.h"
  447. #include "CallManagementIdDef.h" /* CM_SCR_MARKER */
  448. #include "PhoneBookGprot.h"
  449. #include "ProfileGprots.h"
  450. #include "SettingGenum.h"
  451. #include "SecuritySetup.h" /* SECSETGetFdlBdlModeReq */
  452. #include "Service.h" /* GoToServicesMenu */
  453. #include "ServiceDefs.h" /* SERVICES_MAIN_MENU_SCREEN_ID */
  454. #include "wapadp.h"
  455. #ifdef __USAT__
  456. #include "DateTimeGprot.h"
  457. #endif 
  458. #ifdef __MMI_WLAN_FEATURES__
  459. #include "NetworkSetupDefs.h"
  460. #endif
  461. SATSETUPMENU gSATMainMenu;
  462. SATSUBMENU gSATSubMenu;
  463. SATDISPLAYTEXT gSATDisplayText;
  464. SATGETINPUT gSATGetInput;
  465. SATGETINKEY gSATGetInkey;
  466. SATSENDSMS gSATSendSMS;
  467. SATSENDSS gSATSendSS;
  468. SATSENDUSSD gSATSendUSSD;
  469. SATPLAYTONE gSATPlayTone;
  470. SATCALLSETUP gSATCallSetup;
  471. SATIMAGERECORD gSATImageRecord;
  472. SATRUNATCOMMAND gSATRunATCommand;
  473. SATLAUNCHBROWSER gSATLaunchBrowser;
  474. SATSENDDTMF gSATSendDTMF;
  475. /* micha1016 */
  476. SATDISPLAYIDLETEXT gSATDisplayIdleText;
  477. SATCONTEXT gSATContext;
  478. /* extern U8 isIdleScreenReached; */
  479. extern S16 MMI_current_input_ext_type;  /* diamond, 2005/07/22 GET INPUT numeric input without 'p' and 'w' */
  480. #ifdef __SATCE__
  481. SATOPENCHANNEL satOpenChannel;
  482. SATCLOSECHANNEL satCloseChannel;
  483. SATSENDDATA satSendData;
  484. SATRECVDATA satRecvData;
  485. #endif /* __SATCE__ */ 
  486. #ifdef __SAT_MMI_UNIT_TEST__
  487. mmi_smu_read_sim_rsp_struct EFback1a = {0, 0, {L4C_OK, 0},
  488. 10,
  489. {0x01, 0x08, 0x08, 0x11, 0x4F, 0x04, 0x00, 0x00, 0x00, 0x0A}
  490. };
  491. mmi_smu_read_sim_rsp_struct EFback2a = {0, 0, {L4C_OK, 0},
  492. 10,
  493. {0x08, 0x08, 0xFF, 0x03, 0xA5, 0x99, 0x99, 0xA5, 0xC3, 0xFF}
  494. };
  495. mmi_smu_read_sim_rsp_struct EFback1 = {0, 0, {L4C_OK, 0},
  496. 10,
  497. {0x01, 0x08, 0x08, 0x21, 0x4F, 0x02, 0x00, 0x00, 0x00, 0x1F}
  498. };
  499. mmi_smu_read_sim_rsp_struct EFback2 = {0, 0, {L4C_OK, 0},
  500. 31,
  501. {0x08, 0x08, 0x02, 0x03, 0x00, 0x16, 0xAA, 0xAA, 0x80, 0x02, 0x85, 0x42,
  502.  0x81, 0x42, 0x81, 0x42, 0x81, 0x52, 0x80, 0x02, 0xAA, 0xAA, 0xFF, 0x00,
  503.  0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF}
  504. };
  505. #endif /* __SAT_MMI_UNIT_TEST__ */ 
  506. extern void mmi_frm_sms_sim_refresh_ind(U16);
  507. extern void mmi_frm_add_history_before_cm_marker(U16 scrn_id, FuncPtr func_ptr);
  508. #ifdef __SAT_MMI_UNIT_TEST__
  509. void SATSetupIdleDisplayTest(void);
  510. #endif 
  511. void (*SATGetIconCompleteCallBack) (void);
  512. /*****************************************************************************
  513.  * FUNCTION
  514.  *  InitSimAppToolkit
  515.  * DESCRIPTION
  516.  *  Initialises variables & Protocol Handlers for SAT
  517.  * PARAMETERS
  518.  *  void
  519.  * RETURNS
  520.  *  void
  521.  *****************************************************************************/
  522. void InitSimAppToolkit(void)
  523. {
  524.     /*----------------------------------------------------------------*/
  525.     /* Local Variables                                                */
  526.     /*----------------------------------------------------------------*/
  527.     /*----------------------------------------------------------------*/
  528.     /* Code Body                                                      */
  529.     /*----------------------------------------------------------------*/
  530. #ifdef __SAT_MMI_UNIT_TEST__
  531.     SATSetupIdleDisplayTest();
  532. #endif 
  533.     SetProtocolEventHandler(SATSetupMenuInd, PRT_MMI_SAT_SETUP_MENU_IND);
  534.     SetProtocolEventHandler(SATSetupMenuRsp, PRT_MMI_SAT_SETUP_MENU_RES_RSP);
  535.     /* micha0216 */
  536.     SetProtocolEventHandler(SATMenuSelectRsp, PRT_MMI_SAT_MENU_SELECT_RSP);
  537.     SetProtocolEventHandler(SATSelectItemInd, PRT_MMI_SAT_SELECT_ITEM_IND);
  538.     SetProtocolEventHandler(SATSelectItemRsp, PRT_MMI_SAT_SELECT_ITEM_RES_RSP);
  539.     SetProtocolEventHandler(SATDisplayTextInd, PRT_MMI_SAT_DISPLAY_TEXT_IND);
  540.     SetProtocolEventHandler(SATDisplayTextRsp, PRT_MMI_SAT_DISPLAY_TEXT_RES_RSP);
  541.     SetProtocolEventHandler(SATGetInputInd, PRT_MMI_SAT_GET_INPUT_IND);
  542.     SetProtocolEventHandler(SATGetInputRsp, PRT_MMI_SAT_GET_INPUT_RES_RSP);
  543.     SetProtocolEventHandler(SATGetInkeyInd, PRT_MMI_SAT_GET_INKEY_IND);
  544.     SetProtocolEventHandler(SATGetInkeyRsp, PRT_MMI_SAT_GET_INKEY_RES_RSP);
  545.     SetProtocolEventHandler(SATCallSetupInd, PRT_MMI_SAT_CALL_SETUP_IND);
  546.     SetProtocolEventHandler(SATCallSetupStage1Rsp, PRT_MMI_SAT_CALL_SETUP_STAGE1_RSP);
  547.     SetProtocolEventHandler(SATCallSetupStage2Rsp, PRT_MMI_SAT_CALL_SETUP_STAGE2_RSP);
  548.     SetProtocolEventHandler(SATSendSMSInd, PRT_MMI_SAT_SEND_SMS_IND);
  549.     SetProtocolEventHandler(SATSendSMSStage1Rsp, PRT_MMI_SAT_SEND_SMS_STAGE1_RSP);
  550.     SetProtocolEventHandler(SATSendSMSStage2Rsp, PRT_MMI_SAT_SEND_SMS_STAGE2_RSP);
  551.     SetProtocolEventHandler(SATSendSSInd, PRT_MMI_SAT_SEND_SS_IND);
  552.     SetProtocolEventHandler(SATSendSSStage1Rsp, PRT_MMI_SAT_SEND_SS_STAGE1_RSP);
  553.     SetProtocolEventHandler(SATSendSSStage2Rsp, PRT_MMI_SAT_SEND_SS_STAGE2_RSP);
  554.     SetProtocolEventHandler(SATSendUSSDInd, PRT_MMI_SAT_SEND_USSD_IND);
  555.     SetProtocolEventHandler(SATSendUSSDStage1Rsp, PRT_MMI_SAT_SEND_USSD_STAGE1_RSP);
  556.     SetProtocolEventHandler(SATSendUSSDStage2Rsp, PRT_MMI_SAT_SEND_USSD_STAGE2_RSP);
  557.     SetProtocolEventHandler(SATMMIInfoInd, PRT_MMI_SAT_MMI_INFO_IND);
  558.     SetProtocolEventHandler(SATPlayToneInd, PRT_MMI_SAT_PLAY_TONE_IND);
  559.     SetProtocolEventHandler(SATPlayToneRsp, PRT_MMI_SAT_PLAY_TONE_RES_RSP);
  560.     SetProtocolEventHandler(SATLangNotifyInd, PRT_MMI_SAT_LANG_NOTIFY_IND);
  561.     SetProtocolEventHandler(SATLaunchBrowserInd, PRT_MMI_SAT_LAUNCH_BROWSER_IND);
  562.     SetProtocolEventHandler(WAPLaunchBrowserRsp, PRT_WAP_MMI_LAUNCH_BROWSER_RSP);
  563.     SetProtocolEventHandler(SATLaunchBrowserRsp, PRT_MMI_SAT_LAUNCH_BROWSER_RES_RSP);
  564.     SetProtocolEventHandler(SATEVDLBrowserTerminationInd, PRT_WAP_MMI_BROWSER_TERMINATION_IND);
  565.     SetProtocolEventHandler(SATSendDTMFInd, PRT_MMI_SAT_SEND_DTMF_IND);
  566.     SetProtocolEventHandler(SATSendDTMFStage1Rsp, PRT_MMI_SAT_SEND_DTMF_STAGE1_RSP);
  567.     SetProtocolEventHandler(SATSendDTMFStage2Rsp, PRT_MMI_SAT_SEND_DTMF_STAGE2_RSP);
  568.     SetProtocolEventHandler(SATSetupIdleDisplayInd, PRT_MMI_SAT_SETUP_IDLE_DISPLAY_IND);
  569.     SetProtocolEventHandler(SATRunATCommandInd, PRT_MMI_SAT_RUN_AT_COMMAND_IND);
  570.     /* micha0714 */
  571.     SetProtocolEventHandler(SATNoFurtherCommandInd, PRT_MMI_SAT_NO_OTHER_CMD_IND);
  572.     /* micha0201 */
  573.     SetProtocolEventHandler(SATSIMFileChangeInd, PRT_MMI_SAT_SIM_FILE_CHANGE_IND);
  574. #ifdef __SATCE__
  575.     SetProtocolEventHandler(SATOpenChannelInd, MSG_ID_MMI_SAT_OPEN_CHANNEL_IND);
  576.     SetProtocolEventHandler(SATOpenChannelRes, MSG_ID_MMI_SAT_OPEN_CHANNEL_RSP);
  577.     SetProtocolEventHandler(SATCloseChannelInd, MSG_ID_MMI_SAT_CLOSE_CHANNEL_IND);
  578.     SetProtocolEventHandler(SATSendDataInd, MSG_ID_MMI_SAT_SEND_DATA_IND);
  579.     SetProtocolEventHandler(SATSendDataRes, MSG_ID_MMI_SAT_SEND_DATA_RSP);
  580.     SetProtocolEventHandler(SATRecvDataInd, MSG_ID_MMI_SAT_RECV_DATA_IND);
  581.     SetProtocolEventHandler(SATRecvDataRes, MSG_ID_MMI_SAT_RECV_DATA_RSP);
  582. #endif /* __SATCE__ */ 
  583.     gSATContext.getImageStage = (U16) SAT_IMAGE_IDLE_CMD;
  584.     gSATContext.gotStage1Rsp = 1;
  585.     gSATContext.lastSATCmd = SAT_NONE_CMD;
  586.     gSATContext.simFuncPtr[0] = mmi_sat_clear_idle_display_text; /* max 3 callbacks for SIM file changed indication */
  587.     gSATContext.simFuncPtr[1] = mmi_sat_refresh_to_update_imsi;
  588. }
  589. /* micha0714 */
  590. /*****************************************************************************
  591.  * FUNCTION
  592.  *  SATNoFurtherCommandInd
  593.  * DESCRIPTION
  594.  *  
  595.  * PARAMETERS
  596.  *  msgPtr      [?]     
  597.  * RETURNS
  598.  *  void
  599.  *****************************************************************************/
  600. void SATNoFurtherCommandInd(void *msgPtr)
  601. {
  602.     /*----------------------------------------------------------------*/
  603.     /* Local Variables                                                */
  604.     /*----------------------------------------------------------------*/
  605.     /*----------------------------------------------------------------*/
  606.     /* Code Body                                                      */
  607.     /*----------------------------------------------------------------*/
  608.     if (!gSATContext.waitTimeExpired)
  609.     {
  610.         gSATMainMenu.isSentRsp = 1; /* diamond, 2006/04/06 Avoid to add SAT main menu to history if no furthur command comes in SAT screen more than 1 times */
  611.         SATMessageWaitTimer();
  612.     }
  613. }
  614. /*****************************************************************************
  615.  * FUNCTION
  616.  *  SATFileChangePhbCheck
  617.  * DESCRIPTION
  618.  *  
  619.  * PARAMETERS
  620.  *  simChange       [?]     
  621.  * RETURNS
  622.  *  void
  623.  *****************************************************************************/
  624. static pBOOL SATFileChangePhbCheck(mmi_sat_sim_file_change_ind_struct *simChange)
  625. {
  626.     /*----------------------------------------------------------------*/
  627.     /* Local Variables                                                */
  628.     /*----------------------------------------------------------------*/
  629.     U8 i;
  630.     pBOOL rtn = MMI_FALSE;
  631.     /*----------------------------------------------------------------*/
  632.     /* Code Body                                                      */
  633.     /*----------------------------------------------------------------*/
  634.     if (simChange->is_full_changed)
  635.     {
  636.         return MMI_TRUE;
  637.     }
  638.     for (i = 0; i < simChange->num_of_file; i++)
  639.     {
  640.         if (simChange->file_list[i] == FILE_ADN_IDX
  641.             || simChange->file_list[i] == FILE_FDN_IDX
  642.             || simChange->file_list[i] == FILE_LND_IDX
  643.             || simChange->file_list[i] == FILE_SDN_IDX
  644.             || simChange->file_list[i] == FILE_EXT1_IDX
  645.             || simChange->file_list[i] == FILE_EXT2_IDX
  646.             || simChange->file_list[i] == FILE_EXT3_IDX
  647.             || simChange->file_list[i] == FILE_BDN_IDX
  648.             || simChange->file_list[i] == FILE_EXT4_IDX)
  649.         {
  650.             rtn = MMI_TRUE;
  651.             break;
  652.         }
  653.     }
  654.     return rtn;
  655. }
  656. /*****************************************************************************
  657.  * FUNCTION
  658.  *  SATFileChangeSmsCheck
  659.  * DESCRIPTION
  660.  *  
  661.  * PARAMETERS
  662.  *  simChange       [?]     
  663.  * RETURNS
  664.  *  void
  665.  *****************************************************************************/
  666. static pBOOL SATFileChangeSmsCheck(mmi_sat_sim_file_change_ind_struct *simChange)
  667. {
  668.     /*----------------------------------------------------------------*/
  669.     /* Local Variables                                                */
  670.     /*----------------------------------------------------------------*/
  671.     U8 i;
  672.     pBOOL rtn = MMI_FALSE;
  673.     /*----------------------------------------------------------------*/
  674.     /* Code Body                                                      */
  675.     /*----------------------------------------------------------------*/
  676.     if (simChange->is_full_changed)
  677.     {
  678.         return MMI_TRUE;
  679.     }
  680.     for (i = 0; i < simChange->num_of_file; i++)
  681.     {
  682.         if (simChange->file_list[i] == FILE_SMSS_IDX
  683.             || simChange->file_list[i] == FILE_SMSP_IDX
  684.             || simChange->file_list[i] == FILE_SMS_IDX
  685.             || simChange->file_list[i] == FILE_CBMI_IDX
  686.             || simChange->file_list[i] == FILE_CBMID_IDX || simChange->file_list[i] == FILE_CBMIR_IDX
  687.     #ifdef __CPHS__
  688.             || simChange->file_list[i] == FILE_VM_WAIT_IDX || simChange->file_list[i] == FILE_MAILBOX_NUM_IDX
  689.     #endif 
  690.             || simChange->file_list[i] == FILE_ELP_IDX || simChange->file_list[i] == FILE_LP_IDX)
  691.         {
  692.             rtn = MMI_TRUE;
  693.             break;
  694.         }
  695.     }
  696.     return rtn;
  697. }
  698. /* micha0201 */
  699. /*****************************************************************************
  700.  * FUNCTION
  701.  *  SATSIMFileChangeInd
  702.  * DESCRIPTION
  703.  *  
  704.  * PARAMETERS
  705.  *  msgPtr      [?]     
  706.  * RETURNS
  707.  *  void
  708.  *****************************************************************************/
  709. void SATSIMFileChangeInd(void *msgPtr)
  710. {
  711.     /*----------------------------------------------------------------*/
  712.     /* Local Variables                                                */
  713.     /*----------------------------------------------------------------*/
  714.     U8 i;
  715.     mmi_sat_sim_file_change_ind_struct *simChange;
  716.     /*----------------------------------------------------------------*/
  717.     /* Code Body                                                      */
  718.     /*----------------------------------------------------------------*/
  719.     simChange = (mmi_sat_sim_file_change_ind_struct*) msgPtr;
  720.     if (simChange->refresh_type == TYPE_SIM_RESET)
  721.     {
  722.         GoToSATRebootScreen();
  723.         return;
  724.     }
  725.     /* diamond, 2005/05/31 sim file change notification */
  726.     else
  727.     {
  728.         for (i = 0; i < MAX_FILE_CHANGE_NOTIFY_CALLBACK; i++)
  729.         {
  730.             if (gSATContext.simFuncPtr[i] != NULL)
  731.             {
  732.                 gSATContext.simFuncPtr[i] (simChange->refresh_type);
  733.             }
  734.         }
  735.     }
  736.     /* diamond, 2006/01/06 sim file change for sms */
  737.     if (SATFileChangeSmsCheck(simChange))
  738.     {
  739.         mmi_frm_sms_sim_refresh_ind(simChange->refresh_type);    /* SMS */
  740.     }
  741.     
  742.     /* PHB & Call Log */
  743.     if (SATFileChangePhbCheck(simChange))
  744.     {
  745.         CHISTSatHandler(); 
  746.         mmi_phb_sat_handler(TRUE);
  747.         SECSETGetFdlBdlModeReq();
  748.     }
  749.     /* single file refresh */
  750.     if (simChange->refresh_type == TYPE_FILE_CHANGE)
  751.     {
  752.         for (i = 0; i < simChange->num_of_file; i++)
  753.         {
  754.             switch (simChange->file_list[i])
  755.             {
  756.                 case FILE_MSISDN_IDX:
  757.                     mmi_sat_get_msisdn_info(); /* linear fixed EF, need to get file info and then get data */
  758.                     break;
  759.                 case FILE_SPN_IDX:
  760.                     mmi_sat_get_spn_data(); /* transparent EF, read data directly */
  761.                     break;
  762.                 default:
  763.                     break;
  764.             }
  765.         }
  766.     }
  767. }
  768. /*****************************************************************************
  769.  * FUNCTION
  770.  *  GoToSATRebootScreen
  771.  * DESCRIPTION
  772.  *  
  773.  * PARAMETERS
  774.  *  void
  775.  * RETURNS
  776.  *  void
  777.  *****************************************************************************/
  778. void GoToSATRebootScreen(void)
  779. {
  780.     /*----------------------------------------------------------------*/
  781.     /* Local Variables                                                */
  782.     /*----------------------------------------------------------------*/
  783.     /*----------------------------------------------------------------*/
  784.     /* Code Body                                                      */
  785.     /*----------------------------------------------------------------*/
  786.     EntryNewScreen(SCR_ID_SAT_WAITSCREEN, NULL, GoToSATRebootScreen, NULL);
  787.     /* ShowCategory65Screen((PU8)GetString(STR_ID_SIM_REFRESH), SAT_WAIT_IMAGE_ID, NULL); */
  788.     DisplayPopup(
  789.         (U8*) GetString(STR_ID_SIM_REFRESH),
  790.         IMG_GLOBAL_WARNING,
  791.         0,
  792.         UI_POPUP_NOTIFYDURATION_TIME * 2,
  793.         (U8) ERROR_TONE);
  794.     ClearInputEventHandler(MMI_DEVICE_ALL); /* go to reboot now and no input can be accepted*/
  795.     SetKeyHandler(0, KEY_END, KEY_EVENT_DOWN);
  796.     SetKeyHandler(0, KEY_END, KEY_EVENT_UP);
  797.     mmi_sat_nw_detach_before_reboot();
  798.     StartTimer(SAT_REFRESH_REBOOT_TIMER, 3000, SATRefreshRebootTimeOut);
  799. }
  800. /*****************************************************************************
  801.  * FUNCTION
  802.  *  SATRefreshRebootTimeOut
  803.  * DESCRIPTION
  804.  *  
  805.  * PARAMETERS
  806.  *  void
  807.  * RETURNS
  808.  *  void
  809.  *****************************************************************************/
  810. void SATRefreshRebootTimeOut(void)
  811. {
  812.     /*----------------------------------------------------------------*/
  813.     /* Local Variables                                                */
  814.     /*----------------------------------------------------------------*/
  815.     /*----------------------------------------------------------------*/
  816.     /* Code Body                                                      */
  817.     /*----------------------------------------------------------------*/
  818. #ifdef MMI_ON_HARDWARE_P
  819.     ClearProtocolEventHandler(MSG_ID_MMI_NW_PWROFF_DETACH_RSP);
  820. #endif
  821.     AlmATPowerReset(0, 0);
  822. }
  823. /*****************************************************************************
  824.  * FUNCTION
  825.  *  IsSATPresent
  826.  * DESCRIPTION
  827.  *  
  828.  * PARAMETERS
  829.  *  void
  830.  * RETURNS
  831.  *  void
  832.  *****************************************************************************/
  833. U8 IsSATPresent(void)
  834. {
  835.     /*----------------------------------------------------------------*/
  836.     /* Local Variables                                                */
  837.     /*----------------------------------------------------------------*/
  838.     /*----------------------------------------------------------------*/
  839.     /* Code Body                                                      */
  840.     /*----------------------------------------------------------------*/
  841. #ifdef __MMI_WLAN_FEATURES__
  842.     if (mmi_netset_get_active_preferred_mode() == P_WLAN_ONLY)
  843.         return 0;
  844.     else
  845. #endif /* __MMI_WLAN_FEATURES__ */
  846.         return (gSATContext.isSATPresent);
  847. }
  848. /*****************************************************************************
  849.  * FUNCTION
  850.  *  IsInSATScreen
  851.  * DESCRIPTION
  852.  *  
  853.  * PARAMETERS
  854.  *  void
  855.  * RETURNS
  856.  *  void
  857.  *****************************************************************************/
  858. U8 IsInSATScreen(void)
  859. {
  860.     /*----------------------------------------------------------------*/
  861.     /* Local Variables                                                */
  862.     /*----------------------------------------------------------------*/
  863.     /*----------------------------------------------------------------*/
  864.     /* Code Body                                                      */
  865.     /*----------------------------------------------------------------*/
  866.     return (gSATContext.isInSATScreen);
  867. }
  868. /*****************************************************************************
  869.  * FUNCTION
  870.  *  IsInSATCall
  871.  * DESCRIPTION
  872.  *  
  873.  * PARAMETERS
  874.  *  void
  875.  * RETURNS
  876.  *  void
  877.  *****************************************************************************/
  878. U8 IsInSATCall(void)
  879. {
  880.     /*----------------------------------------------------------------*/
  881.     /* Local Variables                                                */
  882.     /*----------------------------------------------------------------*/
  883.     /*----------------------------------------------------------------*/
  884.     /* Code Body                                                      */
  885.     /*----------------------------------------------------------------*/
  886.     return (gSATContext.isInSATCall);
  887. }
  888. /* micha0831 */
  889. /*****************************************************************************
  890.  * FUNCTION
  891.  *  SATCallTerminate
  892.  * DESCRIPTION
  893.  *  Called by Call Manage
  894.  * PARAMETERS
  895.  *  void
  896.  * RETURNS
  897.  *  void
  898.  *****************************************************************************/
  899. void SATCallTerminate(void)
  900. {
  901.     /*----------------------------------------------------------------*/
  902.     /* Local Variables                                                */
  903.     /*----------------------------------------------------------------*/
  904.     /*----------------------------------------------------------------*/
  905.     /* Code Body                                                      */
  906.     /*----------------------------------------------------------------*/
  907.     if (gSATContext.isInSATCall)
  908.     {
  909.         gSATContext.isInSATCall = 0;
  910.         if (!gSATCallSetup.isSentRsp)
  911.         {
  912.             if (gSATCallSetup.exitCause == SAT_CALL_DISCONNECT_BEFORE_CONNECT)
  913.             {
  914.                 TerminalResponseCallSetup(
  915.                     SAT_USER_CLEAR_DOWN_CALL_BEFORE_CONNECTION_RELEASE,
  916.                     0,
  917.                     gSATCallSetup.cmdDetail);
  918.             }
  919.             else
  920.             {
  921.                 TerminalResponseCallSetup(SAT_ME_CURRENTLY_UNABLE_TO_PROCESS_CMD, 0, gSATCallSetup.cmdDetail);
  922.             }
  923.         }
  924.     }
  925. }
  926. /*****************************************************************************
  927.  * FUNCTION
  928.  *  GetSATIdleText
  929.  * DESCRIPTION
  930.  *  
  931.  * PARAMETERS
  932.  *  void
  933.  * RETURNS
  934.  *  void
  935.  *****************************************************************************/
  936. U8 *GetSATIdleText(void)
  937. {
  938.     /*----------------------------------------------------------------*/
  939.     /* Local Variables                                                */
  940.     /*----------------------------------------------------------------*/
  941.     /*----------------------------------------------------------------*/
  942.     /* Code Body                                                      */
  943.     /*----------------------------------------------------------------*/
  944.     return (gSATContext.idleTextPtr);
  945. }
  946. /*****************************************************************************
  947.  * FUNCTION
  948.  *  GetSATIdleIcon
  949.  * DESCRIPTION
  950.  *  
  951.  * PARAMETERS
  952.  *  void
  953.  * RETURNS
  954.  *  void
  955.  *****************************************************************************/
  956. U8 *GetSATIdleIcon(void)
  957. {
  958.     /*----------------------------------------------------------------*/
  959.     /* Local Variables                                                */
  960.     /*----------------------------------------------------------------*/
  961.     /*----------------------------------------------------------------*/
  962.     /* Code Body                                                      */
  963.     /*----------------------------------------------------------------*/
  964.     return (gSATContext.idleIconPtr);
  965. }
  966. /*****************************************************************************
  967.  * FUNCTION
  968.  *  GetPostponedSATScreen
  969.  * DESCRIPTION
  970.  *  
  971.  * PARAMETERS
  972.  *  void
  973.  * RETURNS
  974.  *  void
  975.  *****************************************************************************/
  976. FuncPtr GetPostponedSATScreen(void)
  977. {
  978.     /*----------------------------------------------------------------*/
  979.     /* Local Variables                                                */
  980.     /*----------------------------------------------------------------*/
  981.     /*----------------------------------------------------------------*/
  982.     /* Code Body                                                      */
  983.     /*----------------------------------------------------------------*/
  984.     return (gSATContext.postponedSATScreen);
  985. }
  986. /*****************************************************************************
  987.  * FUNCTION
  988.  *  ClearPostponedSATScreen
  989.  * DESCRIPTION
  990.  *  
  991.  * PARAMETERS
  992.  *  void
  993.  * RETURNS
  994.  *  void
  995.  *****************************************************************************/
  996. void ClearPostponedSATScreen(void)
  997. {
  998.     /*----------------------------------------------------------------*/
  999.     /* Local Variables                                                */
  1000.     /*----------------------------------------------------------------*/
  1001.     /*----------------------------------------------------------------*/
  1002.     /* Code Body                                                      */
  1003.     /*----------------------------------------------------------------*/
  1004.     gSATContext.postponedSATScreen = NULL;
  1005. }
  1006. /*****************************************************************************
  1007.  * FUNCTION
  1008.  *  GetSATMainMenuAlphaID
  1009.  * DESCRIPTION
  1010.  *  
  1011.  * PARAMETERS
  1012.  *  void
  1013.  * RETURNS
  1014.  *  void
  1015.  *****************************************************************************/
  1016. U8 *GetSATMainMenuAlphaID(void)
  1017. {
  1018.     /*----------------------------------------------------------------*/
  1019.     /* Local Variables                                                */
  1020.     /*----------------------------------------------------------------*/
  1021.     /*----------------------------------------------------------------*/
  1022.     /* Code Body                                                      */
  1023.     /*----------------------------------------------------------------*/
  1024.     return (gSATMainMenu.alphaId);
  1025. }
  1026. /*****************************************************************************
  1027.  * FUNCTION
  1028.  *  SATHistoryHandler
  1029.  * DESCRIPTION
  1030.  *  Calls Corresponding Function in History
  1031.  * PARAMETERS
  1032.  *  void
  1033.  * RETURNS
  1034.  *  void
  1035.  *****************************************************************************/
  1036. void SATHistoryHandler(void)
  1037. {
  1038.     /*----------------------------------------------------------------*/
  1039.     /* Local Variables                                                */
  1040.     /*----------------------------------------------------------------*/
  1041.     /*----------------------------------------------------------------*/
  1042.     /* Code Body                                                      */
  1043.     /*----------------------------------------------------------------*/
  1044.     SetIsInSATScreen();
  1045.     gSATContext.guiBufferPointer = GetCurrGuiBuffer(SCR_ID_SAT_HISTORY);
  1046.     (*gSATContext.historyFuncPtr) ();
  1047. }
  1048. /*****************************************************************************
  1049.  * FUNCTION
  1050.  *  SATSaveHistory
  1051.  * DESCRIPTION
  1052.  *  Saves SAT in History
  1053.  * PARAMETERS
  1054.  *  void
  1055.  * RETURNS
  1056.  *  void
  1057.  *****************************************************************************/
  1058. void SATSaveHistory(void)
  1059. {
  1060.     /*----------------------------------------------------------------*/
  1061.     /* Local Variables                                                */
  1062.     /*----------------------------------------------------------------*/
  1063.     /*----------------------------------------------------------------*/
  1064.     /* Code Body                                                      */
  1065.     /*----------------------------------------------------------------*/
  1066.     GenericExitScreen(SCR_ID_SAT_HISTORY, SATHistoryHandler);
  1067.     ClearIsInSATScreen();
  1068. }
  1069. /*****************************************************************************
  1070.  * FUNCTION
  1071.  *  SATMessageWaitTimer
  1072.  * DESCRIPTION
  1073.  *  Timer CallBack Function called by when the SAT dows not recieve any
  1074.  *  command from SIM for 3 secs
  1075.  * PARAMETERS
  1076.  *  void
  1077.  *  ptr(?)      [IN]        (Timer Id is returned in this)
  1078.  * RETURNS
  1079.  *  void
  1080.  *****************************************************************************/
  1081. void SATMessageWaitTimer(void)
  1082. {
  1083.     /*----------------------------------------------------------------*/
  1084.     /* Local Variables                                                */
  1085.     /*----------------------------------------------------------------*/
  1086.     /*----------------------------------------------------------------*/
  1087.     /* Code Body                                                      */
  1088.     /*----------------------------------------------------------------*/
  1089.     SATStopWaitTimer();
  1090.     PRINT_INFORMATION(("[SAT] please wait timer expires: isInSATScreen = %d, isInSATMenu = %d", gSATContext.isInSATScreen, gSATContext.isInSATMenu));
  1091.     if (gSATContext.isInSATScreen)
  1092.     {
  1093.     #ifdef __MMI_CLAMCLOSE_BACK2IDLE__
  1094.         if (IsClamClose())
  1095.         {
  1096.             DisplayIdleScreen();
  1097.             return;
  1098.         }
  1099.     #endif /* __MMI_CLAMCLOSE_BACK2IDLE__ */ 
  1100.         if (gSATContext.isInSATMenu)
  1101.         {
  1102.             gSATContext.historyFuncPtr = GoToSATMainMenu;
  1103.             if (isInCall() && !IsInSATCall())
  1104.             {
  1105.                 /* diamond, 2006/05/30 SAT -> call -> SAT -> Terminal Response then go back to call screen not SAT screen */
  1106.                 if (!IsScreenPresent(SCR_ID_SAT_HISTORY))
  1107.                 {
  1108.                     mmi_frm_add_history_before_cm_marker(SCR_ID_SAT_HISTORY, SATHistoryHandler);
  1109.                 }
  1110.                 GoBackHistory();
  1111.             }
  1112.             else if ((GetCurrScrnId() != SCR_ID_SAT_HISTORY) && (IsScreenPresent(SCR_ID_SAT_HISTORY)))
  1113.             {
  1114.                 GoBackHistory();
  1115.             }
  1116.             else if (IsScreenPresent(SCR_ID_SAT_HISTORY))
  1117.             {
  1118.                 GoBackToHistory(SCR_ID_SAT_HISTORY);
  1119.             }
  1120.             else
  1121.             {
  1122.                 gSATContext.guiBufferPointer = NULL;
  1123.                 GoToSATMainMenu();
  1124.             }
  1125.         }
  1126.         else
  1127.         {
  1128.             if (IsScreenPresent(SCR_ID_SAT_HISTORY))
  1129.             {
  1130.                 GoBackToHistory(SCR_ID_SAT_HISTORY);
  1131.             }
  1132.             else
  1133.             {
  1134.                 ClearIsInSATScreen();
  1135.                 GoBackHistory();
  1136.             }
  1137.         }
  1138.     }
  1139.     else
  1140.     {
  1141.         gSATContext.historyFuncPtr = GoToSATMainMenu;
  1142.         if (!gSATContext.isInSATMenu)
  1143.         {
  1144.             ClearIsInSATScreen();
  1145.             DeleteScreenIfPresent(SCR_ID_SAT_HISTORY);
  1146.         }
  1147.     }
  1148. }
  1149. /*****************************************************************************
  1150.  * FUNCTION
  1151.  *  StartSATTimerNoResponsefromUser
  1152.  * DESCRIPTION
  1153.  *  Starts No Response Timer and calls the passed
  1154.  *  function if no key is pressed in that duration
  1155.  * PARAMETERS
  1156.  *  FuncPtr         [IN]        
  1157.  *  function(?)     [IN]        To be called on Timer Expiry
  1158.  * RETURNS
  1159.  *  void
  1160.  *****************************************************************************/
  1161. void StartSATTimerNoResponsefromUser(FuncPtr FuncPtr)
  1162. {
  1163.     /*----------------------------------------------------------------*/
  1164.     /* Local Variables                                                */
  1165.     /*----------------------------------------------------------------*/
  1166.     /*----------------------------------------------------------------*/
  1167.     /* Code Body                                                      */
  1168.     /*----------------------------------------------------------------*/
  1169.     gSATContext.noResponseFuncPtr = FuncPtr;
  1170. #ifdef __USAT__
  1171.     if (gSATContext.lastSATCmd == SAT_DISPLAY_TEXT_CMD && gSATDisplayText.duration != 0)
  1172.     {
  1173.         if (!gSATDisplayText.countdownStarted)
  1174.         {
  1175.             StartTimer(SAT_TERMINAL_RESP_TIMER, gSATDisplayText.duration, gSATContext.noResponseFuncPtr);
  1176.             gSATDisplayText.countdownStarted = 1;
  1177.         }
  1178.         return;
  1179.     }
  1180.     if (gSATContext.lastSATCmd == SAT_GET_INKEY && gSATGetInkey.duration != 0)
  1181.     {
  1182.         if (!gSATGetInkey.countdownStarted)
  1183.         {
  1184.             StartTimer(SAT_TERMINAL_RESP_TIMER, gSATGetInkey.duration, gSATContext.noResponseFuncPtr);
  1185.             gSATGetInkey.countdownStarted = 1;
  1186.         }
  1187.         return;
  1188.     }
  1189. #endif /* __USAT__ */ 
  1190.     /* diamond, 2005/07/11 duration for DISPLAY TEXT "clear after a delay" case */
  1191.     if (gSATContext.lastSATCmd == SAT_DISPLAY_TEXT_CMD && gSATDisplayText.clearTextType == SAT_CLEAR_AFTER_DELAY)
  1192.     {
  1193.         StartTimer(SAT_TERMINAL_RESP_TIMER, SAT_DISPLAY_TEXT_DELAY_DURATION, gSATContext.noResponseFuncPtr);
  1194.         return;
  1195.     }
  1196.     /* end, diamond */
  1197. #ifdef MMI_ON_HARDWARE_P
  1198.     if (is_test_sim())
  1199.     {
  1200.         StartTimer(SAT_TERMINAL_RESP_TIMER, 60000, gSATContext.noResponseFuncPtr);
  1201.     }
  1202.     else
  1203.     {
  1204.         StartTimer(SAT_TERMINAL_RESP_TIMER, SAT_NO_RESPONSE_TIMER_DURATION, gSATContext.noResponseFuncPtr);
  1205.     }
  1206. #else /* MMI_ON_HARDWARE_P */ 
  1207.     StartTimer(SAT_TERMINAL_RESP_TIMER, SAT_NO_RESPONSE_TIMER_DURATION, gSATContext.noResponseFuncPtr);
  1208. #endif /* MMI_ON_HARDWARE_P */ 
  1209. }
  1210. /*****************************************************************************
  1211.  * FUNCTION
  1212.  *  StopSATTimerNoResponsefromUser
  1213.  * DESCRIPTION
  1214.  *  Stops No Response Timer
  1215.  * PARAMETERS
  1216.  *  void
  1217.  * RETURNS
  1218.  *  void
  1219.  *****************************************************************************/
  1220. void StopSATTimerNoResponsefromUser(void)
  1221. {
  1222.     /*----------------------------------------------------------------*/
  1223.     /* Local Variables                                                */
  1224.     /*----------------------------------------------------------------*/
  1225.     /*----------------------------------------------------------------*/
  1226.     /* Code Body                                                      */
  1227.     /*----------------------------------------------------------------*/
  1228.     StopTimer(SAT_TERMINAL_RESP_TIMER);
  1229. }
  1230. /*****************************************************************************
  1231.  * FUNCTION
  1232.  *  TemporaryStopSATTimerNoResponsefromUser
  1233.  * DESCRIPTION
  1234.  *  Stops No Response Timer when any key is pressed
  1235.  * PARAMETERS
  1236.  *  void
  1237.  * RETURNS
  1238.  *  void
  1239.  *****************************************************************************/
  1240. void TemporaryStopSATTimerNoResponsefromUser(void)
  1241. {
  1242.     /*----------------------------------------------------------------*/
  1243.     /* Local Variables                                                */
  1244.     /*----------------------------------------------------------------*/
  1245.     /*----------------------------------------------------------------*/
  1246.     /* Code Body                                                      */
  1247.     /*----------------------------------------------------------------*/
  1248.     StopTimer(SAT_TERMINAL_RESP_TIMER);
  1249. }
  1250. /*****************************************************************************
  1251.  * FUNCTION
  1252.  *  RestartSATTimerNoResponsefromUser
  1253.  * DESCRIPTION
  1254.  *  ResStarts No Response Timer when any key is released
  1255.  * PARAMETERS
  1256.  *  void
  1257.  *  FuncPtr(?)      [IN]        Function to be called on Timer Expiry
  1258.  * RETURNS
  1259.  *  void
  1260.  *****************************************************************************/
  1261. void RestartSATTimerNoResponsefromUser(void)
  1262. {
  1263.     /*----------------------------------------------------------------*/
  1264.     /* Local Variables                                                */
  1265.     /*----------------------------------------------------------------*/
  1266.     /*----------------------------------------------------------------*/
  1267.     /* Code Body                                                      */
  1268.     /*----------------------------------------------------------------*/
  1269.     /* diamond, 2005/07/25 SAT timer */
  1270.     if (gSATContext.noResponseFuncPtr != NULL)
  1271.     {
  1272.         /* diamond, 2005/07/11 duration for DISPLAY TEXT "clear after a delay" case */
  1273.         if (gSATContext.lastSATCmd == SAT_DISPLAY_TEXT_CMD && gSATDisplayText.clearTextType == SAT_CLEAR_AFTER_DELAY)
  1274.         {
  1275.             StartTimer(SAT_TERMINAL_RESP_TIMER, SAT_DISPLAY_TEXT_DELAY_DURATION, gSATContext.noResponseFuncPtr);
  1276.             return;
  1277.         }
  1278.         /* end, diamond */
  1279.     #ifdef MMI_ON_HARDWARE_P
  1280.         if (is_test_sim())
  1281.         {
  1282.             StartTimer(SAT_TERMINAL_RESP_TIMER, 60000, gSATContext.noResponseFuncPtr);
  1283.         }
  1284.         else
  1285.         {
  1286.             StartTimer(SAT_TERMINAL_RESP_TIMER, SAT_NO_RESPONSE_TIMER_DURATION, gSATContext.noResponseFuncPtr);
  1287.         }
  1288.     #else /* MMI_ON_HARDWARE_P */ 
  1289.         StartTimer(SAT_TERMINAL_RESP_TIMER, SAT_NO_RESPONSE_TIMER_DURATION, gSATContext.noResponseFuncPtr);
  1290.     #endif /* MMI_ON_HARDWARE_P */ 
  1291.     }
  1292. }
  1293. /*****************************************************************************
  1294.  * FUNCTION
  1295.  *  StartSATTimerHelp
  1296.  * DESCRIPTION
  1297.  *  Starts Help Timer and calls the passed
  1298.  *  function if no key is pressed in that duration
  1299.  * PARAMETERS
  1300.  *  FuncPtr         [IN]        
  1301.  *  function(?)     [IN]        To be called on Timer Expiry
  1302.  * RETURNS
  1303.  *  void
  1304.  *****************************************************************************/
  1305. void StartSATTimerHelp(FuncPtr FuncPtr)
  1306. {
  1307.     /*----------------------------------------------------------------*/
  1308.     /* Local Variables                                                */
  1309.     /*----------------------------------------------------------------*/
  1310.     /*----------------------------------------------------------------*/
  1311.     /* Code Body                                                      */
  1312.     /*----------------------------------------------------------------*/
  1313.     gSATContext.helpFuncPtr = FuncPtr;
  1314.     StartTimer(SAT_HELP_TIMER, SAT_HELP_TIMER_DURATION, gSATContext.helpFuncPtr);
  1315. }
  1316. /*****************************************************************************
  1317.  * FUNCTION
  1318.  *  StopSATTimerHelp
  1319.  * DESCRIPTION
  1320.  *  Stops Help Timer
  1321.  * PARAMETERS
  1322.  *  void
  1323.  *  FuncPtr(?)      [IN]        Function to be called on Timer Expiry
  1324.  * RETURNS
  1325.  *  void
  1326.  *****************************************************************************/
  1327. void StopSATTimerHelp(void)
  1328. {
  1329.     /*----------------------------------------------------------------*/
  1330.     /* Local Variables                                                */
  1331.     /*----------------------------------------------------------------*/
  1332.     /*----------------------------------------------------------------*/
  1333.     /* Code Body                                                      */
  1334.     /*----------------------------------------------------------------*/
  1335.     StopTimer(SAT_HELP_TIMER);
  1336. }
  1337. /*****************************************************************************
  1338.  * FUNCTION
  1339.  *  TemporaryStopSATTimerHelp
  1340.  * DESCRIPTION
  1341.  *  Stops Help Timer when any key is pressed
  1342.  * PARAMETERS
  1343.  *  void
  1344.  *  FuncPtr(?)      [IN]        Function to be called on Timer Expiry
  1345.  * RETURNS
  1346.  *  void
  1347.  *****************************************************************************/
  1348. void TemporaryStopSATTimerHelp(void)
  1349. {
  1350.     /*----------------------------------------------------------------*/
  1351.     /* Local Variables                                                */
  1352.     /*----------------------------------------------------------------*/
  1353.     /*----------------------------------------------------------------*/
  1354.     /* Code Body                                                      */
  1355.     /*----------------------------------------------------------------*/
  1356.     StopTimer(SAT_HELP_TIMER);
  1357. }
  1358. /*****************************************************************************
  1359.  * FUNCTION
  1360.  *  RestartSATTimerHelp
  1361.  * DESCRIPTION
  1362.  *  Restarts Help Timer when any key is released
  1363.  * PARAMETERS
  1364.  *  void
  1365.  *  FuncPtr(?)      [IN]        Function to be called on Timer Expiry
  1366.  * RETURNS
  1367.  *  void
  1368.  *****************************************************************************/
  1369. void RestartSATTimerHelp(void)
  1370. {
  1371.     /*----------------------------------------------------------------*/
  1372.     /* Local Variables                                                */
  1373.     /*----------------------------------------------------------------*/
  1374.     /*----------------------------------------------------------------*/
  1375.     /* Code Body                                                      */
  1376.     /*----------------------------------------------------------------*/
  1377.     /* diamond, 2005/07/25 SAT timer */
  1378.     if (gSATContext.helpFuncPtr != NULL)
  1379.     {
  1380.         StartTimer(SAT_HELP_TIMER, SAT_HELP_TIMER_DURATION, gSATContext.helpFuncPtr);
  1381.     }
  1382. }
  1383. /*****************************************************************************
  1384.  * FUNCTION
  1385.  *  ExitVariables
  1386.  * DESCRIPTION
  1387.  *  Reinitialises the global varibales of SAT while
  1388.  *  exiting
  1389.  * PARAMETERS
  1390.  *  void
  1391.  * RETURNS
  1392.  *  void
  1393.  *****************************************************************************/
  1394. void ExitVariables(void)
  1395. {
  1396.     /*----------------------------------------------------------------*/
  1397.     /* Local Variables                                                */
  1398.     /*----------------------------------------------------------------*/
  1399.     /*----------------------------------------------------------------*/
  1400.     /* Code Body                                                      */
  1401.     /*----------------------------------------------------------------*/
  1402.     gSATContext.isInSATMenu = 0;
  1403.     gSATMainMenu.selectedMenuItem = 0;
  1404.     SATStopWaitTimer();
  1405.     ClearIsInSATScreen();
  1406. }
  1407. /*****************************************************************************
  1408.  * FUNCTION
  1409.  *  ExitSATToIdle
  1410.  * DESCRIPTION
  1411.  *  Takes the user back to Idle Screen
  1412.  * PARAMETERS
  1413.  *  void
  1414.  * RETURNS
  1415.  *  void
  1416.  *****************************************************************************/
  1417. void ExitSATToIdle(void)
  1418. {
  1419.     /*----------------------------------------------------------------*/
  1420.     /* Local Variables                                                */
  1421.     /*----------------------------------------------------------------*/
  1422.     /*----------------------------------------------------------------*/
  1423.     /* Code Body                                                      */
  1424.     /*----------------------------------------------------------------*/
  1425.     if (isInCall())
  1426.     {
  1427.         HangupAllCalls();
  1428.     }
  1429.     else
  1430.     {
  1431.         gSATContext.isInSATMenu = 0;
  1432.         ClearIsInSATScreen();
  1433.         SATStopWaitTimer();
  1434.         DisplayIdleScreen();
  1435.     }
  1436. }
  1437. /*****************************************************************************
  1438.  * FUNCTION
  1439.  *  SATPleaseWaitScreen
  1440.  * DESCRIPTION
  1441.  *  Displays Please Wait Screen just sets the variables
  1442.  * PARAMETERS
  1443.  *  string      [IN]        String to be displayed in Please Wait Screen
  1444.  *  image       [IN]        Image to be displayed in Please Wait Screen
  1445.  * RETURNS
  1446.  *  void
  1447.  *****************************************************************************/
  1448. void SATPleaseWaitScreen(U16 string, U16 image)
  1449. {
  1450.     /*----------------------------------------------------------------*/
  1451.     /* Local Variables                                                */
  1452.     /*----------------------------------------------------------------*/
  1453.     /*----------------------------------------------------------------*/
  1454.     /* Code Body                                                      */
  1455.     /*----------------------------------------------------------------*/
  1456.     gSATContext.waitString = string;
  1457.     gSATContext.waitImage = image;
  1458.     PleaseWaitActualScreen();
  1459. #ifndef __MTK_TARGET__
  1460.     StartTimer(SAT_REFRESH_REBOOT_TIMER, 3000, SATMessageWaitTimer); /* diamond, 2006/05/30 Send NO FURTHER CMD to MMI */
  1461. #endif
  1462. }
  1463. /*****************************************************************************
  1464.  * FUNCTION
  1465.  *  PleaseWaitActualScreen
  1466.  * DESCRIPTION
  1467.  *  Displays Wait Screen on MMI, Entry function
  1468.  * PARAMETERS
  1469.  *  void
  1470.  * RETURNS
  1471.  *  void
  1472.  *****************************************************************************/
  1473. void PleaseWaitActualScreen(void)
  1474. {
  1475.     /*----------------------------------------------------------------*/
  1476.     /* Local Variables                                                */
  1477.     /*----------------------------------------------------------------*/
  1478.     /*----------------------------------------------------------------*/
  1479.     /* Code Body                                                      */
  1480.     /*----------------------------------------------------------------*/
  1481.     PRINT_INFORMATION(("[SAT] please wait screen: isInSATScreen = %d", gSATContext.isInSATScreen));
  1482.     if (gSATContext.isInSATScreen)
  1483.     {
  1484.         gSATContext.exitCondition = &gSATContext.waitTimeExpired;
  1485.         EntryNewScreen(SCR_ID_SAT_WAITSCREEN, SATGenericExitHandler, NULL, NULL);
  1486.         ClearHighlightHandler();
  1487.     #ifdef __MMI_SAT_PLEASE_WAIT_ONLY_TEXT__
  1488.         ShowCategory151Screen(0, 0, 0, 0, 0, 0, (PU8) GetString(gSATContext.waitString), 0, NULL);
  1489.     #else /* __MMI_SAT_PLEASE_WAIT_ONLY_TEXT__ */ 
  1490.         /* diamond, 2005/06/15 change screen style to be the same as DISPLAY TEXT if no image is assigned */
  1491.         if (gSATContext.waitImage == 0)
  1492.         {
  1493.             ShowCategory151Screen(0, 0, 0, 0, 0, 0, (PU8) GetString(gSATContext.waitString), 0, NULL);
  1494.         }
  1495.         else
  1496.             /* end, diamond */
  1497.         {
  1498.             ShowCategory9Screen(gSATContext.waitString, gSATContext.waitImage, NULL);
  1499.         }
  1500.     #endif /* __MMI_SAT_PLEASE_WAIT_ONLY_TEXT__ */ 
  1501.         SetKeyHandler(0, KEY_END, KEY_EVENT_DOWN);
  1502.     }
  1503.     gSATContext.historyFuncPtr = PleaseWaitActualScreen;
  1504.     /* micha1012 */
  1505.     AlmDisableExpiryHandler();
  1506.     StartTimer(SAT_MESSAGE_WAIT_TIMER, SAT_MESSAGE_WAIT_TIMER_DURATION, SATMessageWaitTimer);
  1507.     gSATContext.waitTimeExpired = 0;
  1508. }
  1509. /*****************************************************************************
  1510.  * FUNCTION
  1511.  *  SATStopWaitTimer
  1512.  * DESCRIPTION
  1513.  *  Stops Please Wait Timer, Timer is started when Please
  1514.  *  Wait Screen is called
  1515.  * PARAMETERS
  1516.  *  void
  1517.  * RETURNS
  1518.  *  void
  1519.  *****************************************************************************/
  1520. void SATStopWaitTimer(void)
  1521. {
  1522.     /*----------------------------------------------------------------*/
  1523.     /* Local Variables                                                */
  1524.     /*----------------------------------------------------------------*/
  1525.     /*----------------------------------------------------------------*/
  1526.     /* Code Body                                                      */
  1527.     /*----------------------------------------------------------------*/
  1528.     /* micha1012 */
  1529.     AlmEnableExpiryHandler();
  1530.     StopTimer(SAT_MESSAGE_WAIT_TIMER);
  1531. #ifndef __MTK_TARGET__
  1532.     StopTimer(SAT_REFRESH_REBOOT_TIMER);
  1533.     gSATContext.gotStage1Rsp = 1;
  1534. #endif
  1535.     gSATContext.waitTimeExpired = 1;
  1536. }
  1537. /*****************************************************************************
  1538.  * FUNCTION
  1539.  *  SATSetupMenuInd
  1540.  * DESCRIPTION
  1541.  *  Protocol Handler for SETUP MENU IND
  1542.  * PARAMETERS
  1543.  *  msgPtr      [IN]        Pointer to data from L4
  1544.  * RETURNS
  1545.  *  void
  1546.  *****************************************************************************/
  1547. void SATSetupMenuInd(void *msgPtr)
  1548. {
  1549.     /*----------------------------------------------------------------*/
  1550.     /* Local Variables                                                */
  1551.     /*----------------------------------------------------------------*/
  1552.     U8 i;
  1553.     U8 *tempDataPtr;
  1554.     SATMENUITEM *menuItem;
  1555.     mmi_sat_setup_menu_ind_struct *setupMenu;
  1556.     U16 convertedLen;
  1557.     /*----------------------------------------------------------------*/
  1558.     /* Code Body                                                      */
  1559.     /*----------------------------------------------------------------*/
  1560.     setupMenu = (mmi_sat_setup_menu_ind_struct*) msgPtr;
  1561.     if (gSATContext.isSATPresent)
  1562.     {
  1563.         FreeMainMenu(&gSATMainMenu);
  1564.     }
  1565.     memset(&gSATMainMenu, 0, sizeof(gSATMainMenu));
  1566.     /* diamond, 2005/08/28 record the last selected item for backward move to SAT main menu */
  1567.     gSATMainMenu.selectedMenuItem = 0;
  1568.     gSATMainMenu.isHelpInfoAvailable = setupMenu->is_help_info_available;
  1569.     memcpy(gSATMainMenu.cmdDetail, setupMenu->cmd_detail, 5 * sizeof(U8));
  1570.     gSATMainMenu.numOfItem = setupMenu->num_of_item;
  1571. #ifdef __SAT_MMI_UNIT_TEST__
  1572.     gSATMainMenu.isIconAvailable = 1;
  1573.     if (gSATMainMenu.isIconAvailable)
  1574.     {
  1575.         gSATMainMenu.IconID = 1;
  1576.         gSATMainMenu.iconAttr = SAT_ICON_NOT_SELF_EX;
  1577.     }
  1578.     gSATMainMenu.noItemIconIdList = 1;
  1579.     gSATMainMenu.itemIconListAttr = 1;
  1580.     gSATMainMenu.noNextActionIndList = 1;
  1581.     gSATMainMenu.dcsOfAlphaId = MMI_DEFAULT_DCS;
  1582.     /* diamond, 2006/05/22 Prevent from getting icon image unsuccessfully */
  1583.         gSATMainMenu.alphaIdLen = 20;
  1584.         gSATMainMenu.alphaId = CovertStringForPlatform(
  1585.                                 (PU8) "abcdefghji1234567890",
  1586.                                 gSATMainMenu.alphaIdLen,
  1587.                                 gSATMainMenu.dcsOfAlphaId,
  1588.                                 &gSATMainMenu.alphaIdLen);
  1589. #else /* __SAT_MMI_UNIT_TEST__ */ 
  1590.     gSATMainMenu.isIconAvailable = setupMenu->is_icon_available;
  1591.     if (gSATMainMenu.isIconAvailable)
  1592.     {
  1593.         gSATMainMenu.IconID = setupMenu->icon_info.icon_id;
  1594.         gSATMainMenu.iconAttr = setupMenu->icon_info.icon_attr;
  1595.     }
  1596.     gSATMainMenu.noItemIconIdList = setupMenu->no_item_icon_id_list;
  1597.     gSATMainMenu.itemIconListAttr = setupMenu->item_icon_list_attr;
  1598.     gSATMainMenu.noNextActionIndList = setupMenu->no_next_action_ind_list;
  1599.     gSATMainMenu.dcsOfAlphaId = setupMenu->dcs_of_alpha_id;
  1600.     /* diamond, 2006/05/22 Prevent from getting icon image unsuccessfully */
  1601.         gSATMainMenu.alphaIdLen = setupMenu->no_alpha_id;
  1602.         gSATMainMenu.alphaId = CovertStringForPlatform(
  1603.                                 setupMenu->alpha_id,
  1604.                                 gSATMainMenu.alphaIdLen,
  1605.                                 gSATMainMenu.dcsOfAlphaId,
  1606.                                 &gSATMainMenu.alphaIdLen);
  1607. #endif /* __SAT_MMI_UNIT_TEST__ */ 
  1608. #ifdef __USAT__
  1609.     gSATMainMenu.noTextAttribute = setupMenu->no_text_attribute;
  1610.     if (gSATMainMenu.noTextAttribute != 0)
  1611.     {
  1612.         gSATMainMenu.textFormatting = OslMalloc(gSATMainMenu.noTextAttribute * 4);
  1613.         memcpy(gSATMainMenu.textFormatting, setupMenu->text_formatting, gSATMainMenu.noTextAttribute * 4);
  1614.     }
  1615. #endif /* __USAT__ */ 
  1616.     if (gSATMainMenu.numOfItem == 0)
  1617.     {
  1618.         SendTerminalResponseSetupMenu(SAT_CMD_PERFORMED_SUCCESSFULLY, gSATMainMenu.cmdDetail);
  1619.         FreeMainMenu(&gSATMainMenu);
  1620.         gSATContext.isSATPresent = 0;
  1621.         if (gSATContext.isInSATMenu)
  1622.         {
  1623.             SATStopWaitTimer();
  1624.             DeleteScreenIfPresent(SCR_ID_SAT_HISTORY);
  1625.             if (GetExitScrnID() == SCR_ID_SAT_HISTORY)
  1626.             {
  1627.                 ClearExitHandler();
  1628.             }
  1629.             GoToSATMainMenu();
  1630.         }
  1631.         return;
  1632.     }
  1633.     if (gSATMainMenu.numOfItem > 0)
  1634.     {
  1635.         gSATMainMenu.menuItems = OslMalloc(gSATMainMenu.numOfItem * sizeof(SATMENUITEM));
  1636.         menuItem = gSATMainMenu.menuItems;
  1637.         tempDataPtr = setupMenu->item_data;
  1638.         memset(gSATMainMenu.menuItems, 0, gSATMainMenu.numOfItem * sizeof(SATMENUITEM));
  1639.         for (i = 0; i < gSATMainMenu.numOfItem; i++, menuItem++)
  1640.         {
  1641.             menuItem->itemLen = (U16) (*(tempDataPtr + 1));
  1642.             if (menuItem->itemLen)
  1643.             {
  1644.                 tempDataPtr += 2;
  1645.                 menuItem->itemId = *tempDataPtr++;
  1646.                 menuItem->itemDcs = *tempDataPtr++;
  1647.                 menuItem->itemData = CovertStringForPlatform(tempDataPtr, menuItem->itemLen, menuItem->itemDcs, &convertedLen);
  1648.                 tempDataPtr += menuItem->itemLen;
  1649.                 menuItem->itemLen = convertedLen;
  1650.             }
  1651.             else
  1652.             {
  1653.                 /* diamond, 2006/03/19 Keep the menu item if its content is nothing */
  1654.                 tempDataPtr += 2;
  1655.                 menuItem->itemId = *tempDataPtr++;
  1656.                 menuItem->itemDcs = *tempDataPtr++;
  1657.                 tempDataPtr += menuItem->itemLen;
  1658.             }
  1659.             if (gSATMainMenu.noItemIconIdList)
  1660.         #ifdef __SAT_MMI_UNIT_TEST__
  1661.                 menuItem->IconID = 1;
  1662.         #else 
  1663.                 menuItem->IconID = *(setupMenu->item_icon_id_list + i);
  1664.         #endif 
  1665.             /* diamond, 2006/05/22 Prevent from getting icon image unsuccessfully */
  1666.         #if 0
  1667. /* under construction !*/
  1668. /* under construction !*/
  1669. /* under construction !*/
  1670. /* under construction !*/
  1671. /* under construction !*/
  1672. /* under construction !*/
  1673. /* under construction !*/
  1674. /* under construction !*/
  1675. /* under construction !*/
  1676.         #endif /* 0 */ 
  1677.             if (gSATMainMenu.noNextActionIndList)
  1678.         #ifdef __SAT_MMI_UNIT_TEST__
  1679.                 menuItem->nextAction = SAT_NEXT_ACTION_RESERVED_FOR_TIA;
  1680.         #else 
  1681.                 menuItem->nextAction = setupMenu->next_action_ind_list[i];
  1682.         #endif 
  1683.         #ifdef __USAT__
  1684.             if (setupMenu->no_item_attribute)
  1685.             {
  1686.                 memcpy(menuItem->itemTextFormatting, setupMenu->item_formatting + 4 * i, 4);
  1687.             }
  1688.             else
  1689.             {
  1690.                 memset(menuItem->itemTextFormatting, 0, 4);
  1691.             }
  1692.         #endif /* __USAT__ */ 
  1693.         }
  1694.     }
  1695.     SendTerminalResponseSetupMenu(SAT_CMD_PERFORMED_SUCCESSFULLY, gSATMainMenu.cmdDetail);
  1696.     gSATContext.isSATPresent = 1;
  1697. }
  1698. /*****************************************************************************
  1699.  * FUNCTION
  1700.  *  SATReturnNextAction
  1701.  * DESCRIPTION
  1702.  *  SAT next action indication
  1703.  * PARAMETERS
  1704.  *  NextActionID        [IN]        
  1705.  * RETURNS
  1706.  *  void
  1707.  *****************************************************************************/
  1708. /* micha1229 */
  1709. PU8 SATReturnNextAction(U8 NextActionID)
  1710. {
  1711.     /*----------------------------------------------------------------*/
  1712.     /* Local Variables                                                */
  1713.     /*----------------------------------------------------------------*/
  1714.     /*----------------------------------------------------------------*/
  1715.     /* Code Body                                                      */
  1716.     /*----------------------------------------------------------------*/
  1717.     switch (NextActionID)
  1718.     {
  1719.         case SAT_NEXT_ACTION_SETUP_CALL:
  1720.             return ((PU8) GetString(SAT_NEXT_ACTION_SETUP_CALL_STRING_ID));
  1721.         case SAT_NEXT_ACTION_SEND_SS:
  1722.             return ((PU8) GetString(SAT_NEXT_ACTION_SEND_SS_STRING_ID));
  1723.         case SAT_NEXT_ACTION_SEND_USSD:
  1724.             return ((PU8) GetString(SAT_NEXT_ACTION_SEND_USSD_STRING_ID));
  1725.         case SAT_NEXT_ACTION_SEND_SMS:
  1726.             return ((PU8) GetString(SAT_NEXT_ACTION_SEND_SMS_STRING_ID));
  1727.         case SAT_NEXT_ACTION_PLAY_TONE:
  1728.             return ((PU8) GetString(SAT_NEXT_ACTION_PLAY_TONE_STRING_ID));
  1729.         case SAT_NEXT_ACTION_DISPLAY_TEXT:
  1730.             return ((PU8) GetString(SAT_NEXT_ACTION_DISPLAY_TEXT_STRING_ID));
  1731.         case SAT_NEXT_ACTION_GET_INKEY:
  1732.             return ((PU8) GetString(SAT_NEXT_ACTION_GET_INKEY_STRING_ID));
  1733.         case SAT_NEXT_ACTION_GET_INPUT:
  1734.             return ((PU8) GetString(SAT_NEXT_ACTION_GET_INPUT_STRING_ID));
  1735.         case SAT_NEXT_ACTION_SELECT_ITEM:
  1736.             return ((PU8) GetString(SAT_NEXT_ACTION_SELECT_ITEM_STRING_ID));
  1737.         case SAT_NEXT_ACTION_SETUP_MENU:
  1738.             return ((PU8) GetString(SAT_NEXT_ACTION_SETUP_MENU_STRING_ID));
  1739.         case SAT_NEXT_ACTION_SETUP_IDLE_TEXT:
  1740.             return ((PU8) GetString(SAT_NEXT_ACTION_SETUP_IDLE_TEXT_STRING_ID));
  1741.         case SAT_NEXT_ACTION_PERFORM_CARD_APDU:
  1742.             return ((PU8) GetString(SAT_NEXT_ACTION_PERFORM_CARD_APDU_STRING_ID));
  1743.         case SAT_NEXT_ACTION_POWER_ON_CARD:
  1744.             return ((PU8) GetString(SAT_NEXT_ACTION_POWER_ON_CARD_STRING_ID));
  1745.         case SAT_NEXT_ACTION_POWER_OFF_CARD:
  1746.             return ((PU8) GetString(SAT_NEXT_ACTION_POWER_OFF_CARD_STRING_ID));
  1747.         case SAT_NEXT_ACTION_GET_READER_STATUS:
  1748.             return ((PU8) GetString(SAT_NEXT_ACTION_GET_READER_STATUS_STRING_ID));
  1749.         case SAT_NEXT_ACTION_OPEN_CHANNEL:
  1750.             return ((PU8) GetString(SAT_NEXT_ACTION_OPEN_CHANNEL_STRING_ID));
  1751.         case SAT_NEXT_ACTION_CLOSE_CHANNEL:
  1752.             return ((PU8) GetString(SAT_NEXT_ACTION_CLOSE_CHANNEL_STRING_ID));
  1753.         case SAT_NEXT_ACTION_RECEIVE_DATA:
  1754.             return ((PU8) GetString(SAT_NEXT_ACTION_RECEIVE_DATA_STRING_ID));
  1755.         case SAT_NEXT_ACTION_SEND_DATA:
  1756.             return ((PU8) GetString(SAT_NEXT_ACTION_SEND_DATA_STRING_ID));
  1757.         case SAT_NEXT_ACTION_GET_CHANNEL_STATUS:
  1758.             return ((PU8) GetString(SAT_NEXT_ACTION_GET_CHANNEL_STATUS_STRING_ID));
  1759.         case SAT_NEXT_ACTION_RESERVED_FOR_TIA:
  1760.             return ((PU8) GetString(SAT_NEXT_ACTION_RESERVED_FOR_TIA_STRING_ID));
  1761.         case SAT_NEXT_ACTION_END_SESSION:
  1762.             return ((PU8) GetString(SAT_NEXT_ACTION_END_SESSION_STRING_ID));
  1763.         default:
  1764.             return (NULL);
  1765.     }
  1766. }
  1767. /*****************************************************************************
  1768.  * FUNCTION
  1769.  *  SATAddIconIDToList
  1770.  * DESCRIPTION
  1771.  *  
  1772.  * PARAMETERS
  1773.  *  IconID      [IN]        
  1774.  * RETURNS
  1775.  *  void
  1776.  *****************************************************************************/
  1777. void SATAddIconIDToList(U8 IconID)
  1778. {
  1779.     /*----------------------------------------------------------------*/
  1780.     /* Local Variables                                                */
  1781.     /*----------------------------------------------------------------*/
  1782.     U8 i;
  1783.     /*----------------------------------------------------------------*/
  1784.     /* Code Body                                                      */
  1785.     /*----------------------------------------------------------------*/
  1786.     for (i = 0; i < MAX_ICON_SUPPORT; i++)
  1787.     {
  1788.         if (gSATContext.iconList[i].iconID == IconID)
  1789.         {
  1790.             return;
  1791.         }
  1792.         if (gSATContext.iconList[i].iconID == 0)
  1793.         {
  1794.             gSATContext.iconList[i].iconID = IconID;
  1795.             return;
  1796.         }
  1797.     }
  1798. }
  1799. /*****************************************************************************
  1800.  * FUNCTION
  1801.  *  SATGetIconFromList
  1802.  * DESCRIPTION
  1803.  *  
  1804.  * PARAMETERS
  1805.  *  IconID      [IN]        
  1806.  * RETURNS
  1807.  *  void
  1808.  *****************************************************************************/
  1809. U8 *SATGetIconFromList(U8 IconID)
  1810. {
  1811.     /*----------------------------------------------------------------*/
  1812.     /* Local Variables                                                */
  1813.     /*----------------------------------------------------------------*/
  1814.     U8 i;
  1815.     /*----------------------------------------------------------------*/
  1816.     /* Code Body                                                      */
  1817.     /*----------------------------------------------------------------*/
  1818.     for (i = 0; i < MAX_ICON_SUPPORT; i++)
  1819.     {
  1820.         if (gSATContext.iconList[i].iconID == IconID && gSATContext.iconList[i].gotFromSIM == MMI_TRUE)
  1821.         {
  1822.             gSATContext.isCMDIconSupported = (gSATContext.iconList[i].iconAvailable == MMI_TRUE) ? MMI_TRUE : MMI_FALSE;        /* diamond 2005/05/24 icon */
  1823.             return (gSATContext.iconList[i].iconData);
  1824.         }
  1825.         if (gSATContext.iconList[i].iconID == 0)
  1826.         {
  1827.             return (NULL);
  1828.         }
  1829.     }
  1830.     return (NULL);
  1831. }
  1832. /*****************************************************************************
  1833.  * FUNCTION
  1834.  *  SATCheckAllIconGot
  1835.  * DESCRIPTION
  1836.  *  
  1837.  * PARAMETERS
  1838.  *  void
  1839.  * RETURNS
  1840.  *  void
  1841.  *****************************************************************************/
  1842. MMI_BOOL SATCheckAllIconGot(void)
  1843. {
  1844.     /*----------------------------------------------------------------*/
  1845.     /* Local Variables                                                */
  1846.     /*----------------------------------------------------------------*/
  1847.     U8 i;
  1848.     /*----------------------------------------------------------------*/
  1849.     /* Code Body                                                      */
  1850.     /*----------------------------------------------------------------*/
  1851.     for (i = 0; i < MAX_ICON_SUPPORT; i++)
  1852.     {
  1853.         if (gSATContext.iconList[i].iconID == 0)
  1854.         {
  1855.             return (MMI_TRUE);
  1856.         }
  1857.         if (gSATContext.iconList[i].gotFromSIM != MMI_TRUE)
  1858.         {
  1859.             return (MMI_FALSE);
  1860.         }
  1861.     }
  1862.     return (MMI_TRUE);
  1863. }
  1864. /*****************************************************************************
  1865.  * FUNCTION
  1866.  *  SATClearAllIcons
  1867.  * DESCRIPTION
  1868.  *  
  1869.  * PARAMETERS
  1870.  *  void
  1871.  * RETURNS
  1872.  *  void
  1873.  *****************************************************************************/
  1874. void SATClearAllIcons(void)
  1875. {
  1876.     /*----------------------------------------------------------------*/
  1877.     /* Local Variables                                                */
  1878.     /*----------------------------------------------------------------*/
  1879.     U8 i;
  1880.     /*----------------------------------------------------------------*/
  1881.     /* Code Body                                                      */
  1882.     /*----------------------------------------------------------------*/
  1883.     for (i = 0; i < MAX_ICON_SUPPORT; i++)
  1884.     {
  1885.         if (gSATContext.iconList[i].iconID == 0)
  1886.         {
  1887.             return;
  1888.         }
  1889.         if (gSATContext.iconList[i].gotFromSIM == MMI_TRUE)
  1890.         {
  1891.             if (gSATContext.iconList[i].iconData != NULL)
  1892.             {
  1893.                 if (gSATContext.iconList[i].iconAvailable == MMI_TRUE)  /* diamond, 2005/06/03 icon */
  1894.                 {
  1895.                     OslMfree(gSATContext.iconList[i].iconData);
  1896.                 }
  1897.                 gSATContext.iconList[i].iconData = NULL;
  1898.             }
  1899.             gSATContext.iconList[i].iconID = 0;
  1900.             gSATContext.iconList[i].gotFromSIM = 0;
  1901.             gSATContext.iconList[i].iconAvailable = 0;  /* diamond, 2005/06/03 icon */
  1902.         }
  1903.     }
  1904. }
  1905. /*****************************************************************************
  1906.  * FUNCTION
  1907.  *  SATGetIconDataToList
  1908.  * DESCRIPTION
  1909.  *  
  1910.  * PARAMETERS
  1911.  *  void
  1912.  * RETURNS
  1913.  *  void
  1914.  *****************************************************************************/
  1915. void SATGetIconDataToList(void)
  1916. {
  1917.     /*----------------------------------------------------------------*/
  1918.     /* Local Variables                                                */
  1919.     /*----------------------------------------------------------------*/
  1920.     U8 i;
  1921.     /*----------------------------------------------------------------*/
  1922.     /* Code Body                                                      */
  1923.     /*----------------------------------------------------------------*/
  1924.     for (i = 0; i < MAX_ICON_SUPPORT; i++)
  1925.     {
  1926.         if (gSATContext.iconList[i].iconID == 0)
  1927.         {
  1928.             gSATContext.currGetIconIndex = 0;
  1929.             SATGetIconCompleteCallBack();
  1930.             return;
  1931.         }
  1932.         if (gSATContext.iconList[i].gotFromSIM == MMI_FALSE)
  1933.         {
  1934.             gSATContext.currGetIconIndex = i;
  1935.         #ifdef __SAT_MMI_UNIT_TEST__
  1936.             SendImageDataRecordReq(&EFback1);
  1937.         #else 
  1938.             SendImageLenRecordReq(gSATContext.iconList[i].iconID);
  1939.         #endif 
  1940.             return;
  1941.         }
  1942.     }
  1943. }
  1944. /*****************************************************************************
  1945.  * FUNCTION
  1946.  *  SATGetIconDataCallBack
  1947.  * DESCRIPTION
  1948.  *  
  1949.  * PARAMETERS
  1950.  *  void
  1951.  * RETURNS
  1952.  *  void
  1953.  *****************************************************************************/
  1954. void SATGetIconDataCallBack(void)
  1955. {
  1956.     /*----------------------------------------------------------------*/
  1957.     /* Local Variables                                                */
  1958.     /*----------------------------------------------------------------*/
  1959.     U32 dataSize, totalImageSize, rawBytes;
  1960.     U32 i;   /* diamond, 2006/05/22 Handle the large icon */
  1961.     U8 j, bitPerRasterPoint, currBitIndex, bitMask, bitMask1, bitMask2, CLUTIndex;
  1962.     PU8 dataPointer, currColorImgByte;
  1963.     U16 c_black, c_white, pixData;
  1964.     /*----------------------------------------------------------------*/
  1965.     /* Code Body                                                      */
  1966.     /*----------------------------------------------------------------*/
  1967.     gSATContext.iconList[gSATContext.currGetIconIndex].gotFromSIM = MMI_TRUE;
  1968.     if (gSATImageRecord.noOfImages && (gSATImageRecord.imageData != NULL))
  1969.     {
  1970.         totalImageSize = (U32) (gSATImageRecord.imageInst->width * gSATImageRecord.imageInst->height * 2 + 19);
  1971.         /* diamond, 2005/05/24, If the icon is too large to allocate memory, the icon will be ignored. */
  1972.         gSATContext.iconList[gSATContext.currGetIconIndex].iconData = NULL;
  1973.         if (totalImageSize <= 2048 &&   /* the max size of OslMalloc */
  1974.             gSATImageRecord.imageInst->width == gSATImageRecord.imageData[0] &&
  1975.             gSATImageRecord.imageInst->height == gSATImageRecord.imageData[1])
  1976.         {
  1977.             gSATContext.iconList[gSATContext.currGetIconIndex].iconAvailable = MMI_TRUE;
  1978.             /* end, diamond */
  1979.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData = (U8*) OslMalloc(totalImageSize * sizeof(U8));
  1980.             memset(gSATContext.iconList[gSATContext.currGetIconIndex].iconData, 0, totalImageSize * sizeof(U8));
  1981.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData[0] = 4 /* IMAGE_TYPE_DEVICE_BITMAP */ ;
  1982.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData[1] = 0;
  1983.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData[2] = (U8) ((totalImageSize - 6) & 0x000000ff);
  1984.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData[3] =
  1985.                 (U8) (((totalImageSize - 6) >> 8) & 0x000000ff);
  1986.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData[4] =
  1987.                 (U8) (((totalImageSize - 6) >> 16) & 0x000000ff);
  1988.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData[5] =
  1989.                 (U8) (((totalImageSize - 6) >> 24) & 0x000000ff);
  1990.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData[6] = gSATImageRecord.imageInst->width;
  1991.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData[10] = gSATImageRecord.imageInst->height;
  1992.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData[14] = 0x10;
  1993.             rawBytes = (U32) (gSATImageRecord.imageInst->width * 2);
  1994.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData[15] = (U8) (rawBytes & 0x000000ff);
  1995.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData[16] = (U8) ((rawBytes >> 8) & 0x000000ff);
  1996.             dataPointer = gSATContext.iconList[gSATContext.currGetIconIndex].iconData + 19;
  1997.             dataSize = (U32) gSATImageRecord.imageInst->width * (U32) gSATImageRecord.imageInst->height;
  1998.             if (gSATImageRecord.imageInst->coding == SAT_BASIC_IMAGE)
  1999.             {
  2000.                 c_white = gdi_act_color_from_rgb(255, 255, 255, 255);   /* GDI_RGB_TO_BUFFER_FORMAT(255,255,255); */
  2001.                 c_black = gdi_act_color_from_rgb(255, 0, 0, 0); /* GDI_RGB_TO_BUFFER_FORMAT(0,0,0); */
  2002.                 for (i = 0; i < dataSize; i++)
  2003.                 {
  2004.                     pixData = (*(gSATImageRecord.imageData + 2 + i / 8) >> (7 - (i % 8))) & 0x01 ? c_black : c_white;
  2005.                     *(dataPointer + 2 * i) = (U8) (pixData & 0x00ff);
  2006.                     *(dataPointer + 2 * i + 1) = (U8) ((pixData >> 8) & 0x00ff);
  2007.                 }
  2008.             }
  2009.             else if (gSATImageRecord.imageInst->coding == SAT_COLORR_IMAGE)
  2010.             {
  2011.                 bitPerRasterPoint = (U8) * (gSATImageRecord.imageData + 2);
  2012.                 currBitIndex = 0;
  2013.                 currColorImgByte = gSATImageRecord.imageData + 6;
  2014.                 bitMask = 0x01;
  2015.                 for (i = 0; i < bitPerRasterPoint; i++)
  2016.                 {
  2017.                     bitMask = 2 * bitMask;
  2018.                 }
  2019.                 bitMask = bitMask - 1;
  2020.                 for (i = 0; i < dataSize; i++)
  2021.                 {
  2022.                     if ((currBitIndex + bitPerRasterPoint) < 8)
  2023.                     {
  2024.                         CLUTIndex = ((*currColorImgByte) >> (8 - currBitIndex - bitPerRasterPoint)) & bitMask;
  2025.                         currBitIndex = currBitIndex + bitPerRasterPoint;
  2026.                     }
  2027.                     else
  2028.                     {
  2029.                         bitMask1 = 0x01;
  2030.                         for (j = 0; j < 8 - currBitIndex; j++)
  2031.                         {
  2032.                             bitMask1 = 2 * bitMask1;
  2033.                         }
  2034.                         bitMask1 = bitMask1 - 1;
  2035.                         if ((8 - bitPerRasterPoint - currBitIndex) == 0)
  2036.                         {
  2037.                             CLUTIndex = (*currColorImgByte) & bitMask1;
  2038.                         }
  2039.                         else
  2040.                         {
  2041.                             bitMask2 = 0x01;
  2042.                             for (j = 0; j < bitPerRasterPoint + currBitIndex - 8; j++)
  2043.                             {
  2044.                                 bitMask2 = 2 * bitMask2;
  2045.                             }
  2046.                             bitMask2 = bitMask2 - 1;
  2047.                             CLUTIndex = ((*currColorImgByte) & bitMask1) +
  2048.                                 (((*currColorImgByte + 1) >> (8 - (bitPerRasterPoint + currBitIndex - 8))) & bitMask2);
  2049.                         }
  2050.                         currColorImgByte++;
  2051.                         currBitIndex = (currBitIndex + bitPerRasterPoint) % 8;
  2052.                     }
  2053.                     //pixData = GDI_RGB_TO_BUFFER_FORMAT( gSATImageRecord.CLUTData[CLUTIndex].red, 
  2054.                     //                                       gSATImageRecord.CLUTData[CLUTIndex].green,
  2055.                     //                                       gSATImageRecord.CLUTData[CLUTIndex].blue);
  2056.                     pixData = gdi_act_color_from_rgb(
  2057.                                 255,
  2058.                                 gSATImageRecord.CLUTData[CLUTIndex].red,
  2059.                                 gSATImageRecord.CLUTData[CLUTIndex].green,
  2060.                                 gSATImageRecord.CLUTData[CLUTIndex].blue);
  2061.                     *(dataPointer + 2 * i) = (U8) (pixData & 0x00ff);
  2062.                     *(dataPointer + 2 * i + 1) = (U8) ((pixData >> 8) & 0x00ff);
  2063.                 }
  2064.             }
  2065.         }
  2066.         /* diamond, 2005/05/24 icon */
  2067.         else
  2068.         {
  2069.             gSATContext.iconList[gSATContext.currGetIconIndex].iconAvailable = MMI_FALSE;
  2070.             gSATContext.iconList[gSATContext.currGetIconIndex].iconData = NULL; /* (PU8)GetImage(IMG_GLOBAL_DEFAULT); */
  2071.         }
  2072.         /* end, diamond */
  2073.     }
  2074.     else
  2075.     {
  2076.         /* diamond, 2006/05/22 Prevent from getting icon image unsuccessfully */
  2077.         gSATContext.iconList[gSATContext.currGetIconIndex].iconAvailable = MMI_FALSE;
  2078.         gSATContext.iconList[gSATContext.currGetIconIndex].iconData = NULL;
  2079.     }
  2080.     gSATImageRecord.iconId = 0;
  2081.     gSATImageRecord.noOfImages = 0;
  2082.     gSATImageRecord.noOfCLUT = 0;
  2083.     gSATImageRecord.locOfCLUT = 0;
  2084.     if (gSATImageRecord.imageInst != NULL)
  2085.     {
  2086.         OslMfree(gSATImageRecord.imageInst);
  2087.         gSATImageRecord.imageInst = NULL;
  2088.     }
  2089.     if (gSATImageRecord.imageData != NULL)
  2090.     {
  2091.         OslMfree(gSATImageRecord.imageData);
  2092.         gSATImageRecord.imageData = NULL;
  2093.     }
  2094.     gSATImageRecord.CLUTData = NULL;
  2095.     SATGetIconDataToList();
  2096. }
  2097. /*****************************************************************************
  2098.  * FUNCTION
  2099.  *  SendTerminalResponseSetupMenu
  2100.  * DESCRIPTION
  2101.  *  Sends SETUP MENU REQ to L4
  2102.  * PARAMETERS
  2103.  *  res             [IN]        
  2104.  *  cmdDetail       [?]         
  2105.  * RETURNS
  2106.  *  void
  2107.  *****************************************************************************/
  2108. void SendTerminalResponseSetupMenu(U8 res, U8 *cmdDetail)
  2109. {
  2110.     /*----------------------------------------------------------------*/
  2111.     /* Local Variables                                                */
  2112.     /*----------------------------------------------------------------*/
  2113.     MYQUEUE *Message;
  2114.     mmi_sat_setup_menu_res_req_struct *dataPtr;
  2115.     /*----------------------------------------------------------------*/
  2116.     /* Code Body                                                      */
  2117.     /*----------------------------------------------------------------*/
  2118.     Message = ALLOCATE_ITM(MOD_MMI);
  2119.     Message->oslSrcId = MOD_MMI;
  2120.     Message->oslDestId = MOD_L4C;
  2121.     Message->oslMsgId = PRT_MMI_SAT_SETUP_MENU_RES_REQ;
  2122.     dataPtr = (mmi_sat_setup_menu_res_req_struct*) OslConstructDataPtr(sizeof(mmi_sat_setup_menu_res_req_struct));
  2123.     memcpy(dataPtr->cmd_detail, (void*)cmdDetail, 5 * sizeof(U8));
  2124.     dataPtr->res = res;
  2125.     Message->oslDataPtr = (oslParaType*) dataPtr;
  2126.     Message->oslPeerBuffPtr = NULL;
  2127.     SEND_MSG(Message);
  2128.     gSATContext.lastSATCmd = SAT_NONE_CMD;
  2129.     if (gSATContext.isInSATMenu)
  2130.     {
  2131.         SATPleaseWaitScreen(SAT_WAIT_STRING_ID, SAT_WAIT_IMAGE_ID);
  2132.     }
  2133. }
  2134. /*****************************************************************************
  2135.  * FUNCTION
  2136.  *  SATSetupMenuRsp
  2137.  * DESCRIPTION
  2138.  *  Protocol Handler for SETUP MENU RES
  2139.  * PARAMETERS
  2140.  *  msgPtr      [IN]        Pointer to data from L4
  2141.  * RETURNS
  2142.  *  void
  2143.  *****************************************************************************/
  2144. void SATSetupMenuRsp(void *msgPtr)
  2145. {
  2146.     /*----------------------------------------------------------------*/
  2147.     /* Local Variables                                                */
  2148.     /*----------------------------------------------------------------*/
  2149.     mmi_sat_setup_menu_res_rsp_struct *setupMenuRes;
  2150.     /*----------------------------------------------------------------*/
  2151.     /* Code Body                                                      */
  2152.     /*----------------------------------------------------------------*/
  2153.     setupMenuRes = (mmi_sat_setup_menu_res_rsp_struct*) msgPtr;
  2154.     if (setupMenuRes->result == MMI_TRUE)
  2155.     {
  2156.         if (gSATContext.isInSATMenu)
  2157.         {
  2158.             SATStopWaitTimer();
  2159.             DeleteScreenIfPresent(SCR_ID_SAT_HISTORY);
  2160.             if (GetExitScrnID() == SCR_ID_SAT_HISTORY)
  2161.             {
  2162.                 ClearExitHandler();
  2163.             }
  2164.             GoToSATMainMenu();
  2165.         }
  2166.         if (GetActiveScreenId() == SERVICES_MAIN_MENU_SCREEN_ID)
  2167.         {
  2168.             GoToServicesMenu();
  2169.             DeleteScreenIfPresent(SERVICES_MAIN_MENU_SCREEN_ID);
  2170.         }
  2171.     }
  2172. }
  2173. /*****************************************************************************
  2174.  * FUNCTION
  2175.  *  SimBusyPleaseWait
  2176.  * DESCRIPTION
  2177.  *  Display SIM busy screen
  2178.  * PARAMETERS
  2179.  *  void
  2180.  * RETURNS
  2181.  *  void
  2182.  *****************************************************************************/
  2183. void SimBusyPleaseWait(void)
  2184. {
  2185.     /*----------------------------------------------------------------*/
  2186.     /* Local Variables                                                */
  2187.     /*----------------------------------------------------------------*/
  2188.     /*----------------------------------------------------------------*/
  2189.     /* Code Body                                                      */
  2190.     /*----------------------------------------------------------------*/
  2191.     //micha0714
  2192.     //      gSATMainMenu.isSentRsp = 1;
  2193.     DisplayPopup((U8*) GetString(SAT_WAIT_STRING_ID), IMG_GLOBAL_UNFINISHED, 1, SSC_POP_UP_TIME, (U8) ERROR_TONE);
  2194.     /* SATPleaseWaitScreen(SAT_WAIT_STRING_ID, SAT_WAIT_IMAGE_ID); */
  2195. }
  2196. /*****************************************************************************
  2197.  * FUNCTION
  2198.  *  GoToSATMainMenu
  2199.  * DESCRIPTION
  2200.  *  Displays SAT Main Menu
  2201.  * PARAMETERS
  2202.  *  void
  2203.  * RETURNS
  2204.  *  void
  2205.  *****************************************************************************/
  2206. void GoToSATMainMenu(void)
  2207. {
  2208.     /*----------------------------------------------------------------*/
  2209.     /* Local Variables                                                */
  2210.     /*----------------------------------------------------------------*/
  2211.     U8 *listItems[64];
  2212.     U8 *listItemsIcons[64];
  2213.     U8 *listNextAction[64];
  2214.     U16 i;
  2215.     /*----------------------------------------------------------------*/
  2216.     /* Code Body                                                      */
  2217.     /*----------------------------------------------------------------*/
  2218.     memset(listItems, 0, sizeof(listItems));
  2219.     memset(listItemsIcons, 0, sizeof(listItemsIcons));
  2220.     memset(listNextAction, 0, sizeof(listNextAction));
  2221.     if (gSATMainMenu.isIconAvailable)
  2222.     {
  2223.         SATAddIconIDToList(gSATMainMenu.IconID);
  2224.     }
  2225.     for (i = 0; i < gSATMainMenu.noItemIconIdList; i++)
  2226.     {
  2227.         SATAddIconIDToList(gSATMainMenu.menuItems[i].IconID);
  2228.     }
  2229.     if (gSATMainMenu.isIconAvailable || gSATMainMenu.noItemIconIdList)
  2230.     {
  2231.         if (!SATCheckAllIconGot())
  2232.         {
  2233.             SATGetIconCompleteCallBack = GoToSATMainMenu;
  2234.             SATGetIconDataToList();
  2235.             return;
  2236.         }
  2237.     }
  2238.     for (i = 0; i < gSATMainMenu.numOfItem; i++)
  2239.     {
  2240.         listItems[i] = gSATMainMenu.menuItems[i].itemData;
  2241.         if (gSATMainMenu.noItemIconIdList)
  2242.         {
  2243.             listItemsIcons[i] = SATGetIconFromList(gSATMainMenu.menuItems[i].IconID);
  2244.         }
  2245.         if (gSATMainMenu.noNextActionIndList)
  2246.         {
  2247.             listNextAction[i] = SATReturnNextAction(gSATMainMenu.menuItems[i].nextAction);
  2248.         }
  2249.         /* diamond, 2006/05/22 Prevent from getting icon image unsuccessfully */
  2250.         if (gSATMainMenu.noItemIconIdList != 0 && gSATMainMenu.itemIconListAttr == SAT_ICON_SELF_EX &&
  2251.             listItemsIcons[i] != NULL)
  2252.         {
  2253.             listItems[i] = NULL;
  2254.         }
  2255.     }
  2256.     if (!gSATContext.isSATPresent)
  2257.     {
  2258.         DeleteScreenIfPresent(SCR_ID_SAT_MAINMENU);
  2259.         ExitSATMainMenu();
  2260.         return;
  2261.     }
  2262.     gSATContext.exitCondition = &gSATMainMenu.isSentRsp;
  2263.     EntryNewScreen(SCR_ID_SAT_MAINMENU, SATGenericExitHandler, NULL, NULL);
  2264.     gSATContext.historyFuncPtr = GoToSATMainMenu;
  2265.     SetIsInSATScreen();
  2266.     gSATMainMenu.isSentRsp = 0;
  2267.     RegisterHighlightHandler(SATMenuIndex);
  2268.     ShowCategory174Screen(
  2269.         gSATMainMenu.alphaId,
  2270.         SATGetIconFromList(gSATMainMenu.IconID),
  2271.         (PU8) GetString(STR_GLOBAL_OK),
  2272.         (PU8) GetImage(IMG_GLOBAL_OK),
  2273.         (PU8) GetString(STR_GLOBAL_BACK),
  2274.         (PU8) GetImage(IMG_GLOBAL_BACK),
  2275.         gSATMainMenu.numOfItem,
  2276.         listItems,
  2277.         /* listItemsIcons,listNextAction,0,0,gSATContext.guiBufferPointer); */ listItemsIcons,
  2278.         listNextAction,
  2279.         0,
  2280.         gSATMainMenu.selectedMenuItem,
  2281.         gSATContext.guiBufferPointer);
  2282.     SetKeyHandler(ExitSATToIdle, KEY_END, KEY_EVENT_DOWN);
  2283.     SATCompletePreviousTransaction();
  2284.     /* micha0328 */
  2285.     if (gSATMainMenu.isHelpInfoAvailable)
  2286.     {
  2287.         SetKeyHandler(EnvelopeSetupMenuHelp, KEY_SEND, KEY_EVENT_UP);
  2288.     }
  2289.     if (gSATContext.gotStage1Rsp)
  2290.     {
  2291.         SetLeftSoftkeyFunction(EnvelopeSetupMenuOK, KEY_EVENT_UP);
  2292.         SetRightSoftkeyFunction(ExitSATMainMenu, KEY_EVENT_UP);
  2293.         SetKeyHandler(EnvelopeSetupMenuOK, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2294.         SetKeyHandler(ExitSATMainMenu, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2295.     }
  2296.     else
  2297.     {
  2298.         SetLeftSoftkeyFunction(SimBusyPleaseWait, KEY_EVENT_UP);
  2299.         SetRightSoftkeyFunction(ExitSATMainMenu, KEY_EVENT_UP);
  2300.         SetKeyHandler(SimBusyPleaseWait, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  2301.         SetKeyHandler(ExitSATMainMenu, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  2302.     }
  2303.     gSATContext.isInSATMenu = 1;
  2304. }
  2305. /*****************************************************************************
  2306.  * FUNCTION
  2307.  *  SATCompletePreviousTransaction
  2308.  * DESCRIPTION
  2309.  *  Prevent screen delete by others
  2310.  * PARAMETERS
  2311.  *  void
  2312.  * RETURNS
  2313.  *  void
  2314.  *****************************************************************************/
  2315. void SATCompletePreviousTransaction(void)
  2316. {
  2317.     /*----------------------------------------------------------------*/
  2318.     /* Local Variables                                                */
  2319.     /*----------------------------------------------------------------*/
  2320.     /*----------------------------------------------------------------*/
  2321.     /* Code Body                                                      */
  2322.     /*----------------------------------------------------------------*/
  2323.     switch (gSATContext.lastSATCmd)
  2324.     {
  2325.         case SAT_SELECT_ITEM_CMD:
  2326.             TerminalResponseSelectItem(SAT_PROACTIVE_CMD_TERMINATED_BY_USER, 0, gSATSubMenu.cmdDetail);
  2327.             break;
  2328.         case SAT_DISPLAY_TEXT_CMD:
  2329.             TerminalResponseDisplayText(SAT_PROACTIVE_CMD_TERMINATED_BY_USER, gSATDisplayText.cmdDetail);
  2330.             break;
  2331.         case SAT_GET_INPUT:
  2332.             TerminalResponseGetInput(SAT_PROACTIVE_CMD_TERMINATED_BY_USER, gSATGetInput.cmdDetail);
  2333.             break;
  2334.         case SAT_GET_INKEY:
  2335.             TerminalResponseGetInkey(SAT_PROACTIVE_CMD_TERMINATED_BY_USER, 0, gSATGetInkey.cmdDetail);
  2336.             break;
  2337.         case SAT_CALL_SETUP_CMD:
  2338.             TerminalResponseCallSetup(SAT_PROACTIVE_CMD_TERMINATED_BY_USER, 0, gSATCallSetup.cmdDetail);        /* Avoid re-try by SIM */
  2339.             break;
  2340.             //              case SAT_SEND_SMS_CMD:
  2341.             //                      TerminalResponseSendSMS(SAT_ME_CURRENTLY_UNABLE_TO_PROCESS_CMD, 0, gSATSendSMS.cmdDetail);
  2342.             //              break;
  2343.         case SAT_PLAY_TONE_CMD:
  2344.             TerminalResponsePlayTone(SAT_ME_CURRENTLY_UNABLE_TO_PROCESS_CMD, gSATPlayTone.cmdDetail);
  2345.             break;
  2346.         case SAT_LAUNCH_BROWSER_CMD:
  2347.             TerminalResponseLaunchBrowser(SAT_ME_CURRENTLY_UNABLE_TO_PROCESS_CMD, 0, gSATLaunchBrowser.cmdDetail);
  2348.             break;
  2349.         case SAT_SEND_DTMF_CMD:
  2350.             TerminalResponseSendDTMF(SAT_ME_CURRENTLY_UNABLE_TO_PROCESS_CMD, 0, gSATSendDTMF.cmdDetail);
  2351.             break;
  2352.         case SAT_SEND_SS_CMD:
  2353.             TerminalResponseSendSS(SAT_ME_CURRENTLY_UNABLE_TO_PROCESS_CMD, 0, NULL, gSATSendSS.cmdDetail);
  2354.             break;
  2355.             //              case SAT_SEND_USSD_CMD:
  2356.             //                      TerminalResponseSendUSSD(SAT_ME_CURRENTLY_UNABLE_TO_PROCESS_CMD, 0,NULL,gSATSendUSSD.cmdDetail);
  2357.             //              break;
  2358.     }
  2359. }
  2360. /*****************************************************************************
  2361.  * FUNCTION
  2362.  *  ExitSATMainMenu
  2363.  * DESCRIPTION
  2364.  *  Exit Handler for SAT Main Menu
  2365.  * PARAMETERS
  2366.  *  void
  2367.  * RETURNS
  2368.  *  void
  2369.  *****************************************************************************/
  2370. void ExitSATMainMenu(void)
  2371. {
  2372.     /*----------------------------------------------------------------*/
  2373.     /* Local Variables                                                */
  2374.     /*----------------------------------------------------------------*/
  2375.     /*----------------------------------------------------------------*/
  2376.     /* Code Body                                                      */
  2377.     /*----------------------------------------------------------------*/
  2378.     ExitVariables();
  2379.     GoBackHistory();
  2380. }
  2381. /*****************************************************************************
  2382.  * FUNCTION
  2383.  *  FreeMainMenu
  2384.  * DESCRIPTION
  2385.  *  Frees memory of various elements of SATSETUPMENU struct
  2386.  * PARAMETERS
  2387.  *  mainMenu        [IN]        Pointer to SATSETUPMENU struct to be freed
  2388.  * RETURNS
  2389.  *  void
  2390.  *****************************************************************************/
  2391. void FreeMainMenu(SATSETUPMENU *mainMenu)
  2392. {
  2393.     /*----------------------------------------------------------------*/
  2394.     /* Local Variables                                                */
  2395.     /*----------------------------------------------------------------*/
  2396.     U8 i;
  2397.     /*----------------------------------------------------------------*/
  2398.     /* Code Body                                                      */
  2399.     /*----------------------------------------------------------------*/
  2400.     SATClearAllIcons();
  2401.     for (i = 0; i < mainMenu->numOfItem; i++)
  2402.     {
  2403.         /* micha1008 */
  2404.         if (mainMenu->menuItems[i].itemData)
  2405.         {
  2406.             OslMfree(mainMenu->menuItems[i].itemData);
  2407.         }
  2408.         mainMenu->menuItems[i].itemData = NULL;
  2409.         mainMenu->menuItems[i].itemLen = 0;
  2410.     }
  2411.     mainMenu->numOfItem = 0;
  2412.     if (mainMenu->menuItems != NULL)
  2413.     {
  2414.         OslMfree(mainMenu->menuItems);
  2415.         mainMenu->menuItems = NULL;
  2416.     }
  2417.     /* micha1008 */
  2418.     if (mainMenu->alphaId)
  2419.     {
  2420.         OslMfree(mainMenu->alphaId);
  2421.     }
  2422.     mainMenu->alphaId = NULL;
  2423.     mainMenu->alphaIdLen = 0;
  2424. #ifdef __USAT__
  2425.     if (mainMenu.textFormatting)
  2426.     {
  2427.         OslMfree(mainMenu.textFormatting);
  2428.     }
  2429.     mainMenu.noTextAttribute = 0;
  2430.     mainMenu.textFormatting = NULL;
  2431. #endif /* __USAT__ */ 
  2432. }
  2433. /*****************************************************************************
  2434.  * FUNCTION
  2435.  *  SATMenuIndex
  2436.  * DESCRIPTION
  2437.  *  Highlight Handler for various menus in SAT
  2438.  * PARAMETERS
  2439.  *  index       [IN]        Index of item highlighted
  2440.  * RETURNS
  2441.  *  void
  2442.  *****************************************************************************/
  2443. void SATMenuIndex(S32 index)
  2444. {
  2445.     /*----------------------------------------------------------------*/
  2446.     /* Local Variables                                                */
  2447.     /*----------------------------------------------------------------*/
  2448.     /*----------------------------------------------------------------*/
  2449.     /* Code Body                                                      */
  2450.     /*----------------------------------------------------------------*/
  2451.     gSATContext.highlightedIndex = (U8) index;
  2452.     /* diamond, 2006/03/22 record the last selected item for backward move to SAT main menu */
  2453.     if (gSATContext.historyFuncPtr == GoToSATMainMenu)
  2454.     {
  2455.         gSATMainMenu.selectedMenuItem = gSATContext.highlightedIndex;
  2456.     }
  2457. }
  2458. /*****************************************************************************
  2459.  * FUNCTION
  2460.  *  EnvelopeSetupMenuOK
  2461.  * DESCRIPTION
  2462.  *  Key Handler for LSK of Main Menu
  2463.  * PARAMETERS
  2464.  *  void
  2465.  *  index(?)        [IN]        Index of item highlighted
  2466.  * RETURNS
  2467.  *  void
  2468.  *****************************************************************************/
  2469. void EnvelopeSetupMenuOK()
  2470. {
  2471.     /*----------------------------------------------------------------*/
  2472.     /* Local Variables                                                */
  2473.     /*----------------------------------------------------------------*/
  2474.     /*----------------------------------------------------------------*/
  2475.     /* Code Body                                                      */
  2476.     /*----------------------------------------------------------------*/
  2477.     if (!gSATContext.gotStage1Rsp)
  2478.     {
  2479.         /* prevent from entry SAT screen first then get SEND SMS indication */
  2480.         SimBusyPleaseWait();
  2481.         return;
  2482.     }
  2483.     EnvelopeSetupMenu(gSATMainMenu.menuItems[gSATContext.highlightedIndex].itemId, FALSE);
  2484.     SATPleaseWaitScreen(SAT_WAIT_STRING_ID, SAT_WAIT_IMAGE_ID);
  2485. }
  2486. /*****************************************************************************
  2487.  * FUNCTION
  2488.  *  EnvelopeSetupMenuHelp
  2489.  * DESCRIPTION
  2490.  *  Key Handler for Hotkey of Main Menu
  2491.  * PARAMETERS
  2492.  *  void
  2493.  *  index(?)        [IN]        Index of item highlighted
  2494.  * RETURNS
  2495.  *  void
  2496.  *****************************************************************************/
  2497. void EnvelopeSetupMenuHelp(void)
  2498. {
  2499.     /*----------------------------------------------------------------*/
  2500.     /* Local Variables                                                */
  2501.     /*----------------------------------------------------------------*/
  2502.     /*----------------------------------------------------------------*/
  2503.     /* Code Body                                                      */
  2504.     /*----------------------------------------------------------------*/
  2505.     EnvelopeSetupMenu(gSATMainMenu.menuItems[gSATContext.highlightedIndex].itemId, TRUE);
  2506.     SATPleaseWaitScreen(SAT_WAIT_STRING_ID, SAT_WAIT_IMAGE_ID);
  2507. }
  2508. /*****************************************************************************
  2509.  * FUNCTION
  2510.  *  EnvelopeSetupMenu
  2511.  * DESCRIPTION
  2512.  *  Sends ENVELOPE MENU SELECT to L4
  2513.  * PARAMETERS
  2514.  *  itemId                  [IN]        Item id of selcted item
  2515.  *  isHelpInfoRequested     [IN]        Is help Rquested (TRUE/FALSE)
  2516.  * RETURNS
  2517.  *  void
  2518.  *****************************************************************************/
  2519. void EnvelopeSetupMenu(U8 itemId, U8 isHelpInfoRequested)
  2520. {
  2521.     /*----------------------------------------------------------------*/
  2522.     /* Local Variables                                                */
  2523.     /*----------------------------------------------------------------*/
  2524.     MYQUEUE *Message;
  2525.     mmi_sat_menu_select_req_struct *dataPtr;
  2526.     /*----------------------------------------------------------------*/
  2527.     /* Code Body                                                      */
  2528.     /*----------------------------------------------------------------*/
  2529.     /* micha0216 */
  2530.     gSATContext.gotStage1Rsp = 0;
  2531.     gSATMainMenu.isSentRsp = 1;
  2532.     Message = ALLOCATE_ITM(MOD_MMI);
  2533.     Message->oslSrcId = MOD_MMI;
  2534.     Message->oslDestId = MOD_L4C;
  2535.     Message->oslMsgId = PRT_MMI_SAT_MENU_SELECT_REQ;
  2536.     dataPtr = (mmi_sat_menu_select_req_struct*) OslConstructDataPtr(sizeof(mmi_sat_menu_select_req_struct));
  2537.     dataPtr->item_id = itemId;
  2538.     dataPtr->is_help_info_requested = isHelpInfoRequested;
  2539.     Message->oslDataPtr = (oslParaType*) dataPtr;
  2540.     Message->oslPeerBuffPtr = NULL;
  2541.     SEND_MSG(Message);
  2542.     gSATContext.lastSATCmd = SAT_NONE_CMD;
  2543. }
  2544. /* micha0216 */
  2545. /*****************************************************************************
  2546.  * FUNCTION
  2547.  *  SATMenuSelectRsp
  2548.  * DESCRIPTION
  2549.  *  Protocol Handler for menu select
  2550.  * PARAMETERS
  2551.  *  msgPtr      [IN]        Pointer to data from L4
  2552.  * RETURNS
  2553.  *  void
  2554.  *****************************************************************************/
  2555. void SATMenuSelectRsp(void *msgPtr)
  2556. {
  2557.     /*----------------------------------------------------------------*/
  2558.     /* Local Variables                                                */
  2559.     /*----------------------------------------------------------------*/
  2560.     /*----------------------------------------------------------------*/
  2561.     /* Code Body                                                      */
  2562.     /*----------------------------------------------------------------*/
  2563.     gSATContext.gotStage1Rsp = 1;
  2564. }
  2565. /*****************************************************************************
  2566.  * FUNCTION
  2567.  *  SATSelectItemInd
  2568.  * DESCRIPTION
  2569.  *  Protocol Handler for SELECT ITEM IND
  2570.  * PARAMETERS
  2571.  *  msgPtr      [IN]        Pointer to data from L4
  2572.  * RETURNS
  2573.  *  void
  2574.  *****************************************************************************/
  2575. void SATSelectItemInd(void *msgPtr)
  2576. {
  2577.     /*----------------------------------------------------------------*/
  2578.     /* Local Variables                                                */
  2579.     /*----------------------------------------------------------------*/
  2580.     U8 i;
  2581.     U8 *tempDataPtr;
  2582.     SATMENUITEM *menuItem;
  2583.     mmi_sat_select_item_ind_struct *selectItem;
  2584.     U16 convertLen;
  2585.     /*----------------------------------------------------------------*/
  2586.     /* Code Body                                                      */
  2587.     /*----------------------------------------------------------------*/
  2588.     selectItem = (mmi_sat_select_item_ind_struct*) msgPtr;
  2589.     FreeSubMenu();
  2590.     gSATContext.lastSATCmd = SAT_SELECT_ITEM_CMD;
  2591.     gSATContext.guiBufferPointer = NULL;
  2592.     gSATSubMenu.isSentRsp = 0;
  2593.     if (GetCurrentState() == CM_OUTGOING_STATE || GetCurrentState() == CM_INCOMING_STATE)
  2594.     {
  2595.         TerminalResponseSelectItem(SAT_ME_CURRENTLY_UNABLE_TO_PROCESS_CMD, 0, selectItem->cmd_detail);
  2596.         return;
  2597.     }
  2598. #ifdef __FLIGHT_MODE_SUPPORT__
  2599.     if (mmi_bootup_get_active_flight_mode() == 1)
  2600.     {
  2601.         TerminalResponseSelectItem(SAT_ME_CURRENTLY_UNABLE_TO_PROCESS_CMD, 0, selectItem->cmd_detail);
  2602.         return;
  2603.     }
  2604. #endif /* __FLIGHT_MODE_SUPPORT__ */ 
  2605.     gSATSubMenu.isHelpInfoAvailable = selectItem->is_help_info_available;
  2606.     memcpy(gSATSubMenu.cmdDetail, selectItem->cmd_detail, 5 * sizeof(U8));
  2607.     gSATSubMenu.numOfItem = selectItem->num_of_item;
  2608. #ifdef __SAT_MMI_UNIT_TEST__
  2609.     gSATSubMenu.isIconAvailable = 1;
  2610.     if (gSATSubMenu.isIconAvailable)
  2611.     {
  2612.         gSATSubMenu.IconID = 1;
  2613.         gSATSubMenu.iconAttr = SAT_ICON_NOT_SELF_EX;
  2614.     }
  2615.     gSATSubMenu.noItemIconIdList = 1;
  2616.     gSATSubMenu.itemIconListAttr = 1;
  2617.     gSATSubMenu.noNextActionIndList = 1;
  2618.     gSATSubMenu.dcsOfAlphaId = selectItem->dcs_of_alpha_id;
  2619.     if (gSATSubMenu.isIconAvailable && gSATSubMenu.iconAttr == SAT_ICON_SELF_EX)
  2620.     {
  2621.         gSATSubMenu.alphaIdLen = 0;
  2622.         gSATSubMenu.alphaId = NULL;
  2623.     }
  2624.     else
  2625.     {
  2626.         gSATSubMenu.alphaIdLen = selectItem->no_alpha_id;
  2627.         gSATSubMenu.alphaId = CovertStringForPlatform(
  2628.                                 selectItem->alpha_id,
  2629.                                 gSATSubMenu.alphaIdLen,
  2630.                                 gSATSubMenu.dcsOfAlphaId,
  2631.                                 &gSATSubMenu.alphaIdLen);
  2632.     }
  2633. #else /* __SAT_MMI_UNIT_TEST__ */ 
  2634.     gSATSubMenu.isIconAvailable = selectItem->is_icon_available;
  2635.     if (gSATSubMenu.isIconAvailable)
  2636.     {
  2637.         gSATSubMenu.IconID = selectItem->icon_info.icon_id;
  2638.         gSATSubMenu.iconAttr = selectItem->icon_info.icon_attr;
  2639.     }
  2640.     gSATSubMenu.noItemIconIdList = selectItem->no_item_icon_id_list;
  2641.     gSATSubMenu.itemIconListAttr = selectItem->item_icon_list_attr;
  2642.     gSATSubMenu.noNextActionIndList = selectItem->no_next_action_ind_list;
  2643.     gSATSubMenu.dcsOfAlphaId = selectItem->dcs_of_alpha_id;
  2644.     if (gSATSubMenu.isIconAvailable && gSATSubMenu.iconAttr == SAT_ICON_SELF_EX)
  2645.     {
  2646.         gSATSubMenu.alphaIdLen = 0;
  2647.         gSATSubMenu.alphaId = NULL;
  2648.     }
  2649.     else
  2650.     {
  2651.         gSATSubMenu.alphaIdLen = selectItem->no_alpha_id;
  2652.         gSATSubMenu.alphaId = CovertStringForPlatform(
  2653.                                 selectItem->alpha_id,
  2654.                                 gSATSubMenu.alphaIdLen,
  2655.                                 gSATSubMenu.dcsOfAlphaId,
  2656.                                 &gSATSubMenu.alphaIdLen);
  2657.     }
  2658. #endif /* __SAT_MMI_UNIT_TEST__ */ 
  2659. #ifdef __USAT__
  2660.     gSATMainMenu.noTextAttribute = selectItem->no_text_attribute;
  2661.     if (gSATMainMenu.noTextAttribute != 0)
  2662.     {
  2663.         gSATMainMenu.textFormatting = OslMalloc(gSATMainMenu.noTextAttribute * 4);
  2664.         memcpy(gSATMainMenu.textFormatting, selectItem->text_formatting, gSATMainMenu.noTextAttribute * 4);
  2665.     }
  2666. #endif /* __USAT__ */ 
  2667.     if (gSATSubMenu.numOfItem == 0)
  2668.     {
  2669.         SelectItemWrongData();
  2670.         return;
  2671.     }
  2672.     if (gSATSubMenu.numOfItem > 0)
  2673.     {
  2674.         gSATSubMenu.menuItems = OslMalloc(gSATSubMenu.numOfItem * sizeof(SATMENUITEM));
  2675.         memset(gSATSubMenu.menuItems, 0, gSATSubMenu.numOfItem * sizeof(SATMENUITEM));
  2676.         menuItem = gSATSubMenu.menuItems;
  2677.         tempDataPtr = selectItem->item_data;
  2678.         for (i = 0; i < gSATSubMenu.numOfItem; i++, menuItem++)
  2679.         {
  2680.             menuItem->itemLen = (U16) (*(tempDataPtr + 1));
  2681.             /* micha0204 */
  2682.             tempDataPtr += 2;
  2683.             menuItem->itemId = *tempDataPtr++;
  2684.             menuItem->itemDcs = *tempDataPtr++;
  2685.             if (menuItem->itemLen != 0)
  2686.             {
  2687.                 menuItem->itemData = CovertStringForPlatform(tempDataPtr, menuItem->itemLen, menuItem->itemDcs, &convertLen);
  2688.                 tempDataPtr += menuItem->itemLen;
  2689.                 menuItem->itemLen = convertLen;
  2690.             }
  2691.             else
  2692.             {
  2693.                 menuItem->itemData = NULL;
  2694.                 menuItem->itemLen = 0;
  2695.             }
  2696.             if (gSATSubMenu.noItemIconIdList)
  2697.         #ifdef __SAT_MMI_UNIT_TEST__
  2698.                 menuItem->IconID = 1;
  2699.         #else 
  2700.                 menuItem->IconID = *(selectItem->item_icon_id_list + i);
  2701.         #endif 
  2702.             if (gSATSubMenu.noItemIconIdList && gSATSubMenu.itemIconListAttr == SAT_ICON_SELF_EX)
  2703.             {
  2704.                 if (menuItem->itemData)
  2705.                 {
  2706.                     OslMfree(menuItem->itemData);
  2707.                 }
  2708.                 menuItem->itemData = NULL;
  2709.                 menuItem->itemLen = 0;
  2710.             }
  2711.             if (gSATSubMenu.noNextActionIndList)
  2712.         #ifdef __SAT_MMI_UNIT_TEST__
  2713.                 menuItem->nextAction = SAT_NEXT_ACTION_RESERVED_FOR_TIA_STRING_ID;
  2714.         #else 
  2715.                 menuItem->nextAction = selectItem->next_action_ind_list[i];
  2716.         #endif 
  2717.         #ifdef __USAT__
  2718.             if (selectItem->no_item_attribute)
  2719.             {
  2720.                 memcpy(menuItem->itemTextFormatting, selectItem->item_formatting + 4 * i, 4);
  2721.             }
  2722.             else
  2723.             {
  2724.                 memset(menuItem->itemTextFormatting, 0, 4);
  2725.             }
  2726.         #endif /* __USAT__ */ 
  2727.         }
  2728.     }
  2729.     gSATSubMenu.defaultIndex = 0;
  2730.     if (selectItem->is_item_id_available)
  2731.     {
  2732.         for (i = 0; i < gSATSubMenu.numOfItem; i++)
  2733.         {
  2734.             if (gSATSubMenu.menuItems[i].itemId == selectItem->item_id)
  2735.             {
  2736.                 gSATSubMenu.defaultIndex = i;
  2737.                 break;
  2738.             }
  2739.         }
  2740.     }
  2741.     SATStopWaitTimer();
  2742.     DeleteScreenIfPresent(SCR_ID_SAT_HISTORY);
  2743.     if (GetExitScrnID() == SCR_ID_SAT_HISTORY)
  2744.     {
  2745.         ClearExitHandler();
  2746.     }
  2747.     GoToSATSubMenu();
  2748. }
  2749. /*****************************************************************************
  2750.  * FUNCTION
  2751.  *  SelectItemWrongData
  2752.  * DESCRIPTION
  2753.  *  Displays SAT Sub Menu
  2754.  * PARAMETERS
  2755.  *  void
  2756.  * RETURNS
  2757.  *  void
  2758.  *****************************************************************************/
  2759. void SelectItemWrongData(void)
  2760. {
  2761.     /*----------------------------------------------------------------*/
  2762.     /* Local Variables                                                */
  2763.     /*----------------------------------------------------------------*/
  2764.     /*----------------------------------------------------------------*/
  2765.     /* Code Body                                                      */
  2766.     /*----------------------------------------------------------------*/
  2767.     TerminalResponseSelectItem(