Official reference client implementation for Cumulocity SmartREST on u-blox C027.

Dependencies:   C027_Support C12832 LM75B MMA7660 MbedSmartRest mbed-rtos mbed

Fork of MbedSmartRestMain by Vincent Wochnik

Files at this revision

API Documentation at this revision

Comitter:
xinlei
Date:
Fri Aug 07 12:38:28 2015 +0000
Parent:
129:b81a6ed6addc
Child:
132:a06da6952339
Commit message:
GPSTracker: fix for new data format

Changed in this revision

C027_Support.lib Show annotated file Show diff for this revision Revisions of this file
MbedAgent.cpp Show annotated file Show diff for this revision Revisions of this file
io/GPSTracker.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
util/SmartRestConf.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/C027_Support.lib	Wed Jun 03 09:51:47 2015 +0000
+++ b/C027_Support.lib	Fri Aug 07 12:38:28 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/xinlei/code/C027_Support/#73d7bfcc1e3d
+http://developer.mbed.org/users/xinlei/code/C027_Support/#0c2bef7cca88
--- a/MbedAgent.cpp	Wed Jun 03 09:51:47 2015 +0000
+++ b/MbedAgent.cpp	Fri Aug 07 12:38:28 2015 +0000
@@ -103,7 +103,7 @@
     while (true) {
         int l = 0;
         for (size_t i = 0; i < N; ++i) {
-//            if (reporters[i] == &ConfigSync::inst()) {
+//            if (reporters[i] == &gps) {
             int l2 = reporters[i]->read(buf2+l, sizeof(buf2)-l, status, DISPLAY_LEN);
             if (l2) { // Refresh LCD display needed
                 LCDDisplay::inst().setThirdLine(status);
--- a/io/GPSTracker.cpp	Wed Jun 03 09:51:47 2015 +0000
+++ b/io/GPSTracker.cpp	Fri Aug 07 12:38:28 2015 +0000
@@ -13,15 +13,13 @@
 
 bool GPSTracker::position(GPSTracker::Position *position)
 {
-    bool result;
+    bool result = false;
     
     _mutex.lock();
     if (_positionSet) {
         memcpy(position, &_position, sizeof(GPSTracker::Position));
         _positionSet = false;
         result = true;
-    } else {
-        result = false;
     }
     _mutex.unlock();
     
@@ -38,8 +36,7 @@
         if (ret <= 0) {
             Thread::wait(100);
             continue;
-        }
-        
+        }        
         len = LENGTH(ret);
         if ((PROTOCOL(ret) != GPSParser::NMEA) || (len <= 6)) {
             aWarning("GPS data is not in NMEA protocol!\r\n");
@@ -47,13 +44,10 @@
         }
 
         // we're only interested in fixed GPS positions, data type: GPGGA
-        if ((strncmp("$GPGGA", buf, 6) != 0)) {
+        if (strncmp("$GPGGA", buf, 6) != 0 && strncmp("$GNGGA", buf, 6) != 0)
             continue;
-        }
-
-        if (!_gps.getNmeaItem(6, buf, len, n, 10) || n == 0) {
+        if (!_gps.getNmeaItem(6, buf, len, n, 10) || n == 0)
             continue;
-        }
         
         // get altitude, latitude and longitude
         if ((!_gps.getNmeaAngle(2, buf, len, latitude)) ||
@@ -61,7 +55,6 @@
             (!_gps.getNmeaItem(9, buf, len, altitude)) ||
             (!_gps.getNmeaItem(10, buf, len, chr)) ||
             (chr != 'M')) {
-            aWarning("Unable to retrieve GPS data!\r\n");
             continue;
         }
 
--- a/main.cpp	Wed Jun 03 09:51:47 2015 +0000
+++ b/main.cpp	Fri Aug 07 12:38:28 2015 +0000
@@ -81,7 +81,7 @@
 
 int main()
 {
-    LCDDisplay::inst().setLines("Mbed Agent V2.1rc6", srHost);
+    LCDDisplay::inst().setLines("Mbed Agent V2.1", srHost);
 //    set_time(1256729737);
     MDMRtos<MDMSerial> mdm;
     pMdm = &mdm;
--- a/util/SmartRestConf.cpp	Wed Jun 03 09:51:47 2015 +0000
+++ b/util/SmartRestConf.cpp	Fri Aug 07 12:38:28 2015 +0000
@@ -9,7 +9,8 @@
 char srAuthStr[100] = {0};
 //const char *srX_ID = "com_cumulocity_MbedAgent_1.5.2";
 const char *srX_ID = NULL;
-const char *srHost = "developer.cumulocity.com";
+//const char *srHost = "developer.cumulocity.com";
+const char *srHost = "dev-b.cumulocity.com";
 //const char *srHost = "management.m2m-devicecloud.com";
 long deviceID = 0;
 char fmtSmartRest[200] = {0};