Cellular library for MTS Socket Modem Arduino Shield devices from Multi-Tech Systems
Dependents: mtsas mtsas mtsas mtsas
Diff: Cellular/UIP.cpp
- Revision:
- 66:8c55e2bf7270
- Parent:
- 59:5535f14e3cc4
- Child:
- 67:7c705fe2acec
--- a/Cellular/UIP.cpp Mon Aug 18 19:42:44 2014 +0000 +++ b/Cellular/UIP.cpp Tue Oct 21 17:26:05 2014 +0000 @@ -120,7 +120,7 @@ logDebug("Closing PPP Connection"); if(socketOpened) { - close(); + close(true); } Code code = sendBasicCommand("AT#CONNECTIONSTOP", 10000); @@ -280,7 +280,7 @@ return socketOpened; } -bool UIP::close() +bool UIP::close(bool clearBuffer) { if(io == NULL) { logError("MTSBufferedIO not set"); @@ -302,19 +302,21 @@ return false; } - Timer tmr; - int counter = 0; - char tmp[256]; - tmr.start(); - do { - if(socketOpened == false) { - break; - } - read(tmp, 256, 1000); - } while(counter++ < 10); - - io->rxClear(); - io->txClear(); + if (clearBuffer) { + Timer tmr; + int counter = 0; + char tmp[256]; + tmr.start(); + do { + if(socketOpened == false) { + break; + } + read(tmp, 256, 1000); + } while(counter++ < 10); + + io->rxClear(); + io->txClear(); + } socketOpened = false; return true;