AppConfig.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /****************************************************************************
  2. *
  3. * Copy right: 2021-, Copyrigths of RLWL Ltd.Chen J
  4. * File name: AppConfig.h
  5. * Description: App Config H file 配置文件,可以针对不同参数进行更改
  6. * History: Rev3.0 2021-07-06
  7. *
  8. ****************************************************************************/
  9. #ifndef APPCONFIG_H
  10. #define APPCONFIG_H
  11. #define BMS_MANUFACTURE (3) //BMS制造商表示1-超力源,2-美顺,3-金茂卡车项目
  12. #define BMS_INFO (1) //1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺6455
  13. #define DATA_MODULE_TYPE (1) //1表示NB模块,2表示4G cat1
  14. #define EOLSTATE (0) //1表示下线检测跳过,使用默认值,0表示使用下线检测
  15. #define DEFAULT_SN "JMTEST00000000001" //默认上传的SN编码
  16. #define APPSWVERSION 0x0300000E //数据模块软件版本号
  17. #define TCP_ADD "iotp.fast-fun.cn" //数据上传的地址
  18. #define TCP_PORT 8712 //数据上传的端口
  19. #define NB_OTHER_TEMP_NUM (4) //NB采集的温度个数
  20. #define HWVERSION 0x0102 //硬件主版本,现为V1.2板
  21. #define BLSWVERSION 0x01020000 //BootLoader版本号V1.2.0.0
  22. #define DRVSWVERSION 0x01050000 //驱动层版本号V1.4.0.0 驱动层1.5.0.0,增加了三轴
  23. #define APP_CONFIG_FILE_NAME "qxappconfig.nvm"
  24. #define APP_DATAINFO_FILE_NAME "qxappDataInfo3.nvm"
  25. #define BATT_SN_LEN 17
  26. #define BMS_OTHER_TEMP 2
  27. #define CELL_NUM 384
  28. #define CELL_TEMP_NUM 64
  29. #define BATT_IDLE_SYM 0x00 //静置
  30. #define BATT_CHARGE_SYM 0x02 //充电
  31. #define BATT_DISCHARGE_SYM 0x01 //放电
  32. #define BATT_MOVE_SYM 0x01 //移动
  33. #define BATT_NO_MOVE_SYM 0x00 //静止
  34. #define TCP_START_SYM1 0x23
  35. #define TCP_START_SYM2 0x23
  36. #define TCP_CMD_SYM 0x02 //实时信息上报是0x02
  37. #define TCP_HEART_SYM 0x07 //心跳包标志
  38. #define TCP_ANS_SYM 0xFE
  39. /*-------以下为下行指令定义区----------*/
  40. #define TCP_QUERY_SYM 0x80
  41. #define TCP_SETCMD_SYM 0x81
  42. #define TCP_CONCMD_SYM 0x82
  43. /*----------------end----------------*/
  44. //encrypt methord
  45. #define TCP_ENCPT_ENABLE 0x00
  46. #define TCP_ENCPT_DISABLE 0x01
  47. //message type mark 0x02上报数据单元定义区
  48. #define BATTMSG 0x80
  49. #define GPSMSG 0x82
  50. #define STATESMSG 0x85
  51. #define VERSIONMSG 0x86
  52. #define DEBUGMSG 0x8C
  53. //BMS升级区定义
  54. #define FLASH_BMS_FOTA_START_ADDR 0x2E6000 //BMS升级文件存储起始地址
  55. #define FLASH_BMS_FOTA_LEN 0x32000 //BMS升级文件存储长度 = =200k
  56. #define FLASH_BMS_FOTA_END_ADDR 0x318000 //BMS升级文件存储结束地址
  57. //declear struct vars 结构体变量定义
  58. typedef struct _AppConfigDataType
  59. {
  60. BOOL appDataModify; //数据更改标志位
  61. UINT8 battSN[BATT_SN_LEN]; //电池SN号码
  62. BOOL isBattLocked; //0:not locked; 1:locked
  63. UINT8 chargEndWorkTime; //
  64. UINT8 BattTempCount; //电池温度个数
  65. UINT16 BattCellCount; //电池电压串数
  66. UINT8 BmsHwVersion;
  67. UINT8 BmsSwVersion;
  68. UINT32 BLSwVersion;
  69. UINT32 DrvSwVersion;
  70. UINT32 AppSwVersion; //APP软件版本
  71. UINT8 EOLState;
  72. } AppConfigDataType;
  73. typedef struct _AppConfigDataHeader
  74. {
  75. UINT16 fileBodySize; //file body size, not include size of header;
  76. UINT8 checkSum;
  77. } AppConfigDataHeader;
  78. typedef struct _AppDataType
  79. {
  80. BOOL appDataModify; //数据更改标志位
  81. UINT8 BattInfoSendFreqHigh; //电池信息发送间隔高频,单位s
  82. UINT8 BattInfoSendFreqNomal; //电池信息发送间隔正常,单位s
  83. UINT8 BattInfoSendFreqLow; //电池信息发送间隔低频,单位s
  84. UINT8 PosInfoSendFreqHigh; //定位信息发送间隔高频,单位s
  85. UINT8 PosInfoSendFreqNormal; //定位信息发送间隔正常,单位s
  86. UINT8 PosInfoSendFreqLow; //定位信息发送间隔低频,单位s
  87. UINT32 AccMileage; //累计里程,单位m
  88. UINT16 SysReStartCount; //系统重启次数
  89. UINT8 RelayControl; //继电器控制
  90. UINT8 BattLock; //电池锁定状态
  91. UINT8 BattStolenFlag; //电池被盗状态
  92. UINT32 blcv_Q_totalCpE[28]; //累计均衡容量 读取量 数组最大28
  93. UINT16 blcv_Q_reqCpE[28]; //均衡需求容量 读取量 数组最大28
  94. UINT16 socd_pct_bcuSocE; //电池显示SOC 读取量;
  95. UINT16 socd_pct_battSocE; //电池真实SOC 读取量;
  96. UINT16 sohd_tm_chrgStartStatE; //充电前静置时间读取量;
  97. UINT8 sohd_flg_chrgEndE; //充电结束标志位读取量;
  98. UINT16 sohv_V_chrgStartStatE[28]; //充电开始时刻的单体电压(数组)读取量;
  99. UINT16 sohd_Q_chrgE; //充入容量读取量;
  100. UINT16 sohv_Q_packCapArrE[10]; //10次整包容量(数组)读取量;
  101. UINT8 VIN[17]; //电池SN号码
  102. } AppDataBody;
  103. typedef struct _AppDataHeader
  104. {
  105. UINT16 fileBodySize; //file body size, not include size of header;
  106. UINT8 checkSum;
  107. } AppDataHeader;
  108. typedef struct AppSocketConnectionContext_Tag
  109. {
  110. INT32 id;
  111. INT32 status;
  112. } AppSocketConnectionContext;
  113. typedef enum
  114. {
  115. IDLE = 0,
  116. WORK,
  117. LISTEN
  118. } process_app;
  119. typedef struct _GPSInfo
  120. {
  121. UINT8 locateMark;
  122. UINT8 satelliteNum;
  123. UINT8 direction[2];
  124. UINT8 speed[2];
  125. UINT8 altitude[2];
  126. UINT8 latitude[4];
  127. UINT8 longitude[4];
  128. UINT8 AccMileage[4];
  129. //若此处新增gps信息,需要同步修改tcp线程的定义
  130. } GPSInfo;
  131. #endif