app.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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. {
  15. #endif
  16. //全局定义声明区
  17. #define BMS_MANUFACTURE (2) //BMS制造商表示1-超力源,2-美顺
  18. #define DATA_MODULE_TYPE (1) //1表示NB模块,2表示4G cat1
  19. #define BMS_INFO (3) //1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺MLS,2-2表示美顺MWL,2-3表示美顺MGM
  20. #define EOLSTATE (0) //1标识下线检测跳过,使用默认值
  21. #if BMS_MANUFACTURE == 1
  22. #if BMS_INFO == 1
  23. #define BATT_CELL_VOL_NUM (14)
  24. #define BATT_TEMP_NUM (3)
  25. #define BATT_OTHER_TEMP_NUM (2)
  26. #elif BMS_INFO == 2
  27. #define BATT_CELL_VOL_NUM (17)
  28. #define BATT_TEMP_NUM (4)
  29. #define BATT_OTHER_TEMP_NUM (2)
  30. #endif
  31. #elif BMS_MANUFACTURE == 2
  32. #if BMS_INFO == 1
  33. #define BATT_CELL_VOL_NUM (20)
  34. #define BATT_TEMP_NUM (3)
  35. #define BATT_OTHER_TEMP_NUM (2)
  36. #elif BMS_INFO == 2
  37. #define BATT_CELL_VOL_NUM (17)
  38. #define BATT_TEMP_NUM (4)
  39. #define BATT_OTHER_TEMP_NUM (2)
  40. #elif BMS_INFO == 3
  41. #define BATT_CELL_VOL_NUM (20)
  42. #define BATT_TEMP_NUM (4)
  43. #define BATT_OTHER_TEMP_NUM (2)
  44. #endif
  45. #endif
  46. #define NB_OTHER_TEMP_NUM (4) //NB采集的温度个数
  47. #define BATT_CELL_VOL_NUM_2 (BATT_CELL_VOL_NUM * 2)
  48. #define HWVERSION 0x0102 //硬件主版本,现为V1.2板
  49. #define BLSWVERSION 0x01020000 //BootLoader版本号V1.2.0.0
  50. #define DRVSWVERSION 0x01050000 //驱动层版本号V1.4.0.0 驱动层1.5.0.0,增加了三轴
  51. //#define APPSWVERSION 0x01020209
  52. #define APPSWVERSION 0x02030030
  53. // #define APPSWVERSION 0x02030000
  54. //#define APPSWVERSION 0x0201000E
  55. //--------------------------------------------------------------------------------
  56. #define BATT_IDLE_SYM 0x00 //静置
  57. #define BATT_CHARGE_SYM 0x02 //充电
  58. #define BATT_DISCHARGE_SYM 0x01 //放电
  59. #define BATT_MOVE_SYM 0x01 //移动
  60. #define BATT_NO_MOVE_SYM 0x00 //静止
  61. #define APP_CONFIG_FILE_LATEST_VERSION 0
  62. #define APP_CONFIG_FILE_NAME "qxappconfig.nvm"
  63. #define APP_DATAINFO_FILE_NAME "qxappDataInfo.nvm"
  64. #define BATT_SN_LEN 17
  65. typedef struct AppNVMDataType
  66. {
  67. BOOL appDataModify; //数据更改标志位
  68. UINT8 battSN[BATT_SN_LEN]; //电池SN号码
  69. BOOL isBattLocked; //0:not locked; 1:locked
  70. UINT8 chargEndWorkTime; //the unit is min
  71. UINT8 wakeupWorkTime; //the unit is min
  72. UINT8 sleepTime;
  73. UINT16 HwVersion;
  74. UINT32 BLSwVersion;
  75. UINT32 DrvSwVersion;
  76. UINT32 AppSwVersion;
  77. UINT8 EOLState;
  78. } AppNVMDataType;
  79. typedef struct AppConfigHeader
  80. {
  81. UINT16 fileBodySize; //file body size, not include size of header;
  82. UINT8 version;
  83. UINT8 checkSum;
  84. } AppConfigHeader;
  85. typedef struct _UartAnswerMsg
  86. {
  87. BOOL UartFlag;
  88. UINT8 dataPtr[8];
  89. UINT16 len;
  90. } UartAnswerMsgType;
  91. typedef enum
  92. {
  93. APP_INIT_STATE,
  94. APP_DEACTIVE_STATE,
  95. APP_IPREADY_STATE,
  96. APP_REPORT_STATE,
  97. APP_IDLE_STATE,
  98. APP_WAIT_STATE
  99. } appRunningState_t;
  100. //uint8_t* Uart_Receive_func(Uart_Receive_Type Uart_Receive_Msg,uint8_t* Uart_Rece_buffer,uint8_t Data_Len);
  101. //累计数据结构体
  102. typedef struct AppDataType
  103. {
  104. BOOL appDataModify; //数据更改标志位
  105. UINT8 BmsChrgInfoSendFreq;
  106. UINT8 BmsDisChrgInfoSendFreq;
  107. UINT8 GpsChrgInfoSendFreq;
  108. UINT8 GpsDisChrgInfoSendFreq;
  109. INT8 BattCurrentNegFlag;
  110. UINT32 CumulativeCapacity;
  111. UINT32 AccMileage;
  112. UINT16 SysReStart;
  113. UINT8 RelayControl;
  114. UINT8 ErrorMsg;
  115. UINT8 userLock;
  116. UINT8 rentalLock;
  117. UINT8 rentaltype;
  118. UINT8 ExpiryTimeArray[6];
  119. } AppDataBody;
  120. typedef struct _AppDataHeader
  121. {
  122. UINT16 fileBodySize; //file body size, not include size of header;
  123. UINT8 checkSum;
  124. } AppDataHeader;
  125. #ifdef __cplusplus
  126. }
  127. #endif
  128. #endif /* APP_H */