message.h 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #ifndef __MESSAGE_H_
  2. #define __MESSAGE_H_
  3. #include "ListBox.h"
  4. #define SMS_FILE "n58_f1"
  5. #if 0
  6. #define SMS_START_ADDRESS 0x3E70000 //消息存储首地址 1M处
  7. #else
  8. #define SMS_START_ADDRESS 0
  9. #endif
  10. #define SMS_TOTAL_NUM 50 //分配消息容量空间(初始化时,n58在第70条时写返回失败了,可能空间不够,暂时未确定)
  11. #define SMS_SIZE_PER 128//256 //每条消息大小(包括头信息与内容总体)
  12. #define SMS_SIGNAL_LEN (99)//90 //每条信息内容长度
  13. #pragma pack(push)
  14. #pragma pack(1)
  15. //SUT_SMS_CONF_HEADER
  16. typedef struct{
  17. unsigned char resetFlag; //复位标记,如果为R,则复位消息在外部flash的内容,在HGS.SMS资源文件设置为‘R’,每次烧录都会复位
  18. unsigned int newAddr; //保存最新消息的地址,掉电上电使用,在HGS.SMS资源文件设置为0000
  19. }SUT_SMS_CONF_HEADER;
  20. //SUT_SMS_INFO_HEADER
  21. typedef struct{//每条消息的头信息,带链表
  22. unsigned char flag; //0,没消息 1,有消息
  23. unsigned char read; //0,已读, 1,未读
  24. unsigned int recTime;//消息接收的时间戳 Y:6bit,M:4bit,D:5bit,H:5bit,M:6bit,S:6bit = 32bit
  25. unsigned short len; //消息数据长度,除头信息外
  26. unsigned int upperAddr;//指向上一条消息地址
  27. unsigned int nextAddr; //下一条消息地址
  28. }SUT_SMS_INFO_HEADER;
  29. #define SMS_INFO_REAL_LEN sizeof(SUT_SMS_INFO_HEADER)-8 //除链表信息外
  30. #define SMS_INFO_DETAIL_OFFSET sizeof(SUT_SMS_INFO_HEADER)//具体消息内容偏移地址
  31. typedef struct{//消息控制使用
  32. unsigned char haveUnRead:1; //0,没有未读消息 1,有未读消息
  33. unsigned char smsUpdate:1; //0,没有收到信息 1,收到信息可以存储
  34. unsigned char poolFull:1; //0,内存充足 1,没内存了
  35. unsigned char smsEnable; //0,消息功能失效,1消息功能正常
  36. unsigned short smsTotalNum; //已存消息数目
  37. unsigned short smsUnReadNum; //未读消息数目
  38. unsigned int newestAddr; //保存从哪开始读消息的地址,即最新消息
  39. unsigned int emptyAddr; //保存消息的地址
  40. unsigned int upToBeRead; //分页向上读时记录上一页开始读的位置
  41. unsigned int downToBeRead; //分页向下读时记录下一页开始读的位置
  42. unsigned int ReadAddr[LIST_ROW];//保存每页显示的消息对应用在外部flash的地址,读取消息所有内容时使用
  43. }SUT_SMS_DEFINE;
  44. //////////////////////////////////////////////
  45. #define MESS_EDIT_BUFFER_LEN_MAX 92 //显示具体消息内容长度
  46. typedef struct{
  47. unsigned short x;
  48. unsigned char y;
  49. char buffer[MESS_EDIT_BUFFER_LEN_MAX+1];
  50. char buffer1[20];
  51. unsigned char item;
  52. unsigned char len;
  53. unsigned char xlen;
  54. unsigned char ylen;
  55. FONT_MODEENUM font
  56. }SUT_MESSAGE_EDIT;
  57. #pragma pack(pop)
  58. extern SUT_SMS_DEFINE sutSms;
  59. extern SUT_MESSAGE_EDIT sutMEdit;
  60. void uiShowMailBox(char update);
  61. void MessageResponse(void);
  62. void MessageReadShow(char Update);
  63. void MessageReadResponse(void);
  64. void SetMessageFile(const char *filename);
  65. void MessageEditInit(SUT_MESSAGE_EDIT *p,unsigned short x,unsigned char y,char *def,FONT_MODEENUM);
  66. unsigned short MessageEditShow(SUT_MESSAGE_EDIT *p,char *def);
  67. void MessageDeletShow(char update);
  68. void MessageDeletResponse(void);
  69. void SetGotNewMessage(void);
  70. void ShowMessageFlag(unsigned char show);
  71. //////////////////////////////
  72. void SetMessageConfi(void);
  73. void IncomingSMS(void);
  74. void DeleteSpecificSMS(void);
  75. unsigned char GetPagePreMessage(struct SUT_LIST_BOX *p,unsigned char firstRead, char up_down);
  76. void MessageOptionShow(char update);
  77. void MessageOptionResponse(void);
  78. void SMSHandle(void);
  79. #endif