virtual void setSupported(PropertyList supported, AbstractSource* source) = 0;
virtual void updateSupported(PropertyList added, PropertyList removed) = 0;
+
/// Deprecated:
void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid)
{
/*! uuid() is a unique identifier
* @return a guid-style unique identifier
*/
- virtual string uuid() = 0;
+ virtual const string uuid() = 0;
+
+
+ /// Deprecated:
+ virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid)
+ {
+ DebugOut(DebugOut::Warning)<<"propertyChanged(VehicleProperty::Property, AbstractPropertyType*,string) is deprecated. Use propertyChanged(AbstractPropertyType*, const string &)"<<endl;
+ propertyChanged(value, uuid);
+ }
/*! propertyChanged is called when a subscribed to property changes.
* @see AbstractRoutingEngine::subscribeToPropertyChanges()
- * @param property name that changed
* @param value value of the property that changed. this is a temporary pointer that will be destroyed.
* Do not destroy it. If you need to store the value use value.anyValue(), value.value<T>() or
* value->copy() to copy.
* @param uuid Unique identifier representing the source
*/
- virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) = 0;
+ virtual void propertyChanged(AbstractPropertyType* value, const string &uuid) {}
+
virtual void supportedChanged(PropertyList supportedProperties) = 0;
DebugOut(int debugLevel = 4)
{
mDebugLevel = debugLevel;
- ostream out(buf);
-
- out.precision(15);
if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
{
+ ostream out(buf);
+ out.precision(15);
out<<bufferTime(amb::currentTime())<<" | ";
if(mDebugLevel == Error)
DebugOut const& operator << (string message) const
{
- ostream out(buf);
-
- out.precision(15);
-
if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
- out<<message<<" ";
+ {
+ ostream out(buf);
+ out.precision(15);
+ out<<message<<" ";
+ }
return *this;
}
DebugOut const& operator << (ostream & (*manip)(std::ostream&)) const
{
- ostream out(buf);
- out.precision(15);
if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
- out<<endl;
+ {
+ ostream out(buf);
+ out.precision(15);
+ out<<endl;
+ }
return *this;
}
DebugOut const & operator << (double val) const
{
- ostream out(buf);
-
- out.precision(15);
-
if(mDebugLevel <= debugThreshhold || mDebugLevel == Error || mDebugLevel == Warning)
- out<<val<<" ";
+ {
+ ostream out(buf);
+ out.precision(15);
+ out<<val<<" ";
+ }
return *this;
}
routingEngine->setSupported(mSupported, this);
}
-void DatabaseSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, std::string uuid)
+void DatabaseSink::propertyChanged(AbstractPropertyType *value, const std::string &uuid)
{
+ VehicleProperty::Property property = value->name;
+
if(!shared)
return;
}
-std::string DatabaseSink::uuid()
+const string DatabaseSink::uuid()
{
return "9f88156e-cb92-4472-8775-9c08addf50d3";
}
DatabaseSink(AbstractRoutingEngine* engine, map<string, string> config);
~DatabaseSink();
virtual void supportedChanged(PropertyList supportedProperties);
- virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid);
- virtual std::string uuid();
+ virtual void propertyChanged(AbstractPropertyType *value, const std::string &uuid);
+ const std::string uuid();
///source role:
virtual void getPropertyAsync(AsyncPropertyReply *reply);
AbstractRoutingEngine* re;
/// From AbstractSink:
- virtual string uuid(){ return "DBusInterfaceManager"; }
+ virtual const string uuid(){ return "DBusInterfaceManager"; }
virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) { }
virtual void supportedChanged(PropertyList supportedProperties);
unregisterObject();
}
-void DBusSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string uuid)
+void DBusSink::propertyChanged(AbstractPropertyType *value, const std::string &uuid)
{
+ VehicleProperty::Property property = value->name;
+
if(propertyDBusMap.find(property) == propertyDBusMap.end() || value->zone != zoneFilter)
return;
mTime = value->timestamp;
}
-std::string DBusSink::uuid()
+const string DBusSink::uuid()
{
return "c2e6cafa-eef5-4b8a-99a0-0f2c9be1057d";
}
DBusSink(std::string objectName, AbstractRoutingEngine* engine, GDBusConnection* connection, map<string, string> config);
virtual ~DBusSink() { }
virtual void supportedChanged(PropertyList supportedProperties);
- virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, std::string uuid);
- virtual std::string uuid();
+ virtual void propertyChanged(AbstractPropertyType *value, const std::string &uuid);
+ virtual const std::string uuid();
std::list<VehicleProperty::Property> wantsProperties()
{
return new DemoSinkManager(routingengine, config);
}
-string DemoSink::uuid()
+const string DemoSink::uuid()
{
return "5b0e8a04-d6d7-43af-b827-1663627a25d9";
}
-void DemoSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string uuid)
+void DemoSink::propertyChanged(AbstractPropertyType *value, const string &uuid)
{
+ VehicleProperty::Property property = value->name;
+
std::string app = configuration["script"];
std::string strValue = value->toString();
DemoSink(AbstractRoutingEngine* re, map<string, string> config);
~DemoSink();
- string uuid();
+ const string uuid();
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid);
+ void propertyChanged(AbstractPropertyType* value, const string &uuid);
void supportedChanged(PropertyList);
friend class WheelPrivate;
}
-string ExampleSourcePlugin::uuid()
+const string ExampleSourcePlugin::uuid()
{
return "6dd4268a-c605-4a06-9034-59c1e8344c8e";
}
public:
ExampleSourcePlugin(AbstractRoutingEngine* re, map<string, string> config);
- string uuid();
+ const string uuid();
void getPropertyAsync(AsyncPropertyReply *reply);
void getRangePropertyAsync(AsyncRangePropertyReply *reply);
AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
int supportedOperations();
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
void supportedChanged(PropertyList) {}
void randomizeProperties();
g_timeout_add(10000, getRangedCb, routingEngine);
}
-void ExampleSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid)
+void ExampleSink::propertyChanged(AbstractPropertyType* value, const string &uuid)
{
+ VehicleProperty::Property property = value->name;
DebugOut()<<property<<" value: "<<value->toString()<<endl;
}
-std::string ExampleSink::uuid()
+const string ExampleSink::uuid()
{
return "f7e4fab2-eb73-4842-9fb0-e1c550eb2d81";
}
ExampleSink(AbstractRoutingEngine* engine, map<string, string> config);
virtual PropertyList subscriptions();
virtual void supportedChanged(PropertyList supportedProperties);
- virtual void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid);
- virtual std::string uuid();
+ virtual void propertyChanged(AbstractPropertyType* value, const std::string &uuid);
+ virtual const std::string uuid();
};
class ExampleSinkManager: public AbstractSinkManager
MurphySource(AbstractRoutingEngine* re, map<string, string> config);
~MurphySource();
- string uuid() { return "murphy"; };
+ const string uuid() { return "murphy"; }
void getPropertyAsync(AsyncPropertyReply *reply);
void getRangePropertyAsync(AsyncRangePropertyReply *reply);
AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
int supportedOperations();
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
void supportedChanged(PropertyList) {}
void processValue(string propertyName, AbstractPropertyType *value);
return new OBD2Source(routingengine, config);
}
-string OBD2Source::uuid()
+const string OBD2Source::uuid()
{
return "f77af740-f1f8-11e1-aff1-0800200c9a66";
}
public:
OBD2Source(AbstractRoutingEngine* re, map<string, string> config);
~OBD2Source();
- string uuid();
+ const string uuid();
int portHandle;
void getPropertyAsync(AsyncPropertyReply *reply);
void getRangePropertyAsync(AsyncRangePropertyReply *reply){}
void engineCoolantTemp(int temp);
PropertyList removeRequests;
void setSupported(PropertyList list);
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
+
void supportedChanged(PropertyList) {}
GAsyncQueue* commandQueue;
GAsyncQueue* statusQueue;
}
-string OpenCvLuxPlugin::uuid()
+const string OpenCvLuxPlugin::uuid()
{
return "3c7a1ea0-7d2e-11e2-9e96-0800200c9a66";
}
OpenCvLuxPlugin(AbstractRoutingEngine* re, map<string, string> config);
- string uuid();
+ const string uuid();
void getPropertyAsync(AsyncPropertyReply *reply);
void getRangePropertyAsync(AsyncRangePropertyReply *reply);
AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
int supportedOperations();
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
void supportedChanged(PropertyList) {}
void updateProperty(uint lux);
return new TestPlugin(routingengine, config);
}
-string TestPlugin::uuid()
+const string TestPlugin::uuid()
{
return "f77af740-f1f8-11e1-aff1-0800200c9a66";
}
public:
TestPlugin(AbstractRoutingEngine* re, map<string, string> config);
~TestPlugin();
- string uuid();
+ const string uuid();
int portHandle;
void getPropertyAsync(AsyncPropertyReply *reply);
void getRangePropertyAsync(AsyncRangePropertyReply *reply){}
int supportedOperations();
void setSupported(PropertyList list);
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
void supportedChanged(PropertyList) {}
void setConfiguration(map<string, string> config);
//void randomizeProperties();
}
-string TpmsPlugin::uuid()
+const string TpmsPlugin::uuid()
{
- return "CHANGE THIS 6dd4268a-c605-4a06-9034-59c1e8344c8e";
+ return "5e896a00-15b3-11e3-8ffd-0800200c9a66";
}
DebugOut() << "TPMS: getPropertyAsync called for property: " << reply->property << endl;
if(reply->property == VehicleProperty::TirePressureLeftFront) {
- VehicleProperty::TirePressureType temp(lfPressure);
+ VehicleProperty::TirePressureLeftFrontType temp(lfPressure);
+ reply->success = true;
reply->value = &temp;
reply->completed(reply);
}
else if(reply->property == VehicleProperty::TirePressureRightFront) {
- VehicleProperty::TirePressureType temp(rfPressure);
+ VehicleProperty::TirePressureRightFrontType temp(rfPressure);
+ reply->success = true;
reply->value = &temp;
reply->completed(reply);
}
else if(reply->property == VehicleProperty::TirePressureLeftRear) {
- VehicleProperty::TirePressureType temp(lrPressure);
+ VehicleProperty::TirePressureLeftRearType temp(lrPressure);
+ reply->success = true;
reply->value = &temp;
reply->completed(reply);
}
else if(reply->property == VehicleProperty::TirePressureRightRear) {
- VehicleProperty::TirePressureType temp(rrPressure);
+ VehicleProperty::TirePressureRightRearType temp(rrPressure);
+ reply->success = true;
reply->value = &temp;
reply->completed(reply);
}
else if(reply->property == VehicleProperty::TireTemperatureLeftFront) {
- VehicleProperty::EngineSpeedType temp(lfTemperature);
+ VehicleProperty::TireTemperatureLeftFrontType temp(lfTemperature);
+ reply->success = true;
reply->value = &temp;
reply->completed(reply);
}
else if(reply->property == VehicleProperty::TireTemperatureRightFront) {
- VehicleProperty::EngineSpeedType temp(rfTemperature);
+ VehicleProperty::TireTemperatureRightFrontType temp(rfTemperature);
+ reply->success = true;
reply->value = &temp;
reply->completed(reply);
}
else if(reply->property == VehicleProperty::TireTemperatureLeftRear) {
- VehicleProperty::EngineSpeedType temp(lrTemperature);
+ VehicleProperty::TireTemperatureLeftRearType temp(lrTemperature);
+ reply->success = true;
reply->value = &temp;
reply->completed(reply);
}
else if(reply->property == VehicleProperty::TireTemperatureRightRear) {
- VehicleProperty::EngineSpeedType temp(rrTemperature);
+ VehicleProperty::TireTemperatureRightRearType temp(rrTemperature);
+ reply->success = true;
reply->value = &temp;
reply->completed(reply);
}
else {
DebugOut() << "TPMS: no such getProperty type: " << reply->property << endl;
+ reply->success = false;
+ reply->error = AsyncPropertyReply::InvalidOperation;
reply->value = nullptr;
reply->completed(reply);
}
}
}
- VehicleProperty::TirePressureType lfPres(lfPressure);
- VehicleProperty::TirePressureType rfPres(rfPressure);
- VehicleProperty::TirePressureType lrPres(lrPressure);
- VehicleProperty::TirePressureType rrPres(rrPressure);
- VehicleProperty::TireTemperatureType lfTemp(lfTemperature);
- VehicleProperty::TireTemperatureType rfTemp(rfTemperature);
- VehicleProperty::TireTemperatureType lrTemp(lrTemperature);
- VehicleProperty::TireTemperatureType rrTemp(rrTemperature);
-
- routingEngine->updateProperty(VehicleProperty::TirePressureLeftFront, &lfPres, uuid());
- routingEngine->updateProperty(VehicleProperty::TirePressureRightFront, &rfPres, uuid());
- routingEngine->updateProperty(VehicleProperty::TirePressureLeftRear, &lrPres, uuid());
- routingEngine->updateProperty(VehicleProperty::TirePressureRightRear, &rrPres, uuid());
- routingEngine->updateProperty(VehicleProperty::TireTemperatureLeftFront, &lfTemp, uuid());
- routingEngine->updateProperty(VehicleProperty::TireTemperatureRightFront, &rfTemp, uuid());
- routingEngine->updateProperty(VehicleProperty::TireTemperatureLeftRear, &lrTemp, uuid());
- routingEngine->updateProperty(VehicleProperty::TireTemperatureRightRear, &rrTemp, uuid());
+ VehicleProperty::TirePressureLeftFrontType lfPres(lfPressure);
+ VehicleProperty::TirePressureRightFrontType rfPres(rfPressure);
+ VehicleProperty::TirePressureLeftRearType lrPres(lrPressure);
+ VehicleProperty::TirePressureRightRearType rrPres(rrPressure);
+ VehicleProperty::TireTemperatureLeftFrontType lfTemp(lfTemperature);
+ VehicleProperty::TireTemperatureRightFrontType rfTemp(rfTemperature);
+ VehicleProperty::TireTemperatureLeftRearType lrTemp(lrTemperature);
+ VehicleProperty::TireTemperatureRightRearType rrTemp(rrTemperature);
+
+ routingEngine->updateProperty(&lfPres, uuid());
+ routingEngine->updateProperty(&rfPres, uuid());
+ routingEngine->updateProperty(&lrPres, uuid());
+ routingEngine->updateProperty(&rrPres, uuid());
+ routingEngine->updateProperty(&lfTemp, uuid());
+ routingEngine->updateProperty(&rfTemp, uuid());
+ routingEngine->updateProperty(&lrTemp, uuid());
+ routingEngine->updateProperty(&rrTemp, uuid());
return 0;
}
public:
TpmsPlugin(AbstractRoutingEngine* re, map<string, string> config);
- string uuid();
+ const string uuid();
void getPropertyAsync(AsyncPropertyReply *reply);
void getRangePropertyAsync(AsyncRangePropertyReply *reply);
AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
void unsubscribeToPropertyChanges(VehicleProperty::Property property);
PropertyList supported();
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
void supportedChanged(PropertyList) {}
int readValues();
m_re = re;
re->subscribeToProperty(ambdproperty,this);
}
-string WebSocketSink::uuid()
+const string WebSocketSink::uuid()
{
return m_uuid;
}
-void WebSocketSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType *value, string uuid)
+void WebSocketSink::propertyChanged(AbstractPropertyType *value, const string &uuid)
{
- //printf("Got property:%i\n",boost::any_cast<uint16_t>(reply->value));
- //uint16_t velocity = boost::any_cast<uint16_t>(value);
- //m_re->updateProperty(name,VehicleProperty::getPropertyTypeForPropertyNameValue(name,data.front()));
-
+ VehicleProperty::Property property = value->name;
+
stringstream s;
//TODO: Dirty hack hardcoded stuff, jsut to make it work.
public:
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);
+ const string uuid() ;
+ void propertyChanged(AbstractPropertyType *value, const std::string &uuid);
void supportedChanged(PropertyList supportedProperties);
PropertyList subscriptions();
libwebsocket *socket() { return m_wsi; }
return Get | Set | GetRanged;
}
-string WebSocketSource::uuid()
+const string WebSocketSource::uuid()
{
return "d293f670-f0b3-11e1-aff1-0800200c9a66";
}
public:
WebSocketSource(AbstractRoutingEngine* re, std::map<std::string, std::string> config);
- std::string uuid();
+ const std::string uuid();
void getPropertyAsync(AsyncPropertyReply *reply);
void getRangePropertyAsync(AsyncRangePropertyReply *reply);
AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
PropertyList activeRequests;
PropertyList removeRequests;
void setSupported(PropertyList list);
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid) {}
void supportedChanged(PropertyList) {}
void setConfiguration(std::map<std::string, std::string> config);
//map<VehicleProperty::Property,AsyncPropertyReply*> propertyReplyMap;
return new WheelSourcePlugin(routingengine, config);
}
-string WheelSourcePlugin::uuid()
+const string WheelSourcePlugin::uuid()
{
return "c0ffee8a-c605-4a06-9034-59c1deadbeef";
}
WheelSourcePlugin(AbstractRoutingEngine* re, map<string, string> config);
~WheelSourcePlugin();
- string uuid();
+ const string uuid();
void getPropertyAsync(AsyncPropertyReply *reply);
void getRangePropertyAsync(AsyncRangePropertyReply *reply){}
AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
int supportedOperations();
- void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {}
void supportedChanged(PropertyList) {}
map<string, string> getConfiguration() { return configuration; }