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

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.  *
  37.  * Filename:
  38.  * ---------
  39.  *  PreferredMode.c
  40.  *
  41.  * Project:
  42.  * --------
  43.  *  MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *  This file is intends for GSM/WLAN preferred mode application
  48.  *
  49.  * Author:
  50.  * -------
  51.  * -------
  52.  *
  53.  *==============================================================================
  54.  *             HISTORY
  55.  * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  56.  *------------------------------------------------------------------------------
  57.  * removed!
  58.  *
  59.  * removed!
  60.  * removed!
  61.  * removed!
  62.  *
  63.  * removed!
  64.  * removed!
  65.  * removed!
  66.  *
  67.  * removed!
  68.  * removed!
  69.  * removed!
  70.  *
  71.  * removed!
  72.  * removed!
  73.  * removed!
  74.  *
  75.  * removed!
  76.  * removed!
  77.  * removed!
  78.  *
  79.  * removed!
  80.  * removed!
  81.  * removed!
  82.  *
  83.  * removed!
  84.  * removed!
  85.  * removed!
  86.  *
  87.  * removed!
  88.  * removed!
  89.  * removed!
  90.  *
  91.  * removed!
  92.  * removed!
  93.  * removed!
  94.  *
  95.  * removed!
  96.  * removed!
  97.  * removed!
  98.  *
  99.  * removed!
  100.  * removed!
  101.  * removed!
  102.  *
  103.  * removed!
  104.  * removed!
  105.  * removed!
  106.  *
  107.  * removed!
  108.  * removed!
  109.  * removed!
  110.  *
  111.  * removed!
  112.  * removed!
  113.  * removed!
  114.  *
  115.  *------------------------------------------------------------------------------
  116.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!! 
  117.  *============================================================================== 
  118.  *******************************************************************************/
  119. #include "MMI_features.h"
  120. #include "StdC.h"
  121. #include "L4Dr1.h"
  122. #include "L4Dr.h"
  123. #ifdef __MMI_WLAN_FEATURES__
  124. #include "CSP.h"
  125. #include "FrameworkStruct.h"
  126. #include "NetworkSetupDefs.h"
  127. #include "NetworkSetupGProt.h"
  128. #include "DebugInitDef.h"
  129. #include "MainMenuDef.h"
  130. #include "ProtocolEvents.h"
  131. #include "SettingProfile.h"
  132. #include "SettingDefs.h"
  133. #include "PrefNwksGprot.h"
  134. #include "CommonScreens.h"
  135. #include "MessagesExDcl.h"
  136. #include "SimDetectionGprot.h"
  137. #include "SimDetectionGexdcl.h"
  138. #include "CallManagementGprot.h"
  139. #include "mmi_trc.h"
  140. #include "StatusIconRes.h"
  141. #include "SSCStringHandle.h"
  142. #include "NVRAMType.h"
  143. #include "NVRAMProt.h"
  144. #include "FlightModeGProt.h"
  145. #include "IdleAppDef.h"
  146. #include "IdleAppProt.h"
  147. #include "GlobalScrEnum.h"
  148. #ifdef __MMI_VOIP__
  149. #include "VoIPDef.h"
  150. #include "VoIPGProt.h"
  151. #endif /* __MMI_VOIP__ */
  152. #include "SmsGuiInterfaceProt.h"
  153. #include "DataAccountGProt.h"
  154. #include "wgui_categories_idlescreen.h"
  155. #include "wgui_categories_inputs.h"
  156. #include "wgui_categories_CM.h"
  157. #include "WallpaperDefs.h"
  158. #include "DownloadDefs.h"
  159. #include "PhoneSetup.h"
  160. extern void mmi_voip_go_back_2_history(void);
  161. extern void UI_set_font(UI_font_type f);
  162. /*
  163.  * Local Variable
  164.  */
  165. typedef struct _netset_p_mode_req
  166. {
  167.     FuncPtr netset_preferred_mode_req;
  168.     U8 state;
  169. } NETSETPMODEREQ;
  170. static NETSETPMODEREQ mmi_netset_p_mode_req[] = 
  171. {
  172.     {mmi_phnset_enter_gsm_flight_mode, 0},
  173.     {mmi_phnset_exit_gsm_flight_mode, 0},
  174.     {mmi_netset_enter_wlan_flight_mode, 0},
  175.     {mmi_netset_exit_wlan_flight_mode, 0},
  176.     {NULL, 0} /* dummy one, please add callbacks before this entity */
  177. };
  178. /*
  179.  * External Variable
  180.  */
  181. extern NetworkSetupDisplay gNetworkSetupDisplay;
  182. extern PHNSET_CNTX g_phnset_cntx;
  183. /*****************************************************************************
  184.  * FUNCTION
  185.  *  mmi_netset_highlight_preferred_mode
  186.  * DESCRIPTION
  187.  *  Highlight handler for MENU_ID_NETSET_PREFERRED_MODE
  188.  * PARAMETERS
  189.  *  void
  190.  * RETURNS
  191.  *  void
  192.  *****************************************************************************/
  193. void mmi_netset_highlight_preferred_mode(void)
  194. {
  195.     /*----------------------------------------------------------------*/
  196.     /* Local Variables                                                */
  197.     /*----------------------------------------------------------------*/
  198.     /*----------------------------------------------------------------*/
  199.     /* Code Body                                                      */
  200.     /*----------------------------------------------------------------*/
  201.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  202.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  203.     SetLeftSoftkeyFunction(mmi_netset_entry_preferred_mode, KEY_EVENT_UP); 
  204.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  205.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  206.     SetKeyHandler(mmi_netset_entry_preferred_mode, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  207. }
  208. /*****************************************************************************
  209.  * FUNCTION
  210.  *  mmi_netset_entry_preferred_mode
  211.  * DESCRIPTION
  212.  *  Entry function for MENU_ID_NETSET_PREFERRED_MODE
  213.  * PARAMETERS
  214.  *  void
  215.  * RETURNS
  216.  *  void
  217.  *****************************************************************************/
  218. void mmi_netset_entry_preferred_mode(void)
  219. {
  220.     /*----------------------------------------------------------------*/
  221.     /* Local Variables                                                */
  222.     /*----------------------------------------------------------------*/
  223.     U8 nNumofItem = 4;
  224.     U8 *guiBuffer;
  225.     U16 nStrItemList[4] = {
  226.                 STR_ID_NETSET_PREFERRED_MODE_GSM_ONLY,
  227.                 STR_ID_NETSET_PREFERRED_MODE_WLAN_ONLY,
  228.                 STR_ID_NETSET_PREFERRED_MODE_GSM_PREFERRED,
  229.                 STR_ID_NETSET_PREFERRED_MODE_WLAN_PREFERRED};
  230.     /*----------------------------------------------------------------*/
  231.     /* Code Body                                                      */
  232.     /*----------------------------------------------------------------*/
  233.     EntryNewScreen(SCR_ID_NETSET_PREFERRED_MODE, NULL, mmi_netset_entry_preferred_mode, NULL);
  234.     guiBuffer = GetCurrGuiBuffer(SCR_ID_NETSET_PREFERRED_MODE);
  235.     RegisterHighlightHandler(mmi_netset_preferred_mode_highlight_hdlr);
  236.     ShowCategory11Screen(
  237.         STR_ID_NETSET_PREFERRED_MODE,
  238.         MAIN_MENU_TITLE_SETTINGS_ICON,
  239.         STR_GLOBAL_OK,
  240.         IMG_GLOBAL_OK,
  241.         STR_GLOBAL_BACK,
  242.         IMG_GLOBAL_BACK,
  243.         nNumofItem,
  244.         nStrItemList,
  245.         gNetworkSetupDisplay.PreferredModeCurrentIndex,
  246.         guiBuffer);
  247.     SetLeftSoftkeyFunction(mmi_netset_pre_check_preferred_mode, KEY_EVENT_UP);
  248.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  249.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  250.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  251. }
  252. /*****************************************************************************
  253.  * FUNCTION
  254.  *  mmi_netset_hint_preferred_mode
  255.  * DESCRIPTION
  256.  *  Hint handler for MENU_ID_NETSET_PREFERRED_MODE
  257.  * PARAMETERS
  258.  *  void
  259.  * RETURNS
  260.  *  void
  261.  *****************************************************************************/
  262. void mmi_netset_hint_preferred_mode(U16 index)
  263. {
  264.     /*----------------------------------------------------------------*/
  265.     /* Local Variables                                                */
  266.     /*----------------------------------------------------------------*/
  267.     U8 data = 0;
  268.     /*----------------------------------------------------------------*/
  269.     /* Code Body                                                      */
  270.     /*----------------------------------------------------------------*/
  271.     data = mmi_netset_get_active_preferred_mode();
  272.      switch (data)
  273.     {
  274.         case P_GSM_ONLY:
  275.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_ID_NETSET_PREFERRED_MODE_GSM_ONLY));
  276.             break;
  277.         case P_WLAN_ONLY:
  278.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_ID_NETSET_PREFERRED_MODE_WLAN_ONLY));
  279.             break;
  280.         case P_GSM_PREFERRED:
  281.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_ID_NETSET_PREFERRED_MODE_GSM_PREFERRED));
  282.             break;
  283.         case P_WLAN_PREFERRED:
  284.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) GetString(STR_ID_NETSET_PREFERRED_MODE_WLAN_PREFERRED));
  285.             break;
  286.         default:
  287.             pfnUnicodeStrcpy((PS8) hintData[index], (PS8) "");
  288.             break;
  289.     }
  290.     gNetworkSetupDisplay.PreferredModeCurrentIndex = data;
  291. }
  292. /*****************************************************************************
  293.  * FUNCTION
  294.  *  mmi_netset_preferred_mode_highlight_hdlr
  295.  * DESCRIPTION
  296.  *  Hint handler for preferred mode items
  297.  * PARAMETERS
  298.  *  index         [IN]
  299.  * RETURNS
  300.  *  void
  301.  *****************************************************************************/
  302. void mmi_netset_preferred_mode_highlight_hdlr(S32 index)
  303. {
  304.     /*----------------------------------------------------------------*/
  305.     /* Local Variables                                                */
  306.     /*----------------------------------------------------------------*/
  307.     /*----------------------------------------------------------------*/
  308.     /* Code Body                                                      */
  309.     /*----------------------------------------------------------------*/
  310.     gNetworkSetupDisplay.PreferredModeCurrentIndex = (U8) index;
  311. }
  312. /*****************************************************************************
  313.  * FUNCTION
  314.  *  NETSETPreferredModeSelectionOK
  315.  * DESCRIPTION
  316.  *  Process of preferred mode user selection
  317.  * PARAMETERS
  318.  *  void
  319.  * RETURNS
  320.  *  void
  321.  *****************************************************************************/
  322. void mmi_netset_preferred_mode_switch_done(void)
  323. {
  324.     /*----------------------------------------------------------------*/
  325.     /* Local Variables                                                */
  326.     /*----------------------------------------------------------------*/
  327.     S16 error;
  328.     U8 current_mode = 0;
  329.     U8 selected_mode = gNetworkSetupDisplay.PreferredModeCurrentIndex;
  330.     /*----------------------------------------------------------------*/
  331.     /* Code Body                                                      */
  332.     /*----------------------------------------------------------------*/
  333.     current_mode = mmi_netset_get_active_preferred_mode();
  334.     WriteValue(NVRAM_NETSET_PREFERRED_MODE, &selected_mode, DS_BYTE, &error);
  335.     DisplayPopup(
  336.         (U8*) GetString(STR_GLOBAL_DONE),
  337.         IMG_GLOBAL_ACTIVATED,
  338.         1,
  339.         UI_POPUP_NOTIFYDURATION_TIME,
  340.         (U8) SUCCESS_TONE);
  341.     DeleteScreenIfPresent(SCR_FLIGHT_MODE_PROGRESS);
  342.     DeleteScreenIfPresent(SCR_ID_NETSET_PREFERRED_MODE);
  343.     mmi_netset_update_preferred_mode_menu(); 
  344.     /* register WLAN callback for status change */
  345.     if (current_mode == P_GSM_ONLY && selected_mode != P_GSM_ONLY)
  346.     {
  347.         AnsiiToUnicodeString((S8 *) gWLANProviderName, (S8 *) "WLAN OFF");
  348.         mmi_wlan_add_event_notify_hdlr(mmi_netset_register_wlan_stauts_cb);
  349.     }
  350.     if (current_mode != P_GSM_ONLY && selected_mode == P_GSM_ONLY)
  351.     {
  352.         AnsiiToUnicodeString((S8 *) gWLANProviderName, (S8 *) "");
  353.         mmi_wlan_remove_event_notify_hdlr(mmi_netset_register_wlan_stauts_cb);
  354.     }
  355.     /* determine if need to display root screen after mode switch */
  356.     if (!mmi_bootup_is_sim_valid())
  357.     {
  358.         if ((current_mode == P_GSM_ONLY && selected_mode != P_GSM_ONLY) ||
  359.             (current_mode != P_GSM_ONLY && selected_mode == P_GSM_ONLY))
  360.         {
  361.             if (IsScreenPresent(SCR_SIM_INSERTION))
  362.             {
  363.                 DeleteUptoScrID(SCR_SIM_INSERTION);
  364.             }
  365.             else if (IsScreenPresent(SCR_SIM_INSERTION))
  366.             {
  367.                 DeleteUptoScrID(SCR_SIM_BLOCK);
  368.             }
  369.             else
  370.             {
  371.                 DeleteUptoScrID(IDLE_SCREEN_ID);
  372.             }
  373.         }
  374.     }
  375. }
  376. /*****************************************************************************
  377.  * FUNCTION
  378.  *  mmi_netset_switch_preferred_mode
  379.  * DESCRIPTION
  380.  *  Switch preferred mode beginning and callback function
  381.  * PARAMETERS
  382.  *  void
  383.  * RETURNS
  384.  *  void
  385.  *****************************************************************************/
  386. void mmi_netset_switch_preferred_mode(void)
  387. {
  388.     /*----------------------------------------------------------------*/
  389.     /* Local Variables                                                */
  390.     /*----------------------------------------------------------------*/
  391.     U8 i;
  392.     /*----------------------------------------------------------------*/
  393.     /* Code Body                                                      */
  394.     /*----------------------------------------------------------------*/
  395.     for (i = 0; mmi_netset_p_mode_req[i].netset_preferred_mode_req != NULL; i++)
  396.     {
  397.         if (mmi_netset_p_mode_req[i].state)
  398.         {
  399.             mmi_netset_p_mode_req[i].state = 0;
  400.             (*mmi_netset_p_mode_req[i].netset_preferred_mode_req)();
  401.             return;
  402.         }
  403.     }
  404.     mmi_netset_preferred_mode_switch_done();
  405.     for (i = 0; mmi_netset_p_mode_req[i].netset_preferred_mode_req != NULL; i++)
  406.     {
  407. mmi_netset_p_mode_req[i].state = 0;
  408.     }
  409. }
  410. /*****************************************************************************
  411.  * FUNCTION
  412.  *  mmi_netset_pre_check_preferred_mode
  413.  * DESCRIPTION
  414.  *  Pre-check function to enter flight mode
  415.  * PARAMETERS
  416.  *  void
  417.  * RETURNS
  418.  *  void
  419.  *****************************************************************************/
  420. void mmi_netset_pre_check_preferred_mode(void)
  421. {
  422.     /*----------------------------------------------------------------*/
  423.     /* Local Variables                                                */
  424.     /*----------------------------------------------------------------*/
  425.     U8 current_mode = 0;
  426.     U8 selected_mode = gNetworkSetupDisplay.PreferredModeCurrentIndex;
  427.     /*----------------------------------------------------------------*/
  428.     /* Code Body                                                      */
  429.     /*----------------------------------------------------------------*/
  430.     current_mode = mmi_netset_get_active_preferred_mode();
  431.     PRINT_INFORMATION(("@@@@@ Preferred mode: change from %d to %d @@@@@", current_mode, selected_mode));
  432.     switch (current_mode)
  433.     {
  434.         case P_GSM_ONLY:
  435.             switch (selected_mode)
  436.             {
  437.                 case P_WLAN_ONLY:
  438.                     mmi_netset_p_mode_req[0].state = 1; /* enter GSM flight mode */
  439.                     mmi_netset_p_mode_req[3].state = 1; /* leave WLAN flight mode */
  440.                     break;
  441.                 case P_GSM_PREFERRED:
  442.                 case P_WLAN_PREFERRED:
  443.                     mmi_netset_p_mode_req[3].state = 1; /* leave WLAN flight mode */ 
  444.                     break;
  445.                 case P_GSM_ONLY:
  446.                 default:
  447.                     break;
  448.             }
  449.             break;
  450.         case P_WLAN_ONLY:
  451.             switch (selected_mode)
  452.             {
  453.                 case P_GSM_ONLY:
  454.                     mmi_netset_p_mode_req[1].state = 1; /* leave GSM flight mode */ 
  455.                     mmi_netset_p_mode_req[2].state = 1; /* enter WLAN flight mode */
  456.                     break;
  457.                 case P_GSM_PREFERRED:
  458.                 case P_WLAN_PREFERRED:
  459.                     mmi_netset_p_mode_req[1].state = 1; /* leave GSM flight mode */ 
  460.                     break;
  461.                 case P_WLAN_ONLY:
  462.                 default:
  463.                     break;
  464.             }
  465.             break;
  466.         case P_GSM_PREFERRED:
  467.         case P_WLAN_PREFERRED:
  468.             switch (selected_mode)
  469.             {
  470.                 case P_GSM_ONLY:
  471.                     mmi_netset_p_mode_req[2].state = 1; /* enter WLAN flight mode */
  472.                     break;
  473.                 case P_WLAN_ONLY:
  474.                     mmi_netset_p_mode_req[0].state = 1; /* enter GSM flight mode */
  475.                     break;
  476.                 case P_GSM_PREFERRED:
  477.                 case P_WLAN_PREFERRED:
  478.                 default:
  479.                     break;
  480.             }
  481.             break;
  482.         default:
  483.             break;
  484.     }
  485.     ClearInputEventHandler(MMI_DEVICE_ALL);
  486.     mmi_netset_switch_preferred_mode();
  487. }
  488. /*****************************************************************************
  489.  * FUNCTION
  490.  *  mmi_netset_get_active_preferred_mode
  491.  * DESCRIPTION
  492.  *  Get active preferred mode
  493.  * PARAMETERS
  494.  *  void
  495.  * RETURNS
  496.  *  void
  497.  *****************************************************************************/
  498. U8 mmi_netset_get_active_preferred_mode(void)
  499. {
  500.     /*----------------------------------------------------------------*/
  501.     /* Local Variables                                                */
  502.     /*----------------------------------------------------------------*/
  503.     S16 error;
  504.     U8 current_mode = 0;
  505.     /*----------------------------------------------------------------*/
  506.     /* Code Body                                                      */
  507.     /*----------------------------------------------------------------*/
  508.     ReadValue(NVRAM_NETSET_PREFERRED_MODE, &current_mode, DS_BYTE, &error);
  509.     if (current_mode >= P_MODE_END)
  510.     {
  511.         current_mode = P_GSM_PREFERRED;
  512.         WriteValue(NVRAM_NETSET_PREFERRED_MODE, &current_mode, DS_BYTE, &error);
  513.     }
  514.     return current_mode;
  515. }
  516. /*****************************************************************************
  517.  * FUNCTION
  518.  *  mmi_netset_update_preferred_mode_service_area
  519.  * DESCRIPTION
  520.  *  Update idle service area based on preferred mode
  521.  * PARAMETERS
  522.  *  void
  523.  * RETURNS
  524.  *  void
  525.  *****************************************************************************/
  526. void mmi_netset_update_preferred_mode_service_area(void)
  527. {
  528.     /*----------------------------------------------------------------*/
  529.     /* Local Variables                                                */
  530.     /*----------------------------------------------------------------*/
  531.     extern UI_string_type idle_screen_network_name;
  532.     extern UI_string_type idle_screen_network_status;
  533.     /*----------------------------------------------------------------*/
  534.     /* Code Body                                                      */
  535.     /*----------------------------------------------------------------*/
  536.     switch (mmi_netset_get_active_preferred_mode())
  537.     {
  538.         case P_WLAN_ONLY:
  539.             SetIdleScreenNetworkName(gWLANProviderName); /* Line1: WLAN */
  540.             SetIdleScreenNetworkStatus(NULL);
  541.             break;
  542.         case P_GSM_PREFERRED:
  543.             SetIdleScreenNetworkStatus(gWLANProviderName); /* Line2: WLAN */
  544.             break;
  545.         case P_WLAN_PREFERRED:
  546.             idle_screen_network_status = idle_screen_network_name;
  547.             SetIdleScreenNetworkName(gWLANProviderName); /* Line1: WLAN */
  548.             break;
  549.         case P_GSM_ONLY:
  550.         default:
  551.             break;
  552.     }
  553. }
  554. /*****************************************************************************
  555.  * FUNCTION
  556.  *  mmi_netset_register_wlan_stauts_cb
  557.  * DESCRIPTION
  558.  *  Registration function for WLAN status change
  559.  * PARAMETERS
  560.  *  wlan_state         [IN]
  561.  * RETURNS
  562.  *  void
  563.  *****************************************************************************/
  564. void mmi_netset_register_wlan_stauts_cb(U16 wlan_state)
  565. {
  566.     /*----------------------------------------------------------------*/
  567.     /* Local Variables                                                */
  568.     /*----------------------------------------------------------------*/
  569.     U8 iCnt = 0;
  570.     S32 StringWidth, StringHeight;
  571.     stFontAttribute prev_f;
  572.     extern S32 MAIN_LCD_device_width;
  573.     /*----------------------------------------------------------------*/
  574.     /* Code Body                                                      */
  575.     /*----------------------------------------------------------------*/
  576.     PRINT_INFORMATION(("@@@@@ Preferred mode: WLAN status update to %d@@@@@", wlan_state));
  577.     if (wlan_state == DTCNT_BEARER_STATE_INACTIVE)
  578.     {
  579.         AnsiiToUnicodeString((S8 *) gWLANProviderName, (S8 *) "WLAN OFF");
  580.     }
  581.     else if (wlan_state == DTCNT_BEARER_STATE_INITIALIZED)
  582.     {
  583.         AnsiiToUnicodeString((S8 *) gWLANProviderName, (S8 *) "WLAN ON");
  584.     }
  585.     else
  586.     {
  587.         mmi_wlan_get_connected_ap_ssid((S8 *) gWLANProviderName, MAX_LENGTH_DISPLAY_NAME - 1);
  588.         memcpy(&prev_f, UI_font, sizeof(stFontAttribute));
  589.         UI_set_font(&UI_DEFAULT_FONT);
  590.         for (iCnt = (U8) pfnUnicodeStrlen((PS8) gWLANProviderName); iCnt > 0; iCnt--)
  591.         {
  592.             Get_StringWidthHeight((U8*) gWLANProviderName, &StringWidth, &StringHeight);
  593.             /* Add one pixel for border text */
  594.             if ((StringWidth + 1) >= MAIN_LCD_device_width - (ICON_WIDTH << 1))
  595.             {
  596.                 gWLANProviderName[iCnt * ENCODING_LENGTH] = 0x0;
  597.                 gWLANProviderName[iCnt * ENCODING_LENGTH + 1] = 0x0;
  598.             }
  599.             else
  600.             {
  601.                 break;
  602.             }
  603.         }
  604.         UI_set_font(&prev_f);
  605.     }
  606.     if (mmi_idle_is_on_idle_screen())
  607.     {
  608.         EntryIdleScreen();
  609.     }
  610. }
  611. /*****************************************************************************
  612.  * FUNCTION
  613.  *  mmi_netset_init_wlan_setting
  614.  * DESCRIPTION
  615.  *  Initialize WLAN settings
  616.  * PARAMETERS
  617.  *  void
  618.  * RETURNS
  619.  *  void
  620.  *****************************************************************************/
  621. void mmi_netset_init_wlan_setting(void)
  622. {
  623.     /*----------------------------------------------------------------*/
  624.     /* Local Variables                                                */
  625.     /*----------------------------------------------------------------*/
  626.     /*----------------------------------------------------------------*/
  627.     /* Code Body                                                      */
  628.     /*----------------------------------------------------------------*/
  629.     AnsiiToUnicodeString((S8 *) gWLANProviderName, (S8 *) "WLAN OFF");
  630.     if (mmi_netset_get_active_preferred_mode() != P_GSM_ONLY)
  631.     {
  632.         mmi_wlan_add_event_notify_hdlr(mmi_netset_register_wlan_stauts_cb);
  633.     }
  634. }
  635. /*****************************************************************************
  636.  * FUNCTION
  637.  *  mmi_netset_enter_wlan_flight_mode
  638.  * DESCRIPTION
  639.  *  Enter WLAN flight mode
  640.  * PARAMETERS
  641.  *  void
  642.  * RETURNS
  643.  *  void
  644.  *****************************************************************************/
  645. void mmi_netset_enter_wlan_flight_mode(void)
  646. {
  647.     /*----------------------------------------------------------------*/
  648.     /* Local Variables                                                */
  649.     /*----------------------------------------------------------------*/
  650.     /*----------------------------------------------------------------*/
  651.     /* Code Body                                                      */
  652.     /*----------------------------------------------------------------*/
  653.     PRINT_INFORMATION(("@@@@@ Preferred mode: turn off WLAN @@@@@"));
  654.     mmi_wlan_reset_hw_off(mmi_netset_switch_preferred_mode);
  655.     g_phnset_cntx.curFlightMode2 = FLIGHTMODE_SILENT;
  656. }
  657. /*****************************************************************************
  658.  * FUNCTION
  659.  *  mmi_netset_exit_wlan_flight_mode
  660.  * DESCRIPTION
  661.  *  Exit WLAN flight mode
  662.  * PARAMETERS
  663.  *  void
  664.  * RETURNS
  665.  *  void
  666.  *****************************************************************************/
  667. void mmi_netset_exit_wlan_flight_mode(void)
  668. {
  669.     /*----------------------------------------------------------------*/
  670.     /* Local Variables                                                */
  671.     /*----------------------------------------------------------------*/
  672.     /*----------------------------------------------------------------*/
  673.     /* Code Body                                                      */
  674.     /*----------------------------------------------------------------*/
  675.     PRINT_INFORMATION(("@@@@@ Preferred mode: turn on WLAN @@@@@"));
  676.     mmi_wlan_reset_hw_on(mmi_netset_switch_preferred_mode);
  677.     g_phnset_cntx.curFlightMode2 = FLIGHTMODE_OFF;
  678. }
  679. /*****************************************************************************
  680.  * FUNCTION
  681.  *  mmi_netset_update_preferred_mode_menu
  682.  * DESCRIPTION
  683.  *  Dial mode selection menu update function
  684.  * PARAMETERS
  685.  *  void
  686.  * RETURNS
  687.  *  void
  688.  *****************************************************************************/
  689. void mmi_netset_update_preferred_mode_menu(void)
  690. {
  691.     /*----------------------------------------------------------------*/
  692.     /* Local Variables                                                */
  693.     /*----------------------------------------------------------------*/
  694.     /*----------------------------------------------------------------*/
  695.     /* Code Body                                                      */
  696.     /*----------------------------------------------------------------*/
  697.     switch (mmi_netset_get_active_preferred_mode())
  698.     {
  699.         case P_GSM_ONLY:
  700.             mmi_frm_hide_menu_item(MENU_ID_WLAN_MAIN);
  701.         #ifdef __MMI_VOIP__
  702.             mmi_frm_hide_menu_item(MENU_ID_DIALER_SCREEN_OPTIONS_CHANGE_MODE);
  703. //          mmi_frm_hide_menu_item(MENU_ID_VOIP_MAIN);
  704.         #endif /* __MMI_VOIP__ */
  705.             if (mmi_bootup_is_sim_valid())
  706.             {
  707.                 mmi_frm_unhide_menu_item(MESSAGES_MENU_SMS_MENUID);      /* SMS */
  708.                 mmi_frm_unhide_menu_item(MESSAGES_MENU_MMS_MENUID);      /* MMS */
  709.                 mmi_frm_unhide_menu_item(MENU_CHATAPP_ID);               /* Chat */
  710.                 mmi_frm_unhide_menu_item(MESSAGES_MENU_VMAIL_MENUID);    /* Voice Mail */
  711.                 mmi_frm_unhide_menu_item(MESSAGES_MENU_CB_MENUID);       /* Cell Broadcast */
  712.                 mmi_frm_unhide_menu_item(MENU_ID_UM_MAIN);               /* Unified Message */
  713.                 mmi_frm_unhide_menu_item(MENU8237_SCR8093_MNGCALL_MENU_MAIN);
  714.             }
  715.             mmi_frm_unhide_menu_item(MENU9186_SELECTION_MODE);
  716.             mmi_frm_unhide_menu_item(MENU9189_GPRS_CONNECTION_MODE);
  717.             break;
  718.         case P_WLAN_ONLY:
  719.             mmi_frm_unhide_menu_item(MENU_ID_WLAN_MAIN);
  720.         #ifdef __MMI_VOIP__
  721.             mmi_frm_hide_menu_item(MENU_ID_DIALER_SCREEN_OPTIONS_CHANGE_MODE);
  722. //          mmi_frm_unhide_menu_item(MENU_ID_VOIP_MAIN);
  723.         #endif /* __MMI_VOIP__ */
  724.             if (mmi_bootup_is_sim_valid())
  725.             {
  726.                 mmi_frm_hide_menu_item(MESSAGES_MENU_SMS_MENUID);      /* SMS */
  727.                 mmi_frm_hide_menu_item(MESSAGES_MENU_MMS_MENUID);      /* MMS */
  728.                 mmi_frm_hide_menu_item(MENU_CHATAPP_ID);               /* Chat */
  729.                 mmi_frm_hide_menu_item(MESSAGES_MENU_VMAIL_MENUID);    /* Voice Mail */
  730.                 mmi_frm_hide_menu_item(MESSAGES_MENU_CB_MENUID);       /* Cell Broadcast */
  731.                 mmi_frm_hide_menu_item(MENU_ID_UM_MAIN);               /* Unified Message */
  732.                 mmi_frm_hide_menu_item(MENU8237_SCR8093_MNGCALL_MENU_MAIN);
  733.             }
  734.             mmi_frm_hide_menu_item(MENU9186_SELECTION_MODE);
  735.             mmi_frm_hide_menu_item(MENU9189_GPRS_CONNECTION_MODE);
  736.             break;
  737.         default:
  738.             mmi_frm_unhide_menu_item(MENU_ID_WLAN_MAIN);
  739.         #ifdef __MMI_VOIP__
  740.             mmi_frm_unhide_menu_item(MENU_ID_DIALER_SCREEN_OPTIONS_CHANGE_MODE);
  741. //          mmi_frm_unhide_menu_item(MENU_ID_VOIP_MAIN);
  742.         #endif /* __MMI_VOIP__ */
  743.             if (mmi_bootup_is_sim_valid())
  744.             {
  745.                 mmi_frm_unhide_menu_item(MESSAGES_MENU_SMS_MENUID);      /* SMS */
  746.                 mmi_frm_unhide_menu_item(MESSAGES_MENU_MMS_MENUID);      /* MMS */
  747.                 mmi_frm_unhide_menu_item(MENU_CHATAPP_ID);               /* Chat */
  748.                 mmi_frm_unhide_menu_item(MESSAGES_MENU_VMAIL_MENUID);    /* Voice Mail */
  749.                 mmi_frm_unhide_menu_item(MESSAGES_MENU_CB_MENUID);       /* Cell Broadcast */
  750.                 mmi_frm_unhide_menu_item(MENU_ID_UM_MAIN);               /* Unified Message */
  751.                 mmi_frm_unhide_menu_item(MENU8237_SCR8093_MNGCALL_MENU_MAIN);
  752.             }
  753.             mmi_frm_unhide_menu_item(MENU9186_SELECTION_MODE);
  754.             mmi_frm_unhide_menu_item(MENU9189_GPRS_CONNECTION_MODE);
  755.             break;
  756.     }
  757. }
  758. #ifdef __MMI_VOIP__
  759. /*****************************************************************************
  760.  * FUNCTION
  761.  *  mmi_netset_highlight_dial_by_gsm
  762.  * DESCRIPTION
  763.  *  Highlight handler for 'Dial by GSM'
  764.  * PARAMETERS
  765.  *  void
  766.  * RETURNS
  767.  *  void
  768.  *****************************************************************************/
  769. void mmi_netset_highlight_dialer_option_dial(void)
  770. {
  771.     /*----------------------------------------------------------------*/
  772.     /* Local Variables                                                */
  773.     /*----------------------------------------------------------------*/
  774.     /*----------------------------------------------------------------*/
  775.     /* Code Body                                                      */
  776.     /*----------------------------------------------------------------*/
  777.     switch (mmi_netset_get_active_preferred_mode())
  778.     {
  779.         case P_WLAN_ONLY:
  780.             ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  781.             ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  782.             SetLeftSoftkeyFunction(mmi_netset_entry_dialpad_call_by_wlan, KEY_EVENT_UP);
  783.             SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  784.             SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  785.             break;
  786.         case P_GSM_PREFERRED:
  787.         case P_WLAN_PREFERRED:
  788.             ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  789.             ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  790.             SetLeftSoftkeyFunction(mmi_netset_entry_dial_mode_selection, KEY_EVENT_UP);
  791.             SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  792.             SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  793.             mmi_netset_register_call_entry_func(IdleDialPadCall, mmi_netset_entry_dialpad_call_by_wlan);
  794.             break;
  795.        case P_GSM_ONLY:
  796.        default:
  797.            MMI_ASSERT(0); /* shall not enter this in GSM only mode */
  798.            break;
  799.     }
  800. }
  801. /*****************************************************************************
  802.  * FUNCTION
  803.  *  mmi_netset_highlight_phonebook_save
  804.  * DESCRIPTION
  805.  *  Highlight handler for 'Save to Phonebook'
  806.  * PARAMETERS
  807.  *  void
  808.  * RETURNS
  809.  *  void
  810.  *****************************************************************************/
  811. void mmi_netset_highlight_dialer_option_phonebook_save(void)
  812. {
  813.     /*----------------------------------------------------------------*/
  814.     /* Local Variables                                                */
  815.     /*----------------------------------------------------------------*/
  816.     /*----------------------------------------------------------------*/
  817.     /* Code Body                                                      */
  818.     /*----------------------------------------------------------------*/
  819.     /* change left and right soft key */
  820.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  821.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  822.     /* set left and right soft key handler */
  823.     SetLeftSoftkeyFunction(IdleDialPadSavePhoneBook, KEY_EVENT_UP);
  824.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  825.     /* set key handler for left and right arrow key */
  826.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  827. }
  828. /*****************************************************************************
  829.  * FUNCTION
  830.  *  mmi_netset_highlight_dialer_option_input_method
  831.  * DESCRIPTION
  832.  *  Highlight handler for 'Input Method'
  833.  * PARAMETERS
  834.  *  void
  835.  * RETURNS
  836.  *  void
  837.  *****************************************************************************/
  838. void mmi_netset_highlight_dialer_option_input_method(void)
  839. {
  840.     /*----------------------------------------------------------------*/
  841.     /* Local Variables                                                */
  842.     /*----------------------------------------------------------------*/
  843.     /*----------------------------------------------------------------*/
  844.     /* Code Body                                                      */
  845.     /*----------------------------------------------------------------*/
  846.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  847.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  848.     SetLeftSoftkeyFunction(EntryAPRequiredInputMethodScreen, KEY_EVENT_UP);
  849.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  850.     RegisterInputMethodScreenCloseFunction(mmi_voip_go_back_2_history);
  851. }
  852. /*****************************************************************************
  853.  * FUNCTION
  854.  *  mmi_netset_highlight_change_dial_mode
  855.  * DESCRIPTION
  856.  *  Highlight handler for 'Change Dial Mode'
  857.  * PARAMETERS
  858.  *  void
  859.  * RETURNS
  860.  *  void
  861.  *****************************************************************************/
  862. void mmi_netset_highlight_dialer_option_change_dial_mode(void)
  863. {
  864.     /*----------------------------------------------------------------*/
  865.     /* Local Variables                                                */
  866.     /*----------------------------------------------------------------*/
  867.     /*----------------------------------------------------------------*/
  868.     /* Code Body                                                      */
  869.     /*----------------------------------------------------------------*/
  870.     /* change left and right soft key */
  871.     ChangeLeftSoftkey(STR_GLOBAL_OK, IMG_GLOBAL_OK);
  872.     ChangeRightSoftkey(STR_GLOBAL_BACK, IMG_GLOBAL_BACK);
  873.     /* set left and right soft key handler */
  874.     SetLeftSoftkeyFunction(mmi_netset_entry_change_dial_mode, KEY_EVENT_UP);
  875.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  876.     /* set key handler for left and right arrow key */
  877.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  878. }
  879. /*****************************************************************************
  880.  * FUNCTION
  881.  *  mmi_netset_entry_dialpad_call_by_wlan
  882.  * DESCRIPTION
  883.  *  WLAN make call from dialer screen
  884.  * PARAMETERS
  885.  *  void
  886.  * RETURNS
  887.  *  void
  888.  *****************************************************************************/
  889. void mmi_netset_entry_dialpad_call_by_wlan(void)
  890. {
  891.     /*----------------------------------------------------------------*/
  892.     /* Local Variables                                                */
  893.     /*----------------------------------------------------------------*/
  894.     /*----------------------------------------------------------------*/
  895.     /* Code Body                                                      */
  896.     /*----------------------------------------------------------------*/
  897. #ifdef __MMI_TOUCH_DIAL_SCREEN__
  898.     if (!SSCStringParsing2() && g_idle_context.DialPadCallBuffer[0] != '')
  899. #else 
  900.     if (!SSCStringParsing2())
  901. #endif 
  902.         mmi_voip_app_make_call((U8*) g_idle_context.DialPadCallBuffer);
  903. }
  904. /*****************************************************************************
  905.  * FUNCTION
  906.  *  mmi_netset_entry_change_dial_mode
  907.  * DESCRIPTION
  908.  *  Dial mode change entry function
  909.  * PARAMETERS
  910.  *  void
  911.  * RETURNS
  912.  *  void
  913.  *****************************************************************************/
  914. void mmi_netset_entry_change_dial_mode(void)
  915. {
  916.     /*----------------------------------------------------------------*/
  917.     /* Local Variables                                                */
  918.     /*----------------------------------------------------------------*/
  919.     /*----------------------------------------------------------------*/
  920.     /* Code Body                                                      */
  921.     /*----------------------------------------------------------------*/
  922.     gNetworkSetupDisplay.DigitScreenDialMode = (gNetworkSetupDisplay.DigitScreenDialMode) ? 0 : 1; /* 0: GSM, 1: WLAN */
  923.     sprintf(g_idle_context.DialPadCallBuffer, "");
  924.     g_idle_context.IdleScreenDigitKeyCode = -1;
  925.     IdleScreenDigitHandler();
  926.     DeleteScreenIfPresent(IDLE_SCREEN_DIGIT_OPTIONS_ID);
  927.     DeleteScreenIfPresent(IDLE_SCREEN_DIGIT_HANDLER_ID);
  928.     DeleteScreenIfPresent(SCR_ID_VOIP_CALL_EDITOR);
  929.     if (mmi_netset_get_active_preferred_mode() == P_WLAN_PREFERRED || mmi_netset_get_dial_mode() == 0)
  930.     {
  931.         /* enter VoIP dialer screen first then change dialer mode to digit dialer */
  932.         /* restore RSK/LSK handers because they are changed to disable long press */
  933.         SetLeftSoftkeyFunction(mmi_netset_enter_wlan_dialer_option, KEY_EVENT_UP);
  934.         SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  935.     }
  936. }
  937. /*****************************************************************************
  938.  * FUNCTION
  939.  *  mmi_netset_set_dial_mode
  940.  * DESCRIPTION
  941.  *  Get dial mode
  942.  * PARAMETERS
  943.  *  mode               [IN]
  944.  * RETURNS
  945.  *  void
  946.  *****************************************************************************/
  947. void mmi_netset_set_dial_mode(U8 mode)
  948. {
  949.     /*----------------------------------------------------------------*/
  950.     /* Local Variables                                                */
  951.     /*----------------------------------------------------------------*/
  952.     /*----------------------------------------------------------------*/
  953.     /* Code Body                                                      */
  954.     /*----------------------------------------------------------------*/
  955.     gNetworkSetupDisplay.DigitScreenDialMode = mode;
  956. }
  957. /*****************************************************************************
  958.  * FUNCTION
  959.  *  mmi_netset_get_dial_mode
  960.  * DESCRIPTION
  961.  *  Get dial mode
  962.  * PARAMETERS
  963.  *  void
  964.  * RETURNS
  965.  *  U8
  966.  *****************************************************************************/
  967. U8 mmi_netset_get_dial_mode(void)
  968. {
  969.     /*----------------------------------------------------------------*/
  970.     /* Local Variables                                                */
  971.     /*----------------------------------------------------------------*/
  972.     /*----------------------------------------------------------------*/
  973.     /* Code Body                                                      */
  974.     /*----------------------------------------------------------------*/
  975.     return gNetworkSetupDisplay.DigitScreenDialMode;
  976. }
  977. /*****************************************************************************
  978.  * FUNCTION
  979.  *  mmi_netset_enter_wlan_dialer_option
  980.  * DESCRIPTION
  981.  *  WLAN dialer option screen entry function
  982.  * PARAMETERS
  983.  *  void
  984.  * RETURNS
  985.  *  void
  986.  *****************************************************************************/
  987. void mmi_netset_enter_wlan_dialer_option(void)
  988. {
  989.     /*----------------------------------------------------------------*/
  990.     /* Local Variables                                                */
  991.     /*----------------------------------------------------------------*/
  992.     PU8 guiBuffer;
  993.     U16 nStrItemList[4];    /* Stores the strings id of submenus returned */
  994.     U16 nNumofItem;         /* Stores no of children in the submenu */
  995.     historyNode *History;
  996.     /*----------------------------------------------------------------*/
  997.     /* Code Body                                                      */
  998.     /*----------------------------------------------------------------*/
  999.     /* always need to save the digit dialer screen to the history when enter option screen */
  1000.     if (mmi_netset_get_dial_mode() == 0)
  1001.     {
  1002.         g_idle_context.AvoidHistoryofDialerScreen = 0;
  1003.     }
  1004.     EntryNewScreen(IDLE_SCREEN_DIGIT_OPTIONS_ID, NULL, mmi_netset_enter_wlan_dialer_option, NULL);
  1005.     guiBuffer = GetCurrGuiBuffer(IDLE_SCREEN_DIGIT_OPTIONS_ID);
  1006.     nNumofItem = GetNumOfChild_Ext(MENU_ID_DIALER_SCREEN_OPTIONS);
  1007.     GetSequenceStringIds_Ext(MENU_ID_DIALER_SCREEN_OPTIONS, nStrItemList);
  1008.     SetParentHandler(MENU_ID_DIALER_SCREEN_OPTIONS);
  1009.     RegisterHighlightHandler(ExecuteCurrHiliteHandler);
  1010.     ShowCategory15Screen(
  1011.         STR_GLOBAL_OPTIONS,
  1012.         0,
  1013.         STR_GLOBAL_OK,
  1014.         IMG_GLOBAL_OK,
  1015.         STR_GLOBAL_BACK,
  1016.         IMG_GLOBAL_BACK,
  1017.         nNumofItem,
  1018.         nStrItemList,
  1019.         (PU16) gIndexIconsImageList,
  1020.         LIST_MENU,
  1021.         0,
  1022.         guiBuffer);
  1023.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1024.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1025.     /* reset the guiBuffer to enable long press after go back to the digit dialer screen */
  1026.     if (GetHistoryScrID(IDLE_SCREEN_DIGIT_HANDLER_ID, &History) == ST_SUCCESS)
  1027.     {
  1028.         if (History->guiBuffer != NULL)
  1029.         {
  1030.             OslMfree(History->guiBuffer);
  1031.             History->guiBuffer = NULL;
  1032.         }
  1033.     }
  1034. }
  1035. /*****************************************************************************
  1036.  * FUNCTION
  1037.  *  mmi_netset_enter_wlan_dialer_screen
  1038.  * DESCRIPTION
  1039.  *  WLAN dialer screen entry function
  1040.  * PARAMETERS
  1041.  *  void
  1042.  * RETURNS
  1043.  *  void
  1044.  *****************************************************************************/
  1045. void mmi_netset_enter_wlan_dialer_screen(void)
  1046. {
  1047.     /*----------------------------------------------------------------*/
  1048.     /* Local Variables                                                */
  1049.     /*----------------------------------------------------------------*/
  1050.     U8 *guiBuffer = NULL;
  1051.     extern S16 MMI_prefered_input_type;
  1052.     /*----------------------------------------------------------------*/
  1053.     /* Code Body                                                      */
  1054.     /*----------------------------------------------------------------*/
  1055.     EntryNewScreen(SCR_ID_VOIP_CALL_EDITOR, NULL, mmi_netset_enter_wlan_dialer_screen, NULL);
  1056.     guiBuffer = GetCurrGuiBuffer(SCR_ID_VOIP_CALL_EDITOR);
  1057.     ShowCategory404Screen(
  1058.         STR_GLOBAL_OPTIONS,
  1059.         IMG_GLOBAL_OPTIONS,
  1060.         STR_GLOBAL_BACK,
  1061.         IMG_GLOBAL_BACK,
  1062.         IMG_ID_VOIP_CALL_EDITOR,
  1063.         (U8*) g_idle_context.DialPadCallBuffer,
  1064.         VOIP_URI_LEN, //MAX_DIAL_PAD,
  1065.         guiBuffer);
  1066.     SetLeftSoftkeyFunction(mmi_netset_enter_wlan_dialer_option, KEY_EVENT_UP);
  1067.     SetCategory5RightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1068.     SetKeyHandler(mmi_netset_entry_dialpad_call_by_wlan, KEY_SEND, KEY_EVENT_DOWN);
  1069. /*
  1070.     #ifdef __MMI_STARKEY_TOGGLE_PROFILE__
  1071.         SetKeyHandler(IdleToggleProfile, KEY_STAR, KEY_LONG_PRESS);
  1072.     #else 
  1073.         SetKeyHandler(IdleToggleProfile, KEY_POUND, KEY_LONG_PRESS);
  1074.     #endif 
  1075. */
  1076.     if (MMI_prefered_input_type == INPUT_TYPE_NUMERIC_CHANGEABLE && g_idle_context.IdleScreenDigitKeyCode >= 0)
  1077.     {
  1078.         ExecuteCurrKeyHandler(g_idle_context.IdleScreenDigitKeyCode, KEY_EVENT_DOWN);
  1079.         g_idle_context.IdleScreenDigitKeyCode = -1;
  1080.     }
  1081. }
  1082. /*****************************************************************************
  1083.  * FUNCTION
  1084.  *  mmi_netset_register_call_entry_func
  1085.  * DESCRIPTION
  1086.  *  Dial mode selection callback function for dialing
  1087.  * PARAMETERS
  1088.  *  gsm_call_ptr       [IN]
  1089.  *  wlan_call_ptr      [IN]
  1090.  * RETURNS
  1091.  *  void
  1092.  *****************************************************************************/
  1093. void mmi_netset_register_call_entry_func(FuncPtr gsm_call_ptr, FuncPtr wlan_call_ptr)
  1094. {
  1095.     /*----------------------------------------------------------------*/
  1096.     /* Local Variables                                                */
  1097.     /*----------------------------------------------------------------*/
  1098.     /*----------------------------------------------------------------*/
  1099.     /* Code Body                                                      */
  1100.     /*----------------------------------------------------------------*/
  1101.     gNetworkSetupDisplay.GSMCallEntryPtr = gsm_call_ptr;
  1102.     gNetworkSetupDisplay.WLANCallEntryPtr = wlan_call_ptr;
  1103.     gNetworkSetupDisplay.DialModeCurrentIndex = 0;
  1104. }
  1105. /*****************************************************************************
  1106.  * FUNCTION
  1107.  *  mmi_netset_confirm_dial_mode_selection
  1108.  * DESCRIPTION
  1109.  *  Dial mode selection confirmation function
  1110.  * PARAMETERS
  1111.  *  void
  1112.  * RETURNS
  1113.  *  void
  1114.  *****************************************************************************/
  1115. void mmi_netset_confirm_dial_mode_selection(void)
  1116. {
  1117.     /*----------------------------------------------------------------*/
  1118.     /* Local Variables                                                */
  1119.     /*----------------------------------------------------------------*/
  1120.     /*----------------------------------------------------------------*/
  1121.     /* Code Body                                                      */
  1122.     /*----------------------------------------------------------------*/
  1123.     EntryNewScreen(GLOBAL_SCR_DUMMY, NULL, NULL, NULL); /* to delete dial mode selection screen */
  1124.     switch (gNetworkSetupDisplay.DialModeCurrentIndex)
  1125.     {
  1126.         case 0:
  1127.             if (gNetworkSetupDisplay.GSMCallEntryPtr != NULL)
  1128.             {
  1129.                 (*gNetworkSetupDisplay.GSMCallEntryPtr) ();
  1130.             }
  1131.             break;
  1132.         case 1:
  1133.             if (gNetworkSetupDisplay.WLANCallEntryPtr != NULL)
  1134.             {
  1135.                 (*gNetworkSetupDisplay.WLANCallEntryPtr) ();
  1136.             }
  1137.             break;
  1138.         default:
  1139.             break;
  1140.     }
  1141.     DeleteScreenIfPresent(IDLE_SCREEN_DIGIT_OPTIONS_ID);
  1142.     DeleteScreenIfPresent(SCR_ID_NETSET_DIAL_MODE_SELECTION);
  1143.     if (gNetworkSetupDisplay.DialModeCurrentIndex == 0 ||
  1144.        (gNetworkSetupDisplay.DialModeCurrentIndex == 1 && mmi_voip_app_get_register_state() == MMI_VOIP_REG_STATE))
  1145.     {
  1146.          /* Delete dialer screen of in GSM call */
  1147.         DeleteScreenIfPresent(IDLE_SCREEN_DIGIT_HANDLER_ID);
  1148.     }
  1149. }
  1150. /*****************************************************************************
  1151.  * FUNCTION
  1152.  *  mmi_netset_entry_dial_mode_selection
  1153.  * DESCRIPTION
  1154.  *  Dial mode selection highlight handler
  1155.  * PARAMETERS
  1156.  *  index              [IN]
  1157.  * RETURNS
  1158.  *  void
  1159.  *****************************************************************************/
  1160. void mmi_netset_dial_mode_selection_highlight_hdlr(S32 index)
  1161. {
  1162.     /*----------------------------------------------------------------*/
  1163.     /* Local Variables                                                */
  1164.     /*----------------------------------------------------------------*/
  1165.     /*----------------------------------------------------------------*/
  1166.     /* Code Body                                                      */
  1167.     /*----------------------------------------------------------------*/
  1168.     gNetworkSetupDisplay.DialModeCurrentIndex = (U8) index;
  1169. }
  1170. /*****************************************************************************
  1171.  * FUNCTION
  1172.  *  mmi_netset_entry_dial_mode_selection
  1173.  * DESCRIPTION
  1174.  *  Dial mode selection entry function
  1175.  * PARAMETERS
  1176.  *  void
  1177.  * RETURNS
  1178.  *  void
  1179.  *****************************************************************************/
  1180. void mmi_netset_entry_dial_mode_selection(void)
  1181. {
  1182.     /*----------------------------------------------------------------*/
  1183.     /* Local Variables                                                */
  1184.     /*----------------------------------------------------------------*/
  1185.     U8 nNumofItem = 2;
  1186.     U8 *guiBuffer;
  1187.     U16 nStrItemList[] = {STR_ID_DIALER_SCREEN_OPTIONS_GSM_DIAL, STR_ID_DIALER_SCREEN_OPTIONS_WLAN_DIAL};
  1188.     /*----------------------------------------------------------------*/
  1189.     /* Code Body                                                      */
  1190.     /*----------------------------------------------------------------*/
  1191.     EntryNewScreen(SCR_ID_NETSET_DIAL_MODE_SELECTION, NULL, mmi_netset_entry_dial_mode_selection, NULL);
  1192.     guiBuffer = GetCurrGuiBuffer(SCR_ID_NETSET_DIAL_MODE_SELECTION);
  1193.     RegisterHighlightHandler(mmi_netset_dial_mode_selection_highlight_hdlr);
  1194.     ShowCategory15Screen(
  1195.         STR_ID_NETSET_PREFERRED_MODE,
  1196.         0,
  1197.         STR_GLOBAL_OK,
  1198.         IMG_GLOBAL_OK,
  1199.         STR_GLOBAL_BACK,
  1200.         IMG_GLOBAL_BACK,
  1201.         nNumofItem,
  1202.         nStrItemList,
  1203.        (PU16) gIndexIconsImageList,
  1204.         LIST_MENU,
  1205.         0,
  1206.         guiBuffer);
  1207.     SetLeftSoftkeyFunction(mmi_netset_confirm_dial_mode_selection, KEY_EVENT_UP);
  1208.     SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
  1209.     SetKeyHandler(0, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
  1210.     SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
  1211. }
  1212. #endif /* __MMI_VOIP__ */
  1213. #endif /* __MMI_WLAN_FEATURES__ */