C027 updated to work with latest mBed libraries

Dependents:   Cellular_HelloMQTT UBLOXModemDriver UBLOXMQTTDriver

Fork of C027_Support by u-blox

Revision:
11:b084552b03fe
Parent:
10:3f1c13a8763d
Child:
15:5eda64e5b9d1
--- a/GPS.cpp	Thu Nov 14 12:57:21 2013 +0000
+++ b/GPS.cpp	Thu Nov 14 15:52:36 2013 +0000
@@ -119,7 +119,7 @@
     return i;
 }
 
-int GPSParser::sendUbx(unsigned char cls, unsigned char id, const void* buf, int len)
+int GPSParser::sendUbx(unsigned char cls, unsigned char id, const void* buf /*= NULL*/, int len /*= 0*/)
 {
     char head[6] = { 0xB5, 0x62, cls, id, len >> 0, len >> 8 };
     char crc[2];
@@ -134,7 +134,7 @@
     for (i = 0; i < len; i ++)
     {
         ca += ((char*)buf)[i];
-        cb += ca;
+        cb += ca; 
     }
     i  = _send(head, sizeof(head));
     i += _send(buf, len);
@@ -272,7 +272,7 @@
     if (len) 
     {
         if (!I2C::write(GPSADR,&REGSTREAM,sizeof(REGSTREAM),true))
-            sent = _send(buf, len);
+            sent = send(buf, len);
         found = (len == sent);
         stop();
     }
@@ -282,26 +282,20 @@
 int GPSI2C::sendNmea(const char* buf, int len)
 { 
     int sent = 0;
-    if (len) 
-    {
-        if (!I2C::write(GPSADR,&REGSTREAM,sizeof(REGSTREAM),true))
-            sent = GPSParser::sendNmea(buf, len);
-        found = (len == sent);
-        stop();
-    }
+    if (!I2C::write(GPSADR,&REGSTREAM,sizeof(REGSTREAM),true))
+        sent = GPSParser::sendNmea(buf, len);
+    found = (len == sent);
+    stop();
     return sent;
 }
 
 int GPSI2C::sendUbx(unsigned char cls, unsigned char id, const void* buf, int len)
 { 
     int sent = 0;
-    if (len) 
-    {
-        if (!I2C::write(GPSADR,&REGSTREAM,sizeof(REGSTREAM),true))
-            sent = GPSParser::sendUbx(cls, id, buf, len);
-        found = (len == sent);
-        stop();
-    }
+    if (!I2C::write(GPSADR,&REGSTREAM,sizeof(REGSTREAM),true))
+        sent = GPSParser::sendUbx(cls, id, buf, len);
+    found = (len == sent);
+    stop();
     return sent;
 }