Coder Social home page Coder Social logo

Comments (1)

agdl avatar agdl commented on July 29, 2024

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 gsm.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.