Open agdl opened 8 years ago
From @brezinapeto on February 26, 2016 8:19
What I did in my GSM libraries :
void GSM3MobileServerService::stop()
{
// Review, should be the server?
/*theGSM3MobileClientProvider->disconnectTCP(local1Remote0, mySocket);
if(flags & GSM3MOBILESERVERSERVICE_SYNCH)
waitForAnswer();
theGSM3MobileClientProvider->releaseSocket(mySocket);*/
theGSM3MobileServerProvider->disconnectTCPServer(mySocket); //PBR modification
if(flags & GSM3MOBILESERVERSERVICE_SYNCH)
waitForAnswer();
theGSM3MobileClientProvider->releaseSocket(mySocket);
mySocket = -1;
}
//Disconnect Server main function. PBR modification
int GSM3ShieldV1ServerProvider::disconnectTCPServer(uint8_t socket)
{
// id Socket does not really mean anything, in this case we have
// only one socket running
theGSM3ShieldV1ModemCore.openCommand(this,DISCONNECTTCP);
// If we are not closed, launch the command
//[ZZ] if(theGSM3ShieldV1ModemCore.getStatus()==TRANSPARENT_CONNECTED)
// {
delay(1000);
theGSM3ShieldV1ModemCore.print("+++");
delay(1000);
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QISRVC=2"));//PBR modification
theGSM3ShieldV1ModemCore.genericCommand_rq(PSTR("AT+QICLOSE"));
theGSM3ShieldV1ModemCore.setStatus(GPRS_READY);
// }
// Looks like it runs everytime, so we simply flush to death and go on
do
{
// Empty the local buffer, and tell the modem to XON
// If meanwhile we receive a DISCONNECT we should detect it as URC.
theGSM3ShieldV1ModemCore.theBuffer().flush();
theGSM3ShieldV1ModemCore.gss.spaceAvailable();
// Give some time for the buffer to refill
delay(100);
theGSM3ShieldV1ModemCore.closeCommand(1);
}while(theGSM3ShieldV1ModemCore.theBuffer().storedBytes()>0);
theGSM3ShieldV1ModemCore.unRegisterUMProvider(this);
return theGSM3ShieldV1ModemCore.getCommandError();
}
From @brezinapeto on February 25, 2016 14:28
Please read communication with Quectel :
Here is answer from Quectel:
Copied from original issue: arduino/Arduino#4612