a library to use GPRS like ethernet or wifi, which makes it possible to connect to the internet with your GPRS module

Dependencies:   BufferedSerial

Dependents:   ThinkSpeak_Test roam_v1 roam_v2 finalv3

Fork of GPRSInterface by wei zou

Revision:
11:0184e407128e
Parent:
9:38800611a613
Child:
13:379ce1d51b88
diff -r 652c23d73373 -r 0184e407128e GPRS/GPRS.cpp
--- a/GPRS/GPRS.cpp	Tue Mar 10 02:57:52 2015 +0000
+++ b/GPRS/GPRS.cpp	Tue Mar 10 03:04:27 2015 +0000
@@ -144,16 +144,20 @@
     char cmd[16];
     char resp[96];
     snprintf(cmd,16,"AT+CIPSTATUS=%d\r\n",socket);
-    sendCmd(cmd);
-    readBuffer(resp,sizeof(resp),DEFAULT_TIMEOUT);
-    if(NULL != strstr(resp,"CONNECTED")) {
-        //+CIPSTATUS: 1,0,"TCP","216.52.233.120","80","CONNECTED"
-        return true;
-    } else {
-        //+CIPSTATUS: 1,0,"TCP","216.52.233.120","80","CLOSED"
-        //+CIPSTATUS: 0,,"","","","INITIAL"
-        return false;
+    for (int i = 0; i < 3; i++) {
+        sendCmd(cmd);
+        readBuffer(resp,sizeof(resp),DEFAULT_TIMEOUT);
+        if(NULL != strstr(resp,"CONN")) {
+            //+CIPSTATUS: 1,0,"TCP","216.52.233.120","80","CONNECTED"
+            return true;
+        } else if (NULL != strstr(resp,"CLOSE")) {
+            //+CIPSTATUS: 1,0,"TCP","216.52.233.120","80","CLOSED"
+            //+CIPSTATUS: 0,,"","","","INITIAL"
+            return false;
+        }
     }
+    
+    return false;
 }
 
 void GPRS::reset()