diff options
author | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-09-15 18:58:31 +0000 |
---|---|---|
committer | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-09-15 18:58:31 +0000 |
commit | 0e5dcf90be80a6cbe671566202d292f376506d85 (patch) | |
tree | c91cd6c05395af986fe18ef02282455ca3bb7823 /navit | |
parent | 02535b42cab5ea685da31f5b390d11598b6984ba (diff) | |
download | navit-0e5dcf90be80a6cbe671566202d292f376506d85.tar.gz |
Fix:vehicle_gpsd:Require libgps V3.1+, drop compatibility #ifdefs and warning about LC_ALL.|Fixes #850.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5642 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r-- | navit/main.c | 2 | ||||
-rw-r--r-- | navit/vehicle/gpsd/CMakeLists.txt | 7 | ||||
-rw-r--r-- | navit/vehicle/gpsd/vehicle_gpsd.c | 54 |
3 files changed, 0 insertions, 63 deletions
diff --git a/navit/main.c b/navit/main.c index 231b70f80..c8c27dcad 100644 --- a/navit/main.c +++ b/navit/main.c @@ -404,8 +404,6 @@ main_init(const char *program) main_setup_environment(2); #endif /* _WIN32 || _WIN32_WCE */ - if (getenv("LC_ALL")) - dbg(0,"Warning: LC_ALL is set, this might lead to problems (e.g. strange positions from GPS)\n"); s = getenv("NAVIT_WID"); if (s) { setenv("SDL_WINDOWID", s, 0); diff --git a/navit/vehicle/gpsd/CMakeLists.txt b/navit/vehicle/gpsd/CMakeLists.txt index 091df2f71..1c204f6b4 100644 --- a/navit/vehicle/gpsd/CMakeLists.txt +++ b/navit/vehicle/gpsd/CMakeLists.txt @@ -1,8 +1 @@ module_add_library(vehicle_gpsd vehicle_gpsd.c) -if (LIBGPS19_FOUND) - set_property( - TARGET vehicle_gpsd - APPEND PROPERTY COMPILE_DEFINITIONS HAVE_LIBGPS19=1 - ) -endif (LIBGPS19_FOUND) - diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c index f9ab8adfc..766a454d3 100644 --- a/navit/vehicle/gpsd/vehicle_gpsd.c +++ b/navit/vehicle/gpsd/vehicle_gpsd.c @@ -70,12 +70,7 @@ static struct vehicle_priv { static void vehicle_gpsd_io(struct vehicle_priv *priv); static void -#ifdef HAVE_LIBGPS19 vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len) -#else -vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len, - int level) -#endif { char *pos,*nmea_data_buf; int i=0,sats_signal=0; @@ -117,32 +112,16 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len, data->set &= ~ALTITUDE_SET; } if (data->set & SATELLITE_SET) { -#ifdef HAVE_LIBGPS19 if(data->satellites_visible > 0) { -#else - if(data->satellites > 0) { -#endif sats_signal=0; -#ifdef HAVE_LIBGPS19 for( i=0;i<data->satellites_visible;i++) { -#else - for( i=0;i<data->satellites;i++) { -#endif if (data->ss[i] > 0) sats_signal++; } } -#ifdef HAVE_LIBGPS19 if (priv->sats_used != data->satellites_used || priv->sats != data->satellites_visible || priv->sats_signal != sats_signal ) { -#else - if (priv->sats_used != data->satellites_used || priv->sats != data->satellites || priv->sats_signal != sats_signal ) { -#endif priv->sats_used = data->satellites_used; -#ifdef HAVE_LIBGPS19 priv->sats = data->satellites_visible; -#else - priv->sats = data->satellites; -#endif priv->sats_signal = sats_signal; callback_list_call_attr_0(priv->cbl, attr_position_sats); } @@ -160,17 +139,10 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len, priv->fix_time = data->fix.time; data->set &= ~TIME_SET; } -#ifdef HAVE_LIBGPS19 if (data->set & DOP_SET) { dbg(1, "pdop : %g\n", data->dop.pdop); priv->hdop = data->dop.pdop; data->set &= ~DOP_SET; -#else - if (data->set & PDOP_SET) { - dbg(1, "pdop : %g\n", data->pdop); - priv->hdop = data->hdop; - data->set &= ~PDOP_SET; -#endif } if (data->set & LATLON_SET) { priv->geo.lat = data->fix.latitude; @@ -205,31 +177,19 @@ vehicle_gpsd_try_open(struct vehicle_priv *priv) } dbg(0,"Trying to connect to %s:%s\n",source+7,port?port:"default"); -#if GPSD_API_MAJOR_VERSION >= 5 /* gps_open returns 0 on success */ if (gps_open(source + 7, port, priv->gps)) { -#else - priv->gps = gps_open(source + 7, port); - if(!priv->gps) { -#endif dbg(0,"gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?\n", priv->source, priv->retry_interval); g_free(source); return TRUE; } g_free(source); -#ifdef HAVE_LIBGPS19 if (strchr(priv->gpsd_query,'r')) gps_stream(priv->gps, WATCH_ENABLE|WATCH_NMEA|WATCH_JSON, NULL); else gps_stream(priv->gps, WATCH_ENABLE|WATCH_JSON, NULL); -#else - gps_query(priv->gps, priv->gpsd_query); -#endif -#if GPSD_API_MAJOR_VERSION < 5 - gps_set_raw_hook(priv->gps, vehicle_gpsd_callback); -#endif priv->cb = callback_new_1(callback_cast(vehicle_gpsd_io), priv); priv->cbt = callback_new_1(callback_cast(vehicle_gpsd_try_open), priv); priv->evwatch = event_add_watch((void *)priv->gps->gps_fd, event_watch_cond_read, priv->cb); @@ -291,9 +251,7 @@ 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; } #ifdef HAVE_GPSBT @@ -311,7 +269,6 @@ vehicle_gpsd_io(struct vehicle_priv *priv) dbg(1, "enter\n"); if (priv->gps) { vehicle_last = priv; -#if GPSD_API_MAJOR_VERSION >= 5 if(gps_read(priv->gps)==-1) { dbg(0,"gps_poll failed\n"); vehicle_gpsd_close(priv); @@ -322,13 +279,6 @@ vehicle_gpsd_io(struct vehicle_priv *priv) buf = gps_data(priv->gps); vehicle_gpsd_callback(priv->gps,buf,strlen(buf)); } -#else - if (gps_poll(priv->gps)) { - dbg(0,"gps_poll failed\n"); - vehicle_gpsd_close(priv); - vehicle_gpsd_open(priv); - } -#endif } } @@ -340,9 +290,7 @@ vehicle_gpsd_destroy(struct vehicle_priv *priv) g_free(priv->source); if (priv->gpsd_query) g_free(priv->gpsd_query); -#if GPSD_API_MAJOR_VERSION >= 5 g_free(priv->gps); -#endif g_free(priv); } @@ -428,9 +376,7 @@ vehicle_gpsd_new_gpsd(struct vehicle_methods dbg(1, "enter\n"); source = attr_search(attrs, NULL, attr_source); ret = g_new0(struct vehicle_priv, 1); -#if GPSD_API_MAJOR_VERSION >= 5 ret->gps = g_new0(struct gps_data_t, 1); -#endif ret->source = g_strdup(source->u.str); query = attr_search(attrs, NULL, attr_gpsd_query); if (query) { |