refactored how timestamp and sequence are stored: moved to AbstractProperty 33/2533/1
authorKevron Rees <kevron_m_rees@linux.intel.com>
Wed, 28 Nov 2012 23:04:31 +0000 (15:04 -0800)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Wed, 28 Nov 2012 23:04:31 +0000 (15:04 -0800)
29 files changed:
ambd/core.cpp
ambd/core.h
lib/CMakeLists.txt
lib/abstractpropertytype.h
lib/abstractroutingengine.h
lib/abstractsink.h
lib/timestamp.cpp [new file with mode: 0644]
lib/timestamp.h
plugins/database/databasesink.cpp
plugins/database/databasesink.h
plugins/dbus/dbusplugin.cpp
plugins/dbus/dbusplugin.h
plugins/demosink/demosinkplugin.cpp
plugins/demosink/demosinkplugin.h
plugins/exampleplugin.cpp
plugins/exampleplugin.h
plugins/examplesink.cpp
plugins/examplesink.h
plugins/obd2plugin/obd2source.cpp
plugins/obd2plugin/obd2source.h
plugins/tpms/tpmsplugin.cpp
plugins/tpms/tpmsplugin.h
plugins/websocketsink/websocketsink.cpp
plugins/websocketsink/websocketsink.h
plugins/websocketsink/websocketsinkmanager.cpp
plugins/websocketsourceplugin/websocketsource.cpp
plugins/websocketsourceplugin/websocketsource.h
plugins/wheel/wheelplugin.cpp
plugins/wheel/wheelplugin.h

index 02aa4cb..0107ee9 100644 (file)
@@ -140,7 +140,7 @@ void Core::updateSupported(PropertyList added, PropertyList removed)
        }
 }
 
-void Core::updateProperty(VehicleProperty::Property property, AbstractPropertyType *value, std::string uuid, double timestamp, uint32_t sequence)
+void Core::updateProperty(VehicleProperty::Property property, AbstractPropertyType *value, std::string uuid)
 {
        SinkList list = propertySinkMap[property];
        
@@ -148,21 +148,10 @@ void Core::updateProperty(VehicleProperty::Property property, AbstractPropertyTy
 
        propertiesPerSecond++;
 
-       /*if(previousValueMap.find(property) != previousValueMap.end())
-       {
-               std::string v = previousValueMap[property];
-               if(v == value->toString())
-               {
-                       ///no change from last value;
-                       return;
-               }
-       }
-
-       previousValueMap[property] = value->toString();*/
 
        for(SinkList::iterator itr = list.begin(); itr != list.end(); itr++)
        {
-               (*itr)->propertyChanged(property, value, uuid, timestamp, sequence);
+               (*itr)->propertyChanged(property, value, uuid);
        }
 }
 
index 6afe7b2..7ad4ad0 100644 (file)
@@ -36,7 +36,7 @@ public:
 
        void setSupported(PropertyList supported, AbstractSource* source);
        void updateSupported(PropertyList added, PropertyList removed);
-       void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value, string uuid, double timestamp, uint32_t sequence);
+       void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value, string uuid);
        
        /// sinks:
        
index e822f2d..b8fe915 100644 (file)
@@ -1,4 +1,4 @@
-set(amb_sources abstractpropertytype.cpp abstractroutingengine.cpp listplusplus.cpp abstractsink.cpp vehicleproperty.cpp abstractsource.cpp debugout.cpp)
+set(amb_sources abstractpropertytype.cpp abstractroutingengine.cpp listplusplus.cpp abstractsink.cpp vehicleproperty.cpp abstractsource.cpp debugout.cpp timestamp.cpp)
 set(amb_headers_install abstractpropertytype.h nullptr.h abstractroutingengine.h listplusplus.h abstractsink.h vehicleproperty.h debugout.h abstractsource.h timestamp.h)
 include_directories( ${include_dirs} )
 add_library(amb SHARED ${amb_sources})
index c9297e5..87272e4 100644 (file)
 #include <boost/lexical_cast.hpp>
 #include <boost/utility.hpp>
 #include <type_traits>
