added trip meter property
[profile/ivi/automotive-message-broker.git] / plugins / dbus / basicproperty.h
index 818cd08..bedf1c2 100644 (file)
 #define _BASICPROPERTY_H_
 
 #include "abstractproperty.h"
+#include "vehicleproperty.h"
+#include "abstractroutingengine.h"
 
 template <typename T>
 class BasicProperty: public AbstractProperty
 {
 public:
-       BasicProperty(string propertyName, string signature, Access access, AbstractDBusInterface *interface)
-               :AbstractProperty(propertyName,signature,access,interface)
+       BasicProperty(AbstractRoutingEngine* re, string ambPropertyName, string propertyName, string signature, Access access, AbstractDBusInterface *interface)
+               :AbstractProperty(propertyName, signature, access, interface)
        {
-
+               mAmbPropertyName = ambPropertyName;
        }
 
        void setValue(T val)
@@ -48,8 +50,21 @@ public:
 
        virtual void fromGVariant(GVariant *value)
        {
+               T val;
+               g_variant_get(value,signature().c_str(), &val);
+
+               AbstractPropertyType* apt = VehicleProperty::getPropertyTypeForPropertyNameValue(mAmbPropertyName,"");
+               apt->setValue(val);
 
+               routingEngine->setProperty(mAmbPropertyName, apt);
+
+               ///delete this because we should be done
+               delete apt;
        }
+
+private:
+       VehicleProperty::Property mAmbPropertyName;
+       AbstractRoutingEngine* routingEngine;
 };
 
 #endif