C027_SupportTest_xively_locationで使用しているC027用ライブラリ

Fork of C027_Support by u-blox

下記のプログラムC027_SupportTest_xively_locationで使用しているC027用ライブラリです。

Import programC027_SupportTest_xively_location

インターフェース2014年10月号のu-blox C027で3G通信する記事で使用したプログラム。   CQ publishing Interface 2014.10 issue, C027 3G test program.

オリジナルのライブラリは下記を参照してください。

Import libraryC027_Support

support library for C027 helper functions for Buffer Pipes, Buffered Serial Port (rtos capable) and GPS parsing. It includes modem APIs for USSD, SMS and Sockets.

Revision:
68:33a96cf64986
Parent:
66:69072b3c5bca
Child:
69:4d6fa520dfca
--- a/MDM.cpp	Tue May 13 16:03:40 2014 +0000
+++ b/MDM.cpp	Tue May 13 16:25:56 2014 +0000
@@ -770,31 +770,43 @@
 int MDMParser::socketSend(int socket, const char * buf, int len)
 {
     TRACE("socketSend(%d,,%d)\r\n", socket,len);
-    if(len > 0) {
-        sendFormated("AT+USOWR=%d,%d\r\n",socket,len);
+    int cnt = len;
+    while (cnt > 0) {
+        int blk = MAX_SIZE;
+        if (cnt < blk) 
+            blk = cnt;
+        sendFormated("AT+USOWR=%d,%d\r\n",socket,blk);
         if (RESP_PROMPT != waitFinalResp())
             return SOCKET_ERROR;
         WAIT_MS(50);
-        send(buf, len);
+        send(buf, blk);
         if (RESP_OK != waitFinalResp()) 
             return SOCKET_ERROR;
+        buf += blk;
+        cnt -= blk;
     }
-    return len;
+    return (len - cnt);
 }
 
 int MDMParser::socketSendTo(int socket, IP ip, int port, const char * buf, int len)
 {
     TRACE("socketSendTo(%d," IPSTR ",%d,,%d)\r\n", socket, IPNUM(ip),port,len);
-    if(len > 0) {
-        sendFormated("AT+USOST=%d,\"" IPSTR "\",%d,%d\r\n",socket,IPNUM(ip),port,len);
+    int cnt = len;
+    while (cnt > 0) {
+        int blk = MAX_SIZE;
+        if (cnt < blk) 
+            blk = cnt;
+       sendFormated("AT+USOST=%d,\"" IPSTR "\",%d,%d\r\n",socket,IPNUM(ip),port,blk);
         if (RESP_PROMPT != waitFinalResp())
             return SOCKET_ERROR;
         WAIT_MS(50);
-        send(buf, len);
+        send(buf, blk);
         if (RESP_OK != waitFinalResp())
             return SOCKET_ERROR;
+        buf += blk;
+        cnt -= blk;
     }
-    return len;
+    return (len - cnt);
 }
 
 int MDMParser::socketReadable(int socket)