summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevron Rees <tripzero.kev@gmail.com>2013-05-05 15:56:02 -0700
committerKevron Rees <tripzero.kev@gmail.com>2013-05-05 15:56:35 -0700
commitfd9e4886c066e9b4fd86958695c16f397e117a24 (patch)
tree26151dd6ae547aaaa078f5e1accf44dfac5f09c9
parent23b8b262e0695940ef0a4b59e3ef3aa1f11ef804 (diff)
downloadautomotive-message-broker-fd9e4886c066e9b4fd86958695c16f397e117a24.tar.gz
dbus plugin should not set property if the getAsync() call is not successful
-rw-r--r--plugins/dbus/abstractproperty.h2
-rw-r--r--plugins/dbus/varianttype.cpp3
-rw-r--r--plugins/gpsd/gpsdplugin.cpp18
3 files changed, 21 insertions, 2 deletions
diff --git a/plugins/dbus/abstractproperty.h b/plugins/dbus/abstractproperty.h
index 41d4f0ca..67b4ee07 100644
--- a/plugins/dbus/abstractproperty.h
+++ b/plugins/dbus/abstractproperty.h
@@ -78,6 +78,8 @@ public:
{
if(mValue) delete mValue;
+ //if(!val) return;
+
mValue = val->copy();
mAnyValue = val->anyValue();
mTimestamp = val->timestamp;
diff --git a/plugins/dbus/varianttype.cpp b/plugins/dbus/varianttype.cpp
index acde5e37..5f568534 100644
--- a/plugins/dbus/varianttype.cpp
+++ b/plugins/dbus/varianttype.cpp
@@ -57,7 +57,8 @@ void VariantType::fromGVariant(GVariant *val)
void VariantType::asyncReply(AsyncPropertyReply * reply)
{
- setValue(reply->value);
+ if(reply->success)
+ setValue(reply->value);
delete reply;
}
diff --git a/plugins/gpsd/gpsdplugin.cpp b/plugins/gpsd/gpsdplugin.cpp
index b3432f2a..742901c3 100644
--- a/plugins/gpsd/gpsdplugin.cpp
+++ b/plugins/gpsd/gpsdplugin.cpp
@@ -50,22 +50,38 @@ static int updateGpsposition(gpointer data)
double time = amb::currentTime();
+ bool changed = false;
+
if(shared->gps.fix.mode > 2)
{
if(shared->gps.fix.latitude != shared->oldlat)
+ {
shared->oldlat = shared->gps.fix.latitude;
+ changed |= true;
+ }
if(shared->gps.fix.longitude != shared->oldlon)
+ {
shared->oldlon = shared->gps.fix.longitude;
+ changed |= true;
+ }
if(shared->gps.fix.altitude != shared->oldalt)
+ {
shared->oldalt = shared->gps.fix.altitude;
+ changed |= true;
+ }
if(shared->gps.fix.track != shared->oldheading)
+ {
shared->oldheading = shared->gps.fix.track;
+ changed |= true;
+ }
if(shared->gps.fix.speed * MPS_TO_KPH != shared->oldspeed)
{
shared->oldspeed = shared->gps.fix.speed * MPS_TO_KPH;
+ changed |= true;
}
- shared->parent->updateProperty();
+ if(changed)
+ shared->parent->updateProperty();
}
return 1;