+#include "timestamp.h"
 
 class AbstractPropertyType
 {
 public:
+       AbstractPropertyType(): timestamp(0), sequence(0) {}
+
        virtual std::string toString() const = 0;
 
        virtual void fromString(std::string)= 0;
 
        virtual AbstractPropertyType* copy() = 0;
 
+       double timestamp;
+
+       uint32_t sequence;
+
        void setValue(boost::any val)
        {
                mValue = val;
+               timestamp = amb::currentTime();
        }
 
        template <typename T>
index 1bf7578..f45d846 100644 (file)
@@ -38,17 +38,6 @@ class AsyncRangePropertyReply;
 typedef std::function<void (AsyncPropertyReply*)> GetPropertyCompletedSignal;
 typedef std::function<void (AsyncRangePropertyReply*)> GetRangedPropertyCompletedSignal;
 
-class PropertyValueTime {
-public:
-       ~PropertyValueTime()
-       {
-               delete value;
-       }
-
-       AbstractPropertyType* value;
-       double timestamp;
-};
-
 class AsyncPropertyRequest
 {
 public:
@@ -150,7 +139,7 @@ public:
                values.clear();
        }
 
-       std::list<PropertyValueTime*> values;
+       std::list<AbstractPropertyType*> values;
        bool success;
 };
 
@@ -159,7 +148,7 @@ class AbstractRoutingEngine
 public:
        virtual void setSupported(PropertyList supported, AbstractSource* source) = 0;
        virtual void updateSupported(PropertyList added, PropertyList removed) = 0;
-       virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid, double timestamp, uint32_t sequence) = 0;
+       virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid) = 0;
 
        /// sinks:
        virtual void registerSink(AbstractSink* self) = 0;
index 4a74691..110c72e 100644 (file)
@@ -57,7 +57,7 @@ public:
          * Do not destroy it.  If you need to store the value use value.anyValue() or value.value<T>() to copy.
          * @param uuid Unique identifier representing the source
          */
-       virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string  uuid, double timestamp, uint32_t sequence) = 0;
+       virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string  uuid) = 0;
        virtual void supportedChanged(PropertyList supportedProperties) = 0;
        
 
diff --git a/lib/timestamp.cpp b/lib/timestamp.cpp
new file mode 100644 (file)
index 0000000..6756803
--- /dev/null
@@ -0,0 +1,18 @@
+#include "timestamp.h"
+
+#include <time.h>
+#include <iostream>
+
+double amb::currentTime()
+{
+       struct timespec tm;
+
+       clock_gettime(CLOCK_REALTIME, &tm);
+
+       double ns = double(tm.tv_nsec) / 1000000000;
+
+
+       double time = double(tm.tv_sec) + ns;
+
+       return time;
+}
index 1d3a2f7..745bc13 100644 (file)
@@ -1,24 +1,10 @@
-#ifndef _TIMESTAMP_H__
-#define _TIMESTAMP_H__
+#ifndef _TIMESTAMP_H___
+#define _TIMESTAMP_H___
 
-#include <time.h>
-#include <iostream>
 
 namespace amb {
 
-double currentTime()
-{
-       struct timespec tm;
-
-       clock_gettime(CLOCK_REALTIME, &tm);
-
-       double ns = double(tm.tv_nsec) / 1000000000;
-
-
-       double time = double(tm.tv_sec) + ns;
-
-       return time;
-}
+double currentTime();
 
 }
 
index ac605a8..abb7bef 100644 (file)
@@ -63,12 +63,14 @@ void DatabaseSink::supportedChanged(PropertyList supportedProperties)
 }
 
 
-void DatabaseSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, std::string uuid, double timestamp, uint32_t sequence)
+void DatabaseSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, std::string uuid)
 {
        DBObject* obj = new DBObject;
        obj->key = property;
        obj->value = value->toString();
        obj->source = uuid;
+       obj->time = value->timestamp;
+       obj->sequence = value->sequence;
 }
 
 
