STM32通过GPRS与服务器建立TCP连接(2)
- UID
- 1029342
- 性别
- 男
|
STM32通过GPRS与服务器建立TCP连接(2)
case 9:
if(GprsState.bits.Timeout == true)
{
// SendUartStr("AT^SICS=0,passwd,gprs",3);
USART3_Task_Cnt = 10;
SetGprsTime(100);
}
break;
case 10:
if(GprsState.bits.Timeout == true)
{
SendUartStr("AT^SICS=0,apn,"cmnet"",3);
USART3_Task_Cnt = 11;
SetGprsTime(100);
}
break;
case 11:
if(GprsState.bits.Timeout == true)
{
SendUartStr("AT^SISS=1,ConID,0",3);
USART3_Task_Cnt = 12;
SetGprsTime(100);
}
break;
case 12:
if(GprsState.bits.Timeout == true)
{
SendUartStr("AT^SISS=1,srvType,socket",3);
USART3_Task_Cnt = 13;
SetGprsTime(200);
}
break;
case 13:
if(GprsState.bits.Timeout == true)
{
SendUartStr("AT^SISS=1,address,"socktcp://118.244.164.188:7777"",3);
USART3_Task_Cnt = 14;
SetGprsTime(600);
}
break;
case 14:
if(GprsState.bits.Timeout == true)
{
SendUartStr("AT^SISO=1",3);
USART3_Task_Cnt = 15;
SetGprsTime(5000);
GprsState.bits.Connect_Send_OK = false;
}
break;
case 15:
if(GprsState.bits.Connect_Send_OK == true)
{
GprsState.bits.Connect_Send_OK = false;
USART3_Task_Cnt = 16;
SendUartStr("Connect_OK!",1);
}
if(GprsState.bits.Timeout == true)
{
SendUartStr("AT^SISC=1",3);
// USART3_Task_Cnt = 0;
USART3_Task_Cnt = 7;
SetGprsTime(3000);
}
break;
case 16:
// SendUartStr("AT^SISW=1,12",3);
if(GprsState.bits.Timeout == true)
{
if(GPRSDataBuf.WaitSend == !0)
{
SendUartStr("AT^SISW=1,",3);
SendUartByte((GPRSDataBuf.length)/10+0x30,3);
SendUartByte((GPRSDataBuf.length)+0x30,3);
SendUartStr("",3);
USART3_Task_Cnt = 17;
SetGprsTime(50);
}
}
break;
case 17:
if(GprsState.bits.Timeout == true)
{
if(GPRSDataBuf.WaitSend == !0)
{
SendUartStr((char*)GPRSDataBuf.buf,3);
SendUartStr("",3);
USART3_Task_Cnt = 18;
SetGprsTime(5000);
}
}
break;
case 18:
if(GprsState.bits.Timeout == true)
{
// USART3_Task_Cnt = 0;
SendUartStr("AT^SISC=1",3);
USART3_Task_Cnt = 7;
SetGprsTime(1000);
}
if(GprsState.bits.Connect_Send_OK == true)
{
GprsState.bits.Connect_Send_OK = false;
GPRSDataBuf.SendOK = !0;
GPRSDataBuf.WaitSend = 0;
USART3_Task_Cnt = 16;
SetGprsTime(1000); //发送间隔时间
}
break;
case 19:
break;
default:
break;
}
} |
|
|
|
|
|