#ifndef __MESSAGE_H_ #define __MESSAGE_H_ #include "ListBox.h" #define SMS_FILE "n58_f1" #if 0 #define SMS_START_ADDRESS 0x3E70000 //消息存储首地址 1M处 #else #define SMS_START_ADDRESS 0 #endif #define SMS_TOTAL_NUM 50 //分配消息容量空间(初始化时,n58在第70条时写返回失败了,可能空间不够,暂时未确定) #define SMS_SIZE_PER 128//256 //每条消息大小(包括头信息与内容总体) #define SMS_SIGNAL_LEN (99)//90 //每条信息内容长度 #pragma pack(push) #pragma pack(1) //SUT_SMS_CONF_HEADER typedef struct{ unsigned char resetFlag; //复位标记,如果为R,则复位消息在外部flash的内容,在HGS.SMS资源文件设置为‘R’,每次烧录都会复位 unsigned int newAddr; //保存最新消息的地址,掉电上电使用,在HGS.SMS资源文件设置为0000 }SUT_SMS_CONF_HEADER; //SUT_SMS_INFO_HEADER typedef struct{//每条消息的头信息,带链表 unsigned char flag; //0,没消息 1,有消息 unsigned char read; //0,已读, 1,未读 unsigned int recTime;//消息接收的时间戳 Y:6bit,M:4bit,D:5bit,H:5bit,M:6bit,S:6bit = 32bit unsigned short len; //消息数据长度,除头信息外 unsigned int upperAddr;//指向上一条消息地址 unsigned int nextAddr; //下一条消息地址 }SUT_SMS_INFO_HEADER; #define SMS_INFO_REAL_LEN sizeof(SUT_SMS_INFO_HEADER)-8 //除链表信息外 #define SMS_INFO_DETAIL_OFFSET sizeof(SUT_SMS_INFO_HEADER)//具体消息内容偏移地址 typedef struct{//消息控制使用 unsigned char haveUnRead:1; //0,没有未读消息 1,有未读消息 unsigned char smsUpdate:1; //0,没有收到信息 1,收到信息可以存储 unsigned char poolFull:1; //0,内存充足 1,没内存了 unsigned char smsEnable; //0,消息功能失效,1消息功能正常 unsigned short smsTotalNum; //已存消息数目 unsigned short smsUnReadNum; //未读消息数目 unsigned int newestAddr; //保存从哪开始读消息的地址,即最新消息 unsigned int emptyAddr; //保存消息的地址 unsigned int upToBeRead; //分页向上读时记录上一页开始读的位置 unsigned int downToBeRead; //分页向下读时记录下一页开始读的位置 unsigned int ReadAddr[LIST_ROW];//保存每页显示的消息对应用在外部flash的地址,读取消息所有内容时使用 }SUT_SMS_DEFINE; ////////////////////////////////////////////// #define MESS_EDIT_BUFFER_LEN_MAX 92 //显示具体消息内容长度 typedef struct{ unsigned short x; unsigned char y; char buffer[MESS_EDIT_BUFFER_LEN_MAX+1]; char buffer1[20]; unsigned char item; unsigned char len; unsigned char xlen; unsigned char ylen; FONT_MODEENUM font }SUT_MESSAGE_EDIT; #pragma pack(pop) extern SUT_SMS_DEFINE sutSms; extern SUT_MESSAGE_EDIT sutMEdit; void uiShowMailBox(char update); void MessageResponse(void); void MessageReadShow(char Update); void MessageReadResponse(void); void SetMessageFile(const char *filename); void MessageEditInit(SUT_MESSAGE_EDIT *p,unsigned short x,unsigned char y,char *def,FONT_MODEENUM); unsigned short MessageEditShow(SUT_MESSAGE_EDIT *p,char *def); void MessageDeletShow(char update); void MessageDeletResponse(void); void SetGotNewMessage(void); void ShowMessageFlag(unsigned char show); ////////////////////////////// void SetMessageConfi(void); void IncomingSMS(void); void DeleteSpecificSMS(void); unsigned char GetPagePreMessage(struct SUT_LIST_BOX *p,unsigned char firstRead, char up_down); void MessageOptionShow(char update); void MessageOptionResponse(void); void SMSHandle(void); #endif