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

📄 mfw_ffs.c

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



#include <stdio.h>
#include <string.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 "custom.h"
#include "gsm.h"
#include "vsi.h"

#include "mfw_sys.h"
#include "p_sim.h"

#include "vsi.h"

#include "mfw_mfw.h"
#include "mfw_win.h"

#include "mfw_kbd.h"
#include "mfw_edt.h"
#include "mfw_lng.h"
#include "mfw_tim.h"
#include "mfw_icn.h"
#include "mfw_mnu.h"
#include "mfw_phb.h"
#include "mfw_cm.h"
#include "mfw_sim.h"
#include "mfw_nm.h"
#include "mfw_phb.h"
#include "ksd.h"
#include "psa.h"
#include "mfw_sms.h"
#include "mfw_sat.h"

#include "mfw_ffs.h"

#include "dspl.h"

#include "gdi.h" //ES!!

#ifdef WIN32
    #include "MmiMain.h"
#endif
#include "Audio.h"  
#include "pcm.h"
#include "Mfw_cphs.h"  // line select

#include "../bmi/Mmiblklangdb.h"
#include "../bmi/mmiicons.h"
#include "../bmi/mmi3dframe.h"

//#include "mfw_porting.h"


#define hCommACI _ENTITY_PREFIXED(hCommACI)

#if defined (NEW_FRAME)
EXTERN T_HANDLE hCommACI;
#else
EXTERN T_VSI_CHANDLE hCommACI;
#endif
#define hCommMMI  hCommACI




char CurrentScheFileName[20];

void Common_ffsfile_init(void);
void phonebook_ffsfile_init(void);
void Get_NVM_data(void);
void flash_ConfigDataChecksum_init(void);   
void ConfigFLASHSMSReset(void);
void ffs_Check_stop(void);



TffsfileCmd ffsfileCmd;//ffs file cmd storage ,hxl add 2002-11-26

typedef enum
{
    DATA,
    NO_DATA
} WriteFlag;


FlashData FFS_flashData;
//-------------------------hxl added------------------------------
static const FlashData FlashDefaultData=
{
    /*current time*/
    0,  //uint8 current_hour;
    0,   //	uint8 current_minute;
    /*current date*/
    0, //	uint8 current_day;
    0, //	uint8 current_month;
    0, //	uint16 current_year;
    /*alarm data*/
    0, //	uint8 alarm_hour;
    0, //	uint8 alarm_minute;
    0, //	uint8 alarm_day;
    0, //	uint8 alarm_month;
    0, //	uint16 alarm_year;
    20, //    uint8 timeZone;  BeiJing time
    1, //  unit8 cityNumber;
    0,  // full hour alert flag
    12, //everyday alarm hour
    30, //everyday alarm min
    0,  //everyday alarm switch
    12, //weekly alarm hour
    30, //weekly alarm min
    0,  //weekly alarm switch, it should be decode
    "",    //uint8  weeklyChineseString[50];
    "",    //uint8  weeklyEnglishString[50];
    /*Call timers*/
    0, //	uint32 last_call_duration;
    0, //	uint32 incoming_calls_duration;
    0, //	uint32 outgoing_calls_duration;

    /*MSSET data*/

    0, //	uint8 output_volume;
    0, //	uint8 voice_memo_position;
    0, //	uint8 PLMN_selection_mode;
    0,     //uint8 Band_restriction; //xsf 2002.07.31 for band set
    0, //	uint8 redial_mode;
    1, //   uint8 time_format;
    0,// uint8 call_minute_flag WUFEI ADD

    /* Network Log              */
    0, //   uint8 net_log_status;                 /* status                   */
    {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0}, //   uint8 plmn_name[20];                /* plmn name                */
    {0,0,0,0, 0,0},    //   uint8 network_name [6];             /* plmn name numeric        */

    /*Setting status*/

    0, //	uint8 settings_status;

    {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,},   //	uint8 voice_mail[22];

    /*mailbox number*/
    {0,0,0,0, 0,0,0,0, 0,0},   //	uint8 mbn_AlphId[10];
    0, //	uint8 mbn_len;
    0, //	uint8 mbn_numTp;
    {0,0,0,0, 0,0,0,0, 0,0},   //	uint8 mbn_Num[10];

    //Predictive text Flags
    0, //	uint8 PredTextAvailable;
    0, //	uint8 PredTextSelected;

    //CPHS ALS info
    0, //	uint8 als_selLine;
    0, // 	uint8 als_statLine;
    0,0,{0,0},{0,0}, //gdy add autopower
    {0,0,0,0,0,0,0,0,0,0,0,0,0},//gdy add for latest alarm time
    AllLanguage,//CB language
    0xFF,
    {0, 0xFE, 0xFF, 0xFF, 0xFF,
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
        0xFF, 0xFF, 0xFF, 0xFF, 0xFF},//CB DCS 
    {0x0000, 0x0001, 0x0002, 0x0003, 0x0004,0x0005,0x0006,0x0007,0x0008,0x0009,0xFFFF,0xFFFF,
        0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF,0xFFFF},//CB MID 
    0,
    0,
    {TxtSendSms,TxtReadSms,TxtAlarm,TxtScene,TxtMissedCalls,TxtIncomingCalls,0,0,0,0,0,0,0,0,0}, //zhangxp add for shortcut menu
    2,//开机动画		/* 2004/06/01 sunsj modify */
    0,//uint language 中文
    7,//对比度强度
    0,10,0  //hxl add for dict 2002-12-24
};
FieldTest   FFS_FieldTest;

