app.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. /****************************************************************************
  2. *
  3. * Copy right: 2017-, Copyrigths of EigenComm Ltd.
  4. * File name: app.h
  5. * Description: EC616 onenet demo entry header file
  6. * History: Rev1.0 2018-07-12
  7. *
  8. ****************************************************************************/
  9. #include "commontypedef.h"
  10. #ifndef APP_H
  11. #define APP_H
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. //全局定义声明区
  16. #define BMS_MANUFACTURE (1) //BMS制造商表示1-超力源,2-美顺
  17. #define DATA_MODULE_TYPE (1) //1表示NB模块,2表示4G cat1
  18. #define BAT4830
  19. //#define BAT6060 //电池型号变化需要更改
  20. #ifdef BAT4830
  21. #define BATT_CELL_VOL_NUM (14)
  22. #define BATT_TEMP_NUM (3)
  23. #define BMS_INFO (1) //1BMS信息表示4830
  24. #define BATT_OTHER_TEMP_NUM (2)
  25. #elif defined BAT6060
  26. #define BATT_CELL_VOL_NUM (17)
  27. #define BATT_TEMP_NUM (5)
  28. #define BMS_INFO (2) //2-BMS信息表示6060
  29. #define BATT_OTHER_TEMP_NUM (2)
  30. #endif
  31. #define BATT_CELL_VOL_NUM_2 (BATT_CELL_VOL_NUM*2)
  32. #define BATT_SN_LEN 17
  33. #define HWVERSION 0x0102 //硬件主版本,现为V1.2板
  34. #define BLSWVERSION 0x01020000 //BootLoader版本号V1.2.0.0
  35. #define DRVSWVERSION 0x01040000 //驱动层版本号V1.4.0.0
  36. #define APPSWVERSION 0x01020118
  37. //--------------------------------------------------------------------------------
  38. #define APP_CONFIG_FILE_LATEST_VERSION 0
  39. #define APP_CONFIG_FILE_NAME "qxappconfig.nvm"
  40. #define APP_DATAINFO_FILE_NAME "qxappDataInfo.nvm"
  41. typedef struct AppNVMDataType
  42. {
  43. BOOL appDataModify; //数据更改标志位
  44. UINT8 battSN[BATT_SN_LEN]; //电池SN号码
  45. BOOL isBattLocked; //0:not locked; 1:locked
  46. UINT8 chargEndWorkTime; //the unit is min
  47. UINT8 wakeupWorkTime; //the unit is min
  48. UINT8 sleepTime;
  49. UINT16 HwVersion;
  50. UINT32 BLSwVersion;
  51. UINT32 DrvSwVersion;
  52. UINT32 AppSwVersion;
  53. UINT8 EOLState;
  54. }AppNVMDataType;
  55. typedef struct AppConfigHeader
  56. {
  57. UINT16 fileBodySize; //file body size, not include size of header;
  58. UINT8 version;
  59. UINT8 checkSum;
  60. }AppConfigHeader;
  61. typedef struct _UartAnswerMsg
  62. {
  63. bool UartFlag;
  64. UINT8 dataPtr[8];
  65. UINT16 len;
  66. }UartAnswerMsgType;
  67. typedef enum
  68. {
  69. APP_INIT_STATE,
  70. APP_DEACTIVE_STATE,
  71. APP_IPREADY_STATE,
  72. APP_REPORT_STATE,
  73. APP_IDLE_STATE,
  74. APP_WAIT_STATE
  75. } appRunningState_t;
  76. //uint8_t* Uart_Receive_func(Uart_Receive_Type Uart_Receive_Msg,uint8_t* Uart_Rece_buffer,uint8_t Data_Len);
  77. //累计数据结构体
  78. typedef struct AppDataType
  79. {
  80. BOOL appDataModify; //数据更改标志位
  81. UINT8 BmsChrgInfoSendFreq;
  82. UINT8 BmsDisChrgInfoSendFreq;
  83. UINT8 GpsChrgInfoSendFreq;
  84. UINT8 GpsDisChrgInfoSendFreq;
  85. UINT32 CumulativeCapacity;
  86. }AppDataBody;
  87. typedef struct _AppDataHeader
  88. {
  89. UINT16 fileBodySize; //file body size, not include size of header;
  90. UINT8 checkSum;
  91. }AppDataHeader;
  92. #ifdef __cplusplus
  93. }
  94. #endif
  95. #endif /* APP_H */