123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #ifndef __MESSAGE_H
- #define __MESSAGE_H
- /*****************************************************************/
- #include <stm32f10x.h>
- #include "Includes.h"
- //#define REPORT_SMS_VOICE define it if you want report SMS local
-
- #if 0
- #define SMS_START_ADDRESS 0x3E70000 //消息存储首地址 1M处
- #else
- #define SMS_START_ADDRESS 0x00300000 //消息存在第1.5M开始的0.5M大小处,1000条站0.5M
- #endif
-
- #define SMS_TOTAL_NUM 1000 //分配消息容量空间
- #define SMS_SIZE_PER 512//256 //每条消息大小(包括头信息与内容总体)
- #define SMS_SIGNAL_LEN (400)//90 //每条信息内容长度
-
- //SUT_SMS_CONF_HEADER
- struct SUT_SMS_CONF_HEADER
- {
- uint8_t resetFlag; //复位标记,如果为R,则复位消息在外部flash的内容,在HGS.SMS资源文件设置为‘R’,每次烧录都会复位
- uint32_t newAddr; //保存最新消息的地址,掉电上电使用,在HGS.SMS资源文件设置为0000
- }__attribute__((packed));
- //SUT_SMS_INFO_HEADER
- struct SUT_SMS_INFO_HEADER
- {//每条消息的头信息,带链表
- uint8_t flag; //0,没消息 1,有消息
- uint8_t read; //0,已读, 1,未读
- uint32_t recTime;//消息接收的时间戳 Y:6bit,M:4bit,D:5bit,H:5bit,M:6bit,S:6bit = 32bit
- uint16_t len; //消息数据长度,除头信息外
- uint32_t upperAddr;//指向上一条消息地址
- uint32_t nextAddr; //下一条消息地址
- }__attribute__((packed));
- #define SMS_INFO_REAL_LEN sizeof(struct SUT_SMS_INFO_HEADER)-8 //除链表信息外
- #define SMS_INFO_DETAIL_OFFSET sizeof(struct SUT_SMS_INFO_HEADER)//具体消息内容偏移地址
-
- //SUT_SMS_DEFINE
- struct SUT_SMS_DEFINE
- {//消息控制使用
- uint8_t haveUnRead:1; //0,没有未读消息 1,有未读消息
- uint8_t smsUpdate:1; //0,没有收到信息 1,收到信息可以存储
- uint8_t poolFull:1; //0,内存充足 1,没内存了
-
- uint8_t smsEnable; //0,消息功能失效,1消息功能正常
- uint16_t smsTotalNum; //已存消息数目
- uint16_t smsUnReadNum; //未读消息数目
- uint32_t newestAddr; //保存从哪开始读消息的地址,即最新消息
- uint32_t emptyAddr; //保存消息的地址
-
- uint32_t upToBeRead; //分页向上读时记录上一页开始读的位置
- uint32_t downToBeRead; //分页向下读时记录下一页开始读的位置
-
- uint32_t ReadAddr[LIST_ROW];//保存每页显示的消息对应用在外部flash的地址,读取消息所有内容时使用
- }__attribute__((packed));
- //////////////////////////////////////////////
- #define MESS_EDIT_BUFFER_LEN_MAX 92 //显示具体消息内容长度
- typedef struct SUT_MESSAGE_EDIT
- {
- 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;
- }SUT_MESSAGE_EDIT;
- extern struct SUT_SMS_DEFINE sutSms;
- void UIShowMailBox(int update);
- void MessageResponse(void);
- void MessageReadShow(int Update);
- void MessageReadResponse(void);
- void SetMessageFile(const char *filename);
- void MessageEditInit(SUT_MESSAGE_EDIT *p,unsigned short x,unsigned char y,char *def);
- unsigned short MessageEditShow(SUT_MESSAGE_EDIT *p,char *def);
- void MessageDeletShow(int update);
- void MessageDeletResponse(void);
- void SetGotNewMessage(void);
- void ShowMessageFlag(uint8_t show);
- //////////////////////////////
- void SetMessageConfi(void);
- void IncomingSMS(void);
- void DeleteSpecificSMS(void);
- uint8_t GetPagePreMessage(struct SUT_LIST_BOX *p,uint8_t firstRead, char up_down);
- void MessageOptionShow(int update);
- void MessageOptionResponse(void);
- #endif
|