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

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.  * JProfileStorageHandler.C
  40.  *
  41.  * Project:
  42.  * --------
  43.  *   MAUI
  44.  *
  45.  * Description:
  46.  * ------------
  47.  *   This is source file for NVRAM storage related part for the profiles (BROWSER & MMS .....)
  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.  * removed!
  59.  * removed!
  60.  *
  61.  * removed!
  62.  * removed!
  63.  * removed!
  64.  *
  65.  * removed!
  66.  * removed!
  67.  * removed!
  68.  *
  69.  *------------------------------------------------------------------------------
  70.  * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
  71.  *============================================================================
  72.  ****************************************************************************/
  73. #ifndef _JPROFILESTORAGEHANDLER_C
  74. #define _JPROFILESTORAGEHANDLER_C
  75. #include "MMI_features.h"
  76. #if defined (JATAAYU_SUPPORT) && (defined (WAP_SUPPORT) || (defined (MMS_SUPPORT)))
  77. #include "stdC.h"
  78. #include "L4Dr1.h"
  79. #include "PixtelDataTypes.h"
  80. #include "EventsGprot.h"
  81. #include "Ucs2prot.h"
  82. #include "Unicodexdcl.h"
  83. #include "wgui_categories_util.h"
  84. #include "NVRAMType.h"
  85. #include "NVRAMProt.h"
  86. #include "NVRAMEnum.h"
  87. #include "custom_nvram_editor_data_item.h"
  88. #include "JProvWap.h"
  89. #include "JProfileHandlerDefs.h"
  90. #include "JProfileHandlerTypes.h"
  91. #include "JProfileHandlerProts.h"
  92. #if defined(MMS_SUPPORT)//dilip
  93. extern void mmi_jmms_set_profile(void);
  94. #endif
  95. extern pBOOL GetUCS2Flag(PS8 buffer);
  96. /*****************************************************************************
  97.  * FUNCTION
  98.  *  mmi_ph_get_brw_profile_name_list
  99.  * DESCRIPTION
  100.  *  This reads the browser profile name list from the NVRAM
  101.  * PARAMETERS
  102.  *  void
  103.  * RETURNS
  104.  *  void
  105.  *****************************************************************************/
  106. void mmi_ph_get_brw_profile_name_list(void)
  107. {
  108.     /*----------------------------------------------------------------*/
  109.     /* Local Variables                                                */
  110.     /*----------------------------------------------------------------*/
  111.     S16 error;
  112.     /*----------------------------------------------------------------*/
  113.     /* Code Body                                                      */
  114.     /*----------------------------------------------------------------*/
  115.     if (g_ph_wap_prof_name_arr_p == NULL)
  116.     {
  117.         g_ph_wap_prof_name_arr_p =
  118.             (nvram_wap_profile_name_array_struct*) jdd_MemAlloc(NVRAM_EF_WAP_PROFILE_NAMES_SIZE, 1);
  119.     }
  120.     ReadRecord(NVRAM_EF_WAP_PROFILE_NAMES_LID, 1, g_ph_wap_prof_name_arr_p, NVRAM_EF_WAP_PROFILE_NAMES_SIZE, &error);
  121. }
  122. /*****************************************************************************
  123.  * FUNCTION
  124.  *  mmi_ph_get_mms_profile_name_list
  125.  * DESCRIPTION
  126.  *  This reads the MMS profile name list from the NVRAM
  127.  * PARAMETERS
  128.  *  void
  129.  * RETURNS
  130.  *  void
  131.  *****************************************************************************/
  132. void mmi_ph_get_mms_profile_name_list(void)
  133. {
  134.     /*----------------------------------------------------------------*/
  135.     /* Local Variables                                                */
  136.     /*----------------------------------------------------------------*/
  137.     S16 error;
  138.     /*----------------------------------------------------------------*/
  139.     /* Code Body                                                      */
  140.     /*----------------------------------------------------------------*/
  141.     if (g_ph_mms_prof_name_arr_p == NULL)
  142.     {
  143.         g_ph_mms_prof_name_arr_p =
  144.             (nvram_mms_profile_name_array_struct*) jdd_MemAlloc(NVRAM_EF_MMS_PROFILE_NAMES_SIZE, 1);
  145.     }
  146.     ReadRecord(NVRAM_EF_MMS_PROFILE_NAMES_LID, 1, g_ph_mms_prof_name_arr_p, NVRAM_EF_MMS_PROFILE_NAMES_SIZE, &error);
  147. }
  148. /*****************************************************************************
  149.  * FUNCTION
  150.  *  mmi_ph_get_profile_nvram_content_data
  151.  * DESCRIPTION
  152.  *  This reads the content data for the given profile index from the NVRAM
  153.  * PARAMETERS
  154.  *  index       [IN]        Index of the profile
  155.  * RETURNS
  156.  *  void
  157.  *****************************************************************************/
  158. void mmi_ph_get_profile_nvram_content_data(U8 index)
  159. {
  160.     /*----------------------------------------------------------------*/
  161.     /* Local Variables                                                */
  162.     /*----------------------------------------------------------------*/
  163.     S16 error;
  164.     /*----------------------------------------------------------------*/
  165.     /* Code Body                                                      */
  166.     /*----------------------------------------------------------------*/
  167.     if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
  168.     {
  169.         ReadRecord(
  170.             NVRAM_EF_WAP_PROFILE_CONTENT_LID,
  171.             (U16) (index + 1),
  172.             g_ph_wap_profile_p,
  173.             NVRAM_EF_WAP_PROFILE_CONTENT_SIZE,
  174.             &error);
  175.     }
  176.     else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
  177.     {
  178.         ReadRecord(
  179.             NVRAM_EF_MMS_PROFILE_CONTENT_LID,
  180.             (U16) (index + 1),
  181.             g_ph_mms_profile_p,
  182.             NVRAM_EF_MMS_PROFILE_CONTENT_SIZE,
  183.             &error);
  184.     }
  185. }
  186. /*****************************************************************************
  187.  * FUNCTION
  188.  *  mmi_ph_get_activated_profile_data
  189.  * DESCRIPTION
  190.  *  This gets the activated profile content data from the NVRAM into the global context of the activated profile
  191.  * PARAMETERS
  192.  *  profile     [IN]        Profile type(Browser,MMS.....)
  193.  *  index       [IN]        Activated profile index
  194.  * RETURNS
  195.  *  void
  196.  *****************************************************************************/
  197. void mmi_ph_get_activated_profile_data(ph_profile_enum profile, U8 index)
  198. {
  199.     /*----------------------------------------------------------------*/
  200.     /* Local Variables                                                */
  201.     /*----------------------------------------------------------------*/
  202.     S16 error;
  203.     /*----------------------------------------------------------------*/
  204.     /* Code Body                                                      */
  205.     /*----------------------------------------------------------------*/
  206.     if (profile == PH_BROWSER_PROFILE)
  207.     {
  208.         ReadRecord(
  209.             NVRAM_EF_WAP_PROFILE_CONTENT_LID,
  210.             (U16) (index + 1),
  211.             g_ph_activated_wap_profile,
  212.             NVRAM_EF_WAP_PROFILE_CONTENT_SIZE,
  213.             &error);
  214.     }
  215. else if (profile == PH_MMS_PROFILE)
  216.     {
  217.         ReadRecord(
  218.             NVRAM_EF_MMS_PROFILE_CONTENT_LID,
  219.             (U16) (index + 1),
  220.             g_ph_activated_mms_profile,
  221.             NVRAM_EF_MMS_PROFILE_CONTENT_SIZE,
  222.             &error);
  223.     }
  224. }
  225. /*****************************************************************************
  226.  * FUNCTION
  227.  *  mmi_ph_update_nvram_wap_profile
  228.  * DESCRIPTION
  229.  *  This API updates the NVRAM data for the browser profile (both Name & Content)
  230.  * PARAMETERS
  231.  *  void
  232.  * RETURNS
  233.  *  void
  234.  *****************************************************************************/
  235. void mmi_ph_update_nvram_wap_profile(void)
  236. {
  237.     /*----------------------------------------------------------------*/
  238.     /* Local Variables                                                */
  239.     /*----------------------------------------------------------------*/
  240.     S16 error;
  241.     U32 index = g_ph_cntx.profile_index;
  242.     /*----------------------------------------------------------------*/
  243.     /* Code Body                                                      */
  244.     /*----------------------------------------------------------------*/
  245.     if (UCS2Strlen((S8*) g_ph_cntx.profile_display_p->profile_name))
  246.     {
  247.         if (GetUCS2Flag((S8*) g_ph_cntx.profile_display_p->profile_name))
  248.         {
  249.             g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].dcs = PH_DCS_UCS;
  250.             UCS2Strncpy(
  251.                 (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].profile_name),
  252.                 (S8*) g_ph_cntx.profile_display_p->profile_name,
  253.                 NVRAM_WAP_PROFILE_PROFILE_NAME_LEN);
  254.         }
  255.         else
  256.         {
  257.             g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].dcs = PH_DCS_ASCII;
  258.             UnicodeToAnsii(
  259.                 (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].profile_name),
  260.                 (S8*) g_ph_cntx.profile_display_p->profile_name);
  261.         }
  262.     }
  263.     else
  264.     {
  265.         S8 temp_unicode[8];
  266.         S8 temp[4];
  267.         S8 *profile_name_p;
  268.         profile_name_p = (S8*) get_string((MMI_ID_TYPE) STR_ID_PROF_HDLR_PROFILE);
  269.         gui_itoa((S32) (index + 1), (U16*) temp, 10);
  270.         AnsiiToUnicodeString((S8*) temp_unicode, (S8*) temp);
  271.         UCS2Strcpy((S8*) g_ph_cntx.profile_display_p->profile_name, profile_name_p);
  272.         UCS2Strcat((S8*) g_ph_cntx.profile_display_p->profile_name, temp_unicode);
  273.         g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].dcs = PH_DCS_UCS;
  274.         UCS2Strncpy(
  275.             (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].profile_name),
  276.             (S8*) g_ph_cntx.profile_display_p->profile_name,
  277.             NVRAM_WAP_PROFILE_PROFILE_NAME_LEN);
  278.     }
  279.     UnicodeToAnsii((S8*) g_ph_wap_profile_p->homepage_url, (S8*) (g_ph_cntx.profile_display_p->homepage_url));
  280.     UnicodeToAnsii((S8*) (g_ph_wap_profile_p->username), (S8*) (g_ph_cntx.profile_display_p->username));
  281.     UnicodeToAnsii((S8*) (g_ph_wap_profile_p->password), (S8*) (g_ph_cntx.profile_display_p->password));
  282.     if (index == g_ph_cntx.wap_actived_profile_index)
  283.     {
  284.         memcpy(g_ph_activated_wap_profile, g_ph_wap_profile_p, NVRAM_EF_WAP_PROFILE_CONTENT_SIZE);
  285.     }
  286.     WriteRecord(
  287.         NVRAM_EF_WAP_PROFILE_CONTENT_LID,
  288.         (U16) (index + 1),
  289.         g_ph_wap_profile_p,
  290.         NVRAM_EF_WAP_PROFILE_CONTENT_SIZE,
  291.         &error);
  292.     WriteRecord(NVRAM_EF_WAP_PROFILE_NAMES_LID, 1, g_ph_wap_prof_name_arr_p, NVRAM_EF_WAP_PROFILE_NAMES_SIZE, &error);
  293.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  294.     DeleteNHistory(1);
  295. }
  296. /*****************************************************************************
  297.  * FUNCTION
  298.  *  mmi_ph_update_nvram_mms_profile
  299.  * DESCRIPTION
  300.  *  This API updates the NVRAM data for the MMS profile (both Name & Content)
  301.  * PARAMETERS
  302.  *  void
  303.  * RETURNS
  304.  *  void
  305.  *****************************************************************************/
  306. void mmi_ph_update_nvram_mms_profile(void)
  307. {
  308.     /*----------------------------------------------------------------*/
  309.     /* Local Variables                                                */
  310.     /*----------------------------------------------------------------*/
  311.     S16 error;
  312.     U32 index = g_ph_cntx.profile_index;
  313.     /*----------------------------------------------------------------*/
  314.     /* Code Body                                                      */
  315.     /*----------------------------------------------------------------*/
  316.     if (UCS2Strlen((S8*) g_ph_cntx.profile_display_p->profile_name))
  317.     {
  318.         if (GetUCS2Flag((S8*) g_ph_cntx.profile_display_p->profile_name))
  319.         {
  320.             g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].dcs = PH_DCS_UCS;
  321.             UCS2Strncpy(
  322.                 (S8*) (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].profile_name),
  323.                 (S8*) g_ph_cntx.profile_display_p->profile_name,
  324.                 NVRAM_WAP_PROFILE_PROFILE_NAME_LEN);
  325.         }
  326.         else
  327.         {
  328.             g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].dcs = PH_DCS_ASCII;
  329.             UnicodeToAnsii(
  330.                 (S8*) (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].profile_name),
  331.                 (S8*) g_ph_cntx.profile_display_p->profile_name);
  332.         }
  333.     }
  334.     else
  335.     {
  336.         S8 temp_unicode[8];
  337.         S8 temp[4];
  338.         S8 *profile_name_p;
  339.         profile_name_p = (S8*) get_string((MMI_ID_TYPE) STR_ID_PROF_HDLR_PROFILE);
  340.         gui_itoa((S32) (index + 1), (U16*) temp, 10);
  341.         AnsiiToUnicodeString((S8*) temp_unicode, (S8*) temp);
  342.         UCS2Strcpy((S8*) g_ph_cntx.profile_display_p->profile_name, profile_name_p);
  343.         UCS2Strcat((S8*) g_ph_cntx.profile_display_p->profile_name, temp_unicode);
  344.         g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].dcs = PH_DCS_UCS;
  345.         UCS2Strncpy(
  346.             (S8*) (g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].profile_name),
  347.             (S8*) g_ph_cntx.profile_display_p->profile_name,
  348.             NVRAM_WAP_PROFILE_PROFILE_NAME_LEN);
  349.     }
  350.     UnicodeToAnsii((S8*) g_ph_mms_profile_p->mmsc_url, (S8*) (g_ph_cntx.profile_display_p->homepage_url));
  351.     UnicodeToAnsii((S8*) (g_ph_mms_profile_p->username), (S8*) (g_ph_cntx.profile_display_p->username));
  352.     UnicodeToAnsii((S8*) (g_ph_mms_profile_p->password), (S8*) (g_ph_cntx.profile_display_p->password));
  353.     if (index == g_ph_cntx.mms_actived_profile_index)
  354.     {
  355.         memcpy(g_ph_activated_mms_profile, g_ph_mms_profile_p, NVRAM_EF_MMS_PROFILE_CONTENT_SIZE);
  356. #if defined(MMS_SUPPORT)/*dilip*/
  357.         mmi_jmms_set_profile();
  358. #endif
  359.     }
  360.     WriteRecord(
  361.         NVRAM_EF_MMS_PROFILE_CONTENT_LID,
  362.         (U16) (index + 1),
  363.         g_ph_mms_profile_p,
  364.         NVRAM_EF_MMS_PROFILE_CONTENT_SIZE,
  365.         &error);
  366.     WriteRecord(NVRAM_EF_MMS_PROFILE_NAMES_LID, 1, g_ph_mms_prof_name_arr_p, NVRAM_EF_MMS_PROFILE_NAMES_SIZE, &error);
  367.     DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
  368.     DeleteNHistory(1);
  369. }
  370. /*****************************************************************************
  371.  * FUNCTION
  372.  *  mmi_ph_update_nvram_activated_wap_profile
  373.  * DESCRIPTION
  374.  *  Updates the NVRAM browser activated profile content data
  375.  * PARAMETERS
  376.  *  void
  377.  * RETURNS
  378.  *  void
  379.  *****************************************************************************/
  380. void mmi_ph_update_nvram_activated_wap_profile(void)
  381. {
  382.     /*----------------------------------------------------------------*/
  383.     /* Local Variables                                                */
  384.     /*----------------------------------------------------------------*/
  385.     S16 error;
  386.     /*----------------------------------------------------------------*/
  387.     /* Code Body                                                      */
  388.     /*----------------------------------------------------------------*/
  389.     WriteRecord(
  390.         NVRAM_EF_WAP_PROFILE_CONTENT_LID,
  391.         (U16) (g_ph_cntx.wap_actived_profile_index + 1),
  392.         g_ph_activated_wap_profile,
  393.         NVRAM_EF_WAP_PROFILE_CONTENT_SIZE,
  394.         &error);
  395. }
  396. /*****************************************************************************
  397.  * FUNCTION
  398.  *  mmi_ph_update_nvram_activated_mms_profile
  399.  * DESCRIPTION
  400.  *  Updates the NVRAM MMS activated profile content data
  401.  * PARAMETERS
  402.  *  void
  403.  * RETURNS
  404.  *  void
  405.  *****************************************************************************/
  406. void mmi_ph_update_nvram_activated_mms_profile(void)
  407. {
  408.     /*----------------------------------------------------------------*/
  409.     /* Local Variables                                                */
  410.     /*----------------------------------------------------------------*/
  411.     S16 error;
  412.     /*----------------------------------------------------------------*/
  413.     /* Code Body                                                      */
  414.     /*----------------------------------------------------------------*/
  415.     WriteRecord(
  416.         NVRAM_EF_MMS_PROFILE_CONTENT_LID,
  417.         (U16) (g_ph_cntx.mms_actived_profile_index + 1),
  418.         g_ph_activated_mms_profile,
  419.         NVRAM_EF_MMS_PROFILE_CONTENT_SIZE,
  420.         &error);
  421. }
  422. /*****************************************************************************
  423.  * FUNCTION
  424.  *  mmi_ph_update_prov_nvram_wap_profile
  425.  * DESCRIPTION
  426.  *  Updates the NVRAM browser profile data(Both Name & Content) with the provisioing data for the index selected
  427.  * PARAMETERS
  428.  *  void
  429.  * RETURNS
  430.  *  void
  431.  *****************************************************************************/
  432. void mmi_ph_update_prov_nvram_wap_profile(void)
  433. {
  434.     /*----------------------------------------------------------------*/
  435.     /* Local Variables                                                */
  436.     /*----------------------------------------------------------------*/
  437.     S16 error;
  438.     U8 conn_type;
  439.     U32 len = 0;
  440.     U32 index = g_ph_cntx.profile_index;
  441.     /*----------------------------------------------------------------*/
  442.     /* Code Body                                                      */
  443.     /*----------------------------------------------------------------*/
  444.     g_ph_wap_profile_p->data_account = g_ph_cntx.profile_display_p->data_account;
  445.     WriteRecord(
  446.         NVRAM_EF_WAP_PROFILE_CONTENT_LID,
  447.         (U16) (index + 1),
  448.         g_ph_wap_profile_p,
  449.         NVRAM_EF_WAP_PROFILE_CONTENT_SIZE,
  450.         &error);
  451.     if (index == g_ph_cntx.wap_actived_profile_index)
  452.     {
  453.         memcpy(g_ph_activated_wap_profile, g_ph_wap_profile_p, NVRAM_EF_WAP_PROFILE_CONTENT_SIZE);
  454.     }
  455.     conn_type = g_ph_wap_profile_p->conn_type;
  456.     g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].conn_type = conn_type;
  457.     len = strlen((PS8) g_prov_profile_name_p);
  458.     if ((g_prov_profile_name_p != NULL) && (len > 0))
  459.     {
  460.         g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].dcs = PH_DCS_ASCII;
  461.         if (len >= PROV_PROFILE_PROFILE_NAME_LEN)
  462.         {
  463.             len = PROV_PROFILE_PROFILE_NAME_LEN - 1;
  464.         }
  465.         memcpy(g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].profile_name, g_prov_profile_name_p, len);
  466.         g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].profile_name[len] = '';
  467.         jdd_MemFree(g_prov_profile_name_p);
  468.         g_prov_profile_name_p = NULL;
  469.     }
  470.     else
  471.     {
  472.         S8 temp_unicode[8];
  473.         S8 temp[4];
  474.         S8 *profile_name_p;
  475.         S8 temp_name[PROV_PROFILE_PROFILE_NAME_LEN + 1];
  476.         profile_name_p = (S8*) get_string((MMI_ID_TYPE) STR_ID_PROF_HDLR_PROFILE);
  477.         len = UCS2Strlen((S8*) profile_name_p);
  478.         if (len > (PROV_PROFILE_PROFILE_NAME_LEN / 2))
  479.         {
  480.             len = PROV_PROFILE_PROFILE_NAME_LEN / 2;
  481.         }
  482.         if (GetUCS2Flag((S8*) profile_name_p))
  483.         {
  484.             gui_itoa((S32) (index + 1), (U16*) temp, 10);
  485.             AnsiiToUnicodeString((S8*) temp_unicode, (S8*) temp);
  486.             UCS2Strcat((S8*) profile_name_p, (S8*) temp_unicode);
  487.             g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].dcs = PH_DCS_UCS;
  488.             memcpy(
  489.                 g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].profile_name,
  490.                 profile_name_p,
  491.                 len * ENCODING_LENGTH);
  492.         }
  493.         else
  494.         {
  495.             UnicodeNToAnsii((S8*) temp_name, (S8*) profile_name_p, len);
  496.             temp_name[len] = '';
  497.             gui_itoa((S32) (index + 1), (U16*) temp, 10);
  498.             strcat(temp_name, temp);
  499.             len = strlen(temp_name);
  500.             memcpy(g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].profile_name, temp_name, len + 1);
  501.             g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].dcs = PH_DCS_ASCII;
  502.         }
  503.     }
  504.     WriteRecord(NVRAM_EF_WAP_PROFILE_NAMES_LID, 1, g_ph_wap_prof_name_arr_p, NVRAM_EF_WAP_PROFILE_NAMES_SIZE, &error);
  505. }
  506. /*****************************************************************************
  507.  * FUNCTION
  508.  *  mmi_ph_update_prov_nvram_mms_profile
  509.  * DESCRIPTION
  510.  *  Updates the NVRAM browser profile data(Both Name & Content) with the provisioing data for the index selected
  511.  * PARAMETERS
  512.  *  void
  513.  * RETURNS
  514.  *  void
  515.  *****************************************************************************/
  516. void mmi_ph_update_prov_nvram_mms_profile(void)
  517. {
  518.     /*----------------------------------------------------------------*/
  519.     /* Local Variables                                                */
  520.     /*----------------------------------------------------------------*/
  521.     S16 error;
  522.     U32 len;
  523.     U32 index = g_ph_cntx.profile_index;
  524.     /*----------------------------------------------------------------*/
  525.     /* Code Body                                                      */
  526.     /*----------------------------------------------------------------*/
  527.     g_ph_mms_profile_p->data_account = g_ph_cntx.profile_display_p->data_account;
  528.     WriteRecord(
  529.         NVRAM_EF_MMS_PROFILE_CONTENT_LID,
  530.         (U16) (index + 1),
  531.         g_ph_mms_profile_p,
  532.         NVRAM_EF_MMS_PROFILE_CONTENT_SIZE,
  533.         &error);
  534.     if (index == g_ph_cntx.mms_actived_profile_index)
  535.     {
  536.         memcpy(g_ph_activated_mms_profile, g_ph_mms_profile_p, NVRAM_EF_MMS_PROFILE_CONTENT_SIZE);
  537. #if defined(MMS_SUPPORT)/*dilip*/
  538.         mmi_jmms_set_profile();
  539. #endif
  540.     }
  541.     len = strlen((PS8) g_prov_profile_name_p);
  542.     if ((g_prov_profile_name_p != NULL) && (len > 0))
  543.     {
  544.         g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].dcs = PH_DCS_ASCII;
  545.         if (len >= PROV_PROFILE_PROFILE_NAME_LEN)
  546.         {
  547.             len = PROV_PROFILE_PROFILE_NAME_LEN - 1;
  548.         }
  549.         memcpy(g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].profile_name, g_prov_profile_name_p, len);
  550.         g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].profile_name[len] = '';
  551.         jdd_MemFree(g_prov_profile_name_p);
  552.         g_prov_profile_name_p = NULL;
  553.     }
  554.     else
  555.     {
  556.         S8 temp_unicode[8];
  557.         S8 temp[4];
  558.         S8 *profile_name_p;
  559.         S8 temp_name[PROV_PROFILE_PROFILE_NAME_LEN + 1];
  560.         profile_name_p = (S8*) get_string((MMI_ID_TYPE) STR_ID_PROF_HDLR_PROFILE);
  561.         len = UCS2Strlen((S8*) profile_name_p);
  562.         if (len > PROV_PROFILE_PROFILE_NAME_LEN)
  563.         {
  564.             len = PROV_PROFILE_PROFILE_NAME_LEN;
  565.         }
  566.         if (GetUCS2Flag((S8*) profile_name_p))
  567.         {
  568.             gui_itoa((S32) (index + 1), (U16*) temp, 10);
  569.             AnsiiToUnicodeString((S8*) temp_unicode, (S8*) temp);
  570.             UCS2Strcat((S8*) profile_name_p, (S8*) temp_unicode);
  571.             g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].dcs = PH_DCS_UCS;
  572.             memcpy(
  573.                 g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].profile_name,
  574.                 profile_name_p,
  575.                 len * ENCODING_LENGTH);
  576.         }
  577.         else
  578.         {
  579.             UnicodeNToAnsii((S8*) temp_name, (S8*) profile_name_p, len);
  580.             temp_name[len] = '';
  581.             gui_itoa((S32) (index + 1), (U16*) temp, 10);
  582.             strcat(temp_name, temp);
  583.             len = strlen(temp_name);
  584.             memcpy(g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].profile_name, temp_name, len + 1);
  585.             g_ph_mms_prof_name_arr_p->nvram_mms_profile_name_array[index].dcs = PH_DCS_ASCII;
  586.         }
  587.     }
  588.     WriteRecord(NVRAM_EF_MMS_PROFILE_NAMES_LID, 1, g_ph_mms_prof_name_arr_p, NVRAM_EF_MMS_PROFILE_NAMES_SIZE, &error);
  589. }
  590. #endif /* defined (JATAAYU_SUPPORT) && (defined (WAP_SUPPORT) || (defined (MMS_SUPPORT))) */ 
  591. #endif /* _JPROFILESTORAGEHANDLER_C */