/* * @Author : ChenJie * @Date : 2022-02-10 11:44:08 * @Version : V3.0 * @LastEditors : ChenJie * @LastEditTime : 2022-05-17 16:22:56 * @Description : file content * @FilePath : \S32K146_4G\src\AppTaskUart1.h */ /* * AppTaskUart2.h *4G的串口函数 * Created on: 2022年2月10日 * Author: QiXiang_CHENJIE */ #ifndef APPTASKUART1_H_ #define APPTASKUART1_H_ #include "hal_adapter.h" #include "AppFunclib.h" #include "AppGlobalVar.h" #include "AppTaskGps.h" #define CRLF "\r\n" #define BATT_SN_LEN 17 #define TCP_START_SYM1 0x23 #define TCP_START_SYM2 0x23 #define TCP_CMD_SYM 0x02 // 实时信息上报是0x02 #define TCP_HEART_SYM 0x07 // 心跳包标志 #define TCP_ANS_SYM 0xFE #define TCP_ENCPT_ENABLE 0x00 #define TCP_ENCPT_DISABLE 0x01 #define BattMsg (0x80) #define GpsMsg (0x82) #define VerMsg (0x86) #define DebugMsg (0x8C) #define TruckBattMsg (0x91) #define TruckVehiMsg (0x90) #define TruckAcclMsg (0x92) #define TCP_QUERY_SYM 0x80 #define TCP_SETCMD_SYM 0x81 #define TCP_CONCMD_SYM 0x82 #define TCP_UDSCMD_SYM 0x83 typedef struct _GPSInfoType { uint8 sendTimeUTC[6]; uint8 msgMark; uint8 msgCollectionTimeUTC[6]; GPSInfo GpsInfoData; uint8 Tac[2]; uint8 CellID[4]; uint8 xData[2]; uint8 yData[2]; uint8 zData[2]; } GPSInfoType; typedef struct GPSMsgtoTcpType { uint8 startSymbol[2]; uint8 cmdSymbol; uint8 ansSymbol; uint8 SN[BATT_SN_LEN]; uint8 encryptMethod; uint8 dataLength[2]; GPSInfoType gpsInfo; uint8 CRC; } GPSMsgtoTcpType; typedef struct _VerInfoType { uint8 sendTimeUTC[6]; uint8 msgMark; uint8 msgCollectionTimeUTC[6]; uint8 ICCID[20]; uint8 IMEI[15]; uint8 BMSHwVersion[2]; uint8 BMSSwVersion[4]; uint8 HwVersion[2]; uint8 BLVersion[4]; uint8 DRVVersion[4]; uint8 APPVersion[4]; uint8 BmsType; uint8 BmsInfo; uint8 DataModuleType; } VerInfoType; typedef struct VersionMsgtoTcpType { uint8 startSymbol[2]; uint8 cmdSymbol; uint8 ansSymbol; uint8 SN[BATT_SN_LEN]; uint8 encryptMethod; uint8 dataLength[2]; VerInfoType VerInfo; uint8 CRC; } VersionMsgtoTcpType; typedef struct StorageInfoType { uint8 sendTimeUTC[6]; uint8 msgMark; uint8 msgCollectionTimeUTC[6]; uint8 RelayState; uint8 FanState; uint8 HeatState; uint8 ConvertState; } StorageInfo; typedef struct StorageInfoToTcpType { uint8 startSymbol[2]; uint8 cmdSymbol; uint8 ansSymbol; uint8 SN[BATT_SN_LEN]; uint8 encryptMethod; uint8 dataLength[2]; StorageInfo StorageMsg; uint8 CRC; } StorageInfoToTcp; typedef struct StorageInfoType2 { uint8 sendTimeUTC[6]; uint8 msgMark; uint8 msgCollectionTimeUTC[6]; uint8 meter1AllPwr[4]; uint8 meter1PosPwr[4]; uint8 meter1NegPwr[4]; uint8 meter2AllPwr[4]; uint8 meter2PosPwr[4]; uint8 meter2NegPwr[4]; } StorageInfo2; typedef struct StorageInfoToTcpType2 { uint8 startSymbol[2]; uint8 cmdSymbol; uint8 ansSymbol; uint8 SN[BATT_SN_LEN]; uint8 encryptMethod; uint8 dataLength[2]; StorageInfo2 StorageMsg2; uint8 CRC; } StorageInfoToTcp2; typedef struct AccInfoType { uint8 sendTimeUTC[6]; uint8 msgMark; uint8 msgCollectionTimeUTC[6]; uint8 accOnlineDays[2]; uint8 accDrvMiles[2]; uint8 sohNoCalibrTime[2]; uint8 accChrgEng[4]; uint8 accDischrgEng[4]; uint8 accChrgCap[4]; uint8 accDischrgCap[4]; uint8 accOverChrgTimes; uint8 accOverDischrgTimes; uint8 accCycleTimes[2]; } AccInfo; typedef struct AccInfoToTcpType { uint8 startSymbol[2]; uint8 cmdSymbol; uint8 ansSymbol; uint8 SN[BATT_SN_LEN]; uint8 encryptMethod; uint8 dataLength[2]; AccInfo AccMsg; uint8 CRC; } AccInfoToTcp; typedef struct _DebugInfoType { UINT8 sendTimeUTC[6]; UINT8 msgMark; UINT8 DebugLen[2]; } DebugInfoType; typedef struct DebugMsgtoTcp_Type { UINT8 startSymbol[2]; UINT8 cmdSymbol; UINT8 ansSymbol; UINT8 SN[BATT_SN_LEN]; UINT8 encryptMethod; UINT8 dataLength[2]; DebugInfoType DebugInfo; UINT8 _CRC; } DebugMsgtoTcpType; typedef struct UTC8Time_Type { uint8 year; uint8 month; uint8 day; uint8 hour; uint8 minute; uint8 second; } UTC8TimeType; typedef enum { AT_CMD_TEST = 0, AT_ATE0, AT_SIMREADY, AT_GETICCID, AT_CGREG, AT_CSQ, AT_NETOPEN, AT_CGIP, AT_CONNECT, AT_CONNECTCHK, AT_SEND, AT_DISCON, AT_NETCLOSE, AT_CGNSSPWR } ATCmd; typedef sint8 (*pFunc)(char *PSendStr, char *pReadStr, uint8 CmdIdx, uint16 pReadLen); sint8 at_callbackFunc(char *PSendStr, char *pReadStr, uint8 CmdIdx, uint16 pReadLen); typedef struct { ATCmd cmd; /*指令序号*/ char *str; /*指令内容*/ pFunc cb; /*对应的执行*/ } ATCmdFunc; typedef enum { PROCESS_TCP_IDLE = 0, PROCESS_TCP_INIT, PROCESS_TCP_ATSYS, PROCESS_TCP_REGCHK, PROCESS_TCP_CONNECT, PROCESS_TCP_SEND, PROCESS_TCP_RECV, PROCESS_TCP_HEART, PROCESS_TCP_SLEEP, PROCESS_TCP_ERROR } process_Tcp; typedef struct { sint16 TimeCalibCnt[3]; sint16 VersionFeqCnt[3]; sint16 TrkBattFeqCnt[3]; sint16 GpsFeqCnt[3]; sint16 TrkVehichleFeqCnt[3]; sint16 TrkAccMsgFeqCnt[3]; sint16 DebugMsgFeqCnt[3]; }TcpFeq_type; void Uart_4G_Task(void *pvParameters); sint8 tcpipConnectionSend(uint8 TcpConnectId, uint8 *SendDataPtr, uint16 SendDataLen); #endif /* APPTASKUART1_H_ */