diff options
author | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-11-22 22:34:19 +0000 |
---|---|---|
committer | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2014-11-22 22:34:19 +0000 |
commit | 2a6aa9b917249f44e4aa27d88e255f61eb171d6a (patch) | |
tree | 0ad46b248e42f96e93b54874aa3b073ad1273aa1 /navit/track.c | |
parent | 05edfdebd6b83267121b11538abafe39bff266e7 (diff) | |
download | navit-2a6aa9b917249f44e4aa27d88e255f61eb171d6a.tar.gz |
Refactor:core:Introduce enum for debug levels, and use it everywhere.|First part of #1269.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5960 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/track.c')
-rw-r--r-- | navit/track.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/navit/track.c b/navit/track.c index 4a6a28524..7b73f29fb 100644 --- a/navit/track.c +++ b/navit/track.c @@ -155,7 +155,7 @@ tracking_process_cdf(struct cdf_data *cdf, struct pcoord *pin, struct pcoord *po int speed_num,i; if (cdf->hist_size == 0) { - dbg(1,"No CDF.\n"); + dbg(lvl_warning,"No CDF.\n"); *pout = *pin; *dirout = dirin; return; @@ -338,7 +338,7 @@ tracking_get_attr(struct tracking *_this, enum attr_type type, struct attr *attr struct tracking_line *tl; int result=0; - dbg(1,"enter %s\n",attr_to_name(type)); + dbg(lvl_warning,"enter %s\n",attr_to_name(type)); if (_this->attr) { attr_free(_this->attr); _this->attr=NULL; @@ -471,7 +471,7 @@ tracking_doupdate_lines(struct tracking *tr, struct coord *pc, enum projection p struct coord_geo g; struct coord cc; - dbg(1,"enter\n"); + dbg(lvl_warning,"enter\n"); h=mapset_open(tr->ms); while ((m=mapset_next(h,2))) { cc.x = pc->x; @@ -501,7 +501,7 @@ tracking_doupdate_lines(struct tracking *tr, struct coord *pc, enum projection p map_rect_destroy(mr); } mapset_close(h); - dbg(1, "exit\n"); + dbg(lvl_warning, "exit\n"); } @@ -509,7 +509,7 @@ void tracking_flush(struct tracking *tr) { struct tracking_line *tl=tr->lines,*next; - dbg(1,"enter(tr=%p)\n", tr); + dbg(lvl_warning,"enter(tr=%p)\n", tr); while (tl) { next=tl->next; @@ -603,7 +603,7 @@ tracking_value(struct tracking *tr, struct tracking_line *t, int offset, struct { int value=0; struct street_data *sd=t->street; - dbg(2, "%d: (0x%x,0x%x)-(0x%x,0x%x)\n", offset, sd->c[offset].x, sd->c[offset].y, sd->c[offset+1].x, sd->c[offset+1].y); + dbg(lvl_info, "%d: (0x%x,0x%x)-(0x%x,0x%x)\n", offset, sd->c[offset].x, sd->c[offset].y, sd->c[offset+1].x, sd->c[offset+1].y); if (flags & 1) { struct coord c1, c2, cp; c1.x = sd->c[offset].x; @@ -665,7 +665,7 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v !vehicle_get_attr(tr->vehicle, attr_position_direction, &direction_attr, NULL) || !vehicle_get_attr(tr->vehicle, attr_position_coord_geo, &coord_geo, NULL) || !vehicle_get_attr(tr->vehicle, attr_position_time_iso8601, &time_attr, NULL)) { - dbg(0,"failed to get position data %d %d %d %d\n", + dbg(lvl_error,"failed to get position data %d %d %d %d\n", vehicle_get_attr(tr->vehicle, attr_position_speed, &speed_attr, NULL), vehicle_get_attr(tr->vehicle, attr_position_direction, &direction_attr, NULL), vehicle_get_attr(tr->vehicle, attr_position_coord_geo, &coord_geo, NULL), @@ -685,45 +685,45 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v if (!vehicleprofile_get_attr(vehicleprofile,attr_static_speed,&static_speed,NULL) || !vehicleprofile_get_attr(vehicleprofile,attr_static_distance,&static_distance,NULL)) { static_speed.u.num=3; static_distance.u.num=10; - dbg(1,"Using defaults for static position detection\n"); + dbg(lvl_warning,"Using defaults for static position detection\n"); } - dbg(2,"Static speed: %ld, static distance: %ld\n",static_speed.u.num, static_distance.u.num); + dbg(lvl_info,"Static speed: %ld, static distance: %ld\n",static_speed.u.num, static_distance.u.num); time=iso8601_to_secs(time_attr.u.str); speed=*speed_attr.u.numd; direction=*direction_attr.u.numd; tr->valid=attr_position_valid_valid; transform_from_geo(pro, coord_geo.u.coord_geo, &tr->curr_in); if ((speed < static_speed.u.num && transform_distance(pro, &tr->last_in, &tr->curr_in) < static_distance.u.num )) { - dbg(1,"static speed %f coord 0x%x,0x%x vs 0x%x,0x%x\n",speed,tr->last_in.x,tr->last_in.y, tr->curr_in.x, tr->curr_in.y); + dbg(lvl_warning,"static speed %f coord 0x%x,0x%x vs 0x%x,0x%x\n",speed,tr->last_in.x,tr->last_in.y, tr->curr_in.x, tr->curr_in.y); tr->valid=attr_position_valid_static; tr->speed=0; return; } if (tr->tunnel) { tr->curr_in=tr->curr_out; - dbg(0,"tunnel extrapolation speed %f dir %f\n",tr->speed,tr->direction); - dbg(0,"old 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y); + dbg(lvl_error,"tunnel extrapolation speed %f dir %f\n",tr->speed,tr->direction); + dbg(lvl_error,"old 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y); speed=tr->speed; direction=tr->curr_line->angle[tr->pos]; transform_project(pro, &tr->curr_in, tr->speed*tr->tunnel_extrapolation/36, tr->direction, &tr->curr_in); - dbg(0,"new 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y); + dbg(lvl_error,"new 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y); } else if (vehicle_get_attr(tr->vehicle, attr_lag, &lag, NULL) && lag.u.num > 0) { double espeed; int edirection; if (time-tr->time == 1) { - dbg(1,"extrapolating speed from %f and %f (%f)\n",tr->speed, speed, speed-tr->speed); + dbg(lvl_warning,"extrapolating speed from %f and %f (%f)\n",tr->speed, speed, speed-tr->speed); espeed=speed+(speed-tr->speed)*lag.u.num/10; - dbg(1,"extrapolating angle from %f and %f (%d)\n",tr->direction, direction, tracking_angle_diff(direction,tr->direction,360)); + dbg(lvl_warning,"extrapolating angle from %f and %f (%d)\n",tr->direction, direction, tracking_angle_diff(direction,tr->direction,360)); edirection=direction+tracking_angle_diff(direction,tr->direction,360)*lag.u.num/10; } else { - dbg(1,"no speed and direction extrapolation\n"); + dbg(lvl_warning,"no speed and direction extrapolation\n"); espeed=speed; edirection=direction; } - dbg(1,"lag %ld speed %f direction %d\n",lag.u.num,espeed,edirection); - dbg(1,"old 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y); + dbg(lvl_warning,"lag %ld speed %f direction %d\n",lag.u.num,espeed,edirection); + dbg(lvl_warning,"old 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y); transform_project(pro, &tr->curr_in, espeed*lag.u.num/36, edirection, &tr->curr_in); - dbg(1,"new 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y); + dbg(lvl_warning,"new 0x%x,0x%x\n",tr->curr_in.x, tr->curr_in.y); } tr->time=time; tr->pro=pro; @@ -738,11 +738,11 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v tr->last[0]=tr->curr[0]; tr->last[1]=tr->curr[1]; if (!tr->lines || transform_distance(pro, &tr->last_updated, &tr->curr_in) > 500) { - dbg(1, "update\n"); + dbg(lvl_warning, "update\n"); tracking_flush(tr); tracking_doupdate_lines(tr, &tr->curr_in, pro); tr->last_updated=tr->curr_in; - dbg(1,"update end\n"); + dbg(lvl_warning,"update end\n"); } tr->street_direction=0; @@ -761,7 +761,7 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v tr->curr[0]=sd->c[i]; tr->curr[1]=sd->c[i+1]; tr->direction_matched=t->angle[i]; - dbg(1,"lpnt.x=0x%x,lpnt.y=0x%x pos=%d %d+%d+%d+%d=%d\n", lpnt.x, lpnt.y, i, + dbg(lvl_warning,"lpnt.x=0x%x,lpnt.y=0x%x pos=%d %d+%d+%d+%d=%d\n", lpnt.x, lpnt.y, i, transform_distance_line_sq(&sd->c[i], &sd->c[i+1], &cin, &lpnt_tmp), tracking_angle_delta(tr, tr->curr_angle, t->angle[i], 0)*tr->angle_pref, tracking_is_connected(tr, tr->last, &sd->c[i]) ? tr->connected_pref : 0, @@ -782,7 +782,7 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v } t=t->next; } - dbg(1,"tr->curr_line=%p min=%d\n", tr->curr_line, min); + dbg(lvl_warning,"tr->curr_line=%p min=%d\n", tr->curr_line, min); if (!tr->curr_line || min > tr->offroad_limit_pref) { tr->curr_out=tr->curr_in; tr->coord_geo_valid=0; @@ -794,7 +794,7 @@ tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *v } else if (tr->tunnel) { tr->speed=0; } - dbg(1,"found 0x%x,0x%x\n", tr->curr_out.x, tr->curr_out.y); + dbg(lvl_warning,"found 0x%x,0x%x\n", tr->curr_out.x, tr->curr_out.y); callback_list_call_attr_0(tr->callback_list, attr_position_coord_geo); } @@ -981,7 +981,7 @@ tracking_map_item_coord_get(void *priv_data, struct coord *c, int count) struct map_rect_priv *this=priv_data; enum projection pro; int ret=0; - dbg(1,"enter\n"); + dbg(lvl_warning,"enter\n"); while (this->ccount < 2 && count > 0) { pro = map_projection(this->curr->street->item.map); if (projection_mg != pro) { @@ -990,7 +990,7 @@ tracking_map_item_coord_get(void *priv_data, struct coord *c, int count) c ,projection_mg); } else *c=this->curr->street->c[this->ccount+this->coord]; - dbg(1,"coord %d 0x%x,0x%x\n",this->ccount,c->x,c->y); + dbg(lvl_warning,"coord %d 0x%x,0x%x\n",this->ccount,c->x,c->y); this->ccount++; ret++; c++; @@ -1168,7 +1168,7 @@ tracking_map_get_item(struct map_rect_priv *priv) priv->item.type=type_tracking_10; else priv->item.type=type_tracking_0; - dbg(1,"item %d %d points\n", priv->coord, priv->curr->street->count); + dbg(lvl_warning,"item %d %d points\n", priv->coord, priv->curr->street->count); tracking_map_item_coord_rewind(priv); tracking_map_item_attr_rewind(priv); return ret; |