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

📄 mmibookutils.c

📁 是一个手机功能的模拟程序
💻 C
📖 第 1 页 / 共 5 页
字号:
/*******************************************************************************

                    CONDAT (UK)

********************************************************************************                                                                              

 This software product is the property of Condat (UK) Ltd and may not be
 disclosed to any third party without the express permission of the owner.                                 
                                                                              
********************************************************************************

 $Project name:	Basic MMI                                                      
 $Project code:	BMI (6349)                                                           
 $Module:		PhoneBook
 $File:		    MmiBookUtils.c
 $Revision:		1.0                                                       
                                                                              
 $Author:		Condat(UK)                                                         
 $Date:		    25/10/00                                                      
                                                                                    
********************************************************************************
                                                                              
 Description:
 
    This module provides utility function for use in the
    phone book application
                        
********************************************************************************

 $History: MmiBookUtils.c

    25/10/00			Original Condat(UK) BMI version.	
        08/08            fzq modified  
        21/08/02     ver0.102  fzq modified
 $End

*******************************************************************************/



/*******************************************************************************
                                                                              
                                Include Files
                                                                              
*******************************************************************************/
#define ENTITY_MFW

/* includes */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#if defined (NEW_FRAME)

    #include "typedefs.h"
    #include "vsi.h"
    #include "pei.h"
    #include "custom.h"
    #include "gsm.h"

#else

    #include "stddefs.h"
    #include "custom.h"
    #include "gsm.h"
    #include "vsi.h"

#endif

#include "mfw_sys.h"

#include "mfw_mfw.h"
#include "mfw_win.h"
#include "mfw_kbd.h"
#include "mfw_lng.h"
#include "mfw_edt.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_tim.h"

#include "mfw_sim.h"
#include "mfw_cm.h"
#include "mfw_nm.h"
#include "mfw_phb.h"
#include "mfw_mme.h"
#include "mfw_sat.h"
#include "mfw_sms.h"

#include "dspl.h"

#include "ksd.h"
#include "psa.h"

#include "MmiMain.h"
#include "MmiBookController.h"
#include "MmiDummy.h"
#include "MmiDialogs.h"
#include "MmiLists.h"



#include "MmiMenu.h"
#include "MmiCall.h"
#include "MmiIcons.h"
#include "MmiIdle.h"

#include "MmiSoftKeys.h"
#include "MmiSounds.h"
#include "MmiIdle.h"
#include "MmiNetwork.h"
#include "MmiSat_i.h"
#include "MmiAoc.h"

#include "gdi.h"
#include "audio.h"

#include "cus_aci.h"
#include "p_sim.h"
#include "mfw_ffs.h"
#include "MmiTimers.h"

#include "MmiBookShared.h"
#include "l1tm_cust_add.h"  //hxl add for pcsync 20020925


/*******************************************************************************
                                                                              
                                Private data elements
                                                                              
*******************************************************************************/
#define MAX_SMSNAME 30
static T_EasyName CallData;
static T_SmsName SmsName[MAX_SMSNAME];
static T_MFW_UPN_LIST   *upnList = NULL;
static T_phbk           *GlobalPhoneBookHandle = NULL;
extern int SelectTotal;
extern UINT8 SimNumber[ALL_SIM_LIST][PHB_number_len/2+1];
uint8 SimReadyFlag=0; //for 3120 (change in findnumber()) hu binhao2002-12-26
extern unsigned char no_wait;
static int SameNumber(char *number1,char * number2);//yq added 2003/2/13 for change findnumber
static void AddSmsDataName(T_EasyName AddName);
/*******************************************************************************
                                                                              
                                Private Methods
                                                                              
*******************************************************************************/

/*******************************************************************************

 $Function:    	changeName

 $Description:	Change a phone book entry if we have a valid book selected
 
 $Returns:		status of change, or MWB_PHB_FAIL if an error occurs

 $Arguments:	book, to be updated
                entry, to update
                currentStatus, pointer to status word
 
*******************************************************************************/

static UBYTE changeName( UBYTE book, T_MFW_PHB_ENTRY *entry, T_MFW_PHB_STATUS *currentStatus )
{
    TRACE_FUNCTION( "changeName()" );

    if ( /* ( book == PHB_UPN ) ||*/ ( book == PHB_SDN ) )
        return MFW_PHB_FAIL;

    return phb_store_entry( book, entry, currentStatus );
}

/*******************************************************************************

 $Function:    	deleteName

 $Description:	Delete a phone book entry
 
 $Returns:		status of delete, or MWB_PHB_FAIL if an error occurs

 $Arguments:	book, to be updated
                index, index of entry to delete
                currentStatus, pointer to status word
 
*******************************************************************************/

