summaryrefslogtreecommitdiff
path: root/navit/vehicle/gpsd/vehicle_gpsd.c
diff options
context:
space:
mode:
authorjkoan <jkoan@users.noreply.github.com>2021-06-22 09:28:27 +0200
committerGitHub <noreply@github.com>2021-06-22 09:28:27 +0200
commit39b6e79aa9037848da696b12393ecb2e57eaf625 (patch)
treef90d2cdc3f6df8a2e9356d68a1a3ea35e6d06323 /navit/vehicle/gpsd/vehicle_gpsd.c
parent82881fdf0cbb7509401ea626de892b0e18d024eb (diff)
parentea5a86beafcb52f54544e079ef7e4f8ac8b070f4 (diff)
downloadnavit-PR_830.tar.gz
Merge branch 'trunk' into PR_830PR_830
Diffstat (limited to 'navit/vehicle/gpsd/vehicle_gpsd.c')
-rw-r--r--navit/vehicle/gpsd/vehicle_gpsd.c23
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);