Example program to demonstrate the use of the GnssSerial class.

Dependencies:   gnss

Files at this revision

API Documentation at this revision

Comitter:
rob.meades@u-blox.com
Date:
Mon Jul 31 10:48:08 2017 +0100
Parent:
6:881e2bbf29e4
Commit message:
Point mbed-os library at ARMmbed master and remove unused variable.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Jun 14 20:47:56 2017 +0100
+++ b/main.cpp	Mon Jul 31 10:48:08 2017 +0100
@@ -41,35 +41,34 @@
     int gnssReturnCode;
     int length;
     char buffer[256];
-    char link[128] = "";
     
     printf ("Starting up...\n");
     if (gnss.init()) {
         printf ("Waiting for GNSS to receive something...\n");
-        while (1) {            
+        while (1) {
             gnssReturnCode = gnss.getMessage(buffer, sizeof(buffer));
             if (gnssReturnCode > 0) {
                 ledGreen = 0;
                 ledBlue = 1;
                 ledRed = 1;
                 length = LENGTH(gnssReturnCode);
-                
+
                 printf("NMEA: %.*s\n", length - 2, buffer);
-        
+
                 if ((PROTOCOL(gnssReturnCode) == GnssParser::NMEA) && (length > 6)) {
                     // Talker is $GA=Galileo $GB=Beidou $GL=Glonass $GN=Combined $GP=GNSS
                     if ((buffer[0] == '$') || buffer[1] == 'G') {
                       if (CHECK_TALKER("GLL")) {
                             double latitude = 0, longitude = 0;
                             char ch;
-                            
+
                             if (gnss.getNmeaAngle(1, buffer, length, latitude) && 
                                 gnss.getNmeaAngle(3, buffer, length, longitude) && 
                                 gnss.getNmeaItem(6, buffer, length, ch) && (ch == 'A')) {
                                 ledBlue = 0;
                                 ledRed = 0;
                                 ledGreen = 0;
-                                
+
                                 printf("\nGNSS: location is %.5f %.5f.\n\n", latitude, longitude); 
                                 printf("I am here: https://maps.google.com/?q=%.5f,%.5f\n\n",
                                        latitude, longitude); 
@@ -77,24 +76,24 @@
                         } else if (CHECK_TALKER("GGA") || CHECK_TALKER("GNS")) {
                             double altitude = 0; 
                             const char *timeString = NULL;
-                            
-                             // Altitude
+
+                            // Altitude
                             if (gnss.getNmeaItem(9, buffer, length, altitude)) {
                                 printf("\nGNSS: altitude is %.1f m.\n", altitude); 
                             }
-        
+
                             // Time
                             timeString = gnss.findNmeaItemPos(1, buffer, buffer + length);
                             if (timeString != NULL) {
                                 ledBlue = 0;
                                 ledRed = 1;
                                 ledGreen = 1;
-                                
+
                                 printf("\nGNSS: time is %.6s.\n\n", timeString);
                             }
                         } else if (CHECK_TALKER("VTG")) {
                             double speed = 0; 
-                            
+
                             // Speed
                             if (gnss.getNmeaItem(7, buffer, length, speed)) {
                                 printf("\nGNSS: speed is %.1f km/h.\n\n", speed);
@@ -107,7 +106,7 @@
     } else {
         printf("Unable to initialise GNSS.\n");
     }
-    
+
     ledRed = 0;
     ledGreen = 1;
     ledBlue = 1;
--- a/mbed-os.lib	Wed Jun 14 20:47:56 2017 +0100
+++ b/mbed-os.lib	Mon Jul 31 10:48:08 2017 +0100
@@ -1,1 +1,1 @@
-https://github.com/u-blox/mbed-os/#fb19851b1ac19ed46a49513acbda9a76cb9d3f2d
+https://github.com/ARMmbed/mbed-os/#78a1eddf61efa705ef1e99fc597dcaa5e737fb4c