static const FieldTest FieldTestDefault=
{
    0xA5,
    0xA5,
    0xA5,
    0xA5,
    0xA5,
    0xA5,
    0xA5,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    0,
    '\0'
};


FlashConstData  Ffs_const_data;
static const FlashConstData FlashConstDefaultData=
{
    {0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38}   // 	uint8 serialnumber[8];

};

void flash_constdata_init(void)
{
    Ffs_const_data = FlashConstDefaultData;
}

effs_t flash_constdata_write()
{ 
    MmiTrace("flash_constdata_write");
    return ffs_fwrite(FFSFILE_CONSTCONFIG_PATH,  &Ffs_const_data, sizeof(Ffs_const_data));

}

effs_t flash_constdata_read()
{
    flash_constdata_init();//hxl add for avoid fread fail error 2002-11-25
    return ffs_fread(FFSFILE_CONSTCONFIG_PATH,  &Ffs_const_data, sizeof(Ffs_const_data));
}

//----------------------------end of hxl add------------------------------

//------------------------------WUFEI ADD 02/08/06--------------------------------
//Divert usual used number and cug number table:
FlashDCTb FlashDCTbData; //WUFEI
static const FlashDCTb FlashDCTbDefaultData=
{
    0,
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},//wufei add 1008
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},//hu binhao add 11-21
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},//wufei add 1008
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},//wufei add 1008
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},//wufei add 1008
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},//hu binhao add 11-21
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},//wufei add 1008
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},//wufei add 1008
    0,
    0, //hu binhao add 11-21 
    0,
    0,
    0,  //wufei add 0827
    0,//wufei add 0827
    0,//wufei add 0827
    1,//wufei add 0827  hu binhao change from 0 to 1 ,because the default select line is 1
    0,//wufei add 0918
    0,//hu binhao add 2002-11-28
    {0,0,0,0,0,0,0,0,0,0}, //hu binhao add 2002-11-28
    0,      //hu binhao 2002-12-23
    {0,0,0,0,0,0,0,0,0,0}, //hu binhao 2002-12-27 for 3120
    {0,0,0,0,0,0,0,0,0,0}, //hu binhao 2002-12-27 for 3120
    {0,0,0,0,0,0,0,0,0,0}, //hu binhao 2002-12-27 for 3120
    {0,0,0,0,0,0,0,0,0,0}, //hu binhao 2002-12-27 for 3120
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}}, //hu binhao 2002-12-28 for 3120
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}}, //hu binhao 2002-12-28 for 3120
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}}, //hu binhao 2002-12-28 for 3120
    {{0},{0},{0},{0},{0},{0},{0},{0},{0},{0}},//hu binhao 2002-12-28 for 3120
    0,
    0


};
//------added by ganchh-----------2002/8/27
const EF_RFCAP FlashRFCAPDataDefault=
{
    0x00,0x0B,0x41,0x00,0x00,0x00,0x00,0x00,0x50,0x00,0x00,0xA5,0X05,0x00,0xC0,0x00
};
//-----------ganchh

