AppConfig.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. * @Author : ChenJie
  3. * @Date : 2021-10-14 09:27:15
  4. * @LastEditors : ChenJie
  5. * @LastEditTime : 2022-01-07 14:35:52
  6. * @Description : App Config H file 配置文件,可以针对不同参数进行更改
  7. * @FilePath : \PLAT\project\ec616_0h00\apps\qx_app\inc\AppConfig.h
  8. */
  9. #ifndef APPCONFIG_H
  10. #define APPCONFIG_H
  11. #define BMS_MANUFACTURE (2) // BMS制造商表示1-超力源,2-美顺
  12. #define BMS_INFO (3) // 1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺4830,2-2表示美顺6060 2-3表示美顺7250
  13. #define DATA_MODULE_TYPE (1) // 1表示NB模块,2表示4G cat1
  14. #define EOLSTATE (0) // 1表示下线检测跳过,使用默认值,0表示使用下线检测
  15. #define DEFAULT_SN "RLTEST00000000001" //默认上传的SN编码
  16. #define APPSWRELEASE 0 //软件测试版本标志位,0-测试,1-发布
  17. #define APPSWVERSION 0x0301F241 //数据模块软件版本号
  18. #define RELAYCONFIG 1 //继电器配置
  19. #define TCP_ADD "iotp.fast-fun.cn" //数据上传的地址
  20. #define TCP_PORT 8712 //数据上传的端口
  21. #define NB_OTHER_TEMP_NUM (4) // NB采集的温度个数
  22. #define HWVERSION 0x0102 //硬件主版本,现为V1.2板
  23. #define BLSWVERSION 0x01020000 // BootLoader版本号V1.2.0.0
  24. #define DRVSWVERSION 0x01050000 //驱动层版本号V1.4.0.0 驱动层1.5.0.0,增加了三轴
  25. #define APP_CONFIG_FILE_NAME "qxappconfig.nvm"
  26. #define APP_DATAINFO_FILE_NAME "qxappDataInfo3.nvm"
  27. #define BCU_DATAINFO_FILE_NAME "qxBcuDataInfo.nvm"
  28. #define BATT_SN_LEN 17
  29. #define BMS_OTHER_TEMP 2
  30. #define WORK_TIME 5
  31. #define SLEEP_TIME 60
  32. #define ErrorNumLength 20
  33. #define BATT_IDLE_SYM 0x00 //静置
  34. #define BATT_CHARGE_SYM 0x02 //充电
  35. #define BATT_DISCHARGE_SYM 0x01 //放电
  36. #define BATT_MOVE_SYM 0x01 //移动
  37. #define BATT_NO_MOVE_SYM 0x00 //静止
  38. #define TCP_START_SYM1 0x23
  39. #define TCP_START_SYM2 0x23
  40. #define TCP_CMD_SYM 0x02 //实时信息上报是0x02
  41. #define TCP_HEART_SYM 0x07 //心跳包标志
  42. #define TCP_ANS_SYM 0xFE
  43. /*-------以下为下行指令定义区----------*/
  44. #define TCP_QUERY_SYM 0x80
  45. #define TCP_SETCMD_SYM 0x81
  46. #define TCP_CONCMD_SYM 0x82
  47. /*----------------end----------------*/
  48. // encrypt methord
  49. #define TCP_ENCPT_ENABLE 0x00
  50. #define TCP_ENCPT_DISABLE 0x01
  51. // message type mark 0x02上报数据单元定义区
  52. #define BATTMSG 0x80
  53. #define GPSMSG 0x82
  54. #define OTHERMSG 0x84
  55. #define STATESMSG 0x85
  56. #define VERSIONMSG 0x86
  57. #define DEBUGMSG 0x8C
  58. // BMS升级区定义
  59. #define FLASH_BMS_FOTA_START_ADDR 0x2E6000 // BMS升级文件存储起始地址
  60. #define FLASH_BMS_FOTA_LEN 0x32000 // BMS升级文件存储长度 = =200k
  61. #define FLASH_BMS_FOTA_END_ADDR 0x318000 // BMS升级文件存储结束地址
  62. // declear struct vars 结构体变量定义
  63. typedef struct _AppConfigDataType //该结构体只允许下线检测写入
  64. {
  65. BOOL appDataModify; //数据更改标志位
  66. UINT8 battSN[BATT_SN_LEN]; //电池SN号码
  67. BOOL isBattLocked; // 0:not locked; 1:locked //暂时取消没有使用
  68. UINT8 reserved1; //
  69. UINT8 reserved2; //电池温度个数
  70. UINT8 reserved3; //电池电压串数
  71. UINT8 reserved4;
  72. UINT8 reserved5;
  73. UINT32 reserved6;
  74. UINT32 reserved7;
  75. UINT32 reserved8; // APP软件版本
  76. UINT8 EOLState;
  77. } AppConfigDataType;
  78. typedef struct _AppConfigDataHeader
  79. {
  80. UINT16 fileBodySize; // file body size, not include size of header;
  81. UINT8 checkSum;
  82. } AppConfigDataHeader;
  83. typedef struct _AppDataType
  84. {
  85. BOOL appDataModify; //数据更改标志位
  86. UINT8 BattCellCount; //电池模组个数
  87. UINT8 BattTempCount; //电池温度个数
  88. UINT8 BattInfoSendFreqHigh; //电池信息发送间隔高频,单位s
  89. UINT8 BattInfoSendFreqNomal; //电池信息发送间隔正常,单位s
  90. UINT8 BattInfoSendFreqLow; //电池信息发送间隔低频,单位s
  91. UINT8 PosInfoSendFreqHigh; //定位信息发送间隔高频,单位s
  92. UINT8 PosInfoSendFreqNormal; //定位信息发送间隔正常,单位s
  93. UINT8 PosInfoSendFreqLow; //定位信息发送间隔低频,单位s
  94. UINT32 AccMileage; //累计里程,单位m
  95. UINT16 SysReStartCount; //系统重启次数
  96. UINT8 RelayControl; //继电器控制
  97. UINT8 BattForceLock; //电池强制锁定状态
  98. UINT8 BattLock; //电池锁定状态
  99. UINT8 BattStolenFlag; //电池被盗状态
  100. UINT8 UserLock; // 用户锁锁定
  101. UINT8 RentalLock; //租期锁锁定
  102. UINT8 RentalType; //租期类型
  103. UINT8 ExpiryTimeArray[6]; //超期时间
  104. UINT8 ErrorMsg;
  105. UINT8 RentalStartTime[6]; //租期开始时间
  106. } AppDataBody;
  107. typedef struct _AppAlgorithmType
  108. {
  109. BOOL appDataModify; //数据更改标志位
  110. UINT32 blcv_Q_totalCpE[28]; //累计均衡容量 读取量 数组最大28
  111. UINT16 blcv_Q_reqCpE[28]; //均衡需求容量 读取量 数组最大28
  112. UINT16 socd_pct_bcuSocE; //电池显示SOC 读取量;
  113. UINT16 socd_pct_battSocE; //电池真实SOC 读取量;
  114. UINT16 sohd_tm_chrgStartStatE; //充电前静置时间读取量;
  115. BOOL sohd_flg_chrgEndE; //充电结束标志位读取量;
  116. UINT16 sohv_V_chrgStartStatE[28]; //充电开始时刻的单体电压(数组)读取量;
  117. UINT16 sohd_Q_chrgE; //充入容量读取量;
  118. UINT16 sohv_Q_packCapArrE[10]; // 10次整包容量(数组)读取量;
  119. UINT16 sohv_Q_cellCapArrE[28]; //
  120. UINT16 iscv_Q_remainCpE[28];
  121. UINT32 iscd_tm_totalE;
  122. BOOL sfmd_flg_iscFltE;
  123. BOOL sfmd_flg_mainCirClosFltE;
  124. BOOL sfmd_flg_heatCirClosFltE;
  125. BOOL sfmd_flg_heatCirOpenFltE;
  126. BOOL sfmd_flg_heatRunFltE;
  127. UINT16 ihd_tm_parkTimeE;
  128. UINT16 sorv_ohm_cellRE[28];
  129. } AppAlgorithmData;
  130. typedef struct _AppDataHeader
  131. {
  132. UINT16 fileBodySize; // file body size, not include size of header;
  133. UINT8 checkSum;
  134. } AppDataHeader;
  135. typedef struct _BCUDataHeader
  136. {
  137. UINT16 fileBodySize; // file body size, not include size of header;
  138. UINT8 checkSum;
  139. } BcuDataHeader;
  140. typedef struct AppSocketConnectionContext_Tag
  141. {
  142. INT32 id;
  143. INT32 status;
  144. } AppSocketConnectionContext;
  145. typedef enum
  146. {
  147. IDLE = 0,
  148. WORK,
  149. LISTEN
  150. } process_app;
  151. typedef struct _GPSInfo
  152. {
  153. UINT8 locateMark;
  154. UINT8 satelliteNum;
  155. UINT8 direction[2];
  156. UINT8 speed[2];
  157. UINT8 altitude[2];
  158. UINT8 latitude[4];
  159. UINT8 longitude[4];
  160. UINT8 AccMileage[4];
  161. } GPSInfo;
  162. #endif