|
@@ -221,6 +221,48 @@ sint8 TcpDataSendFunc(sint8 ConnectId)
|
|
|
pSendDataAddr = 0;
|
|
|
return outValue;
|
|
|
}
|
|
|
+sint8 tcpipConnectionSend(uint8 TcpConnectId, uint8 *SendDataPtr, uint16 SendDataLen)
|
|
|
+{
|
|
|
+ sint8 outValue = -1;
|
|
|
+ uint8 sendErrConuter= 0;
|
|
|
+ uint16 ReadLen = 0;
|
|
|
+ char AtCmdSend[30] = {0};
|
|
|
+ uint8 AtCmdSendTotalLen = 0;
|
|
|
+ uint8 UartRecvPtr[128];//暂存buffer改大
|
|
|
+ uint8 ret = 0;
|
|
|
+ sprintf(AtCmdSend, "AT+CIPSEND=%d,%d\r\n", TcpConnectId, SendDataLen);
|
|
|
+ AtCmdSendTotalLen = mstrlen(AtCmdSend);
|
|
|
+ while(outValue!=0&&sendErrConuter<3)
|
|
|
+ {
|
|
|
+ ret = UART_Query_Data(UART_LPUART1, UART_LPUART1, (uint8 *)AtCmdSend, AtCmdSendTotalLen, UartRecvPtr, &ReadLen, 1000);
|
|
|
+ if (((ret==0)&&(ReadLen>0)&&((uint8 *)strstr((char *)UartRecvPtr, (char *)(">"))))||1)//此IF条件默认通过
|
|
|
+ {
|
|
|
+ UART_Send_Data(UART_LPUART1, (uint8 *)SendDataPtr, SendDataLen, 1000);
|
|
|
+ sint8 ret = AtcmdDelayRecvFunc(UART_LPUART1,(char *)("+CIPSEND"),5000);
|
|
|
+ if (ret==0)
|
|
|
+ {
|
|
|
+ outValue = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+#if SEGGER_PRINTF==1
|
|
|
+ SEGGER_RTT_printf("[%d]sendFault!!!\r\n",__LINE__);
|
|
|
+#endif
|
|
|
+ outValue = -2;
|
|
|
+ sendErrConuter++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ outValue = -1;
|
|
|
+ sendErrConuter++;
|
|
|
+ }
|
|
|
+#if SEGGER_PRINTF==1
|
|
|
+ SEGGER_RTT_printf("[%d]outValue=%d,sendErrConuter=%d\r\n",__LINE__,outValue,sendErrConuter);
|
|
|
+#endif
|
|
|
+ }
|
|
|
+ return outValue;
|
|
|
+}
|
|
|
sint8 TcpConnectFunc(sint8 *ConnectId)
|
|
|
{
|
|
|
uint8 ConnectStep = 0;
|
|
@@ -701,9 +743,9 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
|
|
|
uint8 *SendBuffer = NULL;
|
|
|
uint8 DataIdx = 0;
|
|
|
#if SEGGER_PRINTF==1
|
|
|
- SEGGER_RTT_printf("[%d] TcpSendTimeCounter -%d\r\n",__LINE__,TcpSendTimeCounter);
|
|
|
+ SEGGER_RTT_printf("[%d] TcpSendTimeCounter=%d\r\n",__LINE__,TcpSendTimeCounter);
|
|
|
#endif
|
|
|
- if (TcpSendTimeCounter == 1)
|
|
|
+ if (TcpSendTimeCounter == 5)
|
|
|
{
|
|
|
DataIdx = VerMsg; //版本信息发送
|
|
|
}
|
|
@@ -734,7 +776,7 @@ void TcpDataEncode(uint32 *PtrSendAddr, uint16 *SendLen)
|
|
|
return;
|
|
|
}
|
|
|
#if SEGGER_PRINTF==1
|
|
|
- SEGGER_RTT_printf("[%d] DataIdx -%d\r\n",__LINE__,DataIdx);
|
|
|
+ SEGGER_RTT_printf("\r\n[%d] DataIdx -%X\r\n",__LINE__,DataIdx);
|
|
|
#endif
|
|
|
memcpy(TcpbattSN, AppConfigInfo.deviceSn, 17);
|
|
|
GetUtc8Time(&UTC8TimeTcp); //时间获取
|
|
@@ -1348,45 +1390,6 @@ void tcpUdsFunc(uint8 *Ptr,uint8 *AnsPtr)
|
|
|
*(AnsPtr+36) = 0x31;
|
|
|
*(AnsPtr+37) = bcc_chk(AnsPtr, 37);
|
|
|
}
|
|
|
-sint8 tcpipConnectionSend(uint8 TcpConnectId, uint8 *SendDataPtr, uint16 SendDataLen)
|
|
|
-{
|
|
|
- sint8 outValue = -1;
|
|
|
- uint8 sendErrConuter= 0;
|
|
|
- uint16 ReadLen = 0;
|
|
|
- char AtCmdSend[30] = {0};
|
|
|
- uint8 AtCmdSendTotalLen = 0;
|
|
|
- uint8 UartRecvPtr[30];
|
|
|
- uint8 ret = 0;
|
|
|
- sprintf(AtCmdSend, "AT+CIPSEND=%d,%d\r\n", TcpConnectId, SendDataLen);
|
|
|
- AtCmdSendTotalLen = mstrlen(AtCmdSend);
|
|
|
- while(outValue!=0&&sendErrConuter<3)
|
|
|
- {
|
|
|
- ret = UART_Query_Data(UART_LPUART1, UART_LPUART1, (uint8 *)AtCmdSend, AtCmdSendTotalLen, UartRecvPtr, &ReadLen, 1000);
|
|
|
- if (((ret==0)&&(ReadLen>0)&&((uint8 *)strstr((char *)UartRecvPtr, (char *)(">"))))||1)//此IF条件默认通过
|
|
|
- {
|
|
|
- UART_Send_Data(UART_LPUART1, (uint8 *)SendDataPtr, SendDataLen, 1000);
|
|
|
- sint8 ret = AtcmdDelayRecvFunc(UART_LPUART1,(char *)("+CIPSEND"),5000);
|
|
|
- if (ret==0)
|
|
|
- {
|
|
|
- outValue = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- outValue = -2;
|
|
|
- sendErrConuter++;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- outValue = -1;
|
|
|
- sendErrConuter++;
|
|
|
- }
|
|
|
-#if SEGGER_PRINTF==1
|
|
|
- SEGGER_RTT_printf("[%d]outValue=%d,sendErrConuter=%d\r\n",__LINE__,outValue,sendErrConuter);
|
|
|
-#endif
|
|
|
- }
|
|
|
- return outValue;
|
|
|
-}
|
|
|
void Fota_Ftp(uint8 *dataPtrIn)
|
|
|
{
|
|
|
static uint8 ftp_process = 0;
|