void FlashDCTbInitialise(void)
{
    FlashDCTbData = FlashDCTbDefaultData;
}

//----------added by ganchh 2002/8/27------------
effs_t FlashRFCAPInitialise()
{
    EF_RFCAP  FlashRFCAPData;
    FlashRFCAPData=FlashRFCAPDataDefault;
    return ffs_fwrite("/gsm/com/rfcap",&FlashRFCAPData, sizeof(EF_RFCAP));

}
//---------------ganchh
effs_t flash_DCTbwrite()
{
    MmiTrace("flash_DCTbwrite");

    //return ffs_fwrite("/mmi/DCTbData",&FlashDCTbData, sizeof(FlashDCTbData));//hxl delete for managing write flash
    ffsfileCmd.ffsfile[DCTFileIdx].pdir=FFSFILE_DCTB_PATH;
    ffsfileCmd.ffsfile[DCTFileIdx].pdata=&FlashDCTbData;
    ffsfileCmd.ffsfile[DCTFileIdx].size=sizeof(FlashDCTbData);
    ffsfileCmd.ffsfile[DCTFileIdx].writeStatus=1;
    //if time is stop
    return 0;

}

effs_t flash_DCTbread()
{
    uint8   readErrFlag;    //hu binhao 2002-11-28
    uint8   i,n;               //hu binhao 2002-11-28

    FlashDCTbInitialise();//hxl add for avoid fread fail error 2002-11-25
    /* 2004/04/22 sunsj modify */
    return ffs_fread(FFSFILE_DCTB_PATH,&FlashDCTbData, sizeof(FlashDCTbData));

    //----------------hu binhao 2002-11-28 begin---------------------------------
    //case : call number large than 10 
    readErrFlag=0;
    /*
    if((FlashDCTbData.LMNID>10)||(FlashDCTbData.LJNID>10)||(FlashDCTbData.LRNID>10)||(FlashDCTbData.LDNID>10)||(FlashDCTbData.MissedCallNum>10))
        {
            readErrFlag=1;
            FlashDCTbInitialise();
        }*/
    if( FlashDCTbData.LMNID>10 )
    {
        FlashDCTbData.LMNID=10;
        readErrFlag=1;
    }
    if( FlashDCTbData.LJNID>10 )
    {
        FlashDCTbData.LJNID=10;
        readErrFlag=1;
    }
    if( FlashDCTbData.LRNID>10 )
    {
        FlashDCTbData.LRNID=10;
        readErrFlag=1;
    }
    if( FlashDCTbData.LDNID>10 )
    {
        FlashDCTbData.LDNID=10;
        readErrFlag=1;
    }
    if( FlashDCTbData.MissedCallNum>10 )
    {
        FlashDCTbData.MissedCallNum=10;
        readErrFlag=1;
    }
    //case : flags beyond range
    if( (FlashDCTbData.nextcall!=0)&&(FlashDCTbData.nextcall!=1)&&(FlashDCTbData.nextcall!=2) )
    {
        readErrFlag=1;
        FlashDCTbData.nextcall=0;
    }
    if( FlashDCTbData.hideIDflag>1 )
    {
        readErrFlag=1;
        FlashDCTbData.hideIDflag&=1;
    }
    if( FlashDCTbData.callwaitflag>1 )
    {
        readErrFlag=1;
        FlashDCTbData.callwaitflag&=1;
    }

    if( FlashDCTbData.AutoAnswerFlag>1 )
    {
        readErrFlag=1;
        FlashDCTbData.AutoAnswerFlag&=1;
    }

    //case missedcalls is no equal the "1" num in Lmnfalg[10]
    n=0;
    for( i = 0; i < 10; i++ )
    {
        if( FlashDCTbData.LMNflag[i]==1 )
            n++;
    }
    if( n>FlashDCTbData.MissedCallNum )
    {
        readErrFlag=1;
        for( i = 0; i < 10; i++ )
            FlashDCTbData.LMNflag[i]=0; 
        FlashDCTbData.MissedCallNum=0;

    }

⌨️ 快捷键说明

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