diff options
author | Kevron Rees <tripzero.kev@gmail.com> | 2013-05-05 15:56:02 -0700 |
---|---|---|
committer | Kevron Rees <tripzero.kev@gmail.com> | 2013-05-05 15:56:35 -0700 |
commit | fd9e4886c066e9b4fd86958695c16f397e117a24 (patch) | |
tree | 26151dd6ae547aaaa078f5e1accf44dfac5f09c9 | |
parent | 23b8b262e0695940ef0a4b59e3ef3aa1f11ef804 (diff) | |
download | automotive-message-broker-fd9e4886c066e9b4fd86958695c16f397e117a24.tar.gz |
dbus plugin should not set property if the getAsync() call is not successful
-rw-r--r-- | plugins/dbus/abstractproperty.h | 2 | ||||
-rw-r--r-- | plugins/dbus/varianttype.cpp | 3 | ||||
-rw-r--r-- | plugins/gpsd/gpsdplugin.cpp | 18 |
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; |