150 lines
2.7 KiB
C
150 lines
2.7 KiB
C
|
|
#ifndef SYSTEM_FILE_H__
|
|||
|
|
#define SYSTEM_FILE_H__
|
|||
|
|
|
|||
|
|
#include "base.h"
|
|||
|
|
|
|||
|
|
|
|||
|
|
//定义设置文件名
|
|||
|
|
#define SYSFILE_SETFILE_NAME "Setting.json"
|
|||
|
|
//定义设置文件的大小
|
|||
|
|
#define SYSFILE_SETFILE_SIZE (1024*16-1)
|
|||
|
|
|
|||
|
|
//定义闹钟的最大个数
|
|||
|
|
#define SYSFILE_SETFILE_ALARMNUM 5
|
|||
|
|
|
|||
|
|
|
|||
|
|
//闹钟结构体
|
|||
|
|
typedef struct
|
|||
|
|
{
|
|||
|
|
int year; //闹钟响起之后,自动更新年月日为下次闹钟时间
|
|||
|
|
int month;
|
|||
|
|
int day;
|
|||
|
|
int hour;
|
|||
|
|
int min;
|
|||
|
|
int week; //从0位到6位,分别表示星期天到星期六是否响应闹钟
|
|||
|
|
int power; //此位为1,闹钟打开
|
|||
|
|
int tip; //提示,为1开启震动
|
|||
|
|
}AlarmStruct;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//系统设置描述
|
|||
|
|
typedef struct
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
int screenLightPower; //屏幕背光电源
|
|||
|
|
int screenLight; //屏幕背光亮度
|
|||
|
|
int screenOffTime; //自动灭屏时长
|
|||
|
|
int screenAutoLight; //自动亮度开关
|
|||
|
|
|
|||
|
|
char bootPic[20]; //开机第一屏图片名称
|
|||
|
|
|
|||
|
|
int alarmNum; //当前闹钟个数
|
|||
|
|
AlarmStruct alarm[SYSFILE_SETFILE_ALARMNUM];//闹钟
|
|||
|
|
char alarmRing[256]; //闹钟铃声
|
|||
|
|
|
|||
|
|
int time12Hours; //为1启用12小时制
|
|||
|
|
|
|||
|
|
char backPicPath[50]; //背景图文件路径
|
|||
|
|
|
|||
|
|
}SysFile_SetStruct;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//定义结构体类型
|
|||
|
|
#define SYSFILE_TYPE_RECVFILE 0x00000001
|
|||
|
|
#define SYSFILE_TYPE_ALARM 0x00000002
|
|||
|
|
|
|||
|
|
|
|||
|
|
//定义用于判断结构体类型的结构体
|
|||
|
|
typedef struct
|
|||
|
|
{
|
|||
|
|
int structType; //结构体类型
|
|||
|
|
}SysFile_StructType;
|
|||
|
|
|
|||
|
|
|
|||
|
|
//定义文件接收成功的结构体
|
|||
|
|
typedef struct
|
|||
|
|
{
|
|||
|
|
int structType; //结构体类型
|
|||
|
|
char name[256];
|
|||
|
|
u8 *data;
|
|||
|
|
u32 dataLen;
|
|||
|
|
int recved; //为1,接收成功
|
|||
|
|
}SysFile_RecvedStruct;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//获取设置结构体
|
|||
|
|
SysFile_SetStruct *SysFile_GetSysFile(void);
|
|||
|
|
|
|||
|
|
|
|||
|
|
//保存设置文件
|
|||
|
|
void SysFile_SaveSetFile (void);
|
|||
|
|
|
|||
|
|
//取得设置参数
|
|||
|
|
void SysFile_GetSetFile (void );
|
|||
|
|
|
|||
|
|
//设置文件初始化
|
|||
|
|
void SysFile_SetFileInit (void);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//设置背景图片路径
|
|||
|
|
int SysFile_SetBackPicPath (char *path);
|
|||
|
|
|
|||
|
|
//设置闹钟铃声路径
|
|||
|
|
int SysFile_SetAlarmRingPath (char *path);
|
|||
|
|
|
|||
|
|
//设置启动图片路径
|
|||
|
|
int SysFile_SetBootPicPath(char *path);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
//添加一个闹钟
|
|||
|
|
int SysFile_AddAlarm (AlarmStruct *a);
|
|||
|
|
|
|||
|
|
//修改一个闹钟
|
|||
|
|
int SysFile_AlterAlarm (int index,AlarmStruct *a);
|
|||
|
|
|
|||
|
|
//删除一个闹钟
|
|||
|
|
int SysFile_DelAlarm (int index);
|
|||
|
|
|
|||
|
|
//删除所有闹钟
|
|||
|
|
int SysFile_DelAllAlarm (void);
|
|||
|
|
|
|||
|
|
//获取闹钟个数
|
|||
|
|
int SysFile_GetAlarmNum (void);
|
|||
|
|
|
|||
|
|
//取得指定索引的闹钟
|
|||
|
|
int SysFile_GetAlarm (int index,AlarmStruct *a);
|
|||
|
|
|
|||
|
|
//升级闹钟日期
|
|||
|
|
void SysFile_UpDataAlarm (AlarmStruct *a);
|
|||
|
|
|
|||
|
|
//初始化闹钟
|
|||
|
|
void SysFile_InitAlarm (AlarmStruct *a);
|
|||
|
|
|
|||
|
|
//校验闹钟时间到了吗,1,有闹钟时间到,0,没有
|
|||
|
|
//到时间的闹钟自动把日期设置为下一天
|
|||
|
|
int SysFile_CheckAlarm (void);
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#endif
|
|||
|
|
|