index 09f62c6..5884c81 100644 (file)
@@ -111,7 +111,7 @@ public:
        ~DatabaseSink();
        virtual PropertyList subscriptions();
        virtual void supportedChanged(PropertyList supportedProperties);
-       virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid, double timestamp, uint32_t sequence);
+       virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid);
        virtual std::string uuid();
 
 private:
index 196d54d..682df0c 100644 (file)
@@ -54,7 +54,7 @@ void DBusSink::supportedChanged(PropertyList supportedProperties)
                registerObject();
 }
 
-void DBusSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string uuid, double, uint32_t)
+void DBusSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string uuid)
 {
        if(!propertyDBusMap.count(property))
                return;
index 025fbd6..103cfaa 100644 (file)
@@ -33,7 +33,7 @@ class DBusSink : public AbstractSink, public AbstractDBusInterface
 public:
        DBusSink(std::string interface, std::string path, AbstractRoutingEngine* engine, GDBusConnection* connection, map<string, string> config);
        virtual void supportedChanged(PropertyList supportedProperties);
-       virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, std::string uuid,double,uint32_t);
+       virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, std::string uuid);
        virtual std::string uuid();
 
 protected:
index af47696..9f7f6b3 100644 (file)
@@ -75,7 +75,7 @@ string DemoSink::uuid()
        return "5b0e8a04-d6d7-43af-b827-1663627a25d9";
 }
 
-void DemoSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string uuid, double, uint32_t)
+void DemoSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string uuid)
 {
        std::string app = configuration["script"];
        std::string strValue = value->toString();
index 2340a78..ffd806c 100644 (file)
@@ -33,7 +33,7 @@ public:
        
        string uuid();
        
-       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid, double, uint32_t);
+       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid);
        void supportedChanged(PropertyList);
 
        friend class WheelPrivate;      
index 44da9cd..db7b95a 100644 (file)
@@ -184,12 +184,20 @@ void ExampleSourcePlugin::randomizeProperties()
 
        machineGun = !machineGun;
 
-       routingEngine->updateProperty(VehicleProperty::VehicleSpeed, &vel, uuid(),amb::currentTime(), 0);
-       routingEngine->updateProperty(VehicleProperty::EngineSpeed, &es, uuid(),amb::currentTime(), 0);
-       routingEngine->updateProperty(VehicleProperty::AccelerationX, &ac, uuid(),amb::currentTime(), 0);
-       routingEngine->updateProperty(VehicleProperty::SteeringWheelAngle, &swa, uuid(),amb::currentTime(), 0);
-       routingEngine->updateProperty(VehicleProperty::TransmissionShiftPosition,&tsp, uuid(),amb::currentTime(), 0);
-       routingEngine->updateProperty(VehicleProperty::ThrottlePosition, &tp, uuid(),amb::currentTime(), 0);
-       routingEngine->updateProperty(VehicleProperty::EngineCoolantTemperature, &ec, uuid(),amb::currentTime(), 0);
+       vel.timestamp = amb::currentTime();
+       es.timestamp = amb::currentTime();
+       ac.timestamp = amb::currentTime();
+       swa.timestamp = amb::currentTime();
+       tsp.timestamp = amb::currentTime();
+       tp.timestamp = amb::currentTime();
+       ec.timestamp = amb::currentTime();
+
+       routingEngine->updateProperty(VehicleProperty::VehicleSpeed, &vel, uuid());
+       routingEngine->updateProperty(VehicleProperty::EngineSpeed, &es, uuid());
+       routingEngine->updateProperty(VehicleProperty::AccelerationX, &ac, uuid());
+       routingEngine->updateProperty(VehicleProperty::SteeringWheelAngle, &swa, uuid());
+       routingEngine->updateProperty(VehicleProperty::TransmissionShiftPosition,&tsp, uuid());
+       routingEngine->updateProperty(VehicleProperty::ThrottlePosition, &tp, uuid());
+       routingEngine->updateProperty(VehicleProperty::EngineCoolantTemperature, &ec, uuid());
        //routingEngine->updateProperty(VehicleProperty::MachineGunTurretStatus, &mgt);
 }
