AppFunc.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * @Author : ChenJie
  3. * @Date : 2021-10-14 09:27:15
  4. * @Version : V3.0
  5. * @LastEditors : ChenJie
  6. * @LastEditTime : 2021-11-12 15:03:02
  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. BOOL BattHeaterSwitch(UINT8 *heaterSwitch, UINT8 HeatForceControl);
  38. BOOL uartBattInfoDecode(UINT8 *dataPtr);
  39. BOOL UDSAskforDownLoadData();
  40. BOOL UDSClearFotaDownloadRegion();
  41. INT8 rentalEndDetectFunc(void);
  42. static UINT8 bcc_chk_fota(UINT8 *data, UINT8 length);
  43. static UINT8 BmsErrorDecode(UINT32 battWarningState);
  44. static UINT8 Fota_crc_chk(UINT8 *data, UINT8 length);
  45. static void setDefaultAppConfigData(void);
  46. static void setDefaultAppDataInfo(void);
  47. static void setDefaultBcuDataInfo(void);
  48. UINT16 encryptionAlgorithm(UINT16 plainText);
  49. UINT16 GetErrorNum(UINT16 *ErrorArray, UINT8 Errorlen);
  50. UINT8 bcc_chk(UINT8 *data, UINT16 length);
  51. UINT8 LookUpRTtable(UINT32 R_value);
  52. UINT8 PutErrorNum(UINT16 *ErrorArray, UINT8 Errorlen, UINT16 ErrorNum);
  53. UINT8 UDSNegtiveAnswer(UINT8 answerLen, UINT8 messageIndex, UINT32 negCode);
  54. UINT8 UDSPositiveAnswer(UINT8 answerLen, UINT8 messageIndex, UINT32 posCode);
  55. void BattLockFunc(void);
  56. void BattWorkDelayFunc(UINT8 battWorkCurrentState);
  57. void CANEncodeFunction(UINT32 ID, UINT8 *msgData);
  58. void CanMsgTx1000ms(void);
  59. void ErrorNumHandleFunc(void);
  60. void ExpiryTimeCal(UINT8 *StartTimeArray, UINT16 rentalDays, UINT8 *ExpiryTimeArray);
  61. void Fota_Func(UINT8 *DataPtr, INT32 connectId);
  62. void LEDDisplay(void);
  63. void LoadAppConfig(void);
  64. void LoadAppData(void);
  65. void LoadBcuData(void);
  66. void relayControlFunc(UINT16 BuzzerPeriod, float DutyRatio);
  67. void SaveAppConfig(void);
  68. void SaveAppData(void);
  69. void SaveBcuData(void);
  70. void UDS_Service(CAN_Msg_Type *CanRxMsg);
  71. void BmsProtectStateDecode(UINT8 *DischargeProtect, UINT8 *ChargeProtect);