}
-ListPropertyType::ListPropertyType(int)
+ListPropertyType::ListPropertyType(AbstractPropertyType *property)
{
-
+ append(property);
}
ListPropertyType::ListPropertyType(ListPropertyType &other)
GVariant *ListPropertyType::toVariant()
{
GVariantBuilder params;
- g_variant_builder_init(¶ms,G_VARIANT_TYPE_ARRAY);
+ g_variant_builder_init(¶ms, G_VARIANT_TYPE_ARRAY);
for(auto itr = mList.begin(); itr != mList.end(); itr++)
{
- AbstractPropertyType* t;
+ AbstractPropertyType* t = *itr;
g_variant_builder_add_value(¶ms, t->toVariant());
}
- return g_variant_builder_end(¶ms);
+ GVariant* var = g_variant_builder_end(¶ms);
+ g_assert(var);
+ return var;
}
public:
ListPropertyType();
- ListPropertyType(int unused);
+ ListPropertyType(AbstractPropertyType *property);
ListPropertyType(ListPropertyType & other);
~ListPropertyType();
std::string bufferTime(double time)
{
ostringstream f;
+ f.precision(15);
f<<time;
while(f.str().length() < 15)
REGISTERPROPERTY(Altitude,0);
REGISTERPROPERTY(Direction,0);
REGISTERPROPERTY(VehicleType,Vehicle::Unknown);
- REGISTERPROPERTY(DoorsPerRow,0);
+ registerPropertyPriv(DoorsPerRow,[]() { BasicPropertyType<uint16_t> d(0); return new DoorsPerRowType(&d); });
REGISTERPROPERTY(TransmissionGearType,Transmission::Unknown);
REGISTERPROPERTYWITHTYPE(FrontWheelRadius, WheelRadiusType, 0);
REGISTERPROPERTYWITHTYPE(RearWheelRadius, WheelRadiusType, 0);
g_dbus_connection_emit_signal(mConnection, NULL, mObjectPath.c_str(), mInterfaceName.c_str(), string(property->name() + "Changed").c_str(), tuple_variant, &error);
- //g_variant_unref(params[0]);
- //g_variant_unref(params[1]);
g_free(params);
g_variant_unref(val);
if(error)
{
- throw -1;
+ DebugOut(0)<<error->message<<endl;
+ //throw -1;
}
}
#include "varianttype.h"
#include "abstractroutingengine.h"
+#include "debugout.h"
VariantType::VariantType(AbstractRoutingEngine* re, std::string signature, std::string propertyName, Access access, AbstractDBusInterface *interface)
:AbstractProperty(propertyName, signature, access, interface),routingEngine(re)
{
if(!value())
{
-
AbstractPropertyType* v = VehicleProperty::getPropertyTypeForPropertyNameValue(mPropertyName);
setValue(v);
delete v;
}
- return value()->toVariant();
+ auto v = value();
+
+ return v->toVariant();
}
void VariantType::fromGVariant(GVariant *val)
request.value = v;
request.completed = [](AsyncPropertyReply* reply)
{
+ /// TODO: throw dbus exception
+ if(!reply->success)
+ {
+ DebugOut(0)<<"Success fail";
+ }
delete reply;
};
DoorsProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("org.automotive.doors","/org/automotive/vehicleinfo/doors", re, connection, map<string, string>())
{
- wantPropertyVariant(VehicleProperty::DoorsPerRow, "DoorsPerRow", "a(i)", AbstractProperty::Read);
+ wantPropertyVariant(VehicleProperty::DoorsPerRow, "DoorsPerRow", "ai", AbstractProperty::Read);
supportedChanged(re->supported());
}