index 8cb2bf4..8f4327b 100644 (file)
@@ -38,7 +38,7 @@ public:
        void unsubscribeToPropertyChanges(VehicleProperty::Property property);
        PropertyList supported();
        
-       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid, double timestamp, uint32_t sequence) {}
+       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
        void supportedChanged(PropertyList) {}
        
        void randomizeProperties();
index 39a04be..dd531f5 100644 (file)
@@ -69,10 +69,10 @@ ExampleSink::ExampleSink(AbstractRoutingEngine* engine, map<string, string> conf
        vehicleSpeedFromLastWeek.property = VehicleProperty::VehicleSpeed;
        vehicleSpeedFromLastWeek.completed = [](AsyncRangePropertyReply* reply)
        {
-               std::list<PropertyValueTime*> values = reply->values;
+               std::list<AbstractPropertyType*> values = reply->values;
                for(auto itr = values.begin(); itr != values.end(); itr++)
                {
-                       DebugOut(0)<<"Velocity value from last week: "<<(*itr)->value->toString()<<" time: "<<(*itr)->timestamp<<endl;
+                       DebugOut(0)<<"Velocity value from last week: "<<(*itr)->toString()<<" time: "<<(*itr)->timestamp<<endl;
                }
        };
 
@@ -93,7 +93,7 @@ void ExampleSink::supportedChanged(PropertyList supportedProperties)
        routingEngine->subscribeToProperty(VehicleProperty::VehicleSpeed, this);
 }
 
-void ExampleSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid, double timestamp, uint32_t sequence)
+void ExampleSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid)
 {
        DebugOut()<<property<<" value: "<<value->toString()<<endl;
 }
index e45b108..afac457 100644 (file)
@@ -30,7 +30,7 @@ public:
        ExampleSink(AbstractRoutingEngine* engine, map<string, string> config);
        virtual PropertyList subscriptions();
        virtual void supportedChanged(PropertyList supportedProperties);
-       virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid, double timestamp, uint32_t sequence);
+       virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid);
        virtual std::string uuid();
 };
 
index 5e75e99..4170145 100644 (file)
@@ -472,6 +472,7 @@ static int updateProperties(/*gpointer retval,*/ gpointer data)
 
        return true;
 }
+
 void OBD2Source::updateProperty(VehicleProperty::Property property,AbstractPropertyType* value)
 {
        //m_re->updateProperty(property,&value);
@@ -484,29 +485,10 @@ void OBD2Source::updateProperty(VehicleProperty::Property property,AbstractPrope
        }
        else
        {
-               m_re->updateProperty(property,value,uuid(),amb::currentTime(),0);
+               m_re->updateProperty(property,value,uuid());
        }
 }
-void OBD2Source::mafValue(double maf)
-{
-       VehicleProperty::VehicleSpeedType emaf(maf);
-       m_re->updateProperty(VehicleProperty::MassAirFlow,&emaf,uuid(),amb::currentTime(),0);
-}
-void OBD2Source::engineCoolantTemp(int temp)
-{
-       VehicleProperty::VehicleSpeedType etemp(temp);
-       m_re->updateProperty(VehicleProperty::EngineCoolantTemperature,&etemp,uuid(),amb::currentTime(),0);
-}
-void OBD2Source::engineSpeed(double speed)
-{
-       VehicleProperty::VehicleSpeedType espeed(speed);
-       m_re->updateProperty(VehicleProperty::EngineSpeed,&espeed,uuid(),amb::currentTime(),0);
-}
-void OBD2Source::vehicleSpeed(int speed)
-{
-       VehicleProperty::EngineSpeedType vspeed(speed);
-       m_re->updateProperty(VehicleProperty::VehicleSpeed,&vspeed,uuid(),amb::currentTime(),0);
-}
+
 void OBD2Source::setSupported(PropertyList list)
 {
        m_supportedProperties = list;
index 60045de..b9499db 100644 (file)
@@ -143,7 +143,7 @@ public:
        void engineCoolantTemp(int temp);
        PropertyList removeRequests;
        void setSupported(PropertyList list);
-       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid,double,uint32_t) {}
+       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
        void supportedChanged(PropertyList) {}
        GAsyncQueue* commandQueue;
        GAsyncQueue* subscriptionAddQueue;
