/* * @Author : ChenJie * @Date : 2021-10-14 09:27:15 * @Version : V3.0 * @LastEditors : ChenJie * @LastEditTime : 2021-10-14 18:15:45 * @Description : file content * @FilePath : \PLAT\project\ec616_0h00\apps\qx_app\inc\AppFunc.h */ /**************************************************************************** * * Copy right: RL.Chen J and Zhen C * File name: AppFunc.h * Description: 应用层函数调用文件 * History: 2021-07-15 * Version: V3.0 ****************************************************************************/ #include "hal_module_adapter.h" #include "flash_ec616_rt.h" #include "commontypedef.h" #include "flash_ec616_rt.h" #include "mem_map.h" #include "AppConfig.h" #include "ec_tcpip_api.h" #include "AppSignal.h" typedef struct _Fota_Type { BOOL Fota_update_error; UINT32 Fota_All_Data_Len; UINT32 Fota_Current_Addres; UINT8 Fota_Recv_Data_Len; UINT8 Fota_Recv_Data[100]; UINT32 Fota_Flash_Addres; UINT8 Fota_CRC; } Fota_Type; void ExpiryTimeCal(UINT8 *StartTimeArray, UINT16 rentalDays, UINT8 *ExpiryTimeArray); INT8 rentalEndDetectFunc(void); void BattLockFunc(void); void BattWorkDelayFunc(UINT8 battWorkCurrentState); UINT8 bcc_chk(UINT8 *data, UINT16 length); void LEDDisplay(void); BOOL uartBattInfoDecode(UINT8 *dataPtr); static UINT8 BmsErrorDecode(UINT32 battWarningState); UINT16 GetErrorNum(UINT16 *ErrorArray, UINT8 Errorlen); UINT8 PutErrorNum(UINT16 *ErrorArray, UINT8 Errorlen, UINT16 ErrorNum); UINT8 LookUpRTtable(UINT32 R_value); BOOL BattHeaterSwitch(UINT8 *heaterSwitch, UINT8 HeatForceControl); void SaveAppData(void); void LoadAppData(void); void SaveBcuData(void); void LoadBcuData(void); void SaveAppConfig(void); void LoadAppConfig(void); static void setDefaultAppConfigData(void); static void setDefaultAppDataInfo(void); static void setDefaultBcuDataInfo(void); void CanMsgTx1000ms(void); void UDS_Service(CAN_Msg_Type *CanRxMsg); void CANEncodeFunction(UINT32 ID, UINT8 *msgData); void relayControlFunc(UINT8 BuzzerPeriod, float DutyRatio); BOOL UDSClearFotaDownloadRegion(); BOOL UDSAskforDownLoadData(); UINT8 UDSNegtiveAnswer(UINT8 answerLen, UINT8 messageIndex, UINT32 negCode); UINT8 UDSPositiveAnswer(UINT8 answerLen, UINT8 messageIndex, UINT32 posCode); UINT16 encryptionAlgorithm(UINT16 plainText); void Fota_Func(UINT8 *DataPtr, INT32 connectId); static UINT8 bcc_chk_fota(UINT8 *data, UINT8 length); static UINT8 Fota_crc_chk(UINT8 *data, UINT8 length); void ErrorNumHandleFunc(void);