Object path: /org/automotive/runningStatus/tripMeter
Properties:
- uint32 A [readonly]
+ uint32 A [readwrite]
- Distance from trip meter(s) in km.
+ Distance from trip meter(s) in km. This can be only set to "0".
- uint32 B [readonly]
- uint32 C [readonly]
+ uint32 B [readwrite]
+ uint32 C [readwrite]
Interface: org.automotive.transmission
Object path: /org/automotive/runningStatus/transmission
--- /dev/null
+{
+ "sources" : [
+ {
+ "name" : "ExampleSouce",
+ "path" : "/usr/lib/automotive-message-broker/examplesourceplugin.so"
+ }
+ ],
+ "sinks": [
+ {
+ "name" : "DBusSink",
+ "path" : "/usr/lib/automotive-message-broker/dbussinkplugin.so"
+ }
+ ]
+}
+
const VehicleProperty::Property VehicleProperty::TirePressureLeftRear = "TirePressureLeftRear";
const VehicleProperty::Property VehicleProperty::TirePressureRightRear = "TirePressureRightRear";
const VehicleProperty::Property VehicleProperty::VehiclePowerMode = "VehiclePowerMode";
+const VehicleProperty::Property VehicleProperty::TripMeterA = "TripMeterA";
+const VehicleProperty::Property VehicleProperty::TripMeterB = "TripMeterB";
+const VehicleProperty::Property VehicleProperty::TripMeterC = "TripMeterC";
std::list<VehicleProperty::Property> VehicleProperty::mCapabilities;
VehicleProperty::VehicleProperty()
{
registerProperty( VehicleSpeed, [](){ return new VehicleSpeedType(0); });
-
registerProperty(EngineSpeed, [](){ return new EngineSpeedType(0); });
registerProperty(TransmissionShiftPosition, [](){ return new TransmissionShiftPositionType(Transmission::Neutral); });
registerProperty(TransmissionGearPosition, [](){ return new TransmissionGearPositionType(Transmission::Neutral); });
REGISTERPROPERTYWITHTYPE(TirePressureLeftRear, TirePressureType, 0);
REGISTERPROPERTYWITHTYPE(TirePressureRightRear, TirePressureType, 0);
registerProperty( VehiclePowerMode,[](){ return new VehiclePowerModeType(Power::Off); } );
+ REGISTERPROPERTYWITHTYPE(TripMeterA,TripMeterType,0);
+ REGISTERPROPERTYWITHTYPE(TripMeterB,TripMeterType,0);
+ REGISTERPROPERTYWITHTYPE(TripMeterC,TripMeterType,0);
}
std::list<VehicleProperty::Property> VehicleProperty::capabilities()
static const Property VehiclePowerMode;
typedef BasicPropertyType<Power::PowerModes> VehiclePowerModeType;
-
+ static const Property TripMeterA;
+ static const Property TripMeterB;
+ static const Property TripMeterC;
+ typedef BasicPropertyType<uint16_t> TripMeterType;
static std::list<VehicleProperty::Property> capabilities();
pkg_check_modules(gio REQUIRED gio-2.0)
-set(dbussinkplugin_headers dbusplugin.h abstractproperty.h abstractdbusinterface.h dbusinterfacemanager.h accelerationproperty.h basicproperty.h properties.h)
-set(dbussinkplugin_sources dbusplugin.cpp abstractproperty.cpp abstractdbusinterface.cpp dbusinterfacemanager.cpp accelerationproperty.cpp basicproperty.cpp properties.cpp)
+set(dbussinkplugin_headers dbusplugin.h abstractproperty.h abstractdbusinterface.h dbusinterfacemanager.h basicproperty.h properties.h)
+set(dbussinkplugin_sources dbusplugin.cpp abstractproperty.cpp abstractdbusinterface.cpp dbusinterfacemanager.cpp basicproperty.cpp properties.cpp)
add_library(dbussinkplugin MODULE ${dbussinkplugin_sources})
set_target_properties(dbussinkplugin PROPERTIES PREFIX "")
#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)
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
#include "accelerationproperty.h"
#include "properties.h"
+#define ConstructProperty(property) \
+ new property(iface->re, connection);
+
using namespace std;
static void
on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data)
{
DBusInterfaceManager* iface = static_cast<DBusInterfaceManager*>(user_data);
- AbstractDBusInterface* acceleration = new AccelerationPropertyInterface(iface->re, connection);
- VehicleSpeedProperty* vehicleSpeed = new VehicleSpeedProperty(iface->re, connection);
+
+ AbstractDBusInterface* acceleration = new AccelerationProperty(iface->re, connection);
+ AbstractDBusInterface* vehicleSpeed = new VehicleSpeedProperty(iface->re, connection);
+ AbstractDBusInterface* tirePressure = new TirePressureProperty(iface->re, connection);
+ ConstructProperty(VehiclePowerModeProperty);
+ ConstructProperty(TripMeterProperty);
+
}
template <typename T>
void wantProperty(VehicleProperty::Property property, std::string propertyName, std::string signature, AbstractProperty::Access access)
{
- propertyDBusMap[property] = new BasicProperty<T>(propertyName, signature, access, this);
+ propertyDBusMap[property] = new BasicProperty<T>(routingEngine, property, propertyName, signature, access, this);
+ }
+
+ virtual void setProperty(VehicleProperty::Property name, AbstractPropertyType* value)
+ {
+ routingEngine->setProperty(name, value);
}
PropertyDBusMap propertyDBusMap;
TirePressureProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
:DBusSink("org.automotive.tirePressure","/org/automotive/maintainance/tirePressure", re, connection, map<string, string>())
{
- wantProperty<uint16_t>(VehicleProperty::TirePressureLeftFront,"LeftFront", "i", AbstractProperty::Read);
- wantProperty<uint16_t>(VehicleProperty::TirePressureRightFront,"RightFront", "i", AbstractProperty::Read);
- wantProperty<uint16_t>(VehicleProperty::TirePressureLeftRear,"LeftRear", "i", AbstractProperty::Read);
- wantProperty<uint16_t>(VehicleProperty::TirePressureRightRear,"RightRear", "i", AbstractProperty::Read);
+ wantProperty<uint16_t>(VehicleProperty::TirePressureLeftFront,"LeftFront", "q", AbstractProperty::Read);
+ wantProperty<uint16_t>(VehicleProperty::TirePressureRightFront,"RightFront", "q", AbstractProperty::Read);
+ wantProperty<uint16_t>(VehicleProperty::TirePressureLeftRear,"LeftRear", "q", AbstractProperty::Read);
+ wantProperty<uint16_t>(VehicleProperty::TirePressureRightRear,"RightRear", "q", AbstractProperty::Read);
supportedChanged(re->supported());
}
};
{
public:
VehiclePowerModeProperty(AbstractRoutingEngine* re, GDBusConnection* connection)
- :DBusSink("org.automotive.tirePressure","/org/automotive/maintainance/tirePressure", re, connection, map<string, string>())
+ :DBusSink("org.automotive.vehiclePowerMode","/org/automotive/runningstatus/vehiclePowerMode", re, connection, map<string, string>())
{
wantProperty<uint16_t>(VehicleProperty::VehiclePowerMode, "VehiclePowerMode","b",AbstractProperty::Read);
supportedChanged(re->supported());
}
};
+class TripMeterProperty: public DBusSink
+{
+public:
+ TripMeterProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ :DBusSink("org.automotive.tripMeter","/org/automotive/runningstatus/tripMeter", re, connection, map<string, string>())
+ {
+ wantProperty<uint16_t>(VehicleProperty::TripMeterA, "A", "q", AbstractProperty::ReadWrite);
+ wantProperty<uint16_t>(VehicleProperty::TripMeterB, "B", "q", AbstractProperty::ReadWrite);
+ wantProperty<uint16_t>(VehicleProperty::TripMeterC, "C", "q", AbstractProperty::ReadWrite);
+ supportedChanged(re->supported());
+ }
+};
+class AccelerationProperty: public DBusSink
+{
+public:
+ AccelerationProperty(AbstractRoutingEngine *re, GDBusConnection *connection)
+ :DBusSink("org.automotive.acceleration","/org/automotive/runningstatus/acceleration", re, connection, map<string, string>())
+ {
+ wantProperty<uint16_t>(VehicleProperty::AccelerationX, "X", "q", AbstractProperty::Read);
+ wantProperty<uint16_t>(VehicleProperty::AccelerationY, "Y", "q", AbstractProperty::Read);
+ wantProperty<uint16_t>(VehicleProperty::AccelerationZ, "Z", "q", AbstractProperty::Read);
+ supportedChanged(re->supported());
+ }
+};
#endif
}
else if(reply->property == VehicleProperty::VIN)
{
- VehicleProperty::VINType temp("abc00000000000000");
+ VehicleProperty::VINType temp("ABC00000000000000");
reply->value = &temp;
reply->completed(reply);
}