AppFunc.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * @Author : ChenJie
  3. * @Date : 2021-10-14 09:27:15
  4. * @Version : V3.0
  5. * @LastEditors : ChenJie
  6. * @LastEditTime : 2021-10-29 16:23:13
  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. typedef struct _Fota_Type
  27. {
  28. BOOL Fota_update_error;
  29. UINT32 Fota_All_Data_Len;
  30. UINT32 Fota_Current_Addres;
  31. UINT8 Fota_Recv_Data_Len;
  32. UINT8 Fota_Recv_Data[100];
  33. UINT32 Fota_Flash_Addres;
  34. UINT8 Fota_CRC;
  35. } Fota_Type;
  36. BOOL BattHeaterSwitch(UINT8 *heaterSwitch, UINT8 HeatForceControl);
  37. BOOL uartBattInfoDecode(UINT8 *dataPtr);
  38. BOOL UDSAskforDownLoadData();
  39. BOOL UDSClearFotaDownloadRegion();
  40. INT8 rentalEndDetectFunc(void);
  41. static UINT8 bcc_chk_fota(UINT8 *data, UINT8 length);
  42. static UINT8 BmsErrorDecode(UINT32 battWarningState);
  43. static UINT8 Fota_crc_chk(UINT8 *data, UINT8 length);
  44. static void setDefaultAppConfigData(void);
  45. static void setDefaultAppDataInfo(void);
  46. static void setDefaultBcuDataInfo(void);
  47. UINT16 encryptionAlgorithm(UINT16 plainText);
  48. UINT16 GetErrorNum(UINT16 *ErrorArray, UINT8 Errorlen);
  49. UINT8 bcc_chk(UINT8 *data, UINT16 length);
  50. UINT8 LookUpRTtable(UINT32 R_value);
  51. UINT8 PutErrorNum(UINT16 *ErrorArray, UINT8 Errorlen, UINT16 ErrorNum);
  52. UINT8 UDSNegtiveAnswer(UINT8 answerLen, UINT8 messageIndex, UINT32 negCode);
  53. UINT8 UDSPositiveAnswer(UINT8 answerLen, UINT8 messageIndex, UINT32 posCode);
  54. void BattLockFunc(void);
  55. void BattWorkDelayFunc(UINT8 battWorkCurrentState);
  56. void CANEncodeFunction(UINT32 ID, UINT8 *msgData);
  57. void CanMsgTx1000ms(void);
  58. void ErrorNumHandleFunc(void);
  59. void ExpiryTimeCal(UINT8 *StartTimeArray, UINT16 rentalDays, UINT8 *ExpiryTimeArray);
  60. void Fota_Func(UINT8 *DataPtr, INT32 connectId);
  61. void LEDDisplay(void);
  62. void LoadAppConfig(void);
  63. void LoadAppData(void);
  64. void LoadBcuData(void);
  65. void relayControlFunc(UINT16 BuzzerPeriod, float DutyRatio);
  66. void SaveAppConfig(void);
  67. void SaveAppData(void);
  68. void SaveBcuData(void);
  69. void UDS_Service(CAN_Msg_Type *CanRxMsg);