AppFunc.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * @Author : ChenJie
  3. * @Date : 2021-10-14 09:27:15
  4. * @Version : V3.0
  5. * @LastEditors : ChenJie
  6. * @LastEditTime : 2022-01-07 15:04:47
  7. * @Description : file content
  8. * @FilePath : \PLAT\project\ec616_0h00\apps\qx_app\inc\AppFunc.h
  9. */
  10. /****************************************************************************
  11. *
  12. * Copy right: RL.Chen J and Zhen C
  13. * File name: AppFunc.h
  14. * Description: 应用层函数调用文件
  15. * History: 2021-07-15
  16. * Version: V3.0
  17. ****************************************************************************/
  18. #include "hal_module_adapter.h"
  19. #include "flash_ec616_rt.h"
  20. #include "commontypedef.h"
  21. #include "flash_ec616_rt.h"
  22. #include "mem_map.h"
  23. #include "AppConfig.h"
  24. #include "ec_tcpip_api.h"
  25. #include "AppSignal.h"
  26. #include "BCUCal.h"
  27. typedef struct _Fota_Type
  28. {
  29. BOOL Fota_update_error;
  30. UINT32 Fota_All_Data_Len;
  31. UINT32 Fota_Current_Addres;
  32. UINT8 Fota_Recv_Data_Len;
  33. UINT8 Fota_Recv_Data[100];
  34. UINT32 Fota_Flash_Addres;
  35. UINT8 Fota_CRC;
  36. } Fota_Type;
  37. INT16 day_diff(UINT8 *pDate1, UINT8 *pDate2);
  38. BOOL BattHeaterSwitch(UINT8 *heaterSwitch, UINT8 HeatForceControl);
  39. BOOL uartBattInfoDecode(UINT8 *dataPtr);
  40. BOOL UDSAskforDownLoadData();
  41. BOOL UDSClearFotaDownloadRegion();
  42. INT8 rentalEndDetectFunc(void);
  43. static UINT8 bcc_chk_fota(UINT8 *data, UINT8 length);
  44. static UINT8 BmsErrorDecode(UINT32 battWarningState);
  45. static UINT8 Fota_crc_chk(UINT8 *data, UINT8 length);
  46. static void setDefaultAppConfigData(void);
  47. static void setDefaultAppDataInfo(void);
  48. static void setDefaultBcuDataInfo(void);
  49. UINT16 encryptionAlgorithm(UINT16 plainText);
  50. UINT16 GetErrorNum(UINT16 *ErrorArray, UINT8 Errorlen);
  51. UINT16 LookRT_u32u16(UINT32 u0);
  52. UINT8 bcc_chk(UINT8 *data, UINT16 length);
  53. UINT8 PutErrorNum(UINT16 *ErrorArray, UINT8 Errorlen, UINT16 ErrorNum);
  54. UINT8 UDSNegtiveAnswer(UINT8 answerLen, UINT8 messageIndex, UINT32 negCode);
  55. UINT8 UDSPositiveAnswer(UINT8 answerLen, UINT8 messageIndex, UINT32 posCode);
  56. void BattLockFunc(void);
  57. void BattWorkDelayFunc(UINT8 battWorkCurrentState);
  58. void BmsProtectStateDecode(UINT8 *DischargeProtect, UINT8 *ChargeProtect);
  59. void CANEncodeFunction(UINT32 ID, UINT8 *msgData);
  60. void CanMsgTx1000ms(void);
  61. void ErrorNumHandleFunc(void);
  62. void ExpiryTimeCal(UINT8 *StartTimeArray, UINT16 rentalDays, UINT8 *ExpiryTimeArray);
  63. void Fota_Func(UINT8 *DataPtr, INT32 connectId);
  64. void LEDDisplay(void);
  65. void LoadAppConfig(void);
  66. void LoadAppData(void);
  67. void LoadBcuData(void);
  68. void relayControlFunc(UINT16 BuzzerPeriod, float DutyRatio);
  69. void SaveAppConfig(void);
  70. void SaveAppData(void);
  71. void SaveBcuData(void);
  72. void UDS_Service(CAN_Msg_Type *CanRxMsg);