index 836f0ed..c3f912d 100644 (file)
@@ -299,14 +299,14 @@ int TpmsPlugin::readValues()
   VehicleProperty::TireTemperatureType lrTemp(lrTemperature);
   VehicleProperty::TireTemperatureType rrTemp(rrTemperature);
 
-  routingEngine->updateProperty(VehicleProperty::TirePressureLeftFront, &lfPres, uuid(), amb::currentTime(), 0);
-  routingEngine->updateProperty(VehicleProperty::TirePressureRightFront, &rfPres, uuid(), amb::currentTime(), 0);
-  routingEngine->updateProperty(VehicleProperty::TirePressureLeftRear, &lrPres, uuid(), amb::currentTime(), 0);
-  routingEngine->updateProperty(VehicleProperty::TirePressureRightRear, &rrPres, uuid(), amb::currentTime(), 0);
-  routingEngine->updateProperty(VehicleProperty::TireTemperatureLeftFront, &lfTemp, uuid(), amb::currentTime(), 0);
-  routingEngine->updateProperty(VehicleProperty::TireTemperatureRightFront, &rfTemp, uuid(), amb::currentTime(), 0);
-  routingEngine->updateProperty(VehicleProperty::TireTemperatureLeftRear, &lrTemp, uuid(), amb::currentTime(), 0);
-  routingEngine->updateProperty(VehicleProperty::TireTemperatureRightRear, &rrTemp, uuid(), amb::currentTime(), 0);
+  routingEngine->updateProperty(VehicleProperty::TirePressureLeftFront, &lfPres, uuid());
+  routingEngine->updateProperty(VehicleProperty::TirePressureRightFront, &rfPres, uuid());
+  routingEngine->updateProperty(VehicleProperty::TirePressureLeftRear, &lrPres, uuid());
+  routingEngine->updateProperty(VehicleProperty::TirePressureRightRear, &rrPres, uuid());
+  routingEngine->updateProperty(VehicleProperty::TireTemperatureLeftFront, &lfTemp, uuid());
+  routingEngine->updateProperty(VehicleProperty::TireTemperatureRightFront, &rfTemp, uuid());
+  routingEngine->updateProperty(VehicleProperty::TireTemperatureLeftRear, &lrTemp, uuid());
+  routingEngine->updateProperty(VehicleProperty::TireTemperatureRightRear, &rrTemp, uuid());
 
   return 0;
 }
index b4e36da..189c91b 100644 (file)
@@ -38,7 +38,7 @@ public:
        void unsubscribeToPropertyChanges(VehicleProperty::Property property);
        PropertyList supported();
        
-       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid,double,uint32_t) {}
+       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
        void supportedChanged(PropertyList) {}
 
     int readValues();
index e1460a1..bbcb452 100644 (file)
@@ -45,7 +45,7 @@ string WebSocketSink::uuid()
 {
        return m_uuid;
 }
-void WebSocketSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string  uuid, double timestamp, uint32_t sequence)
+void WebSocketSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string  uuid)
 {
   //printf("Got property:%i\n",boost::any_cast<uint16_t>(reply->value));
        //uint16_t velocity = boost::any_cast<uint16_t>(value);
@@ -66,7 +66,7 @@ void WebSocketSink::propertyChanged(VehicleProperty::Property property, Abstract
        
        s.precision(15);
        
-       s << "{\"type\":\"valuechanged\",\"name\":\"" << tmpstr << "\",\"data\":\"" << value->toString() << "\",\"transactionid\":\"" << m_uuid << "\", \"timestamp\":\""<<timestamp<<"\",\"sequence\":\""<<sequence<<"\"}";
+       s << "{\"type\":\"valuechanged\",\"name\":\"" << tmpstr << "\",\"data\":\"" << value->toString() << "\",\"transactionid\":\"" << m_uuid << "\", \"timestamp\":\""<<value->timestamp<<"\",\"sequence\":\""<<value->sequence<<"\"}";
        
        string replystr = s.str();
        //printf("Reply: %s\n",replystr.c_str());
index 09c76e2..c65ebff 100644 (file)
@@ -30,7 +30,7 @@ public:
        WebSocketSink(AbstractRoutingEngine* re,libwebsocket *wsi,string uuid,VehicleProperty::Property property,std::string ambdproperty);
        ~WebSocketSink();
        string uuid() ;
-       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string  uuid, double timestamp, uint32_t sequence);
+       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string  uuid);
        void supportedChanged(PropertyList supportedProperties);
        PropertyList subscriptions();
        libwebsocket *socket() { return m_wsi; }
index 6530458..05a5570 100644 (file)
@@ -190,7 +190,7 @@ void WebSocketSinkManager::addSingleShotRangedSink(libwebsocket* socket, Vehicle
 
                //TODO: Dirty hack hardcoded stuff, jsut to make it work.
                stringstream data ("[");
-               std::list<PropertyValueTime*> values = reply->values;
+               std::list<AbstractPropertyType*> values = reply->values;
                for(auto itr = values.begin(); itr != values.end(); itr++)
                {
                        if(itr != values.begin())
@@ -198,7 +198,7 @@ void WebSocketSinkManager::addSingleShotRangedSink(libwebsocket* socket, Vehicle
                                data<<",";
                        }
 
-                       data << "{ \"value\" : " << "\"" << (*itr)->value->toString() << "\", \"time\" : \"" << (*itr)->timestamp << "\" }";
+                       data << "{ \"value\" : " << "\"" << (*itr)->toString() << "\", \"time\" : \"" << (*itr)->timestamp << "\" }";
                }
 
                data<<"]";
index b15c0ed..3cfa094 100644 (file)
@@ -308,7 +308,7 @@ static int callback_http_only(libwebsocket_context *context,struct libwebsocket
                                try
                                {
                                        AbstractPropertyType* type = VehicleProperty::getPropertyTypeForPropertyNameValue(name,data.front());
-                                       m_re->updateProperty(name, type, source->uuid(), timestamp, 0);
+                                       m_re->updateProperty(name, type, source->uuid());
 
                                        double currenttime = amb::currentTime();
 
@@ -356,9 +356,11 @@ static int callback_http_only(libwebsocket_context *context,struct libwebsocket
                                                pairdata.pop_front();
                                                if (source->propertyReplyMap.find(pair.first) != source->propertyReplyMap.end())
                                                {
-                                                       source->propertyReplyMap[pair.first]->value = VehicleProperty::getPropertyTypeForPropertyNameValue(source->propertyReplyMap[pair.first]->property,pair.second);
+                                                       AbstractPropertyType* v = VehicleProperty::getPropertyTypeForPropertyNameValue(source->propertyReplyMap[pair.first]->property,pair.second);
+                                                       source->propertyReplyMap[pair.first]->value = v;
                                                        source->propertyReplyMap[pair.first]->completed(source->propertyReplyMap[pair.first]);
                                                        source->propertyReplyMap.erase(pair.first);
+                                                       delete v;
                                                }
                                        }
                                        //data will contain a property/value map.
index eb14f1e..3eaaaa5 100644 (file)
@@ -47,7 +47,7 @@ public:
        PropertyList activeRequests;
        PropertyList removeRequests;
        void setSupported(PropertyList list);
-       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid,double, uint32_t) {}
+       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
        void supportedChanged(PropertyList) {}
        void setConfiguration(map<string, string> config);
        map<VehicleProperty::Property,AsyncPropertyReply*> propertyReplyMap;
index b947546..b8f0e50 100644 (file)
@@ -449,7 +449,8 @@ void WheelPrivate::changeMachineGuns(bool val)
 {
        this->machineGuns = val;
        VehicleProperty::MachineGunTurretStatusType temp(this->machineGuns);
-       this->re->updateProperty(VehicleProperty::MachineGunTurretStatus, &temp, mParent->uuid(), amb::currentTime(), 0);
+       temp.timestamp = amb::currentTime();
+       this->re->updateProperty(VehicleProperty::MachineGunTurretStatus, &temp, mParent->uuid());
 }
 
 void WheelPrivate::changeTurnSignal(TurnSignals::TurnSignalType dir, bool val)
@@ -463,7 +464,8 @@ void WheelPrivate::changeTurnSignal(TurnSignals::TurnSignalType dir, bool val)
        }
        this->turnSignal = tsVal;
        VehicleProperty::TurnSignalType temp(this->turnSignal);
-       this->re->updateProperty(VehicleProperty::TurnSignal, &temp, mParent->uuid(), amb::currentTime(), 0);
+       temp.timestamp = amb::currentTime();
+       this->re->updateProperty(VehicleProperty::TurnSignal, &temp, mParent->uuid());
 }
 
 void WheelPrivate::changeGear(int gear)
