Library for the Adafruit FONA. This is a port of the original Arduino library available at: https://github.com/adafruit/Adafruit_FONA_Library . - Modified by Marc PLOUHINEC 27/06/2015 for use in mbed - Modified by lionel VOIRIN 05/08/2018 for use Adafruit FONA 3

Dependents:   Adafruit_FONA_3G_Library_Test

Revision:
11:5f66d83249ea
Parent:
10:7951d9691cb2
Child:
12:7a6b5413b407
--- a/Adafruit_FONA.cpp	Mon Feb 25 20:27:24 2019 +0000
+++ b/Adafruit_FONA.cpp	Sat Mar 02 10:29:28 2019 +0000
@@ -1229,6 +1229,8 @@
     if (! expectReply("+CCHOPEN: 0,0")) return false;
 
     if (! expectReply("+CCHRECV: DATA,0,10", 10000)) return false;
+    
+    readline();
 
     return true;
 }
@@ -1381,9 +1383,8 @@
 uint16_t Adafruit_FONA_3G::sslTCPread(char *buff)
 {
     uint16_t avail;
-
     readline();
-    if (! parseReply("+CCHRECV: DATA,0,", &avail)) return false;
+    if (! parseReply("+CCHRECV: DATA,", &avail, ',', 1)) return false;
 
     readRaw(avail);
 
@@ -1396,9 +1397,8 @@
 #endif
 
     memcpy(buff, replybuffer, avail);
+    buff[avail] = 0;
     
-    replybuffer[0] = 0;
-
     return avail;
 }
 
@@ -1633,8 +1633,9 @@
 uint16_t Adafruit_FONA::readRaw(uint16_t b)
 {
     uint16_t idx = 0;
+    // && (idx < sizeof(replybuffer)-1)
 
-    while (b && (idx < sizeof(replybuffer)-1)) {
+    while (b && idx < 255) {
         if (readable()) {
             replybuffer[idx] = getc();
             idx++;