AppTaskUart1.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * @Author : ChenJie
  3. * @Date : 2022-02-10 11:44:08
  4. * @Version : V3.0
  5. * @LastEditors : ChenJie
  6. * @LastEditTime : 2022-02-14 15:48:07
  7. * @Description : file content
  8. * @FilePath : \S32K146_4G\src\AppTaskUart1.h
  9. */
  10. /*
  11. * AppTaskUart2.h
  12. *4G的串口函数
  13. * Created on: 2022年2月10日
  14. * Author: QiXiang_CHENJIE
  15. */
  16. #ifndef APPTASKUART1_H_
  17. #define APPTASKUART1_H_
  18. #include "hal_adapter.h"
  19. #include "AppFunclib.h"
  20. #include "AppGlobalVar.h"
  21. #include "AppTaskGps.h"
  22. #define CRLF "\r\n"
  23. #define BATT_SN_LEN 17
  24. #define TCP_START_SYM1 0x23
  25. #define TCP_START_SYM2 0x23
  26. #define TCP_CMD_SYM 0x02 //实时信息上报是0x02
  27. #define TCP_HEART_SYM 0x07 //心跳包标志
  28. #define TCP_ANS_SYM 0xFE
  29. #define TCP_ENCPT_ENABLE 0x00
  30. #define TCP_ENCPT_DISABLE 0x01
  31. #define BattMsg (0x80)
  32. #define GpsMsg (0x82)
  33. #define VerMsg (0x86)
  34. #define TruckBattMsg (0x91)
  35. #define TruckVehiMsg (0x90)
  36. #define TruckAcclMsg (0x92)
  37. #define TCP_QUERY_SYM 0x80
  38. #define TCP_SETCMD_SYM 0x81
  39. #define TCP_CONCMD_SYM 0x82
  40. typedef struct _GPSInfoType
  41. {
  42. uint8 sendTimeUTC[6];
  43. uint8 msgMark;
  44. uint8 msgCollectionTimeUTC[6];
  45. GPSInfo GpsInfoData;
  46. uint8 Tac[2];
  47. uint8 CellID[4];
  48. uint8 xData[2];
  49. uint8 yData[2];
  50. uint8 zData[2];
  51. } GPSInfoType;
  52. typedef struct GPSMsgtoTcpType
  53. {
  54. uint8 startSymbol[2];
  55. uint8 cmdSymbol;
  56. uint8 ansSymbol;
  57. uint8 SN[BATT_SN_LEN];
  58. uint8 encryptMethod;
  59. uint8 dataLength[2];
  60. GPSInfoType gpsInfo;
  61. uint8 CRC;
  62. } GPSMsgtoTcpType;
  63. typedef struct _VerInfoType
  64. {
  65. uint8 sendTimeUTC[6];
  66. uint8 msgMark;
  67. uint8 msgCollectionTimeUTC[6];
  68. uint8 ICCID[20];
  69. uint8 IMEI[15];
  70. uint8 BMSHwVersion[2];
  71. uint8 BMSSwVersion[4];
  72. uint8 HwVersion[2];
  73. uint8 BLVersion[4];
  74. uint8 DRVVersion[4];
  75. uint8 APPVersion[4];
  76. uint8 BmsType;
  77. uint8 BmsInfo;
  78. uint8 DataModuleType;
  79. }VerInfoType;
  80. typedef struct VersionMsgtoTcpType
  81. {
  82. uint8 startSymbol[2];
  83. uint8 cmdSymbol;
  84. uint8 ansSymbol;
  85. uint8 SN[BATT_SN_LEN];
  86. uint8 encryptMethod;
  87. uint8 dataLength[2];
  88. VerInfoType VerInfo;
  89. uint8 CRC;
  90. }VersionMsgtoTcpType;
  91. typedef struct StorageInfoType
  92. {
  93. uint8 sendTimeUTC[6];
  94. uint8 msgMark;
  95. uint8 msgCollectionTimeUTC[6];
  96. uint8 RelayState;
  97. uint8 FanState;
  98. uint8 HeatState;
  99. uint8 ConvertState;
  100. }StorageInfo;
  101. typedef struct StorageInfoToTcpType
  102. {
  103. uint8 startSymbol[2];
  104. uint8 cmdSymbol;
  105. uint8 ansSymbol;
  106. uint8 SN[BATT_SN_LEN];
  107. uint8 encryptMethod;
  108. uint8 dataLength[2];
  109. StorageInfo StorageMsg;
  110. uint8 CRC;
  111. }StorageInfoToTcp;
  112. typedef struct UTC8Time_Type
  113. {
  114. uint8 year;
  115. uint8 month;
  116. uint8 day;
  117. uint8 hour;
  118. uint8 minute;
  119. uint8 second;
  120. } UTC8TimeType;
  121. typedef enum
  122. {
  123. AT_CMD_TEST = 0,
  124. AT_SIMREADY,
  125. AT_GETICCID,
  126. AT_CGREG,
  127. AT_CSQ,
  128. AT_NETOPEN,
  129. AT_CGIP,
  130. AT_CONNECT,
  131. AT_CONNECTCHK,
  132. AT_SEND,
  133. AT_DISCON,
  134. AT_NETCLOSE,
  135. } ATCmd;
  136. typedef sint8 (*pFunc)(char *PSendStr, char *pReadStr, uint8 CmdIdx, uint16 pReadLen);
  137. sint8 at_callbackFunc(char *PSendStr, char *pReadStr, uint8 CmdIdx, uint16 pReadLen);
  138. typedef struct
  139. {
  140. ATCmd cmd; /*指令序号*/
  141. char *str; /*指令内容*/
  142. pFunc cb; /*对应的执行*/
  143. } ATCmdFunc;
  144. typedef enum
  145. {
  146. PROCESS_TCP_IDLE = 0,
  147. PROCESS_TCP_ATSYS,
  148. PROCESS_TCP_REGCHK,
  149. PROCESS_TCP_CONNECT,
  150. PROCESS_TCP_SEND,
  151. PROCESS_TCP_RECV,
  152. PROCESS_TCP_HEART,
  153. PROCESS_TCP_SLEEP,
  154. PROCESS_TCP_ERROR
  155. } process_Tcp;
  156. void Uart_4G_Task(void *pvParameters);
  157. #endif /* APPTASKUART1_H_ */