📄 mfw_ffs.c
字号:
#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"
/* SPR#1428 - SH - New Editor changes */
#ifndef NEW_EDITOR
#include "mfw_edt.h"
#endif
#ifdef WIN32
#include "MmiMain.h"
#endif
#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!!
#define hCommACI _ENTITY_PREFIXED(hCommACI)
#if defined (NEW_FRAME)
EXTERN T_HANDLE hCommACI;
#else
EXTERN T_VSI_CHANDLE hCommACI;
#endif
#define hCommMMI hCommACI
typedef enum
{
DATA,
NO_DATA
} WriteFlag;
FlashData FFS_flashData;
static WriteFlag write_flag;
effs_t flash_write(void)
{
return (flash_data_write("/mmi","mmidata", &FFS_flashData, sizeof(FFS_flashData)));
}
effs_t flash_update(void)
{
if (write_flag == DATA)
{ write_flag = NO_DATA;
return (flash_write());
}
else
return EFFS_OK;
}
#ifndef WIN32
// EF 22/10/02 for WIN32 simulation, set anykeyanswer on, and keylock off
/* Marcus: Issue 1719: 11/02/2003: Changed return value from effs_t to int */
int flash_read(void)
{
int val = FFS_fread("/mmi/mmidata", &FFS_flashData, sizeof(FFS_flashData));
if (val == sizeof(FFS_flashData))
{
val = EFFS_OK; /* Successful, return Zero as no data_size as in flash_data_read*/
}
else
{
TRACE_ERROR("The FFS data could not be read!");
TRACE_EVENT_P1("val = %d", val);
/* Error, presumably -ve as in FFS_ERRORS, or the actual number of bytes read */
}
return val;
}
#else
int flash_read()
{FFS_flashData.settings_status|= SettingsAnyKeyAnswerOn;
FFS_flashData.settings_status &= ~SettingsKeyPadLockOn;
FFS_flashData.ConcatenateStatus = TRUE;
}
#endif
effs_t flash_data_write(const char* dir_name, const char* file_name, void* data_pointer, int data_size)
{
T_FFS_DIR dir;
int val;
char file[200];
val = FFS_opendir(dir_name, &dir);
if(val < 0)
{
val = FFS_mkdir(dir_name);
switch(val)
{
case EFFS_OK:
case EFFS_EXISTS:
break;
default:
TRACE_ERROR("The FFS directory could not be created!");
TRACE_EVENT_P2("val = %d dir name = %s", val, dir_name);
return (effs_t)val;
}
}
sprintf(file, "%s/%s", dir_name, file_name);
val = FFS_fwrite( file, data_pointer, data_size);
if(val NEQ EFFS_OK)
{
TRACE_ERROR("The FFS file could not be created");
TRACE_EVENT_P2("val = %d file name = %s", val, file);
}
return (effs_t)val;
}
/* Marcus: Issue 1719: 11/02/2003: Changed return value from effs_t to int */
int flash_data_read(const char* dir_name, const char* file_name, void* data_pointer, int data_size)
{
int val;
char file[200];
sprintf(file, "%s/%s", dir_name, file_name);
val = FFS_fread( file, data_pointer, data_size);
if (val NEQ data_size)
{
TRACE_ERROR("The FFS data could not be read!");
TRACE_EVENT_P1("val = %d", val);
/* Error, presumably -ve as in FFS_ERRORS, or the actual number of bytes read */
}
return val;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -