3c93db3ffa557df33ea87f475aadf12caf2b1c4e
[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                 GVariant* var = temp->toVariant();
21                 std::string signature = g_variant_get_type_string(var);
22                 g_variant_unref(var);
23
24                 propertyDBusMap.push_back( new VariantType(re, prop, prop, VariantType::ReadWrite));
25
26                 delete temp;
27         }
28
29
30 }