[dbus] add overload 'value' for custom dbus property types
[profile/ivi/automotive-message-broker.git] / plugins / dbus / custompropertyinterface.cpp
1 #include "custompropertyinterface.h"
2 #include "vehicleproperty.h"
3 #include "varianttype.h"
4 #include "listplusplus.h"
5
6 CustomPropertyInterface::CustomPropertyInterface(VehicleProperty::Property prop, AbstractRoutingEngine *re, GDBusConnection *connection)
7         :DBusSink(prop, re, connection, map<string, string>())
8 {
9         PropertyList list = VehicleProperty::customProperties();
10
11         if(contains(list,prop))
12         {
13                 AbstractPropertyType* temp = VehicleProperty::getPropertyTypeForPropertyNameValue(prop);
14
15                 if(!temp)
16                 {
17                         throw std::runtime_error("Cannot create custom property: " + prop);
18                 }
19
20                 propertyDBusMap.push_back(new VariantType(re, prop, prop, VariantType::ReadWrite));
21                 propertyDBusMap.push_back(new VariantType(re, prop, "Value", VariantType::ReadWrite));
22
23                 delete temp;
24         }
25 }
26
27 CustomPropertyInterface::~CustomPropertyInterface()
28 {
29
30 }