/**************************************************************************** * * Copy right: 2017-, Copyrigths of EigenComm Ltd. * File name: app.h * Description: EC616 onenet demo entry header file * History: Rev1.0 2018-07-12 * ****************************************************************************/ #include "commontypedef.h" #ifndef APP_H #define APP_H #ifdef __cplusplus extern "C" { #endif //全局定义声明区 #define BMS_MANUFACTURE (2) //BMS制造商表示1-超力源,2-美顺 #define DATA_MODULE_TYPE (1) //1表示NB模块,2表示4G cat1 #define BMS_INFO (3) //1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺MLS,2-2表示美顺MWL,2-3表示美顺MGM #define EOLSTATE (0) //1标识下线检测跳过,使用默认值 #if BMS_MANUFACTURE == 1 #if BMS_INFO == 1 #define BATT_CELL_VOL_NUM (14) #define BATT_TEMP_NUM (3) #define BATT_OTHER_TEMP_NUM (2) #elif BMS_INFO == 2 #define BATT_CELL_VOL_NUM (17) #define BATT_TEMP_NUM (4) #define BATT_OTHER_TEMP_NUM (2) #endif #elif BMS_MANUFACTURE == 2 #if BMS_INFO == 1 #define BATT_CELL_VOL_NUM (20) #define BATT_TEMP_NUM (3) #define BATT_OTHER_TEMP_NUM (2) #elif BMS_INFO == 2 #define BATT_CELL_VOL_NUM (17) #define BATT_TEMP_NUM (4) #define BATT_OTHER_TEMP_NUM (2) #elif BMS_INFO == 3 #define BATT_CELL_VOL_NUM (20) #define BATT_TEMP_NUM (4) #define BATT_OTHER_TEMP_NUM (2) #endif #endif #define NB_OTHER_TEMP_NUM (4) //NB采集的温度个数 #define BATT_CELL_VOL_NUM_2 (BATT_CELL_VOL_NUM * 2) #define HWVERSION 0x0102 //硬件主版本,现为V1.2板 #define BLSWVERSION 0x01020000 //BootLoader版本号V1.2.0.0 #define DRVSWVERSION 0x01050000 //驱动层版本号V1.4.0.0 驱动层1.5.0.0,增加了三轴 //#define APPSWVERSION 0x01020209 #define APPSWVERSION 0x02030030 // #define APPSWVERSION 0x02030000 //#define APPSWVERSION 0x0201000E //-------------------------------------------------------------------------------- #define BATT_IDLE_SYM 0x00 //静置 #define BATT_CHARGE_SYM 0x02 //充电 #define BATT_DISCHARGE_SYM 0x01 //放电 #define BATT_MOVE_SYM 0x01 //移动 #define BATT_NO_MOVE_SYM 0x00 //静止 #define APP_CONFIG_FILE_LATEST_VERSION 0 #define APP_CONFIG_FILE_NAME "qxappconfig.nvm" #define APP_DATAINFO_FILE_NAME "qxappDataInfo.nvm" #define BATT_SN_LEN 17 typedef struct AppNVMDataType { BOOL appDataModify; //数据更改标志位 UINT8 battSN[BATT_SN_LEN]; //电池SN号码 BOOL isBattLocked; //0:not locked; 1:locked UINT8 chargEndWorkTime; //the unit is min UINT8 wakeupWorkTime; //the unit is min UINT8 sleepTime; UINT16 HwVersion; UINT32 BLSwVersion; UINT32 DrvSwVersion; UINT32 AppSwVersion; UINT8 EOLState; } AppNVMDataType; typedef struct AppConfigHeader { UINT16 fileBodySize; //file body size, not include size of header; UINT8 version; UINT8 checkSum; } AppConfigHeader; typedef struct _UartAnswerMsg { BOOL UartFlag; UINT8 dataPtr[8]; UINT16 len; } UartAnswerMsgType; typedef enum { APP_INIT_STATE, APP_DEACTIVE_STATE, APP_IPREADY_STATE, APP_REPORT_STATE, APP_IDLE_STATE, APP_WAIT_STATE } appRunningState_t; //uint8_t* Uart_Receive_func(Uart_Receive_Type Uart_Receive_Msg,uint8_t* Uart_Rece_buffer,uint8_t Data_Len); //累计数据结构体 typedef struct AppDataType { BOOL appDataModify; //数据更改标志位 UINT8 BmsChrgInfoSendFreq; UINT8 BmsDisChrgInfoSendFreq; UINT8 GpsChrgInfoSendFreq; UINT8 GpsDisChrgInfoSendFreq; INT8 BattCurrentNegFlag; UINT32 CumulativeCapacity; UINT32 AccMileage; UINT16 SysReStart; UINT8 RelayControl; UINT8 ErrorMsg; UINT8 userLock; UINT8 rentalLock; UINT8 rentaltype; UINT8 ExpiryTimeArray[6]; } AppDataBody; typedef struct _AppDataHeader { UINT16 fileBodySize; //file body size, not include size of header; UINT8 checkSum; } AppDataHeader; #ifdef __cplusplus } #endif #endif /* APP_H */