/**************************************************************************** * * Copy right: Qx.Chen Jie * File name: TcpTask.h * Description: 网络发送接收任务 * History: 2021-03-07 * ****************************************************************************/ #include "commontypedef.h" #include "bsp.h" #include "bsp_custom.h" #include "osasys.h" #include "ostask.h" #include "queue.h" #include "ps_event_callback.h" #include "cmisim.h" #include "cmimm.h" #include "cmips.h" #include "sockets.h" #include "psifevent.h" #include "ps_lib_api.h" #include "lwip/netdb.h" #include "debug_log.h" #include "slpman_ec616.h" #include "plat_config.h" #include "ec_tcpip_api.h" #include "hal_module_adapter.h" #include "timers.h" #include "AppSignal.h" #include "AppConfig.h" #include "AppFunc.h" #define PROC_TCP_TASK_STACK_SIZE (2048 + 1024) #define APP_EVENT_QUEUE_SIZE (10) #define QMSG_ID_BASE (0x16) #define QMSG_ID_NW_IP_READY (QMSG_ID_BASE) #define QMSG_ID_NW_IP_SUSPEND (QMSG_ID_BASE + 1) #define QMSG_ID_NW_IP_NOREACHABLE (QMSG_ID_BASE + 2) #define QMSG_ID_SOCK_SENDPKG (QMSG_ID_BASE + 4) #define QMSG_ID_SOCK_RECVPKG (QMSG_ID_BASE + 5) #define QMSG_ID_SOCK_LISTEN (QMSG_ID_BASE + 6) #define QMSG_ID_SOCK_EXIT (QMSG_ID_BASE + 7) // typedef struct BattInfoType // { // UINT8 sendTimeUTC[6]; // UINT8 msgMark; // UINT8 msgCollectionTimeUTC[6]; // UINT8 signalStrength; // UINT8 errClass; // UINT8 errCode[2]; // UINT8 battI[2]; // UINT8 battLinkVol[2]; // UINT8 battPackVol[2]; // UINT8 switchState; // UINT8 battSOC; // UINT8 battSOH; // UINT8 batCellBalenceState[4]; //uint32 should change to uint8[]: each bit stand for 1 cell, up to 1024 // UINT8 battCellNum; //uint8 should change to uint16 (0~65535) //zhengchao 31 // //UINT8 *battCellUPtr; // //+1 // UINT16 battTempNum; //uint8 should change to uint16 (0~65535) // //UINT8 *battCellTempPtr; // //+3 // UINT8 battWorkState; // UINT8 battHeatEnableState; // UINT8 battotherTempNum; // UINT8 battotherTemp[BMS_OTHER_TEMP+NB_OTHER_TEMP_NUM]; // }BattInfoType; // typedef struct BattMsgtoTcpType // { // UINT8 startSymbol[2]; // UINT8 cmdSymbol; // UINT8 ansSymbol; // UINT8 SN[BATT_SN_LEN]; // UINT8 encryptMethod; // UINT8 dataLength[2]; // BattInfoType battInfo; // UINT8 CRC; // }BattMsgtoTcpType; /*---------------------------------------------------------------------------*/ typedef struct HeartMsgtoTcpType { UINT8 startSymbol[2]; UINT8 cmdSymbol; UINT8 ansSymbol; UINT8 SN[BATT_SN_LEN]; UINT8 encryptMethod; UINT8 dataLength[2]; UINT8 CRC; } HeartMsgtoTcpType; 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 NBHwVersion[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 _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 _OtherInfoType { UINT8 sendTimeBTC[6]; UINT8 msgMark; UINT8 msgCollectionTimeBTC[6]; UINT8 HeatTargetT; UINT8 HeatOverTime[2]; UINT8 RentalType; UINT8 RentalStartTime[6]; UINT8 RentalDays[2]; UINT8 ExpiryDays[2]; UINT8 BleUserID[4]; UINT8 BleCode[4]; UINT8 BleAddress[6]; UINT8 BmsUploadFre[2]; UINT8 PosUploadFre[2]; UINT8 ChrgPack; } OtherInfoType; typedef struct OtherMsgtoTcpType { UINT8 startSymbol[2]; UINT8 cmdSymbol; UINT8 ansSymbol; UINT8 SN[BATT_SN_LEN]; UINT8 encryptMethod; UINT8 dataLength[2]; OtherInfoType OtherInfo; UINT8 CRC; } OtherMsgtoTcpType; typedef enum { APP_SOCKET_CONNECTION_CLOSED = 0, APP_SOCKET_CONNECTION_CONNECTING, APP_SOCKET_CONNECTION_CONNECTED, } AppSocketConnectionStatus; void AppTaskTcpInit(void *arg); void AppTaskTcpDeInit(void *arg);