project(automotive-message-broker)
cmake_minimum_required(VERSION 2.8)
+set(CMAKE_BUILD_TYPE, Debug)
+
include(FindPkgConfig)
set(PROJECT_NAME "automotive-message-broker")
}
}
-void Core::updateProperty(VehicleProperty::Property property, AbstractPropertyType value)
+void Core::updateProperty(VehicleProperty::Property property, AbstractPropertyType *value)
{
SinkList list = propertySinkMap[property];
return reply;
}
-void Core::setProperty(VehicleProperty::Property property, AbstractPropertyType value)
+void Core::setProperty(VehicleProperty::Property property, AbstractPropertyType *value)
{
for(SourceList::iterator itr = mSources.begin(); itr != mSources.end(); itr++)
{
void setSupported(PropertyList supported, AbstractSource* source);
void updateSupported(PropertyList added, PropertyList removed);
- void updateProperty(VehicleProperty::Property property, AbstractPropertyType value);
+ void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value);
/// sinks:
void registerSink(AbstractSink *self);
void unregisterSink(AbstractSink *self);
AsyncPropertyReply* getPropertyAsync(AsyncPropertyRequest request);
- void setProperty(VehicleProperty::Property,AbstractPropertyType);
+ void setProperty(VehicleProperty::Property,AbstractPropertyType*);
void subscribeToProperty(VehicleProperty::Property, AbstractSink* self);
void unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self);
PropertyList supported() { return mMasterPropertyList; }
-
set(amb_sources abstractpropertytype.cpp abstractroutingengine.cpp listplusplus.cpp abstractsink.cpp vehicleproperty.cpp abstractsource.cpp debugout.cpp)
set(amb_headers_install abstractpropertytype.h abstractroutingengine.h listplusplus.h abstractsink.h vehicleproperty.h debugout.h abstractsource.h)
include_directories( ${include_dirs} )
#include <string>
#include <sstream>
+#include <stdexcept>
#include <boost/any.hpp>
#include <boost/lexical_cast.hpp>
BasicPropertyType(std::string val)
{
- setValue(boost::lexical_cast<T,std::string>(val));
+ if(!val.empty() && val != "")
+ setValue(boost::lexical_cast<T,std::string>(val));
+ else throw std::runtime_error("value cannot be empty");
}
std::string toString()
this->completed = request.completed;
}
- AbstractPropertyType value;
+ AbstractPropertyType* value;
};
class AbstractRoutingEngine
public:
virtual void setSupported(PropertyList supported, AbstractSource* source) = 0;
virtual void updateSupported(PropertyList added, PropertyList removed) = 0;
- virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType value) = 0;
-
+ virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value) = 0;
+
/// sinks:
virtual void registerSink(AbstractSink* self) = 0;
virtual void unregisterSink(AbstractSink* self) = 0;
virtual AsyncPropertyReply *getPropertyAsync(AsyncPropertyRequest request) = 0;
- virtual void setProperty(VehicleProperty::Property, AbstractPropertyType) = 0;
+ virtual void setProperty(VehicleProperty::Property, AbstractPropertyType*) = 0;
virtual void subscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
virtual void unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
virtual PropertyList supported() = 0;
///Pure virtual methods:
virtual string uuid() = 0;
- virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType value, string uuid) = 0;
+ virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) = 0;
virtual void supportedChanged(PropertyList supportedProperties) = 0;
protected:
///pure virtual methods:
virtual void getPropertyAsync(AsyncPropertyReply *reply) = 0;
- virtual void setProperty(VehicleProperty::Property property, AbstractPropertyType value) = 0;
+ virtual void setProperty(VehicleProperty::Property property, AbstractPropertyType* value) = 0;
virtual void subscribeToPropertyChanges(VehicleProperty::Property property) = 0;
virtual void unsubscribeToPropertyChanges(VehicleProperty::Property property) = 0;
virtual PropertyList supported() = 0;
return mProperties;
}
-AbstractPropertyType VehicleProperty::getPropertyTypeForPropertyNameValue(VehicleProperty::Property name, std::string value)
+AbstractPropertyType* VehicleProperty::getPropertyTypeForPropertyNameValue(VehicleProperty::Property name, std::string value)
{
- std::map<VehicleProperty::Property, AbstractPropertyType> theMap;
- theMap[VehicleSpeed] = VehicleSpeedType(value);
- theMap[EngineSpeed] = EngineSpeedType(value);
- theMap[TransmissionShiftPosition] = TransmissionShiftPositionType(value);
- theMap[TransmissionGearPosition] = TransmissionGearPositionType(value);
- theMap[ThrottlePosition] = ThrottlePositionType(value);
- theMap[WheelBrake] = WheelBrakeType(value);
- theMap[SteeringWheelAngle] = SteeringWheelAngleType(value);
- theMap[TurnSignal] = TurnSignalType(value);
- theMap[ClutchStatus] = ClutchStatusType(value);
- theMap[EngineOilPressure] = EngineOilPressureType(value);
- theMap[EngineCoolantTemperature] = EngineCoolantTemperatureType(value);
- theMap[AccelerationX] = AccelerationType(value);
- theMap[AccelerationY] = AccelerationType(value);
- theMap[AccelerationZ] = AccelerationType(value);
- theMap[MassAirFlow] = MassAirFlowType(value);
+ if(name == VehicleSpeed ) return new VehicleSpeedType(value);
+ else if(name == EngineSpeed) return new EngineSpeedType(value);
+ else if(name == TransmissionShiftPosition) return new TransmissionShiftPositionType(value);
+ else if(name == TransmissionGearPosition) return new TransmissionGearPositionType(value);
+ else if(name == ThrottlePosition) return new ThrottlePositionType(value);
+ else if(name == WheelBrake) return new WheelBrakeType(value);
+ else if(name == SteeringWheelAngle) return new SteeringWheelAngleType(value);
+ else if(name == TurnSignal) return new TurnSignalType(value);
+ else if(name == ClutchStatus) return new ClutchStatusType(value);
+ else if(name == EngineOilPressure) return new EngineOilPressureType(value);
+ else if(name == EngineCoolantTemperature) return new EngineCoolantTemperatureType(value);
+ else if(name == AccelerationX) return new AccelerationType(value);
+ else if(name == AccelerationY) return new AccelerationType(value);
+ else if(name == AccelerationZ) return new AccelerationType(value);
+ else if(name == MassAirFlow) return new MassAirFlowType(value);
- return theMap[name];
+ return nullptr;
}
static std::list<VehicleProperty::Property> capabilities();
- static AbstractPropertyType getPropertyTypeForPropertyNameValue(Property name, std::string value);
+ static AbstractPropertyType* getPropertyTypeForPropertyNameValue(Property name, std::string value);
};
virtual GVariant* toGVariant() = 0;
virtual void fromGVariant(GVariant *value) = 0;
- void setValue(AbstractPropertyType val)
+ void setValue(AbstractPropertyType* val)
{
mValue = val;
updateValue();
template<typename T>
T value()
{
- return mValue.value<T>();
+ return mValue->value<T>();
}
protected: ///methods:
protected:
- AbstractPropertyType mValue;
+ AbstractPropertyType * mValue;
string mPropertyName;
string mSignature;
SetterFunc mSetterFunc;
registerObject();
}
-void DBusSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType value, string uuid)
+void DBusSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string uuid)
{
if(!propertyDBusMap.count(property))
return;
public:
DBusSink(std::string interface, std::string path, AbstractRoutingEngine* engine, GDBusConnection* connection);
virtual void supportedChanged(PropertyList supportedProperties);
- virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType value, std::string uuid);
+ virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, std::string uuid);
virtual std::string uuid();
protected:
{
if(reply->property == VehicleProperty::VehicleSpeed)
{
- reply->value = BasicPropertyType<uint16_t>(velocity);
+ VehicleProperty::VehicleSpeedType temp(velocity);
+ reply->value = &temp;
reply->completed(reply);
}
else if(reply->property == VehicleProperty::EngineSpeed)
{
- reply->value = BasicPropertyType<uint16_t>(engineSpeed);
+ VehicleProperty::EngineSpeedType temp(engineSpeed);
+ reply->value = &temp;
reply->completed(reply);
}
else if(reply->property == VehicleProperty::AccelerationX)
{
- reply->value = BasicPropertyType<uint16_t>(accelerationX);
+ VehicleProperty::AccelerationType temp(accelerationX);
+ reply->value = &temp;
reply->completed(reply);
}
else if(reply->property == VehicleProperty::TransmissionShiftPosition)
{
- reply->value = BasicPropertyType<uint16_t>(transmissionShiftPostion);
+ VehicleProperty::TransmissionShiftPositionType temp(transmissionShiftPostion);
+ reply->value = &temp;
reply->completed(reply);
}
else if(reply->property == VehicleProperty::SteeringWheelAngle)
{
- reply->value = BasicPropertyType<uint16_t>(steeringWheelAngle);
+ VehicleProperty::SteeringWheelAngleType temp(steeringWheelAngle);
+ reply->value = &temp;
reply->completed(reply);
}
}
-void ExampleSourcePlugin::setProperty(VehicleProperty::Property , AbstractPropertyType )
+void ExampleSourcePlugin::setProperty(VehicleProperty::Property , AbstractPropertyType *)
{
}
DebugOut()<<"setting velocity to: "<<velocity<<endl;
DebugOut()<<"setting enginespeed to: "<<engineSpeed<<endl;
- routingEngine->updateProperty(VehicleProperty::VehicleSpeed, BasicPropertyType<uint16_t>(velocity));
- routingEngine->updateProperty(VehicleProperty::EngineSpeed, BasicPropertyType<uint16_t>(engineSpeed));
- routingEngine->updateProperty(VehicleProperty::AccelerationX, BasicPropertyType<uint16_t>(accelerationX));
- routingEngine->updateProperty(VehicleProperty::SteeringWheelAngle, BasicPropertyType<uint16_t>(steeringWheelAngle));
- routingEngine->updateProperty(VehicleProperty::TransmissionShiftPosition, BasicPropertyType<uint16_t>(transmissionShiftPostion));
- routingEngine->updateProperty(VehicleProperty::ThrottlePosition, BasicPropertyType<uint16_t>(throttlePos));
- routingEngine->updateProperty(VehicleProperty::EngineCoolantTemperature, BasicPropertyType<uint16_t>(engineCoolant));
+ VehicleProperty::VehicleSpeedType vel(velocity);
+ VehicleProperty::EngineSpeedType es(engineSpeed);
+ VehicleProperty::AccelerationType ac(accelerationX);
+ VehicleProperty::SteeringWheelAngleType swa(steeringWheelAngle);
+ VehicleProperty::TransmissionShiftPositionType tsp(transmissionShiftPostion);
+ VehicleProperty::ThrottlePositionType tp(throttlePos);
+ VehicleProperty::EngineCoolantTemperatureType ec(engineCoolant);
+
+ routingEngine->updateProperty(VehicleProperty::VehicleSpeed, &vel);
+ routingEngine->updateProperty(VehicleProperty::EngineSpeed, &es);
+ routingEngine->updateProperty(VehicleProperty::AccelerationX, &ac);
+ routingEngine->updateProperty(VehicleProperty::SteeringWheelAngle, &swa);
+ routingEngine->updateProperty(VehicleProperty::TransmissionShiftPosition,&tsp);
+ routingEngine->updateProperty(VehicleProperty::ThrottlePosition, &tp);
+ routingEngine->updateProperty(VehicleProperty::EngineCoolantTemperature, &ec);
}
string uuid();
void getPropertyAsync(AsyncPropertyReply *reply);
- void setProperty(VehicleProperty::Property, AbstractPropertyType);
+ void setProperty(VehicleProperty::Property, AbstractPropertyType*);
void subscribeToPropertyChanges(VehicleProperty::Property property);
void unsubscribeToPropertyChanges(VehicleProperty::Property property);
PropertyList supported();
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType value, string uuid) {}
+ void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
void supportedChanged(PropertyList) {}
void randomizeProperties();
AsyncPropertyRequest velocityRequest;
velocityRequest.property = VehicleProperty::VehicleSpeed;
- velocityRequest.completed = [](AsyncPropertyReply* reply) { DebugOut()<<"Velocity Async request completed: "<<reply->value.toString()<<endl; };
+ velocityRequest.completed = [](AsyncPropertyReply* reply) { DebugOut()<<"Velocity Async request completed: "<<reply->value->toString()<<endl; };
AsyncPropertyReply* reply = routingEngine->getPropertyAsync(velocityRequest);
routingEngine->registerSink(this);
routingEngine->subscribeToProperty(VehicleProperty::VehicleSpeed, this);
}
-void ExampleSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType value, std::string uuid)
+void ExampleSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid)
{
- DebugOut()<<property<<" value: "<<value.toString()<<endl;
+ DebugOut()<<property<<" value: "<<value->toString()<<endl;
}
std::string ExampleSink::uuid()
ExampleSink(AbstractRoutingEngine* engine);
virtual PropertyList subscriptions();
virtual void supportedChanged(PropertyList supportedProperties);
- virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType value, std::string uuid);
+ virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid);
virtual std::string uuid();
};
{
return m_uuid;
}
-void WebSocketSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType value, string uuid)
+void WebSocketSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string uuid)
{
//printf("Got property:%i\n",boost::any_cast<uint16_t>(reply->value));
//uint16_t velocity = boost::any_cast<uint16_t>(value);
}
- s << "{\"type\":\"valuechanged\",\"name\":\"" << tmpstr << "\",\"data\":\"" << value.toString() << "\",\"transactionid\":\"" << m_uuid << "\"}";
+ s << "{\"type\":\"valuechanged\",\"name\":\"" << tmpstr << "\",\"data\":\"" << value->toString() << "\",\"transactionid\":\"" << m_uuid << "\"}";
string replystr = s.str();
printf("Reply: %s\n",replystr.c_str());
WebSocketSink(AbstractRoutingEngine* re,libwebsocket *wsi,string uuid,VehicleProperty::Property property,std::string ambdproperty);
~WebSocketSink();
string uuid() ;
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType value, string uuid);
+ void propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string uuid);
void supportedChanged(PropertyList supportedProperties);
PropertyList subscriptions();
private:
}
velocityRequest.completed = [socket,id,property](AsyncPropertyReply* reply)
{
- printf("Got property:%s\n",reply->value.toString().c_str());
+ printf("Got property:%s\n",reply->value->toString().c_str());
//uint16_t velocity = boost::any_cast<uint16_t>(reply->value);
stringstream s;
//}
}*/
tmpstr = property;
- s << "{\"type\":\"methodReply\",\"name\":\"get\",\"data\":[{\"name\":\"" << tmpstr << "\",\"value\":\"" << reply->value.toString() << "\"}],\"transactionid\":\"" << id << "\"}";
+ s << "{\"type\":\"methodReply\",\"name\":\"get\",\"data\":[{\"name\":\"" << tmpstr << "\",\"value\":\"" << reply->value->toString() << "\"}],\"transactionid\":\"" << id << "\"}";
string replystr = s.str();
printf("Reply: %s\n",replystr.c_str());
//data.front()
try
{
- m_re->updateProperty(name,VehicleProperty::getPropertyTypeForPropertyNameValue(name,data.front()));
+ AbstractPropertyType* type = VehicleProperty::getPropertyTypeForPropertyNameValue(name,data.front());
+ m_re->updateProperty(name, type);
+ delete type;
}
catch (exception ex)
{
}*/
}
-void WebSocketSource::setProperty(VehicleProperty::Property , AbstractPropertyType )
+void WebSocketSource::setProperty(VehicleProperty::Property , AbstractPropertyType * )
{
}
string uuid();
boost::any getProperty(VehicleProperty::Property property);
void getPropertyAsync(AsyncPropertyReply *reply);
- void setProperty(VehicleProperty::Property, AbstractPropertyType);
+ void setProperty(VehicleProperty::Property, AbstractPropertyType*);
void subscribeToPropertyChanges(VehicleProperty::Property property);
void unsubscribeToPropertyChanges(VehicleProperty::Property property);
PropertyList supported();
PropertyList activeRequests;
PropertyList removeRequests;
void setSupported(PropertyList list);
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType value, string uuid) {}
+ void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
void supportedChanged(PropertyList) {}
//void randomizeProperties();
WheelPrivate(WheelSourcePlugin *parent, AbstractRoutingEngine *route);
~WheelPrivate();
- AbstractPropertyType getProperty(VehicleProperty::Property propType);
+ AbstractPropertyType *getProperty(VehicleProperty::Property propType);
friend void readCallback(GObject *srcObj, GAsyncResult *res, gpointer userData);
reply->value = this->mWheel->getProperty(reply->property);
reply->completed(reply);
+
+ delete reply->value;
}
-void WheelSourcePlugin::setProperty(VehicleProperty::Property , AbstractPropertyType )
+void WheelSourcePlugin::setProperty(VehicleProperty::Property , AbstractPropertyType * )
{
}
}
-AbstractPropertyType WheelPrivate::getProperty(VehicleProperty::Property propType)
+AbstractPropertyType *WheelPrivate::getProperty(VehicleProperty::Property propType)
{
if (propType == VehicleProperty::VehicleSpeed)
- return VehicleProperty::VehicleSpeedType(this->calcCarSpeed());
+ return new VehicleProperty::VehicleSpeedType(this->calcCarSpeed());
else if (propType == VehicleProperty::EngineSpeed)
- return VehicleProperty::EngineSpeedType(this->calcRPM());
+ return new VehicleProperty::EngineSpeedType(this->calcRPM());
else if (propType == VehicleProperty::TransmissionShiftPosition)
- return VehicleProperty::TransmissionShiftPositionType(this->currentGear);
+ return new VehicleProperty::TransmissionShiftPositionType(this->currentGear);
else if (propType == VehicleProperty::ThrottlePosition)
- return VehicleProperty::ThrottlePositionType(this->throttle);
+ return new VehicleProperty::ThrottlePositionType(this->throttle);
else if (propType == VehicleProperty::WheelBrake)
- return VehicleProperty::WheelBrakeType(this->brake);
+ return new VehicleProperty::WheelBrakeType(this->brake);
else if (propType == VehicleProperty::SteeringWheelAngle)
- return VehicleProperty::SteeringWheelAngleType(this->steeringAngle);
+ return new VehicleProperty::SteeringWheelAngleType(this->steeringAngle);
else if (propType == VehicleProperty::TurnSignal)
- return VehicleProperty::TurnSignalType(this->turnSignal);
+ return new VehicleProperty::TurnSignalType(this->turnSignal);
else if (propType == VehicleProperty::ClutchStatus)
- return VehicleProperty::ClutchStatusType(this->clutch);
+ return new VehicleProperty::ClutchStatusType(this->clutch);
else if (propType == VehicleProperty::EngineOilPressure)
- return VehicleProperty::EngineOilPressureType(this->oilPSI);
+ return new VehicleProperty::EngineOilPressureType(this->oilPSI);
else if (propType == VehicleProperty::EngineCoolantTemperature)
- return VehicleProperty::EngineCoolantTemperatureType(this->coolantTemp);
+ return new VehicleProperty::EngineCoolantTemperatureType(this->coolantTemp);
else if (propType == VehicleProperty::MachineGunTurretStatus)
- return VehicleProperty::MachineGunTurretStatusType(this->machineGuns);
+ return new VehicleProperty::MachineGunTurretStatusType(this->machineGuns);
else
cout << "Unhandled getProperty type: " << propType << endl;
- return AbstractPropertyType();
+ return nullptr;
}
void WheelPrivate::newButtonValue(char number, bool val)
void WheelPrivate::changeMachineGuns(bool val)
{
this->machineGuns = val;
- this->re->updateProperty(VehicleProperty::MachineGunTurretStatus, VehicleProperty::MachineGunTurretStatusType(this->machineGuns));
+ VehicleProperty::MachineGunTurretStatusType temp(this->machineGuns);
+ this->re->updateProperty(VehicleProperty::MachineGunTurretStatus, &temp);
}
void WheelPrivate::changeTurnSignal(TurnSignal dir, bool val)
tsVal = 1;
}
this->turnSignal = tsVal;
- this->re->updateProperty(VehicleProperty::TurnSignal, VehicleProperty::TurnSignalType(this->turnSignal));
+ VehicleProperty::TurnSignalType temp(this->turnSignal);
+ this->re->updateProperty(VehicleProperty::TurnSignal, &temp);
}
void WheelPrivate::changeGear(int gear)
{
this->currentGear = gear;
- this->re->updateProperty(VehicleProperty::TransmissionShiftPosition, VehicleProperty::TransmissionShiftPositionType(this->currentGear));
- this->re->updateProperty(VehicleProperty::VehicleSpeed, VehicleProperty::VehicleSpeedType(this->calcCarSpeed()));
+ VehicleProperty::TransmissionShiftPositionType tempTrans(this->currentGear);
+ VehicleProperty::VehicleSpeedType tempSpeed(this->calcCarSpeed());
+ this->re->updateProperty(VehicleProperty::TransmissionShiftPosition, &tempTrans);
+ this->re->updateProperty(VehicleProperty::VehicleSpeed, &tempSpeed);
}
void WheelPrivate::changeOilPressure(bool increase)
{
- this->re->updateProperty(VehicleProperty::EngineOilPressure, VehicleProperty::EngineOilPressureType(increase ? ++this->oilPSI : --this->oilPSI));
+ VehicleProperty::EngineOilPressureType temp(increase ? ++this->oilPSI : --this->oilPSI);
+ this->re->updateProperty(VehicleProperty::EngineOilPressure, &temp);
}
void WheelPrivate::changeCoolantTemp(bool increase)
{
- this->re->updateProperty(VehicleProperty::EngineCoolantTemperature, VehicleProperty::EngineCoolantTemperatureType(increase ? ++this->coolantTemp : --this->coolantTemp));
+ VehicleProperty::EngineCoolantTemperatureType temp(increase ? ++this->coolantTemp : --this->coolantTemp);
+ this->re->updateProperty(VehicleProperty::EngineCoolantTemperature, &temp);
}
void WheelPrivate::changeSteeringAngle(int val)
{
this->steeringAngle = (((double)val/(double)32767.0) + (double)1.0) * (double)180.0;
- this->re->updateProperty(VehicleProperty::SteeringWheelAngle, VehicleProperty::SteeringWheelAngleType(this->steeringAngle));
+ VehicleProperty::SteeringWheelAngleType temp(this->steeringAngle);
+ this->re->updateProperty(VehicleProperty::SteeringWheelAngle, &temp);
}
void WheelPrivate::changeClutch(int val)
this->oldClutch = this->clutch;
this->clutch = (val < 20000);
if (this->oldClutch != this->clutch)
- this->re->updateProperty(VehicleProperty::ClutchStatus, VehicleProperty::ClutchStatusType(this->clutch));
+ {
+ VehicleProperty::ClutchStatusType temp(this->clutch);
+ this->re->updateProperty(VehicleProperty::ClutchStatus, &temp);
+ }
}
void WheelPrivate::changeThrottle(int val)
{
this->throttle = ((double)(val - 32767)/(double)-65534.0)*(double)100.0;
- this->re->updateProperty(VehicleProperty::ThrottlePosition, VehicleProperty::ThrottlePositionType(this->throttle));
- this->re->updateProperty(VehicleProperty::EngineSpeed, VehicleProperty::EngineSpeedType(this->calcRPM()));
- this->re->updateProperty(VehicleProperty::VehicleSpeed, VehicleProperty::VehicleSpeedType(this->calcCarSpeed()));
+ VehicleProperty::ThrottlePositionType tempThrottle(this->throttle);
+ VehicleProperty::EngineSpeedType tempRpm(this->calcRPM());
+ VehicleProperty::VehicleSpeedType tempSpeed(this->calcCarSpeed());
+
+ this->re->updateProperty(VehicleProperty::ThrottlePosition, &tempThrottle);
+ this->re->updateProperty(VehicleProperty::EngineSpeed, &tempRpm);
+ this->re->updateProperty(VehicleProperty::VehicleSpeed, &tempSpeed);
}
void WheelPrivate::changeBrake(int val)
this->oldBrake = this->brake;
this->brake = (val < 20000);
if (this->oldBrake != this->brake)
- this->re->updateProperty(VehicleProperty::WheelBrake, VehicleProperty::WheelBrakeType(this->brake));
+ {
+ VehicleProperty::WheelBrakeType temp(this->brake);
+ this->re->updateProperty(VehicleProperty::WheelBrake, &temp);
+ }
}
string uuid();
AbstractPropertyType getProperty(VehicleProperty::Property property);
void getPropertyAsync(AsyncPropertyReply *reply);
- void setProperty(VehicleProperty::Property, AbstractPropertyType);
+ void setProperty(VehicleProperty::Property, AbstractPropertyType*);
void subscribeToPropertyChanges(VehicleProperty::Property property);
void unsubscribeToPropertyChanges(VehicleProperty::Property property);
PropertyList supported();
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType value, string uuid) {}
+ void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
void supportedChanged(PropertyList) {}
friend class WheelPrivate;