From a97adbb4c0b7bb119497bb738e53c79a50749cbf Mon Sep 17 00:00:00 2001 From: martin-s Date: Mon, 15 Jun 2009 19:53:24 +0000 Subject: [PATCH] Fix:Core:Improved tracking to compensate for gps receivers with static navigation disabled git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@2317 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/attr.h | 8 ++ navit/navit/attr_def.h | 1 + navit/navit/gui/gtk/destination.c | 2 +- navit/navit/gui/internal/gui_internal.c | 2 +- navit/navit/navit.c | 68 +++++--------- navit/navit/osd/core/osd_core.c | 2 +- navit/navit/route.c | 28 ++---- navit/navit/route.h | 2 +- navit/navit/track.c | 152 ++++++++++++++++++++------------ navit/navit/track.h | 6 +- navit/navit/vehicle/file/vehicle_file.c | 55 +++++++----- navit/navit/vehicleprofile.h | 2 + 12 files changed, 179 insertions(+), 149 deletions(-) diff --git a/navit/navit/attr.h b/navit/navit/attr.h index 6bed739..a7f9c2d 100644 --- a/navit/navit/attr.h +++ b/navit/navit/attr.h @@ -71,6 +71,14 @@ enum attr_type { #define ATTR_REL_MAXABS 0x40000000 #define ATTR_REL_RELSHIFT 0x60000000 +enum attr_position_valid { + attr_position_valid_invalid, + attr_position_valid_static, + attr_position_valid_extrapolated_time, + attr_position_valid_extrapolated_spatial, + attr_position_valid_valid, +}; + struct attr { enum attr_type type; union { diff --git a/navit/navit/attr_def.h b/navit/navit/attr_def.h index 8c253d0..912a1f4 100644 --- a/navit/navit/attr_def.h +++ b/navit/navit/attr_def.h @@ -165,6 +165,7 @@ ATTR(position_magnetic_direction) ATTR(use_overlay) ATTR(night_mode) ATTR(autozoom_active) +ATTR(position_valid) ATTR2(0x0002ffff,type_int_end) ATTR2(0x00030000,type_string_begin) ATTR(type) diff --git a/navit/navit/gui/gtk/destination.c b/navit/navit/gui/gtk/destination.c index 4db7b76..d2003b6 100644 --- a/navit/navit/gui/gtk/destination.c +++ b/navit/navit/gui/gtk/destination.c @@ -523,7 +523,7 @@ int destination_address(struct navit *nav) country_attr=country_default(); tracking=navit_get_tracking(nav); - if (tracking && tracking_get_current_attr(tracking, attr_country_id, &search_attr)) + if (tracking && tracking_get_attr(tracking, attr_country_id, &search_attr, NULL)) country_attr=&search_attr; if (country_attr) { cs=country_search_new(country_attr, 0); diff --git a/navit/navit/gui/internal/gui_internal.c b/navit/navit/gui/internal/gui_internal.c index 6c8d72b..f00a42c 100644 --- a/navit/navit/gui/internal/gui_internal.c +++ b/navit/navit/gui/internal/gui_internal.c @@ -2630,7 +2630,7 @@ gui_internal_search_list_set_default_country(struct gui_priv *this) country_attr=country_default(); tracking=navit_get_tracking(this->nav); - if (tracking && tracking_get_current_attr(tracking, attr_country_id, &search_attr)) + if (tracking && tracking_get_attr(tracking, attr_country_id, &search_attr, NULL)) country_attr=&search_attr; if (country_attr) { cs=country_search_new(country_attr, 0); diff --git a/navit/navit/navit.c b/navit/navit/navit.c index 5896c43..599a2a1 100644 --- a/navit/navit/navit.c +++ b/navit/navit/navit.c @@ -1981,75 +1981,53 @@ navit_vehicle_draw(struct navit *this_, struct navit_vehicle *nv, struct point * static void navit_vehicle_update(struct navit *this_, struct navit_vehicle *nv) { - struct attr attr_dir, attr_speed, attr_pos, attr_hdop, attr_time; + struct attr attr_valid, attr_dir, attr_speed, attr_pos; struct pcoord cursor_pc; struct point cursor_pnt, *pnt=&cursor_pnt; - enum projection pro; + struct tracking *tracking=NULL; + enum projection pro=transform_get_projection(this_->trans); int border=16; - time_t fixtime; - int recenter = 1; // indicates if we should recenter the map + int (*get_attr)(void *, enum attr_type, struct attr *, struct attr_iter *); + void *attr_object; profile(0,NULL); if (this_->ready != 3) { profile(0,"return 1\n"); return; } - - if (! vehicle_get_attr(nv->vehicle, attr_position_direction, &attr_dir, NULL) || - ! vehicle_get_attr(nv->vehicle, attr_position_speed, &attr_speed, NULL) || - ! vehicle_get_attr(nv->vehicle, attr_position_coord_geo, &attr_pos, NULL)) { + if (this_->vehicle == nv && this_->tracking_flag) + tracking=this_->tracking; + if (tracking) { + tracking_update(tracking, nv->vehicle, this_->vehicleprofile, pro); + attr_object=tracking; + get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))tracking_get_attr; + } else { + attr_object=nv->vehicle; + get_attr=(int (*)(void *, enum attr_type, struct attr *, struct attr_iter *))vehicle_get_attr; + } + if (get_attr(attr_object, attr_position_valid, &attr_valid, NULL)) + if (!attr_valid.u.num != attr_position_valid_invalid) + return; + if (! get_attr(attr_object, attr_position_direction, &attr_dir, NULL) || + ! get_attr(attr_object, attr_position_speed, &attr_speed, NULL) || + ! get_attr(attr_object, attr_position_coord_geo, &attr_pos, NULL)) { profile(0,"return 2\n"); return; } nv->dir=*attr_dir.u.numd; nv->speed=*attr_speed.u.numd; - pro=transform_get_projection(this_->trans); transform_from_geo(pro, attr_pos.u.coord_geo, &nv->coord); if (nv != this_->vehicle) { navit_vehicle_draw(this_, nv, NULL); profile(0,"return 3\n"); return; } - - if (nv->speed < 10) { - long long diff,diff_x,diff_y; - - diff_x = abs(nv->coord.x - nv->last.x); - diff_y = abs(nv->coord.y - nv->last.y); - diff = (diff_x * diff_x) + (diff_y * diff_y); - - if ((diff < 20) && (diff > 0)) { // if our long is only 32 bit wide, we could run into an overflow here - recenter = 0; - } - } - if (recenter) { - nv->last = nv->coord; - } - cursor_pc.x = nv->coord.x; cursor_pc.y = nv->coord.y; cursor_pc.pro = pro; - if (this_->tracking && this_->tracking_flag) { - double zero; - if (! vehicle_get_attr(nv->vehicle, attr_position_hdop, &attr_hdop, NULL)) { - zero = 0.f; - attr_hdop.u.numd = &zero; - } - - if (! vehicle_get_attr(nv->vehicle, attr_position_time_iso8601, &attr_time, NULL)) { - fixtime = time(NULL); - } else { - fixtime = iso8601_to_secs(attr_time.u.str); - } - - if (tracking_update(this_->tracking, this_->vehicleprofile, &cursor_pc, nv->dir, attr_hdop.u.numd, nv->speed, fixtime)) { - nv->coord.x=cursor_pc.x; - nv->coord.y=cursor_pc.y; - } - } if (this_->route) { - if (this_->tracking && this_->tracking_flag) - route_set_position_from_tracking(this_->route, this_->tracking); + if (tracking) + route_set_position_from_tracking(this_->route, tracking, pro); else route_set_position(this_->route, &cursor_pc); } diff --git a/navit/navit/osd/core/osd_core.c b/navit/navit/osd/core/osd_core.c index 5a6f003..7a0114d 100644 --- a/navit/navit/osd/core/osd_core.c +++ b/navit/navit/osd/core/osd_core.c @@ -829,7 +829,7 @@ osd_text_draw(struct osd_text *this, struct navit *navit, struct vehicle *v) if (item && !strcmp(key,"route_speed")) { double routespeed = -1; int *flags=tracking_get_current_flags(tracking); - if (flags && (*flags & AF_SPEED_LIMIT) && tracking_get_current_attr(tracking, attr_maxspeed, &maxspeed_attr)) { + if (flags && (*flags & AF_SPEED_LIMIT) && tracking_get_attr(tracking, attr_maxspeed, &maxspeed_attr, NULL)) { routespeed = maxspeed_attr.u.num; value = format_speed(routespeed, ""); } diff --git a/navit/navit/route.c b/navit/navit/route.c index 66b8315..f405c31 100644 --- a/navit/navit/route.c +++ b/navit/navit/route.c @@ -559,22 +559,12 @@ route_contains(struct route *this, struct item *item) { if (! this->path2 || !this->path2->path_hash) return 0; - return (int)(long)item_hash_lookup(this->path2->path_hash, item); -} - -/** - * @brief Checks if the current position in a route is a certain item - * - * @param this The route to check for this item - * @param item The item to search for - * @return True if the current position is this item, false otherwise - */ -int -route_pos_contains(struct route *this, struct item *item) -{ + if (item_hash_lookup(this->path2->path_hash, item)) + return 1; if (! this->pos || !this->pos->street) return 0; return item_is_equal(this->pos->street->item, *item); + } /** @@ -742,9 +732,9 @@ route_set_position(struct route *this, struct pcoord *pos) * @param tracking The tracking to get the coordinates from */ void -route_set_position_from_tracking(struct route *this, struct tracking *tracking) +route_set_position_from_tracking(struct route *this, struct tracking *tracking, enum projection pro) { - struct pcoord *c; + struct coord *c; struct route_info *ret; struct street_data *sd; @@ -758,15 +748,13 @@ route_set_position_from_tracking(struct route *this, struct tracking *tracking) if (this->pos) route_info_free(this->pos); this->pos=NULL; - ret->c.x = c->x; - ret->c.y = c->y; - ret->lp.x=c->x; - ret->lp.y=c->y; + ret->c=*c; + ret->lp=*c; ret->pos=tracking_get_segment_pos(tracking); sd=tracking_get_street_data(tracking); if (sd) { ret->street=street_data_dup(sd); - route_info_distances(ret, c->pro); + route_info_distances(ret, pro); } dbg(3,"c->x=0x%x, c->y=0x%x pos=%d item=(0x%x,0x%x)\n", c->x, c->y, ret->pos, ret->street->item.id_hi, ret->street->item.id_lo); dbg(3,"street 0=(0x%x,0x%x) %d=(0x%x,0x%x)\n", ret->street->c[0].x, ret->street->c[0].y, ret->street->count-1, ret->street->c[ret->street->count-1].x, ret->street->c[ret->street->count-1].y); diff --git a/navit/navit/route.h b/navit/navit/route.h index e71a594..e9b03c8 100644 --- a/navit/navit/route.h +++ b/navit/navit/route.h @@ -89,7 +89,7 @@ int route_get_path_set(struct route *this); int route_set_speed(struct route *this, enum item_type type, int value); int route_contains(struct route *this, struct item *item); void route_set_position(struct route *this, struct pcoord *pos); -void route_set_position_from_tracking(struct route *this, struct tracking *tracking); +void route_set_position_from_tracking(struct route *this, struct tracking *tracking, enum projection pro); struct map_selection *route_rect(int order, struct coord *c1, struct coord *c2, int rel, int abs); void route_set_destination(struct route *this, struct pcoord *dst, int async); struct route_path_handle *route_path_open(struct route *this); diff --git a/navit/navit/track.c b/navit/navit/track.c index 58163e4..f4ffc14 100644 --- a/navit/navit/track.c +++ b/navit/navit/track.c @@ -78,17 +78,23 @@ struct tracking { struct mapset *ms; struct route *rt; struct map *map; + struct vehicle *vehicle; struct vehicleprofile *vehicleprofile; - struct pcoord last_updated; + struct coord last_updated; struct tracking_line *lines; struct tracking_line *curr_line; int pos; - struct coord curr[2]; - struct pcoord curr_in, curr_out; + struct coord curr[2], curr_in, curr_out; int curr_angle; - struct coord last[2]; - struct pcoord last_in, last_out; + struct coord last[2], last_in, last_out; struct cdf_data cdf; + struct attr *attr; + int valid; + double direction; + double speed; + int coord_geo_valid; + struct coord_geo coord_geo; + enum projection pro; }; @@ -279,7 +285,7 @@ tracking_get_angle(struct tracking *tr) return tr->curr_angle; } -struct pcoord * +struct coord * tracking_get_pos(struct tracking *tr) { return &tr->curr_out; @@ -300,20 +306,50 @@ tracking_get_street_data(struct tracking *tr) } int -tracking_get_current_attr(struct tracking *_this, enum attr_type type, struct attr *attr) +tracking_get_attr(struct tracking *_this, enum attr_type type, struct attr *attr, struct attr_iter *attr_iter) { struct item *item; struct map_rect *mr; int result=0; - if (! _this->curr_line || ! _this->curr_line->street) - return 0; - item=&_this->curr_line->street->item; - mr=map_rect_new(item->map,NULL); - item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo); - if (item_attr_get(item, type, attr)) - result=1; - map_rect_destroy(mr); - return result; + dbg(1,"enter %s\n",attr_to_name(type)); + if (_this->attr) { + attr_free(_this->attr); + _this->attr=NULL; + } + switch (type) { + case attr_position_valid: + attr->u.num=_this->valid; + return 1; + case attr_position_direction: + attr->u.numd=&_this->direction; + return 1; + case attr_position_speed: + attr->u.numd=&_this->speed; + return 1; + case attr_position_coord_geo: + if (!_this->coord_geo_valid) { + struct coord c; + c.x=_this->curr_out.x; + c.y=_this->curr_out.y; + transform_to_geo(_this->pro, &c, &_this->coord_geo); + _this->coord_geo_valid=1; + } + attr->u.coord_geo=&_this->coord_geo; + return 1; + default: + if (! _this->curr_line || ! _this->curr_line->street) + return 0; + item=&_this->curr_line->street->item; + mr=map_rect_new(item->map,NULL); + item=map_rect_get_item_byid(mr, item->id_hi, item->id_lo); + if (item_attr_get(item, type, attr)) { + _this->attr=attr_dup(attr); + *attr=*_this->attr; + result=1; + } + map_rect_destroy(mr); + return result; + } } struct item * @@ -375,7 +411,7 @@ street_data_within_selection(struct street_data *sd, struct map_selection *sel) static void -tracking_doupdate_lines(struct tracking *tr, struct pcoord *pc) +tracking_doupdate_lines(struct tracking *tr, struct coord *pc, enum projection pro) { int max_dist=1000; struct map_selection *sel; @@ -393,8 +429,8 @@ tracking_doupdate_lines(struct tracking *tr, struct pcoord *pc) while ((m=mapset_next(h,1))) { cc.x = pc->x; cc.y = pc->y; - if (map_projection(m) != pc->pro) { - transform_to_geo(pc->pro, &cc, &g); + if (map_projection(m) != pro) { + transform_to_geo(pro, &cc, &g); transform_from_geo(map_projection(m), &g, &cc); } sel = route_rect(18, &cc, &cc, 0, max_dist); @@ -485,7 +521,7 @@ tracking_is_connected(struct coord *c1, struct coord *c2) } static int -tracking_is_no_stop(struct coord *c1, struct pcoord *c2) +tracking_is_no_stop(struct coord *c1, struct coord *c2) { if (c1->x == c2->x && c1->y == c2->y) return nostop_pref; @@ -497,8 +533,6 @@ tracking_is_on_route(struct route *rt, struct item *item) { if (! rt) return 0; - if (route_pos_contains(rt, item)) - return 0; if (route_contains(rt, item)) return 0; return route_pref; @@ -538,51 +572,59 @@ tracking_value(struct tracking *tr, struct tracking_line *t, int offset, struct } -int -tracking_update(struct tracking *tr, struct vehicleprofile *vehicleprofile, struct pcoord *pc, int angle, double *hdop, int speed, time_t fixtime) +void +tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *vehicleprofile, enum projection pro) { struct tracking_line *t; int i,value,min; struct coord lpnt; struct coord cin; - struct pcoord pcf; // Coordinate filtered through the CDF - int anglef; // Angle filtered through the CDF - dbg(1,"enter(%p,%p,%d)\n", tr, pc, angle); - dbg(1,"c=%d:0x%x,0x%x\n", pc->pro, pc->x, pc->y); - tr->vehicleprofile=vehicleprofile; - - if (pc->x == tr->curr_in.x && pc->y == tr->curr_in.y) { - if (tr->curr_out.x && tr->curr_out.y) - *pc=tr->curr_out; - return 0; - } + struct attr valid,speed,direction,coord_geo; + if (v) + tr->vehicle=v; + if (vehicleprofile) + tr->vehicleprofile=vehicleprofile; - if (hdop && *hdop > 3.5f) { // This value has been taken from julien cayzac's CDF implementation - *pc = tr->curr_out; - return 0; + if (! tr->vehicle) + return; + if (!vehicle_get_attr(tr->vehicle, attr_position_valid, &valid, NULL)) + valid.u.num=attr_position_valid_valid; + if (valid.u.num == attr_position_valid_invalid) { + tr->valid=valid.u.num; + return; } + if (!vehicle_get_attr(tr->vehicle, attr_position_speed, &speed, NULL) || + !vehicle_get_attr(tr->vehicle, attr_position_direction, &direction, NULL) || + !vehicle_get_attr(tr->vehicle, attr_position_coord_geo, &coord_geo, NULL)) + return; + tr->valid=attr_position_valid_valid; + transform_from_geo(pro, coord_geo.u.coord_geo, &tr->curr_in); + if ((*speed.u.numd < 3 && transform_distance(pro, &tr->last_in, &tr->curr_in) < 10 )) { + dbg(1,"static speed %f coord 0x%x,0x%x vs 0x%x,0x%x\n",*speed.u.numd,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; + } + tr->pro=pro; +#if 0 tracking_process_cdf(&tr->cdf, pc, &pcf, angle, &anglef, speed, fixtime); - +#endif + tr->curr_angle=tr->direction=*direction.u.numd; + tr->speed=*speed.u.numd; tr->last_in=tr->curr_in; tr->last_out=tr->curr_out; tr->last[0]=tr->curr[0]; tr->last[1]=tr->curr[1]; - tr->curr_in=pcf; - tr->curr_angle=anglef; - cin.x = pcf.x; - cin.y = pcf.y; - if (!tr->lines || transform_distance_sq_pc(&tr->last_updated, &pcf) > 250000) { + if (!tr->lines || transform_distance(pro, &tr->last_updated, &tr->curr_in) > 500) { dbg(1, "update\n"); tracking_free_lines(tr); - tracking_doupdate_lines(tr, &pcf); - tr->last_updated=pcf; + tracking_doupdate_lines(tr, &tr->curr_in, pro); + tr->last_updated=tr->curr_in; dbg(1,"update end\n"); } - + t=tr->lines; - if (! t) - return 0; tr->curr_line=NULL; min=INT_MAX/2; while (t) { @@ -596,25 +638,25 @@ tracking_update(struct tracking *tr, struct vehicleprofile *vehicleprofile, stru tr->curr[1]=sd->c[i+1]; dbg(1,"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), - tracking_angle_delta(tr, anglef, t->angle[i], 0)*angle_factor, + tracking_angle_delta(tr, tr->curr_angle, t->angle[i], 0)*angle_factor, tracking_is_connected(tr->last, &sd->c[i]) ? connected_pref : 0, lpnt.x == tr->last_out.x && lpnt.y == tr->last_out.y ? nostop_pref : 0, value ); tr->curr_out.x=lpnt.x; tr->curr_out.y=lpnt.y; - tr->curr_out.pro = pcf.pro; + tr->coord_geo_valid=0; min=value; } } t=t->next; } dbg(1,"tr->curr_line=%p min=%d\n", tr->curr_line, min); - if (!tr->curr_line || min > offroad_limit_pref) - return 0; + if (!tr->curr_line || min > offroad_limit_pref) { + tr->curr_out=tr->curr_in; + tr->coord_geo_valid=0; + } dbg(1,"found 0x%x,0x%x\n", tr->curr_out.x, tr->curr_out.y); - *pc=tr->curr_out; - return 1; } struct tracking * diff --git a/navit/navit/track.h b/navit/navit/track.h index 2c2a089..0440f55 100644 --- a/navit/navit/track.h +++ b/navit/navit/track.h @@ -28,15 +28,15 @@ struct coord; struct mapset; struct street_data; struct tracking; -struct pcoord *tracking_get_pos(struct tracking *tr); +struct coord *tracking_get_pos(struct tracking *tr); int tracking_get_angle(struct tracking *tr); int tracking_get_segment_pos(struct tracking *tr); struct street_data *tracking_get_street_data(struct tracking *tr); -int tracking_update(struct tracking *tr, struct vehicleprofile *vehicleprofile, struct pcoord *c, int angle, double *hdop, int speed, time_t fixtime); +void tracking_update(struct tracking *tr, struct vehicle *v, struct vehicleprofile *vehicleprofile, enum projection pro); struct tracking *tracking_new(struct attr *parent, struct attr **attrs); void tracking_set_mapset(struct tracking *this_, struct mapset *ms); void tracking_set_route(struct tracking *this_, struct route *rt); -int tracking_get_current_attr(struct tracking *_this, enum attr_type type, struct attr *attr); +int tracking_get_attr(struct tracking *_this, enum attr_type type, struct attr *attr, struct attr_iter *attr_iter); struct item *tracking_get_current_item(struct tracking *_this); int *tracking_get_current_flags(struct tracking *_this); void tracking_destroy(struct tracking *tr); diff --git a/navit/navit/vehicle/file/vehicle_file.c b/navit/navit/vehicle/file/vehicle_file.c index a7ee3bb..88ce299 100644 --- a/navit/navit/vehicle/file/vehicle_file.c +++ b/navit/navit/vehicle/file/vehicle_file.c @@ -102,6 +102,7 @@ struct vehicle_priv { int next_count; struct gps_sat next[24]; struct item sat_item; + int valid; }; #ifdef _WIN32 @@ -318,33 +319,39 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer) UTC of Fix[1],Latitude[2],N/S[3],Longitude[4],E/W[5],Quality(0=inv,1=gps,2=dgps)[6],Satelites used[7], HDOP[8],Altitude[9],"M"[10],height of geoid[11], "M"[12], time since dgps update[13], dgps ref station [14] */ - lat = g_ascii_strtod(item[2], NULL); - priv->geo.lat = floor(lat / 100); - lat -= priv->geo.lat * 100; - priv->geo.lat += lat / 60; - - if (!strcasecmp(item[3],"S")) - priv->geo.lat=-priv->geo.lat; - - lng = g_ascii_strtod(item[4], NULL); - priv->geo.lng = floor(lng / 100); - lng -= priv->geo.lng * 100; - priv->geo.lng += lng / 60; - - if (!strcasecmp(item[5],"W")) - priv->geo.lng=-priv->geo.lng; - - sscanf(item[6], "%d", &priv->status); + if (*item[2] && *item[3] && *item[4] && *item[5]) { + lat = g_ascii_strtod(item[2], NULL); + priv->geo.lat = floor(lat / 100); + lat -= priv->geo.lat * 100; + priv->geo.lat += lat / 60; + + if (!strcasecmp(item[3],"S")) + priv->geo.lat=-priv->geo.lat; + + lng = g_ascii_strtod(item[4], NULL); + priv->geo.lng = floor(lng / 100); + lng -= priv->geo.lng * 100; + priv->geo.lng += lng / 60; + + if (!strcasecmp(item[5],"W")) + priv->geo.lng=-priv->geo.lng; + priv->valid=attr_position_valid_valid; + } else + priv->valid=attr_position_valid_invalid; + if (*item[6]) + sscanf(item[6], "%d", &priv->status); + if (*item[7]) sscanf(item[7], "%d", &priv->sats_used); - sscanf(item[8], "%lf", &priv->hdop); - strcpy(priv->fixtime, item[1]); - sscanf(item[9], "%lf", &priv->height); + if (*item[8]) + sscanf(item[8], "%lf", &priv->hdop); + if (*item[1]) + strcpy(priv->fixtime, item[1]); + if (*item[9]) + sscanf(item[9], "%lf", &priv->height); g_free(priv->nmea_data); priv->nmea_data=priv->nmea_data_buf; priv->nmea_data_buf=NULL; - ret = 1; - #ifndef _WIN32 if (priv->file_type == file_type_file) { if (priv->watch) { @@ -390,6 +397,7 @@ vehicle_file_parse(struct vehicle_priv *priv, char *buffer) &priv->fixyear); priv->fixyear += 2000; } + ret = 1; } if (!strncmp(buffer, "$GPGSV", 6) && i >= 4) { /* @@ -606,6 +614,9 @@ vehicle_file_position_attr_get(struct vehicle_priv *priv, } attr->u.item=&priv->sat_item; break; + case attr_position_valid: + attr->u.num=priv->valid; + break; default: return 0; } diff --git a/navit/navit/vehicleprofile.h b/navit/navit/vehicleprofile.h index 51edfad..c424986 100644 --- a/navit/navit/vehicleprofile.h +++ b/navit/navit/vehicleprofile.h @@ -23,6 +23,8 @@ struct vehicleprofile { int flags_reverse_mask; /**< Flags mask for moving in reverse direction */ int flags; /**< Required flags to move through a segment */ int maxspeed_handling; /**< 0 = Always, 1 = Only if lower, 2 = Never */ + int static_speed; /**< Maximum speed of vehicle to consider it stationary */ + int static_distance; /**< Maximum distance of previous position of vehicle to consider it stationary */ struct attr **attrs; GHashTable *roadprofile_hash; }; -- 2.7.4