If navit was started before the gps daemon was running vehicle_gpsd would
report the vehicle as active=0 so navit->vehcile would be null.
We now report the active status based on the attribute value not the
current status of the gps link.
Same applies to vehicle_file and vehicle_gypsy
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@1626
ffa7fe5e-494d-0410-b361-
a75ebd5db220
int no_data_count;
#endif
speed_t baudrate;
+ struct attr ** attrs;
};
#ifdef _WIN32
vehicle_file_position_attr_get(struct vehicle_priv *priv,
enum attr_type type, struct attr *attr)
{
+ struct attr * active=NULL;
+
switch (type) {
case attr_position_height:
attr->u.numd = &priv->height;
return 0;
break;
case attr_active:
- if(priv->watch)
- attr->u.num=1;
- else
- attr->u.num=0;
- break;
+ if(active != NULL && active->u.num == 1)
+ return 1;
+ else
+ return 0;
+ break;
default:
return 0;
}
#endif
}
}
+ ret->attrs = attrs;
on_eof = attr_search(attrs, NULL, attr_on_eof);
if (on_eof && !strcasecmp(on_eof->u.str, "stop"))
ret->on_eof=1;
char *nmea_data;
char *nmea_data_buf;
guint retry_timer;
+ struct attr ** attrs;
} *vehicle_last;
#define DEFAULT_RETRY_INTERVAL 10 // seconds
vehicle_gpsd_position_attr_get(struct vehicle_priv *priv,
enum attr_type type, struct attr *attr)
{
+ struct attr * active=NULL;
switch (type) {
case attr_position_height:
attr->u.numd = &priv->height;
return 0;
break;
case attr_active:
- if ( priv->watch)
- attr->u.num=1;
- else
- attr->u.num=0;
+ active = attr_search(priv->attrs,NULL,attr_active);
+ if(active != NULL && active->u.num == 1)
+ return 1;
+ else
+ return 0;
break;
default:
return 0;
}
ret->cbl = cbl;
*meth = vehicle_gpsd_methods;
+ ret->attrs = attrs;
vehicle_gpsd_open(ret);
return ret;
}
int sats;
int sats_used;
guint retry_timer;
+ struct attr ** attrs;
} *vehicle_last;
#define DEFAULT_RETRY_INTERVAL 10 // seconds
vehicle_gypsy_position_attr_get(struct vehicle_priv *priv,
enum attr_type type, struct attr *attr)
{
+ struct attr * active=NULL;
switch (type) {
case attr_position_height:
attr->u.numd = &priv->height;
case attr_position_coord_geo:
attr->u.coord_geo = &priv->geo;
break;
+ case attr_active:
+ active = attr_search(priv->attrs,NULL,attr_active);
+ if(active != NULL && active->u.num == 1)
+ return 1;
+ else
+ return 0;
+ break;
+
default:
return 0;
}
source = attr_search(attrs, NULL, attr_source);
ret = g_new0(struct vehicle_priv, 1);
ret->source = g_strdup(source->u.str);
+ ret->attrs = attrs;
retry_int = attr_search(attrs, NULL, attr_retry_interval);
if (retry_int) {
ret->retry_interval = retry_int->u.num;