]> err.no Git - mapper/blobdiff - src/gps.c
Parse directly but update informations in callbacks only if we got a sentence that...
[mapper] / src / gps.c
index 08e3f316d7cc060f9b2ddde248d49e20ae7b0361..3e4c63cc64fe5788e6530fe7025d5e5a3f7c4c51 100644 (file)
--- a/src/gps.c
+++ b/src/gps.c
@@ -105,6 +105,7 @@ gps->io.address=NULL;
 gps->io.type=type;
 gps->io.conn=RCVR_OFF;
 gps->io.nmea=NULL;
+gps->io.nmea_cnt=0;
 gps->data.lat=60.20;
 gps->data.lon=22.20;
 gps->connection_error=NULL;
@@ -414,7 +415,7 @@ gps->data.heading=(h<0) ? 360+h : h;
 gps->data.time=time(NULL);
 gps_data_integerize(&gps->data);
 if (gps->update_location!=NULL) {
-       gps->update_location(gps, FALSE);
+       gps->update_location(gps);
 }
 gps->data.lheading=gps->data.heading;
 
@@ -669,9 +670,13 @@ switch (status) {
                                if (*sptr)
                                        *sptr = '\0';   /* take checksum out of the buffer. */
 
-                               gps->io.nmea=g_strdup(gps->io.buffer);
+                               gps->io.nmea_cnt++;
+                               gps->io.nmea=gps->io.buffer;
+
                                g_assert(gps->io.nmea);
-                               g_idle_add_full(G_PRIORITY_HIGH_IDLE, (GSourceFunc)gps_nmea_parse, gps, NULL);
+                               g_debug("NMEA1 %d: (%s)", gps->io.nmea_cnt, gps->io.nmea);
+
+                               gps_nmea_parse(gps);
                        } else {
                                /* There was a checksum, and it was bad. */
                                g_printerr("%s: Bad checksum in NMEA sentence:\n%s\n", __PRETTY_FUNCTION__, gps->io.buffer);