-Interface: org.automotive.VehicleId
-Object path: /org/automotive/vehicleInfo/VehicleId
+Interface: org.automotive.vehicleId
+Object path: /org/automotive/vehicleInfo/vehicleId
Properties:
string WMI [readonly]
length in mm
Interface: org.automotive.fuelInfo
-Object path: /org/automotive/vehicleInfo/FuelInfo
+Object path: /org/automotive/vehicleInfo/fuelInfo
Properties:
byte Type [readonly]
Front = 2,
Rear = 3
-Interface: org.automotive.VehicleType
-Object path: /org/automotive/vehicleInfo/VehicleType
+Interface: org.automotive.vehicleType
+Object path: /org/automotive/vehicleInfo/vehicleType
Properties:
byte VehicleType [readonly]
SUV = 4,
Truck = 5
-Interface: org.automotive.DoorType
-Object path: /org/automotive/vehicleInfo/DoorType
+Interface: org.automotive.doors
+Object path: /org/automotive/vehicleInfo/doors
Properties:
- array{ byte } DoorType [readonly]
+ array{ byte } DoorsPerRow [readonly]
Number of doors in each row. The index represents the row. Position '0'
represents the first row, '1' the second row etc.
- Example a common mini-van may have DoorType[0] = 2 doors,
- DoorType[1] = 1 (side door), DoorType[2] = 1 (trunk).
+ Example a common mini-van may have Doors[0] = 2 doors,
+ Doors[1] = 1 (side door), Doors[2] = 1 (trunk).
-Interface: org.automotive.EngineType
-Object path: /org/automotive/vehicleInfo/EngineType
-Properties:
-
- byte EngineType [readonly]
-
- Gasoline = 0,
- Diesel = 1,
- Hybrid = 2,
- Electric = 3
-
-Interface: org.automotive.TransmissionGearType
-Object path: /org/automotive/vehicleInfo/TransmissionGearType
+Interface: org.automotive.transmissionGearType
+Object path: /org/automotive/vehicleInfo/transmissionGearType
Properties:
byte TransmissionGearType [readonly]
Auto = 0,
Manual = 1,
- CVT
+ CV = 2 (Constant Variable Transmission)
+
+
-Interface: org.automotive.WheelInformation
-Object path: /org/automotive/vehicleInfo/WheelInformation
+Interface: org.automotive.wheelInformation
+Object path: /org/automotive/vehicleInfo/wheelInformation
Properties:
- struct{ double, double } WheelInformation [readonly]
-
- Radius of Wheel, Wheel Track.
+ uint16 FrontRadius [readonly]
+
+ Radius of Front Wheel(s) in mm.
+
+ uint16 RearRadius [readonly]
+
+ Radius of Rear Wheel(s) in mm.
+
+ uint32 Track [readonly]
+
+ Wheel Track in mm.
+#include "abstractpropertytype.h"
+
+
+void ListPropertyType::append(AbstractPropertyType *property)
+{
+ mList.push_back(property->copy());
+}
+
+
+ListPropertyType::ListPropertyType()
+{
+
+}
+
+ListPropertyType::ListPropertyType(int)
+{
+
+}
+
+ListPropertyType::ListPropertyType(ListPropertyType &other)
+{
+ std::list<AbstractPropertyType*> l = other.list();
+ for(auto itr = l.begin(); itr != l.end(); itr++)
+ {
+ append(*itr);
+ }
+}
+
+
+ListPropertyType::~ListPropertyType()
+{
+
+}
+
+
+uint ListPropertyType::count()
+{
+ return mList.size();
+}
+
+
+AbstractPropertyType *ListPropertyType::copy()
+{
+ return new ListPropertyType(*this);
+}
+
+
+std::string ListPropertyType::toString() const
+{
+ std::string str = "[";
+
+ for(auto itr = mList.begin(); itr != mList.end(); itr++)
+ {
+ if(str != "[")
+ str += ",";
+
+ AbstractPropertyType* t = *itr;
+
+ str += t->toString();
+ }
+
+ str += "]";
+
+ return str;
+}
+
+
+void ListPropertyType::fromString(std::string)
+{
+ /// TODO: try to use VehicleProperty::getPropertyType... here
+}
+
+
+GVariant *ListPropertyType::toVariant()
+{
+ GVariantBuilder params;
+ g_variant_builder_init(¶ms,G_VARIANT_TYPE_ARRAY);
+
+ for(auto itr = mList.begin(); itr != mList.end(); itr++)
+ {
+ AbstractPropertyType* t;
+ g_variant_builder_add_value(¶ms, t->toVariant());
+ }
+
+ return g_variant_builder_end(¶ms);
+}
+
+
+void ListPropertyType::fromVariant(GVariant *v)
+{
+
+}
#include <boost/utility.hpp>
#include <type_traits>
#include <glib.h>
+#include <list>
#include "timestamp.h"
class AbstractPropertyType
GVariant* mVariant;
};
+class ListPropertyType: public AbstractPropertyType
+{
+public:
+
+ ListPropertyType();
+ ListPropertyType(int unused);
+ ListPropertyType(ListPropertyType & other);
+ ~ListPropertyType();
+
+ void append(AbstractPropertyType* property);
+
+ uint count();
+
+ AbstractPropertyType* copy();
+
+ std::string toString() const;
+ void fromString(std::string );
+
+
+ GVariant* toVariant();
+ void fromVariant(GVariant* v);
+
+ std::list<AbstractPropertyType*> list() { return mList; }
+
+private:
+ std::list<AbstractPropertyType*> mList;
+};
+
#endif
const VehicleProperty::Property VehicleProperty::VehicleHeight = "VehicleHeight";
const VehicleProperty::Property VehicleProperty::VehicleLength = "VehicleLength";
const VehicleProperty::Property VehicleProperty::VehicleType = "VehicleType";
+const VehicleProperty::Property VehicleProperty::DoorsPerRow = "DoorsPerRow";
+const VehicleProperty::Property VehicleProperty::TransmissionGearType = "TransmissionGearType";
+const VehicleProperty::Property VehicleProperty::FrontWheelRadius = "FrontWheelRadius";
+const VehicleProperty::Property VehicleProperty::RearWheelRadius = "RearWheelRadius";
+const VehicleProperty::Property VehicleProperty::WheelTrack = "WheelTrack";
std::list<VehicleProperty::Property> VehicleProperty::mCapabilities;
std::list<VehicleProperty::Property> VehicleProperty::mCustomProperties;
REGISTERPROPERTY(Altitude,0);
REGISTERPROPERTY(Direction,0);
REGISTERPROPERTY(VehicleType,Vehicle::Unknown);
+ REGISTERPROPERTY(DoorsPerRow,0);
+ REGISTERPROPERTY(TransmissionGearType,Transmission::Unknown);
+ REGISTERPROPERTYWITHTYPE(FrontWheelRadius, WheelRadiusType, 0);
+ REGISTERPROPERTYWITHTYPE(RearWheelRadius, WheelRadiusType, 0);
+ REGISTERPROPERTY(WheelTrack,0);
+
}
OEMCustom1 = 3,
OEMCustom2 = 4
};
+
+enum Type {
+ Unknown = -1,
+ Auto = 0,
+ Manual = 1,
+ CV = 2
+};
}
namespace Power {
};
}
+
+
class VehicleProperty
{
static const Property VehicleType;
typedef BasicPropertyType<Vehicle::Type> VehicleTypeType;
+ static const Property DoorsPerRow;
+ typedef ListPropertyType DoorsPerRowType;
+
+ static const Property TransmissionGearType;
+ typedef BasicPropertyType<Transmission::Type> TransmissionGearTypeType;
+
+ static const Property FrontWheelRadius;
+ static const Property RearWheelRadius;
+ typedef BasicPropertyType<uint16_t> WheelRadiusType;
+ static const Property WheelTrack;
+ typedef BasicPropertyType<uint> WheelTrackType;
/** END PROPERTIES **/
ConstructProperty(EngineOilProperty);
ConstructProperty(ExteriorBrightnessProperty);
ConstructProperty(VehicleId);
+ ConstructProperty(DoorsProperty);
PropertyList list = VehicleProperty::customProperties();
static void
on_name_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
{
+
}
static void
on_name_lost (GDBusConnection *connection, const gchar *name, gpointer user_data)
{
+
}
#include "abstractproperty.h"
#include "abstractdbusinterface.h"
#include "basicproperty.h"
+#include "varianttype.h"
+
#include <map>
#include <type_traits>
propertyDBusMap[property] = new StringDBusProperty(routingEngine, property, propertyName, signature, access, this);
}
+ void wantPropertyVariant(VehicleProperty::Property property, std::string propertyName, std::string signature, AbstractProperty::Access access)
+ {
+ propertyDBusMap[property] = new VariantType(routingEngine, signature, property, access, this);
+ }
+
PropertyDBusMap propertyDBusMap;
private:
}
};
+
+class VehicleTypeProperty: public DBusSink
+{
+public:
+ VehicleTypeProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("org.automotive.vehicleType","/org/automotive/vehicleinfo/vehicleType", re, connection, map<string, string>())
+ {
+ wantProperty<Vehicle::Type>(VehicleProperty::VehicleType, "Type", "i", AbstractProperty::Read);
+
+ supportedChanged(re->supported());
+ }
+};
+
+class DoorsProperty: public DBusSink
+{
+public:
+ 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);
+
+ supportedChanged(re->supported());
+ }
+};
+
+class TransmissionInfoProperty: public DBusSink
+{
+public:
+ TransmissionInfoProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("org.automotive.transmissionGearType","/org/automotive/vehicleinfo/transmissionGearType", re, connection, map<string, string>())
+ {
+ wantProperty<Transmission::Type>(VehicleProperty::TransmissionGearType, "TransmissionGearType", "i", AbstractProperty::Read);
+
+ supportedChanged(re->supported());
+ }
+};
+
+class WheelInformationProperty: public DBusSink
+{
+public:
+ WheelInformationProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
+ :DBusSink("org.automotive.WheelInformationProperty","/org/automotive/vehicleinfo/WheelInformationProperty", re, connection, map<string, string>())
+ {
+ wantProperty<uint16_t>(VehicleProperty::FrontWheelRadius, "FrontWheelRadius", "i", AbstractProperty::Read);
+ wantProperty<uint16_t>(VehicleProperty::RearWheelRadius, "RearWheelRadius", "i", AbstractProperty::Read);
+ wantProperty<uint>(VehicleProperty::WheelTrack, "WheelTrack", "i", AbstractProperty::Read);
+
+ supportedChanged(re->supported());
+ }
+};
+
#endif