AppConfig.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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 (2) //BMS制造商表示1-超力源,2-美顺
  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 (1) //1表示下线检测跳过,使用默认值,0表示使用下线检测
  15. #define DEFAULT_SN "RLTEST00000000001" //默认上传的SN编码
  16. #define APPSWVERSION 0x03000000 //数据模块软件版本号
  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 BATT_IDLE_SYM 0x00 //静置
  28. #define BATT_CHARGE_SYM 0x02 //充电
  29. #define BATT_DISCHARGE_SYM 0x01 //放电
  30. #define BATT_MOVE_SYM 0x01 //移动
  31. #define BATT_NO_MOVE_SYM 0x00 //静止
  32. #define TCP_START_SYM1 0x23
  33. #define TCP_START_SYM2 0x23
  34. #define TCP_CMD_SYM 0x02 //实时信息上报是0x02
  35. #define TCP_HEART_SYM 0x07 //心跳包标志
  36. #define TCP_ANS_SYM 0xFE
  37. /*-------以下为下行指令定义区----------*/
  38. #define TCP_QUERY_SYM 0x80
  39. #define TCP_SETCMD_SYM 0x81
  40. #define TCP_CONCMD_SYM 0x82
  41. /*----------------end----------------*/
  42. //encrypt methord
  43. #define TCP_ENCPT_ENABLE 0x00
  44. #define TCP_ENCPT_DISABLE 0x01
  45. //message type mark 0x02上报数据单元定义区
  46. #define BATTMSG 0x80
  47. #define GPSMSG 0x82
  48. #define STATESMSG 0x85
  49. #define VERSIONMSG 0x86
  50. #define DEBUGMSG 0x8C
  51. //BMS升级区定义
  52. #define FLASH_BMS_FOTA_START_ADDR 0x2E6000 //BMS升级文件存储起始地址
  53. #define FLASH_BMS_FOTA_LEN 0x32000 //BMS升级文件存储长度 = =200k
  54. #define FLASH_BMS_FOTA_END_ADDR 0x318000 //BMS升级文件存储结束地址
  55. //declear struct vars 结构体变量定义
  56. typedef struct _AppConfigDataType
  57. {
  58. BOOL appDataModify; //数据更改标志位
  59. UINT8 battSN[BATT_SN_LEN]; //电池SN号码
  60. BOOL isBattLocked; //0:not locked; 1:locked
  61. UINT8 chargEndWorkTime; //
  62. UINT8 BattTempCount; //电池温度个数
  63. UINT8 BattCellCount; //电池电压串数
  64. UINT8 BmsHwVersion;
  65. UINT8 BmsSwVersion;
  66. UINT32 BLSwVersion;
  67. UINT32 DrvSwVersion;
  68. UINT32 AppSwVersion; //APP软件版本
  69. UINT8 EOLState;
  70. }AppConfigDataType;
  71. typedef struct _AppConfigDataHeader
  72. {
  73. UINT16 fileBodySize; //file body size, not include size of header;
  74. UINT8 checkSum;
  75. }AppConfigDataHeader;
  76. typedef struct _AppDataType
  77. {
  78. BOOL appDataModify; //数据更改标志位
  79. UINT8 BattInfoSendFreqHigh; //电池信息发送间隔高频,单位s
  80. UINT8 BattInfoSendFreqNomal; //电池信息发送间隔正常,单位s
  81. UINT8 BattInfoSendFreqLow; //电池信息发送间隔低频,单位s
  82. UINT8 PosInfoSendFreqHigh; //定位信息发送间隔高频,单位s
  83. UINT8 PosInfoSendFreqNormal; //定位信息发送间隔正常,单位s
  84. UINT8 PosInfoSendFreqLow; //定位信息发送间隔低频,单位s
  85. UINT32 AccMileage; //累计里程,单位m
  86. UINT16 SysReStartCount; //系统重启次数
  87. UINT8 RelayControl; //继电器控制
  88. UINT8 BattLock; //电池锁定状态
  89. UINT8 BattStolenFlag; //电池被盗状态
  90. }AppDataBody;
  91. typedef struct _AppDataHeader
  92. {
  93. UINT16 fileBodySize; //file body size, not include size of header;
  94. UINT8 checkSum;
  95. }AppDataHeader;
  96. typedef struct AppSocketConnectionContext_Tag
  97. {
  98. INT32 id;
  99. INT32 status;
  100. }AppSocketConnectionContext;
  101. typedef enum
  102. {
  103. IDLE = 0,
  104. WORK,
  105. LISTEN
  106. }process_app;
  107. typedef struct _GPSInfo
  108. {
  109. UINT8 locateMark;
  110. UINT8 satelliteNum;
  111. UINT8 direction[2];
  112. UINT8 speed[2];
  113. UINT8 altitude[2];
  114. UINT8 latitude[4];
  115. UINT8 longitude[4];
  116. UINT8 AccMileage[4];
  117. //若此处新增gps信息,需要同步修改tcp线程的定义
  118. }GPSInfo;
  119. #endif