@@ -471,20 +473,24 @@ void WheelPrivate::changeGear(int gear)
        this->currentGear = (Transmission::TransmissionPositions)gear;
        VehicleProperty::TransmissionShiftPositionType tempTrans(this->currentGear);
        VehicleProperty::VehicleSpeedType tempSpeed(this->calcCarSpeed());
-       this->re->updateProperty(VehicleProperty::TransmissionShiftPosition, &tempTrans, mParent->uuid(), amb::currentTime(), 0);
-       this->re->updateProperty(VehicleProperty::VehicleSpeed, &tempSpeed, mParent->uuid(), amb::currentTime(), 0);
+       tempTrans.timestamp = amb::currentTime();
+       tempSpeed.timestamp = amb::currentTime();
+       this->re->updateProperty(VehicleProperty::TransmissionShiftPosition, &tempTrans, mParent->uuid());
+       this->re->updateProperty(VehicleProperty::VehicleSpeed, &tempSpeed, mParent->uuid());
 }
 
 void WheelPrivate::changeOilPressure(bool increase)
 {
        VehicleProperty::EngineOilPressureType temp(increase ? ++this->oilPSI : --this->oilPSI);
-       this->re->updateProperty(VehicleProperty::EngineOilPressure, &temp, mParent->uuid(), amb::currentTime(), 0);
+       temp.timestamp = amb::currentTime();
+       this->re->updateProperty(VehicleProperty::EngineOilPressure, &temp, mParent->uuid());
 }
 
 void WheelPrivate::changeCoolantTemp(bool increase)
 {
-        VehicleProperty::EngineCoolantTemperatureType temp(increase ? ++this->coolantTemp : --this->coolantTemp);
-       this->re->updateProperty(VehicleProperty::EngineCoolantTemperature, &temp, mParent->uuid(), amb::currentTime(), 0);
+       VehicleProperty::EngineCoolantTemperatureType temp(increase ? ++this->coolantTemp : --this->coolantTemp);
+       temp.timestamp = amb::currentTime();
+       this->re->updateProperty(VehicleProperty::EngineCoolantTemperature, &temp, mParent->uuid());
 }
 
 
@@ -492,7 +498,8 @@ void WheelPrivate::changeSteeringAngle(int val)
 {
        this->steeringAngle = (((double)val/(double)32767.0) + (double)1.0) * (double)180.0;
        VehicleProperty::SteeringWheelAngleType temp(this->steeringAngle);
-       this->re->updateProperty(VehicleProperty::SteeringWheelAngle, &temp, mParent->uuid(), amb::currentTime(), 0);
+       temp.timestamp = amb::currentTime();
+       this->re->updateProperty(VehicleProperty::SteeringWheelAngle, &temp, mParent->uuid());
 }
 
 void WheelPrivate::changeClutch(int val)
@@ -502,7 +509,8 @@ void WheelPrivate::changeClutch(int val)
        if (this->oldClutch != this->clutch)
        {
                VehicleProperty::ClutchStatusType temp(this->clutch);
-               this->re->updateProperty(VehicleProperty::ClutchStatus, &temp, mParent->uuid(), amb::currentTime(), 0);
+               temp.timestamp = amb::currentTime();
+               this->re->updateProperty(VehicleProperty::ClutchStatus, &temp, mParent->uuid());
        }
 }
 
