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
Diff: io/GPSTracker.cpp
- Revision:
- 131:ca312ec4bd0f
- Parent:
- 107:fc5f25f0e0d5
- Child:
- 135:c4009ecaf5c0
diff -r b81a6ed6addc -r ca312ec4bd0f io/GPSTracker.cpp --- 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; }