diff options
Diffstat (limited to 'navit/vehicle/gpsd/vehicle_gpsd.c')
-rw-r--r-- | navit/vehicle/gpsd/vehicle_gpsd.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c index 5bb39b7b4..a871cb074 100644 --- a/navit/vehicle/gpsd/vehicle_gpsd.c +++ b/navit/vehicle/gpsd/vehicle_gpsd.c @@ -97,11 +97,11 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len, g_free(priv->nmea_data_buf); priv->nmea_data_buf=nmea_data_buf; } else { - dbg(0, "nmea buffer overflow, discarding '%s'\n", buffer); + dbg(lvl_error, "nmea buffer overflow, discarding '%s'\n", buffer); } } } - dbg(1,"data->set="LONGLONG_HEX_FMT"\n", data->set); + dbg(lvl_warning,"data->set="LONGLONG_HEX_FMT"\n", data->set); if (data->set & SPEED_SET) { priv->speed = data->fix.speed * 3.6; if(!isnan(data->fix.speed)) @@ -164,12 +164,12 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len, } #ifdef HAVE_LIBGPS19 if (data->set & DOP_SET) { - dbg(1, "pdop : %g\n", data->dop.pdop); + dbg(lvl_warning, "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); + dbg(lvl_warning, "pdop : %g\n", data->pdop); priv->hdop = data->hdop; data->set &= ~PDOP_SET; #endif @@ -177,7 +177,7 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len, if (data->set & LATLON_SET) { priv->geo.lat = data->fix.latitude; priv->geo.lng = data->fix.longitude; - dbg(1,"lat=%f lng=%f\n", priv->geo.lat, priv->geo.lng); + dbg(lvl_warning,"lat=%f lng=%f\n", priv->geo.lat, priv->geo.lng); g_free(priv->nmea_data); priv->nmea_data=priv->nmea_data_buf; priv->nmea_data_buf=NULL; @@ -187,7 +187,7 @@ vehicle_gpsd_callback(struct gps_data_t *data, const char *buf, size_t len, if (! isnan(data->fix.speed) && priv->fix_type > 0) { callback_list_call_attr_0(priv->cbl, attr_position_coord_geo); } - dbg(2,"speed ok\n"); + dbg(lvl_info,"speed ok\n"); } /** @@ -205,7 +205,7 @@ vehicle_gpsd_try_open(struct vehicle_priv *priv) *colon = '\0'; port=colon+1; } - dbg(0,"Trying to connect to %s:%s\n",source+7,port?port:"default"); + dbg(lvl_error,"Trying to connect to %s:%s\n",source+7,port?port:"default"); #if GPSD_API_MAJOR_VERSION >= 5 /* gps_open returns 0 on success */ @@ -214,7 +214,7 @@ vehicle_gpsd_try_open(struct vehicle_priv *priv) 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); + dbg(lvl_error,"gps_open failed for '%s'. Retrying in %d seconds. Have you started gpsd?\n", priv->source, priv->retry_interval); g_free(source); return TRUE; } @@ -236,9 +236,9 @@ vehicle_gpsd_try_open(struct vehicle_priv *priv) priv->cbt = callback_new_1(callback_cast(vehicle_gpsd_try_open), priv); priv->evwatch = event_add_watch(priv->gps->gps_fd, event_watch_cond_read, priv->cb); if (!priv->gps->gps_fd) { - dbg(0,"Warning: gps_fd is 0, most likely you have used a gps.h incompatible to libgps"); + dbg(lvl_error,"Warning: gps_fd is 0, most likely you have used a gps.h incompatible to libgps"); } - dbg(0,"Connected to gpsd fd=%d evwatch=%p\n", priv->gps->gps_fd, priv->evwatch); + dbg(lvl_error,"Connected to gpsd fd=%d evwatch=%p\n", priv->gps->gps_fd, priv->evwatch); event_remove_timeout(priv->retry_timer2); priv->retry_timer2=NULL; return FALSE; @@ -257,11 +257,11 @@ vehicle_gpsd_open(struct vehicle_priv *priv) memset(&priv->context, 0, sizeof(gpsbt_t)); if(gpsbt_start(NULL, 0, 0, 0, errstr, sizeof(errstr), 0, &priv->context) < 0) { - dbg(0,"Error connecting to GPS with gpsbt: (%d) %s (%s)\n", + dbg(lvl_error,"Error connecting to GPS with gpsbt: (%d) %s (%s)\n", errno, strerror(errno), errstr); } sleep(1); /* give gpsd time to start */ - dbg(1,"gpsbt_start: completed\n"); + dbg(lvl_warning,"gpsbt_start: completed\n"); #endif priv->retry_timer2=NULL; if (vehicle_gpsd_try_open(priv)) @@ -301,21 +301,21 @@ vehicle_gpsd_close(struct vehicle_priv *priv) #ifdef HAVE_GPSBT err = gpsbt_stop(&priv->context); if (err < 0) { - dbg(0,"Error %d while gpsbt_stop", err); + dbg(lvl_error,"Error %d while gpsbt_stop", err); } - dbg(1,"gpsbt_stop: completed, (%d)",err); + dbg(lvl_warning,"gpsbt_stop: completed, (%d)",err); #endif } static void vehicle_gpsd_io(struct vehicle_priv *priv) { - dbg(1, "enter\n"); + dbg(lvl_warning, "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"); + dbg(lvl_error,"gps_poll failed\n"); vehicle_gpsd_close(priv); vehicle_gpsd_open(priv); } @@ -326,7 +326,7 @@ vehicle_gpsd_io(struct vehicle_priv *priv) } #else if (gps_poll(priv->gps)) { - dbg(0,"gps_poll failed\n"); + dbg(lvl_error,"gps_poll failed\n"); vehicle_gpsd_close(priv); vehicle_gpsd_open(priv); } @@ -427,7 +427,7 @@ vehicle_gpsd_new_gpsd(struct vehicle_methods struct vehicle_priv *ret; struct attr *source, *query, *retry_int; - dbg(1, "enter\n"); + dbg(lvl_warning, "enter\n"); source = attr_search(attrs, NULL, attr_source); ret = g_new0(struct vehicle_priv, 1); #if GPSD_API_MAJOR_VERSION >= 5 @@ -440,16 +440,16 @@ vehicle_gpsd_new_gpsd(struct vehicle_methods } else { ret->gpsd_query = g_strdup("w+x\n"); } - dbg(1,"Format string for gpsd_query: %s\n",ret->gpsd_query); + dbg(lvl_warning,"Format string for gpsd_query: %s\n",ret->gpsd_query); retry_int = attr_search(attrs, NULL, attr_retry_interval); if (retry_int) { ret->retry_interval = retry_int->u.num; if (ret->retry_interval < MIN_RETRY_INTERVAL) { - dbg(0, "Retry interval %d too small, setting to %d\n", ret->retry_interval, MIN_RETRY_INTERVAL); + dbg(lvl_error, "Retry interval %d too small, setting to %d\n", ret->retry_interval, MIN_RETRY_INTERVAL); ret->retry_interval = MIN_RETRY_INTERVAL; } } else { - dbg(1, "Retry interval not defined, setting to %d\n", DEFAULT_RETRY_INTERVAL); + dbg(lvl_warning, "Retry interval not defined, setting to %d\n", DEFAULT_RETRY_INTERVAL); ret->retry_interval = DEFAULT_RETRY_INTERVAL; } ret->cbl = cbl; @@ -462,6 +462,6 @@ vehicle_gpsd_new_gpsd(struct vehicle_methods void plugin_init(void) { - dbg(1, "enter\n"); + dbg(lvl_warning, "enter\n"); plugin_register_vehicle_type("gpsd", vehicle_gpsd_new_gpsd); } |