@@ -514,9 +522,9 @@ void WheelPrivate::changeThrottle(int val)
        VehicleProperty::EngineSpeedType tempRpm(this->calcRPM());
        VehicleProperty::VehicleSpeedType tempSpeed(this->calcCarSpeed());
 
-       this->re->updateProperty(VehicleProperty::ThrottlePosition, &tempThrottle, mParent->uuid(), amb::currentTime(), 0);
-       this->re->updateProperty(VehicleProperty::EngineSpeed, &tempRpm, mParent->uuid(), amb::currentTime(), 0);
-       this->re->updateProperty(VehicleProperty::VehicleSpeed, &tempSpeed, mParent->uuid(), amb::currentTime(), 0);
+       this->re->updateProperty(VehicleProperty::ThrottlePosition, &tempThrottle, mParent->uuid());
+       this->re->updateProperty(VehicleProperty::EngineSpeed, &tempRpm, mParent->uuid());
+       this->re->updateProperty(VehicleProperty::VehicleSpeed, &tempSpeed, mParent->uuid());
 }
 
 void WheelPrivate::changeBrake(int val)
@@ -526,7 +534,7 @@ void WheelPrivate::changeBrake(int val)
        if (this->oldBrake != this->brake)
        {
                VehicleProperty::WheelBrakeType temp(this->brake);
-               this->re->updateProperty(VehicleProperty::WheelBrake, &temp, mParent->uuid(), amb::currentTime(), 0);
+               this->re->updateProperty(VehicleProperty::WheelBrake, &temp, mParent->uuid());
        }
 }
 
@@ -551,22 +559,22 @@ void WheelPrivate::checkButtonEvents()
                if (this->button[11]) {
                //      cout << "Inside button 11!" << endl;
                        VehicleProperty::ButtonEventType tempButton(ButtonEvents::Preset1Button);
-                       this->re->updateProperty(VehicleProperty::ButtonEvent, &tempButton, mParent->uuid(), amb::currentTime(), 0);
+                       this->re->updateProperty(VehicleProperty::ButtonEvent, &tempButton, mParent->uuid());
                }
                if (this->button[8]) {
                //      cout << "Inside button 8!" << endl;
                        VehicleProperty::ButtonEventType tempButton(ButtonEvents::Preset2Button);
-                       this->re->updateProperty(VehicleProperty::ButtonEvent, &tempButton, mParent->uuid(), amb::currentTime(), 0);
+                       this->re->updateProperty(VehicleProperty::ButtonEvent, &tempButton, mParent->uuid());
                }
                if (this->button[9]) {
                //      cout << "Inside button 9!" << endl;
                        VehicleProperty::ButtonEventType tempButton(ButtonEvents::Preset3Button);
-                       this->re->updateProperty(VehicleProperty::ButtonEvent, &tempButton, mParent->uuid(), amb::currentTime(), 0);
+                       this->re->updateProperty(VehicleProperty::ButtonEvent, &tempButton, mParent->uuid());
                }
                if (this->button[10]) {
                //      cout << "Inside button 10!" << endl;
                        VehicleProperty::ButtonEventType tempButton(ButtonEvents::Preset4Button);
-                       this->re->updateProperty(VehicleProperty::ButtonEvent, &tempButton, mParent->uuid(), amb::currentTime(), 0);
+                       this->re->updateProperty(VehicleProperty::ButtonEvent, &tempButton, mParent->uuid());
                }
        }
 }
index 5c7f45d..ab7e662 100644 (file)
@@ -41,7 +41,7 @@ public:
        void unsubscribeToPropertyChanges(VehicleProperty::Property property);
        PropertyList supported();
        
-       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid, double, uint32_t) {}
+       void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
        void supportedChanged(PropertyList) {}
 
        map<string, string> getConfiguration() { return configuration; }