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:
9:38800611a613
Parent:
8:180feb3ebe62
Child:
11:0184e407128e
--- a/GPRS/GPRS.cpp	Tue May 06 03:56:03 2014 +0000
+++ b/GPRS/GPRS.cpp	Mon Mar 09 07:25:05 2015 +0000
@@ -219,20 +219,25 @@
     return req_size>256?256:req_size+1;
 }
 
-int GPRS::send(int socket, const char * str, int len)
+int GPRS::send(int socket, const char * data, int len)
 {
     if (socket < 0 || socket > MAX_SOCK_NUM-1) {
         return -1;
     }
+
     char cmd[32];
+    char resp[16];
     wait(1);
     if(len > 0){
-        snprintf(cmd,sizeof(cmd),"AT+CIPSEND=%d\r\n",socket);
-        if(0 != sendCmdAndWaitForResp(cmd,">",2,CMD)) {
+        snprintf(cmd,sizeof(cmd),"AT+CIPSEND=%d,%d\r\n",socket,len);
+        if(0 != sendCmdAndWaitForResp(cmd,">",DEFAULT_TIMEOUT,CMD)) {
             return false;
         }
-        sendCmd(str);
-        serialModem.putc((char)0x1a);
+        sendData(data, len);
+        snprintf(resp,sizeof(resp),"%d, SEND OK",socket);
+        if(0 != waitForResp(resp,DEFAULT_TIMEOUT,DATA)) {
+            return -1;
+        }
     }
     return len;
 }