Prototyping the Adaptable Emergency System on an C027 board.

Dependencies:   C027_Support mbed

Fork of c027_prototyping by Philémon Favrod

Revision:
4:f1708f6ec905
Child:
7:eeef6f9fa1db
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gps_locate.cpp	Tue Sep 30 16:06:35 2014 +0000
@@ -0,0 +1,46 @@
+#include "gps_locate.h"
+#include "GPS.h"
+
+int gps_on(void)
+{
+    return 0;
+}
+
+int gps_off(void)
+{
+    return 0;
+}
+
+int gps_locate(struct gps_data_t* gps_data)
+{/*
+    // Power on gps
+    GPSI2C gps;
+
+    int ret = 0;
+    char buf[512] = {0};
+
+    while ((ret = gps.getMessage(buf, sizeof(buf))) > 0) {
+        int len = LENGTH(ret);
+        if ((PROTOCOL(ret) == GPSParser::NMEA) && (len > 6)) {
+            if (!strncmp("$GPGLL", buf, 6)) {
+                double la = 0, lo = 0;
+                char ch;
+                if (gps.getNmeaAngle(1,buf,len,la) &&
+                        gps.getNmeaAngle(3,buf,len,lo) &&
+                        gps.getNmeaItem(6,buf,len,ch) && ch == 'A') {
+                    printf("GPS Location: %.5f %.5f\r\n", la, lo);
+                    printf(link, "I am here!\n"
+                            "https://maps.google.com/?q=%.5f,%.5f", la, lo);     
+                }
+            } else if (!strncmp("$GPGGA", buf, 6)) {
+                double a = 0;
+                if (gps.getNmeaItem(9,buf,len,a)) // altitude msl [m]
+                    printf("GPS Altitude: %.1f\r\n", a);
+            } else if (!strncmp("$GPVTG", buf, 6)) {
+                double s = 0;
+                if (gps.getNmeaItem(7,buf,len,s)) // speed [km/h]
+                    printf("GPS Speed: %.1f\r\n", s);
+            }
+        }
+    }*/ return 0;
+}
\ No newline at end of file