summaryrefslogtreecommitdiff
path: root/navit
diff options
context:
space:
mode:
authorsteven_s <steven_s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-11-01 02:48:32 +0000
committersteven_s <steven_s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2008-11-01 02:48:32 +0000
commit554d5793d40d4159a5a73e26b25255ed8de80273 (patch)
tree20f202e58f5e98fa6bebf6cb6a015ccb18e8f464 /navit
parent9c9926186d7e4c5aa035a709e40355892253d9ca (diff)
downloadnavit-554d5793d40d4159a5a73e26b25255ed8de80273.tar.gz
Fix:core: Fix for vehicles not routing until position is set with the GUI. |
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: http://svn.code.sf.net/p/navit/code/trunk/navit@1626 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r--navit/vehicle/file/vehicle_file.c14
-rw-r--r--navit/vehicle/gpsd/vehicle_gpsd.c12
-rw-r--r--navit/vehicle/gypsy/vehicle_gypsy.c11
3 files changed, 28 insertions, 9 deletions
diff --git a/navit/vehicle/file/vehicle_file.c b/navit/vehicle/file/vehicle_file.c
index 6b124d771..43859c18c 100644
--- a/navit/vehicle/file/vehicle_file.c
+++ b/navit/vehicle/file/vehicle_file.c
@@ -75,6 +75,7 @@ struct vehicle_priv {
int no_data_count;
#endif
speed_t baudrate;
+ struct attr ** attrs;
};
#ifdef _WIN32
@@ -438,6 +439,8 @@ static int
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;
@@ -460,11 +463,11 @@ vehicle_file_position_attr_get(struct vehicle_priv *priv,
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;
}
@@ -513,6 +516,7 @@ vehicle_file_new_file(struct vehicle_methods
#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;
diff --git a/navit/vehicle/gpsd/vehicle_gpsd.c b/navit/vehicle/gpsd/vehicle_gpsd.c
index 4e972d06c..2cb661f35 100644
--- a/navit/vehicle/gpsd/vehicle_gpsd.c
+++ b/navit/vehicle/gpsd/vehicle_gpsd.c
@@ -47,6 +47,7 @@ static struct vehicle_priv {
char *nmea_data;
char *nmea_data_buf;
guint retry_timer;
+ struct attr ** attrs;
} *vehicle_last;
#define DEFAULT_RETRY_INTERVAL 10 // seconds
@@ -224,6 +225,7 @@ static int
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;
@@ -249,10 +251,11 @@ vehicle_gpsd_position_attr_get(struct vehicle_priv *priv,
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;
@@ -298,6 +301,7 @@ vehicle_gpsd_new_gpsd(struct vehicle_methods
}
ret->cbl = cbl;
*meth = vehicle_gpsd_methods;
+ ret->attrs = attrs;
vehicle_gpsd_open(ret);
return ret;
}
diff --git a/navit/vehicle/gypsy/vehicle_gypsy.c b/navit/vehicle/gypsy/vehicle_gypsy.c
index fa7250aad..0abd193ef 100644
--- a/navit/vehicle/gypsy/vehicle_gypsy.c
+++ b/navit/vehicle/gypsy/vehicle_gypsy.c
@@ -51,6 +51,7 @@ static struct vehicle_priv {
int sats;
int sats_used;
guint retry_timer;
+ struct attr ** attrs;
} *vehicle_last;
#define DEFAULT_RETRY_INTERVAL 10 // seconds
@@ -246,6 +247,7 @@ static int
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;
@@ -265,6 +267,14 @@ vehicle_gypsy_position_attr_get(struct vehicle_priv *priv,
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;
}
@@ -289,6 +299,7 @@ vehicle_gypsy_new_gypsy(struct vehicle_methods
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;