static UBYTE deleteName( UBYTE book, UBYTE index, T_MFW_PHB_STATUS *currentStatus )
{
    TRACE_FUNCTION( "deleteName()" );

    if ( /*( book == /*PHB_UPN ) ||*/ ( book == PHB_SDN ) )
        return MFW_PHB_FAIL;

    return phb_delete_entry( book, index, currentStatus );
}

/*******************************************************************************

 $Function:    	addName

 $Description:	Add a new name to the phone book
 
 $Returns:		status of change, or MWB_PHB_FAIL if an error occurs

 $Arguments:	book, to be updated
                entry, to update
                currentStatus, pointer to status word
 
*******************************************************************************/

UBYTE addName( UBYTE book, T_MFW_PHB_ENTRY *entry, T_MFW_PHB_STATUS *currentStatus )
{

    int size;
    T_MFW_PHB_STATUS status;
    TRACE_EVENT( "addName()" );
    status.book=PHB_ADN;   
    if ( phb_get_status(&status)==MFW_PHB_OK )
    {
        size=status.tag_len;
    }

    {

        {
            char temp[100];
            memset(temp,'\0',100);
#ifdef NO_ASCIIZ
            {
                if ( *(entry->name.data)==0x80 )
                {
                    if ( size%2==1 )
                    {
                        entry->name.data[size]=0x00;
                        entry->name.data[size+1]=0x00;
                    }
                    else
                    {
                        entry->name.data[size-1]=0x00;
                        entry->name.data[size]=0x00;
                    }
                }
                else
                {
                    if ( size%2==1 )
                    {
                        //entry->name.data[size-1]=0x00;
                        entry->name.data[size]=0x00;
                        entry->name.data[size+1]=0x00;
                    }
                    else
                    {
                        //entry->name.data[size-2]=0x00;
                        entry->name.data[size-1]=0x00;
                        entry->name.data[size]=0x00;
                    }
                }
                if ( Mmi_getCurrentLanguage() == CHINESE_LANGUAGE )
                {
                    //mfw_Ucs2SIMStr( MFW_DCS_7bits, 
                    //    	       entry->name.data, 
                    //         	   entry->name.len ,
                    //        	   buf.data,
                    //    	       &buf.len );
                    TRACE_EVENT("Converting Unicode 2 SIM");

                    // convert from GSM to Alpha characters
                    //bookGsm2Alpha( (UBYTE *) buf.data );

                    sprintf(temp,"Book: %d Name %s Number %s",
                            book,
                            (char*)entry->name.data,(char*)entry->number);
                }
                else

                {
                    // convert from GSM to Alpha characters
                    //bookGsm2Alpha( (UBYTE *) entry->name.data );

                    sprintf(temp,"Book: %d Name %s Number %s",
                            book,
                            (char*)entry->name.data,(char*)entry->number);
                }
            }
#else
            if ( *(entry->name)==0x80 )
            {
                if ( size%2==1 )
                {
                    entry->name[size]=0x00;
                    entry->name[size+1]=0x00;
                }
                else
                {
                    entry->name[size-1]=0x00;
                    entry->name[size]=0x00;
                }
            }
            else
            {
                if ( size%2==1 )
                {
                    //entry->name.data[size-1]=0x00;
                    entry->name[size]=0x00;
                }
                else
                {
                    //entry->name.data[size-2]=0x00;
                    entry->name[size-1]=0x00;
                }
            }
            sprintf(temp,"Book: %d Name %s Number %s",
                    book,
                    (char*)entry->name,(char*)entry->number);
#endif
            TRACE_EVENT(temp);
        }
        entry->index = 0;
        return phb_store_entry( book, entry, currentStatus );
    }
}

/*******************************************************************************
                                                                              
                          File Handling Utilities
                                                                              
*******************************************************************************/

/*******************************************************************************

 $Function:    	storeInFile

 $Description:	Converts the name to a storeable format and stores it
                in the phone book
 
 $Returns:		None

 $Arguments:	phbk, pointer to phonebook structure
 
*******************************************************************************/

void storeInFile( T_phbk *phbk )
{   int i;
    UBYTE actual_length;
    char debug[20];
    char  temp[100];
    TRACE_FUNCTION( "storeInFile()" );

    // Convert the name

#ifdef NO_ASCIIZ

    // if the pattern is GSM default format, use the function mfw_Gsm2SIMStr() here

#ifdef EASY_TEXT_ENABLED

    if ( phbk->edt_buf_name[0] == 0x80 )//if unicode
    {

⌨️ 快捷键说明

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