|
@@ -38,6 +38,8 @@ sint8 TcpRegisterChkFunc(void);
|
|
|
void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen);
|
|
|
void GetUtc8Time(UTC8TimeType *UTC8TimeTcp);
|
|
|
static void AtcmdTransmit(sint8 CmdIdx, uint8 *SetValuePtr, uint16 SetValueLen, sint8 *retFunc);
|
|
|
+static sint8 tcpipConnectionSend(uint8 TcpConnectId,uint8 * SendDataPtr,uint16 SendDataLen);
|
|
|
+static void TcpDataInfoRecvHandle(uint8 *DataRecv,uint16 DataRecvLen);
|
|
|
void Uart_4G_Task(void *pvParameters)
|
|
|
{
|
|
|
(void)pvParameters;
|
|
@@ -51,6 +53,7 @@ void Uart_4G_Task(void *pvParameters)
|
|
|
vTaskDelay(pdMS_TO_TICKS(5000));
|
|
|
uint8 pReadLen = 0;
|
|
|
InitFunc(); // 4G模块初始化,注:AT同步不通过,没有进行次数判定及跳转
|
|
|
+ uint32 SendTimerCounter = 0;
|
|
|
for (;;)
|
|
|
{
|
|
|
switch (gProcess_Tcp_Task)
|
|
@@ -62,10 +65,11 @@ void Uart_4G_Task(void *pvParameters)
|
|
|
{
|
|
|
PROC_TCP_STATE_SWITCH(PROCESS_TCP_REGCHK);
|
|
|
}
|
|
|
- else if (TimerCounter % 1000 == 0)
|
|
|
+ else if ((TimerCounter -SendTimerCounter)>1000)
|
|
|
{
|
|
|
+ SendTimerCounter = TimerCounter;
|
|
|
PROC_TCP_STATE_SWITCH(PROCESS_TCP_SEND);
|
|
|
- Dio_FlipChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3);
|
|
|
+ //Dio_FlipChannel(DioConf_DioChannel_PTE7_GPIO_OUT_MCU_LED3);
|
|
|
}
|
|
|
else if (TimerCounter % 100 == 0)
|
|
|
{
|
|
@@ -135,6 +139,12 @@ void Uart_4G_Task(void *pvParameters)
|
|
|
}
|
|
|
case PROCESS_TCP_RECV: //网络数据接收,100ms空闲状态下即可接收
|
|
|
{
|
|
|
+ memset(RX_Buffer[UART_LPUART1],0x00,sizeof(RX_Buffer[UART_LPUART1]));
|
|
|
+ UART_Receive_Data(UART_LPUART1,RX_Buffer[UART_LPUART1],&pReadLen,100);
|
|
|
+ if(pReadLen>0&&SocketId>=0)
|
|
|
+ {
|
|
|
+ TcpDataInfoRecvHandle(RX_Buffer[UART_LPUART1],pReadLen);
|
|
|
+ }
|
|
|
PROC_TCP_STATE_SWITCH(PROCESS_TCP_IDLE);
|
|
|
break;
|
|
|
}
|
|
@@ -148,10 +158,10 @@ void Uart_4G_Task(void *pvParameters)
|
|
|
}
|
|
|
case PROCESS_TCP_ERROR: //错误状态
|
|
|
{
|
|
|
- Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_OFF);
|
|
|
- vTaskDelay(pdMS_TO_TICKS(100));
|
|
|
+// Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_OFF);
|
|
|
+// vTaskDelay(pdMS_TO_TICKS(100));
|
|
|
PROC_TCP_STATE_SWITCH(PROCESS_TCP_IDLE);
|
|
|
- Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_ON);
|
|
|
+// Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_ON);
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -162,29 +172,13 @@ sint8 TcpDataSendFunc(sint8 ConnectId)
|
|
|
sint8 outValue = -1;
|
|
|
uint32 pSendDataAddr = 0;
|
|
|
uint16 DataSendLen = 0;
|
|
|
- sint8 ATRet = -1;
|
|
|
- uint8 ReadLen = 0;
|
|
|
memcpy(TcpbattSN, defaultSn, 17);
|
|
|
TcpDataEncode(&pSendDataAddr, &DataSendLen); //数据组包,malloc申请在里面,pSendData指向申请的地址
|
|
|
if (DataSendLen == 0)
|
|
|
{
|
|
|
return 0; //暂时无数据可以发
|
|
|
}
|
|
|
- //数据准备完成,下面开始发送
|
|
|
- char AtCmdSend[10] = {0};
|
|
|
- uint8 AtCmdSendTotalLen = 0;
|
|
|
- sprintf(AtCmdSend, "%d,%d\r\n", ConnectId, DataSendLen); //此处需要优化
|
|
|
- AtCmdSendTotalLen = mstrlen(AtCmdSend);
|
|
|
- AtcmdTransmit(AT_SEND, AtCmdSend, AtCmdSendTotalLen, &ATRet);
|
|
|
- if (ATRet == 0)
|
|
|
- {
|
|
|
- memset(RX_Buffer[UART_LPUART1], 0x00, sizeof(RX_Buffer[UART_LPUART1]));
|
|
|
- UART_Query_Data(UART_LPUART1, UART_LPUART1, (uint8 *)pSendDataAddr, DataSendLen, RX_Buffer[UART_LPUART1], &ReadLen, 1000);
|
|
|
- if ((uint8 *)strstr((char *)RX_Buffer[UART_LPUART1], (char *)("OK")))
|
|
|
- {
|
|
|
- outValue = 0;
|
|
|
- }
|
|
|
- }
|
|
|
+ outValue = tcpipConnectionSend(ConnectId,(uint8 *)pSendDataAddr,DataSendLen);//发送函数
|
|
|
if (pSendDataAddr != 0)
|
|
|
{
|
|
|
free((uint8 *)(pSendDataAddr));
|
|
@@ -207,7 +201,7 @@ sint8 TcpConnectFunc(sint8 *ConnectId)
|
|
|
uint8 ATCmdSendLen = mstrlen(ATCmdSend);
|
|
|
uint8 ReadLen = 0;
|
|
|
memset(RX_Buffer[UART_LPUART1], 0x00, sizeof(RX_Buffer[UART_LPUART1]));
|
|
|
- UART_Query_Data(UART_LPUART1, UART_LPUART1, ATCmdSend, ATCmdSendLen, RX_Buffer[UART_LPUART1], &ReadLen, 1000);
|
|
|
+ UART_Query_Data(UART_LPUART1, UART_LPUART1, ATCmdSend, ATCmdSendLen, RX_Buffer[UART_LPUART1], &ReadLen, 100);
|
|
|
uint8 *retptr = NULL;
|
|
|
if (ReadLen > 0)
|
|
|
{
|
|
@@ -390,7 +384,7 @@ void InitFunc(void)
|
|
|
ATCmdSend = (char *)("ATE0\r\n");
|
|
|
ATCmdSendLen = mstrlen(ATCmdSend);
|
|
|
memset(RX_Buffer[UART_LPUART1], 0x00, sizeof(RX_Buffer[UART_LPUART1]));
|
|
|
- UART_Query_Data(UART_LPUART1, UART_LPUART1, ATCmdSend, ATCmdSendLen, RX_Buffer[UART_LPUART1], &ReadLen, 1000);
|
|
|
+ UART_Query_Data(UART_LPUART1, UART_LPUART1, ATCmdSend, ATCmdSendLen, RX_Buffer[UART_LPUART1], &ReadLen, 100);
|
|
|
uint8 *retptr = NULL;
|
|
|
if (ReadLen > 0)
|
|
|
{
|
|
@@ -415,7 +409,7 @@ void InitFunc(void)
|
|
|
ATCmdSend = (char *)("AT+SIMEI?\r\n");
|
|
|
ATCmdSendLen = mstrlen(ATCmdSend);
|
|
|
memset(RX_Buffer[UART_LPUART1], 0x00, sizeof(RX_Buffer[UART_LPUART1]));
|
|
|
- UART_Query_Data(UART_LPUART1, UART_LPUART1, ATCmdSend, ATCmdSendLen, RX_Buffer[UART_LPUART1], &ReadLen, 1000);
|
|
|
+ UART_Query_Data(UART_LPUART1, UART_LPUART1, ATCmdSend, ATCmdSendLen, RX_Buffer[UART_LPUART1], &ReadLen, 100);
|
|
|
uint8 *retptr = NULL;
|
|
|
if (ReadLen > 0)
|
|
|
{
|
|
@@ -441,7 +435,7 @@ void InitFunc(void)
|
|
|
ATCmdSend = (char *)("AT+CTZU=1\r\n");
|
|
|
ATCmdSendLen = mstrlen(ATCmdSend);
|
|
|
memset(RX_Buffer[UART_LPUART1], 0x00, sizeof(RX_Buffer[UART_LPUART1]));
|
|
|
- UART_Query_Data(UART_LPUART1, UART_LPUART1, ATCmdSend, ATCmdSendLen, RX_Buffer[UART_LPUART1], &ReadLen, 1000);
|
|
|
+ UART_Query_Data(UART_LPUART1, UART_LPUART1, ATCmdSend, ATCmdSendLen, RX_Buffer[UART_LPUART1], &ReadLen, 100);
|
|
|
uint8 *retptr = NULL;
|
|
|
if (ReadLen > 0)
|
|
|
{
|
|
@@ -499,7 +493,7 @@ static void AtcmdTransmit(sint8 CmdIdx, uint8 *SetValuePtr, uint16 SetValueLen,
|
|
|
}
|
|
|
memset(RX_Buffer[UART_LPUART1], 0x00, sizeof(RX_Buffer[UART_LPUART1]));
|
|
|
|
|
|
- UART_Query_Data(UART_LPUART1, UART_LPUART1, PtrATCmdSend, ATCmdTotalLen, RX_Buffer[UART_LPUART1], &ReadLen, 1000);
|
|
|
+ UART_Query_Data(UART_LPUART1, UART_LPUART1, PtrATCmdSend, ATCmdTotalLen, RX_Buffer[UART_LPUART1], &ReadLen, 100);
|
|
|
|
|
|
*retFunc = Atcmdfunc[CmdIdx].cb(PtrATCmdSend, RX_Buffer[UART_LPUART1], CmdIdx, ReadLen);
|
|
|
if (PtrATCmdSend != NULL)
|
|
@@ -649,10 +643,14 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
|
|
|
DataIdx = VerMsg; //版本信息发送
|
|
|
}
|
|
|
#ifdef APP_UART0_ENABLE
|
|
|
- else if (TcpSendTimeCounter % 60 == 0)
|
|
|
+ else if (TcpSendTimeCounter % 10 == 0)
|
|
|
{
|
|
|
DataIdx = BattMsg; //电池信息发送
|
|
|
}
|
|
|
+ else if ((TcpSendTimeCounter+1) % 10 == 0)
|
|
|
+ {
|
|
|
+ DataIdx = 0x83; //储能开关信息发送
|
|
|
+ }
|
|
|
else if (TcpSendTimeCounter % 240 == 0)
|
|
|
{
|
|
|
DataIdx = GpsMsg; //定位信息发送
|
|
@@ -786,12 +784,12 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
|
|
|
VerMsgToTcpInfo.VerInfo.msgCollectionTimeUTC[5] = UTC8TimeTcp.second & 0xFF;
|
|
|
memcpy(VerMsgToTcpInfo.VerInfo.ICCID, IccidNum, 20);
|
|
|
memcpy(VerMsgToTcpInfo.VerInfo.IMEI, ImeiNum, 15);
|
|
|
- VerMsgToTcpInfo.VerInfo.BMSHwVersion[0] = 0;
|
|
|
- VerMsgToTcpInfo.VerInfo.BMSHwVersion[1] = 0;
|
|
|
- VerMsgToTcpInfo.VerInfo.BMSSwVersion[0] = 0;
|
|
|
- VerMsgToTcpInfo.VerInfo.BMSSwVersion[1] = 0;
|
|
|
- VerMsgToTcpInfo.VerInfo.BMSSwVersion[2] = 0;
|
|
|
- VerMsgToTcpInfo.VerInfo.BMSSwVersion[3] = 0;
|
|
|
+ VerMsgToTcpInfo.VerInfo.BMSHwVersion[0] = bmsHwVersion>>8;
|
|
|
+ VerMsgToTcpInfo.VerInfo.BMSHwVersion[1] = bmsHwVersion;
|
|
|
+ VerMsgToTcpInfo.VerInfo.BMSSwVersion[0] = bmsSwVersion>>24;
|
|
|
+ VerMsgToTcpInfo.VerInfo.BMSSwVersion[1] = bmsSwVersion>>16;
|
|
|
+ VerMsgToTcpInfo.VerInfo.BMSSwVersion[2] = bmsSwVersion>>8;
|
|
|
+ VerMsgToTcpInfo.VerInfo.BMSSwVersion[3] = bmsSwVersion;
|
|
|
VerMsgToTcpInfo.VerInfo.HwVersion[0] = (HWVERSION >> 8) & 0xFF;
|
|
|
VerMsgToTcpInfo.VerInfo.HwVersion[1] = (HWVERSION)&0xFF;
|
|
|
VerMsgToTcpInfo.VerInfo.BLVersion[0] = (BLSWVERSION >> 24) & 0xFF;
|
|
@@ -875,7 +873,7 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
|
|
|
*(SendBuffer + 55 + AppDataInfo.BattCellCount * 2) = AppDataInfo.BattTempCount; //模组温度个数
|
|
|
memcpy((SendBuffer + 55 + AppDataInfo.BattCellCount * 2 + 1), &battCellTemp, AppDataInfo.BattTempCount); //模组温度
|
|
|
*(SendBuffer + 56 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount) = battWorkState; //电池工作状态
|
|
|
- *(SendBuffer + 57 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount) = battHeatEnableState; //电池加热使能
|
|
|
+ *(SendBuffer + 57 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount) = battHeatEnableState; //电池加热使能状态
|
|
|
*(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount) = BmsOtherTemp + OtherTemp; //其他温度个数
|
|
|
// *(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + 1) = MOSTemp; // mos温度
|
|
|
// *(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + 2) = packTemp; //环境温度
|
|
@@ -884,7 +882,45 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
|
|
|
// *(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + 5) = heatTemp1; //加热温度1
|
|
|
// *(SendBuffer + 58 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + 6) = heatTemp2; //加热温度2
|
|
|
*(SendBuffer + 59 + AppDataInfo.BattCellCount * 2 + AppDataInfo.BattTempCount + BmsOtherTemp + OtherTemp) = bcc_chk(SendBuffer, ProtocolFixedLen + ProtocolFluctedLen - 1); //校验码
|
|
|
- PtrSendAddr = (uint32)SendBuffer;
|
|
|
+ *PtrSendAddr = (uint32)SendBuffer;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case 0x83://储能场景的开关信息
|
|
|
+ {
|
|
|
+ StorageInfoToTcp StorageInfo;
|
|
|
+ *SendLen = sizeof(StorageInfo);
|
|
|
+ SendBuffer = malloc(*SendLen);
|
|
|
+ uint16 DataLen = 0;
|
|
|
+ DataLen = (uint16)sizeof(StorageInfo.StorageMsg);
|
|
|
+ StorageInfo.startSymbol[0] = TCP_START_SYM1;
|
|
|
+ StorageInfo.startSymbol[1] = TCP_START_SYM2;
|
|
|
+ StorageInfo.cmdSymbol = TCP_CMD_SYM;
|
|
|
+ StorageInfo.ansSymbol = TCP_ANS_SYM;
|
|
|
+ memcpy(StorageInfo.SN, TcpbattSN, BATT_SN_LEN);
|
|
|
+ StorageInfo.encryptMethod = TCP_ENCPT_DISABLE; // not encrypt
|
|
|
+ StorageInfo.dataLength[0] = (DataLen >> 8) & 0xFF;
|
|
|
+ StorageInfo.dataLength[1] = DataLen & 0xFF;
|
|
|
+ StorageInfo.StorageMsg.sendTimeUTC[0] = (UTC8TimeTcp.year) & 0xFF; // year
|
|
|
+ StorageInfo.StorageMsg.sendTimeUTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
+ StorageInfo.StorageMsg.sendTimeUTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
+ StorageInfo.StorageMsg.sendTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
+ StorageInfo.StorageMsg.sendTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
+ StorageInfo.StorageMsg.sendTimeUTC[5] = UTC8TimeTcp.second & 0xFF; // sec
|
|
|
+ StorageInfo.StorageMsg.msgMark = DataIdx;
|
|
|
+ StorageInfo.StorageMsg.msgCollectionTimeUTC[0] = (UTC8TimeTcp.year) & 0xFF; // year
|
|
|
+ StorageInfo.StorageMsg.msgCollectionTimeUTC[1] = UTC8TimeTcp.month & 0xFF; // month
|
|
|
+ StorageInfo.StorageMsg.msgCollectionTimeUTC[2] = UTC8TimeTcp.day & 0xFF; // day
|
|
|
+ StorageInfo.StorageMsg.msgCollectionTimeUTC[3] = UTC8TimeTcp.hour & 0xFF; // hour
|
|
|
+ StorageInfo.StorageMsg.msgCollectionTimeUTC[4] = UTC8TimeTcp.minute & 0xFF; // mins
|
|
|
+ StorageInfo.StorageMsg.msgCollectionTimeUTC[5] = UTC8TimeTcp.second & 0xFF;
|
|
|
+ StorageInfo.StorageMsg.RelayState = battRelayState;
|
|
|
+ StorageInfo.StorageMsg.FanState = battFanState;
|
|
|
+ StorageInfo.StorageMsg.HeatState = battHeatState;
|
|
|
+ StorageInfo.StorageMsg.ConvertState = battConverState;
|
|
|
+ StorageInfo.CRC = bcc_chk((uint8 *)&StorageInfo, sizeof(StorageInfo) - 1);
|
|
|
+ memcpy(SendBuffer, &StorageInfo, sizeof(StorageInfo));
|
|
|
+ *PtrSendAddr = (uint32)SendBuffer;
|
|
|
+ break;
|
|
|
}
|
|
|
#endif
|
|
|
#ifdef APP_CAN_ENABLE
|
|
@@ -1092,7 +1128,7 @@ void GetUtc8Time(UTC8TimeType *UTC8TimeTcp)
|
|
|
uint8 ReadLen = 0;
|
|
|
uint8 *retptr = NULL;
|
|
|
memset(RX_Buffer[UART_LPUART1], 0x00, sizeof(RX_Buffer[UART_LPUART1]));
|
|
|
- UART_Query_Data(UART_LPUART1, UART_LPUART1, AtCmdAsk, AtCmdLen, RX_Buffer[UART_LPUART1], &ReadLen, 1000 * 10);
|
|
|
+ UART_Query_Data(UART_LPUART1, UART_LPUART1, AtCmdAsk, AtCmdLen, RX_Buffer[UART_LPUART1], &ReadLen, 100);
|
|
|
if (ReadLen > 0)
|
|
|
{
|
|
|
if ((uint8 *)strstr((char *)RX_Buffer[UART_LPUART1], (char *)("OK")))
|
|
@@ -1107,3 +1143,94 @@ void GetUtc8Time(UTC8TimeType *UTC8TimeTcp)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+static void TcpDataInfoRecvHandle(uint8 *DataRecv,uint16 DataRecvLen)
|
|
|
+{
|
|
|
+ uint8 Tcp_Cmd;
|
|
|
+ uint8 *Ptr=NULL,*retptr=NULL;
|
|
|
+ uint8 TcpCmdAnswer[31];
|
|
|
+ uint16 TcpDataLen = 0;
|
|
|
+ uint16 NumCalTemp = 1;
|
|
|
+ retptr = (uint8 *)strstr((char *)DataRecv, (char *)("\r\n##"));
|
|
|
+ if(retptr==NULL)return;
|
|
|
+ for(uint8 i=0;i<5;i++)
|
|
|
+ {
|
|
|
+ if(*(retptr - i - 1)=='D')
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ TcpDataLen = TcpDataLen + CharToHex(*(retptr - i - 1))*NumCalTemp;
|
|
|
+ NumCalTemp = NumCalTemp*10;
|
|
|
+ }
|
|
|
+ if (TcpDataLen>0)
|
|
|
+ {
|
|
|
+ Ptr = retptr + 2;
|
|
|
+ if ((*(Ptr + 0) == TCP_START_SYM1) && (*(Ptr + 1) == TCP_START_SYM2)) //服务器起始信息
|
|
|
+ {
|
|
|
+ Tcp_Cmd = *(Ptr + 2); //命令标志
|
|
|
+// if (*(Ptr + 3) == 0xFE)
|
|
|
+// {
|
|
|
+// TCPWorkState = 0x01;//需要暂停发送,进行命令应答的标志
|
|
|
+// }
|
|
|
+ switch (Tcp_Cmd)
|
|
|
+ {
|
|
|
+ case TCP_QUERY_SYM:
|
|
|
+ break;
|
|
|
+ case TCP_SETCMD_SYM:
|
|
|
+ break;
|
|
|
+ case TCP_CONCMD_SYM:
|
|
|
+ {
|
|
|
+ TcpCmdAnswer[0] = TCP_START_SYM1;
|
|
|
+ TcpCmdAnswer[1] = TCP_START_SYM1;
|
|
|
+ TcpCmdAnswer[2] = TCP_CONCMD_SYM;
|
|
|
+ if (*(Ptr + 30) == 0x80) //远程锁定命令
|
|
|
+ {
|
|
|
+ TcpCmdAnswer[3] = 0x01;
|
|
|
+ memcpy(&TcpCmdAnswer[4], (Ptr + 4), BATT_SN_LEN);
|
|
|
+ TcpCmdAnswer[21] = TCP_ENCPT_DISABLE;
|
|
|
+ TcpCmdAnswer[22] = 0x00;
|
|
|
+ TcpCmdAnswer[23] = 0x06;
|
|
|
+ memcpy(&TcpCmdAnswer[24], (Ptr + 24), 6);
|
|
|
+ TcpCmdAnswer[30] = bcc_chk(TcpCmdAnswer, 30);
|
|
|
+ if (*(Ptr + 31) == 0x01) // 0x01代表锁定
|
|
|
+ {
|
|
|
+ battSeparateEnable = 1;
|
|
|
+ battSeparateEnableState = 1;
|
|
|
+ tcpipConnectionSend(SocketId, TcpCmdAnswer, 31 );
|
|
|
+ }
|
|
|
+ else if (*(Ptr + 31) == 0x02) // 0x02代表解锁
|
|
|
+ {
|
|
|
+ battSeparateEnable = 1;
|
|
|
+ battSeparateEnableState = 0;
|
|
|
+ tcpipConnectionSend(SocketId, TcpCmdAnswer, 31);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+static sint8 tcpipConnectionSend(uint8 TcpConnectId,uint8 * SendDataPtr,uint16 SendDataLen)
|
|
|
+{
|
|
|
+ sint8 outValue = -1;
|
|
|
+ sint8 ATRet = -1;
|
|
|
+ uint8 ReadLen = 0;
|
|
|
+ char AtCmdSend[10] = {0};
|
|
|
+ uint8 AtCmdSendTotalLen = 0;
|
|
|
+ sprintf(AtCmdSend, "%d,%d\r\n", TcpConnectId, SendDataLen);
|
|
|
+ AtCmdSendTotalLen = mstrlen(AtCmdSend);
|
|
|
+ AtcmdTransmit(AT_SEND, AtCmdSend, AtCmdSendTotalLen, &ATRet);
|
|
|
+ if (ATRet == 0)
|
|
|
+ {
|
|
|
+ memset(RX_Buffer[UART_LPUART1], 0x00, sizeof(RX_Buffer[UART_LPUART1]));
|
|
|
+ UART_Query_Data(UART_LPUART1, UART_LPUART1, (uint8 *)SendDataPtr, SendDataLen, RX_Buffer[UART_LPUART1], &ReadLen, 100);
|
|
|
+ if ((uint8 *)strstr((char *)RX_Buffer[UART_LPUART1], (char *)("OK")))
|
|
|
+ {
|
|
|
+ outValue = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return outValue;
|
|
|
+}
|