diff options
Diffstat (limited to 'navit/vehicle/gpsd/vehicle_gpsd.c')
-rw-r--r-- | navit/vehicle/gpsd/vehicle_gpsd.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c index ea3aaf1f8..9dbc18aa4 100644 --- a/navit/vehicle/gpsd/vehicle_gpsd.c +++ b/navit/vehicle/gpsd/vehicle_gpsd.c @@ -26,6 +26,7 @@ #include <gpsbt.h> #include <errno.h> #endif +#include "config.h" #include "debug.h" #include "callback.h" #include "plugin.h" @@ -166,7 +167,12 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len, data->set &= ~SATELLITE_SET; } if (data->set & STATUS_SET) { +#if GPSD_API_MAJOR_VERSION >= 10 + priv->status = data->fix.status; +#else priv->status = data->status; +#endif // GPSD_API_MAJOR_VERSION >= 10 + data->set &= ~STATUS_SET; } if (data->set & MODE_SET) { @@ -203,9 +209,10 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len, data->set &= ~LATLON_SET; } // If data->fix.speed is NAN, then the drawing gets jumpy. - if (! isnan(data->fix.speed) && priv->fix_type > 0) { - callback_list_call_attr_0(priv->cbl, attr_position_coord_geo); - } + //if (! isnan(data->fix.speed) && priv->fix_type > 0) { + + callback_list_call_attr_0(priv->cbl, attr_position_coord_geo); + dbg(lvl_info,"speed ok"); } @@ -231,6 +238,7 @@ static int vehicle_gpsd_try_open(struct vehicle_priv *priv) { priv->gps = gps_open(source + 7, port); if(!priv->gps) { #endif + priv->cbt = callback_new_1(callback_cast(vehicle_gpsd_try_open), priv); dbg(lvl_error,"gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?", priv->source, priv->retry_interval); g_free(source); @@ -307,10 +315,11 @@ static void vehicle_gpsd_close(struct vehicle_priv *priv) { } if (priv->gps) { gps_close(priv->gps); -#if GPSD_API_MAJOR_VERSION >= 5 - g_free(priv->gps); -#endif - priv->gps = NULL; +//if we release the gps object a reconnect is no longer working. +//#if GPSD_API_MAJOR_VERSION >= 5 +// g_free(priv->gps); +//#endif +// priv->gps = NULL; } #ifdef HAVE_GPSBT err = gpsbt_stop(&priv->context); |