⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jprofilestoragehandler.c

📁 MTK_MMI的部分源代码,从code中大致了解到MMI的执行流程
💻 C
📖 第 1 页 / 共 2 页
字号:
/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2005
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE. 
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/

/*****************************************************************************
 *
 * Filename:
 * ---------
 * JProfileStorageHandler.C
 *
 * Project:
 * --------
 *   MAUI
 *
 * Description:
 * ------------
 *   This is source file for NVRAM storage related part for the profiles (BROWSER & MMS .....)
 *
 * Author:
 * -------
 * -------
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/

#ifndef _JPROFILESTORAGEHANDLER_C
#define _JPROFILESTORAGEHANDLER_C

#include "MMI_features.h"

#if defined (JATAAYU_SUPPORT) && (defined (WAP_SUPPORT) || (defined (MMS_SUPPORT)))


#include "stdC.h"
#include "L4Dr1.h"
#include "PixtelDataTypes.h"
#include "EventsGprot.h"
#include "Ucs2prot.h"
#include "Unicodexdcl.h"
#include "wgui_categories_util.h"

#include "NVRAMType.h"
#include "NVRAMProt.h"
#include "NVRAMEnum.h"

#include "custom_nvram_editor_data_item.h"

#include "JProvWap.h"

#include "JProfileHandlerDefs.h"
#include "JProfileHandlerTypes.h"
#include "JProfileHandlerProts.h"

#if defined(MMS_SUPPORT)//dilip
extern void mmi_jmms_set_profile(void);
#endif
extern pBOOL GetUCS2Flag(PS8 buffer);


/*****************************************************************************
 * FUNCTION
 *  mmi_ph_get_brw_profile_name_list
 * DESCRIPTION
 *  This reads the browser profile name list from the NVRAM
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ph_get_brw_profile_name_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    S16 error;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_ph_wap_prof_name_arr_p == NULL)
    {
        g_ph_wap_prof_name_arr_p =
            (nvram_wap_profile_name_array_struct*) jdd_MemAlloc(NVRAM_EF_WAP_PROFILE_NAMES_SIZE, 1);
    }
    ReadRecord(NVRAM_EF_WAP_PROFILE_NAMES_LID, 1, g_ph_wap_prof_name_arr_p, NVRAM_EF_WAP_PROFILE_NAMES_SIZE, &error);
}

/*****************************************************************************
 * FUNCTION
 *  mmi_ph_get_mms_profile_name_list
 * DESCRIPTION
 *  This reads the MMS profile name list from the NVRAM
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ph_get_mms_profile_name_list(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    S16 error;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_ph_mms_prof_name_arr_p == NULL)
    {
        g_ph_mms_prof_name_arr_p =
            (nvram_mms_profile_name_array_struct*) jdd_MemAlloc(NVRAM_EF_MMS_PROFILE_NAMES_SIZE, 1);
    }
    ReadRecord(NVRAM_EF_MMS_PROFILE_NAMES_LID, 1, g_ph_mms_prof_name_arr_p, NVRAM_EF_MMS_PROFILE_NAMES_SIZE, &error);
}

/*****************************************************************************
 * FUNCTION
 *  mmi_ph_get_profile_nvram_content_data
 * DESCRIPTION
 *  This reads the content data for the given profile index from the NVRAM
 * PARAMETERS
 *  index       [IN]        Index of the profile
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ph_get_profile_nvram_content_data(U8 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    S16 error;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (g_ph_cntx.profile_module == PH_BROWSER_PROFILE)
    {
        ReadRecord(
            NVRAM_EF_WAP_PROFILE_CONTENT_LID,
            (U16) (index + 1),
            g_ph_wap_profile_p,
            NVRAM_EF_WAP_PROFILE_CONTENT_SIZE,
            &error);
    }
    else if (g_ph_cntx.profile_module == PH_MMS_PROFILE)
    {
        ReadRecord(
            NVRAM_EF_MMS_PROFILE_CONTENT_LID,
            (U16) (index + 1),
            g_ph_mms_profile_p,
            NVRAM_EF_MMS_PROFILE_CONTENT_SIZE,
            &error);
    }
}


/*****************************************************************************
 * FUNCTION
 *  mmi_ph_get_activated_profile_data
 * DESCRIPTION
 *  This gets the activated profile content data from the NVRAM into the global context of the activated profile
 * PARAMETERS
 *  profile     [IN]        Profile type(Browser,MMS.....)
 *  index       [IN]        Activated profile index
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ph_get_activated_profile_data(ph_profile_enum profile, U8 index)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    S16 error;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (profile == PH_BROWSER_PROFILE)
    {
        ReadRecord(
            NVRAM_EF_WAP_PROFILE_CONTENT_LID,
            (U16) (index + 1),
            g_ph_activated_wap_profile,
            NVRAM_EF_WAP_PROFILE_CONTENT_SIZE,
            &error);
    }
	else if (profile == PH_MMS_PROFILE)
    {
        ReadRecord(
            NVRAM_EF_MMS_PROFILE_CONTENT_LID,
            (U16) (index + 1),
            g_ph_activated_mms_profile,
            NVRAM_EF_MMS_PROFILE_CONTENT_SIZE,
            &error);
    }

}


/*****************************************************************************
 * FUNCTION
 *  mmi_ph_update_nvram_wap_profile
 * DESCRIPTION
 *  This API updates the NVRAM data for the browser profile (both Name & Content)
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_ph_update_nvram_wap_profile(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    S16 error;

    U32 index = g_ph_cntx.profile_index;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (UCS2Strlen((S8*) g_ph_cntx.profile_display_p->profile_name))
    {
        if (GetUCS2Flag((S8*) g_ph_cntx.profile_display_p->profile_name))
        {
            g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].dcs = PH_DCS_UCS;
            UCS2Strncpy(
                (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].profile_name),
                (S8*) g_ph_cntx.profile_display_p->profile_name,
                NVRAM_WAP_PROFILE_PROFILE_NAME_LEN);
        }
        else
        {
            g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].dcs = PH_DCS_ASCII;
            UnicodeToAnsii(
                (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].profile_name),
                (S8*) g_ph_cntx.profile_display_p->profile_name);
        }
    }
    else
    {
        S8 temp_unicode[8];
        S8 temp[4];
        S8 *profile_name_p;

        profile_name_p = (S8*) get_string((MMI_ID_TYPE) STR_ID_PROF_HDLR_PROFILE);
        gui_itoa((S32) (index + 1), (U16*) temp, 10);
        AnsiiToUnicodeString((S8*) temp_unicode, (S8*) temp);
        UCS2Strcpy((S8*) g_ph_cntx.profile_display_p->profile_name, profile_name_p);
        UCS2Strcat((S8*) g_ph_cntx.profile_display_p->profile_name, temp_unicode);

        g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].dcs = PH_DCS_UCS;
        UCS2Strncpy(
            (S8*) (g_ph_wap_prof_name_arr_p->nvram_wap_profile_name_array[index].profile_name),
            (S8*) g_ph_cntx.profile_display_p->profile_name,
            NVRAM_WAP_PROFILE_PROFILE_NAME_LEN);
    }

    UnicodeToAnsii((S8*) g_ph_wap_profile_p->homepage_url, (S8*) (g_ph_cntx.profile_display_p->homepage_url));
    UnicodeToAnsii((S8*) (g_ph_wap_profile_p->username), (S8*) (g_ph_cntx.profile_display_p->username));
    UnicodeToAnsii((S8*) (g_ph_wap_profile_p->password), (S8*) (g_ph_cntx.profile_display_p->password));

    if (index == g_ph_cntx.wap_actived_profile_index)
    {
        memcpy(g_ph_activated_wap_profile, g_ph_wap_profile_p, NVRAM_EF_WAP_PROFILE_CONTENT_SIZE);
    }

    WriteRecord(
        NVRAM_EF_WAP_PROFILE_CONTENT_LID,
        (U16) (index + 1),
        g_ph_wap_profile_p,
        NVRAM_EF_WAP_PROFILE_CONTENT_SIZE,
        &error);
    WriteRecord(NVRAM_EF_WAP_PROFILE_NAMES_LID, 1, g_ph_wap_prof_name_arr_p, NVRAM_EF_WAP_PROFILE_NAMES_SIZE, &error);

    DisplayPopup((PU8) GetString(STR_GLOBAL_DONE), IMG_GLOBAL_ACTIVATED, 1, UI_POPUP_NOTIFYDURATION_TIME, SUCCESS_TONE);
    DeleteNHistory(1);

}


/*****************************************************************************
 * FUNCTION
 *  mmi_ph_update_nvram_mms_profile
 * DESCRIPTION
 *  This API updates the NVRAM data for the MMS profile (both Name & Content)
 * PARAMETERS
 *  void

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -