return FALSE;
}
-static void
+static void
channel_parse_rmc(gchar * sentence)
{
/* Recommended Minimum Navigation Information C
/* XXX: Set filter logic somewhere else */
if ((_conn_state == RCVR_FIXED) && (_track_store==TRUE)) {
- if ((_gps_filter==TRUE) && (track_drop_cnt<GPS_FILTER_MAX_SKIP)) {
+ if ((_gps_filter==TRUE) && (track_drop_cnt<_filter_maxdrop)) {
integerize_data(&_gps, &_pos);
if ( (_gps.hdop<_filter_hdop || _filter_hdop==0.0) &&
(_gps.vdop<_filter_vdop || _filter_vdop==0.0) &&
map_refresh_mark();
}
}
-
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
-static void
+static void
channel_parse_gga(gchar * sentence)
{
/* GGA Global Positioning System Fix Data
MACRO_PARSE_FLOAT(_pos.altitude, token);
} else
_pos.altitude = NAN;
-
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
-static void
+static void
channel_parse_gsa(gchar * sentence)
{
/* GPS DOP and active satellites
token = strsep(&sentence, DELIM);
if (token && *token)
MACRO_PARSE_FLOAT(_gps.vdop, token);
-
- vprintf("%s(): return\n", __PRETTY_FUNCTION__);
}
-static void
+static void
channel_parse_gsv(gchar * sentence)
{
/* Must be GSV - Satellites in view
/* Keep awake while they watch the progress bar. */
KEEP_DISPLAY_ON();
}
+}
+
+static gboolean
+channel_parse_buffer(gpointer data)
+{
+gchar *buf=(gchar *)data;
+
+if (!strncmp(buf + 3, "GSV", 3)) {
+ if (_conn_state == RCVR_UP)
+ channel_parse_gsv(buf + 7);
+} else if (!strncmp(buf + 3, "RMC", 3))
+ channel_parse_rmc(buf + 7);
+else if (!strncmp(buf + 3, "GGA", 3))
+ channel_parse_gga(buf + 7);
+else if (!strncmp(buf + 3, "GSA", 3))
+ channel_parse_gsa(buf + 7);
+else g_print("Unknown NMEA: [%s]\n", buf);
- g_printf("%s(): return\n", __PRETTY_FUNCTION__);
+g_free(buf);
+
+if (_gps_info)
+ gps_display_data();
+
+if (_satdetails_on)
+ gps_display_details();
+
+return FALSE;
}
gboolean
/* If we're at a \0 (meaning there is no checksum), or if the
* checksum is good, then parse the sentence. */
if (!*sptr || csum == strtol(sptr + 1, NULL, 16)) {
+ gchar *data;
+
if (*sptr)
*sptr = '\0'; /* take checksum out of the buffer. */
- if (!strncmp(_gps_read_buf + 3, "GSV", 3)) {
- if (_conn_state == RCVR_UP)
- channel_parse_gsv(_gps_read_buf + 7);
- } else if (!strncmp(_gps_read_buf + 3, "RMC", 3))
- channel_parse_rmc(_gps_read_buf + 7);
- else if (!strncmp(_gps_read_buf + 3, "GGA", 3))
- channel_parse_gga(_gps_read_buf + 7);
- else if (!strncmp(_gps_read_buf + 3, "GSA", 3))
- channel_parse_gsa(_gps_read_buf + 7);
- else g_print("Unknown NMEA: [%s]\n", _gps_read_buf);
-
- if (_gps_info)
- gps_display_data();
-
- if (_satdetails_on)
- gps_display_details();
+
+ data=g_strdup(_gps_read_buf);
+ g_idle_add_full(G_PRIORITY_HIGH_IDLE, (GSourceFunc)channel_parse_buffer, data, NULL);
} else {
/* There was a checksum, and it was bad. */
g_printerr("%s: Bad checksum in NMEA sentence:\n%s\n", __PRETTY_FUNCTION__, _gps_read_buf);
case G_IO_STATUS_AGAIN:
return TRUE;
break;
+ default:
+ g_assert_not_reached();
+ break;
}
vprintf("%s(): return TRUE\n", __PRETTY_FUNCTION__);