From: Kevron Rees Date: Thu, 5 Sep 2013 21:28:05 +0000 (-0700) Subject: make uuid() const. update all plugins X-Git-Tag: accepted/tizen/20131016.224205~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fae2fb4d98a8d50ae4d9ba07a6c0e422efcf1bab;p=profile%2Fivi%2Fautomotive-message-broker.git make uuid() const. update all plugins --- diff --git a/lib/abstractroutingengine.h b/lib/abstractroutingengine.h index f538459..3448fce 100644 --- a/lib/abstractroutingengine.h +++ b/lib/abstractroutingengine.h @@ -195,6 +195,7 @@ public: 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) { diff --git a/lib/abstractsink.h b/lib/abstractsink.h index 77ca6ec..a98f44e 100644 --- a/lib/abstractsink.h +++ b/lib/abstractsink.h @@ -48,17 +48,25 @@ public: /*! 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 &)"<() 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; diff --git a/lib/debugout.h b/lib/debugout.h index 1ec9a13..660fbfb 100644 --- a/lib/debugout.h +++ b/lib/debugout.h @@ -40,12 +40,11 @@ public: 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<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; @@ -394,7 +396,7 @@ void DatabaseSink::propertyChanged(VehicleProperty::Property property, AbstractP } -std::string DatabaseSink::uuid() +const string DatabaseSink::uuid() { return "9f88156e-cb92-4472-8775-9c08addf50d3"; } diff --git a/plugins/database/databasesink.h b/plugins/database/databasesink.h index 57f87d4..7b6dc0f 100644 --- a/plugins/database/databasesink.h +++ b/plugins/database/databasesink.h @@ -150,8 +150,8 @@ public: DatabaseSink(AbstractRoutingEngine* engine, map 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); diff --git a/plugins/dbus/dbusinterfacemanager.h b/plugins/dbus/dbusinterfacemanager.h index 94e6734..d94cab3 100644 --- a/plugins/dbus/dbusinterfacemanager.h +++ b/plugins/dbus/dbusinterfacemanager.h @@ -35,7 +35,7 @@ public: 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); diff --git a/plugins/dbus/dbusplugin.cpp b/plugins/dbus/dbusplugin.cpp index f1a7a1d..c51ca26 100644 --- a/plugins/dbus/dbusplugin.cpp +++ b/plugins/dbus/dbusplugin.cpp @@ -61,8 +61,10 @@ void DBusSink::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; @@ -71,7 +73,7 @@ void DBusSink::propertyChanged(VehicleProperty::Property property, AbstractPrope mTime = value->timestamp; } -std::string DBusSink::uuid() +const string DBusSink::uuid() { return "c2e6cafa-eef5-4b8a-99a0-0f2c9be1057d"; } diff --git a/plugins/dbus/dbusplugin.h b/plugins/dbus/dbusplugin.h index 2afb74b..67bb12a 100644 --- a/plugins/dbus/dbusplugin.h +++ b/plugins/dbus/dbusplugin.h @@ -36,8 +36,8 @@ public: DBusSink(std::string objectName, AbstractRoutingEngine* engine, GDBusConnection* connection, map 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 wantsProperties() { diff --git a/plugins/demosink/demosinkplugin.cpp b/plugins/demosink/demosinkplugin.cpp index d8f4057..b76d98e 100644 --- a/plugins/demosink/demosinkplugin.cpp +++ b/plugins/demosink/demosinkplugin.cpp @@ -71,13 +71,15 @@ extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine, ma 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(); diff --git a/plugins/demosink/demosinkplugin.h b/plugins/demosink/demosinkplugin.h index ffd806c..755b5c5 100644 --- a/plugins/demosink/demosinkplugin.h +++ b/plugins/demosink/demosinkplugin.h @@ -31,9 +31,9 @@ public: DemoSink(AbstractRoutingEngine* re, map 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; diff --git a/plugins/exampleplugin.cpp b/plugins/exampleplugin.cpp index bfdffbe..a0074b7 100644 --- a/plugins/exampleplugin.cpp +++ b/plugins/exampleplugin.cpp @@ -90,7 +90,7 @@ extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map config); - string uuid(); + const string uuid(); void getPropertyAsync(AsyncPropertyReply *reply); void getRangePropertyAsync(AsyncRangePropertyReply *reply); AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request); @@ -40,7 +40,6 @@ public: int supportedOperations(); - void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {} void supportedChanged(PropertyList) {} void randomizeProperties(); diff --git a/plugins/examplesink.cpp b/plugins/examplesink.cpp index 1dbeba1..5c1fb0a 100644 --- a/plugins/examplesink.cpp +++ b/plugins/examplesink.cpp @@ -193,12 +193,13 @@ void ExampleSink::supportedChanged(PropertyList supportedProperties) 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()<toString()< 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 diff --git a/plugins/murphyplugin/murphysource.h b/plugins/murphyplugin/murphysource.h index 463ed93..1095409 100644 --- a/plugins/murphyplugin/murphysource.h +++ b/plugins/murphyplugin/murphysource.h @@ -39,7 +39,7 @@ public: MurphySource(AbstractRoutingEngine* re, map config); ~MurphySource(); - string uuid() { return "murphy"; }; + const string uuid() { return "murphy"; } void getPropertyAsync(AsyncPropertyReply *reply); void getRangePropertyAsync(AsyncRangePropertyReply *reply); AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request); @@ -49,7 +49,6 @@ public: int supportedOperations(); - void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {} void supportedChanged(PropertyList) {} void processValue(string propertyName, AbstractPropertyType *value); diff --git a/plugins/obd2plugin/obd2source.cpp b/plugins/obd2plugin/obd2source.cpp index f7961c4..70a1493 100644 --- a/plugins/obd2plugin/obd2source.cpp +++ b/plugins/obd2plugin/obd2source.cpp @@ -658,7 +658,7 @@ extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map config); ~OBD2Source(); - string uuid(); + const string uuid(); int portHandle; void getPropertyAsync(AsyncPropertyReply *reply); void getRangePropertyAsync(AsyncRangePropertyReply *reply){} @@ -153,7 +153,7 @@ public: 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; diff --git a/plugins/opencvlux/opencvluxplugin.cpp b/plugins/opencvlux/opencvluxplugin.cpp index 9ab7434..142ced4 100644 --- a/plugins/opencvlux/opencvluxplugin.cpp +++ b/plugins/opencvlux/opencvluxplugin.cpp @@ -113,7 +113,7 @@ extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map config); - string uuid(); + const string uuid(); void getPropertyAsync(AsyncPropertyReply *reply); void getRangePropertyAsync(AsyncRangePropertyReply *reply); AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request); @@ -58,7 +58,6 @@ public: int supportedOperations(); - void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {} void supportedChanged(PropertyList) {} void updateProperty(uint lux); diff --git a/plugins/testplugin/testplugin.cpp b/plugins/testplugin/testplugin.cpp index d120ffe..d3298d5 100644 --- a/plugins/testplugin/testplugin.cpp +++ b/plugins/testplugin/testplugin.cpp @@ -102,7 +102,7 @@ extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map config); ~TestPlugin(); - string uuid(); + const string uuid(); int portHandle; void getPropertyAsync(AsyncPropertyReply *reply); void getRangePropertyAsync(AsyncRangePropertyReply *reply){} @@ -53,7 +53,6 @@ public: int supportedOperations(); void setSupported(PropertyList list); - void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {} void supportedChanged(PropertyList) {} void setConfiguration(map config); //void randomizeProperties(); diff --git a/plugins/tpms/tpmsplugin.cpp b/plugins/tpms/tpmsplugin.cpp index c3f912d..2dea1fd 100644 --- a/plugins/tpms/tpmsplugin.cpp +++ b/plugins/tpms/tpmsplugin.cpp @@ -102,9 +102,9 @@ extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, mapproperty << 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); } @@ -290,23 +300,23 @@ int TpmsPlugin::readValues() } } - 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; } diff --git a/plugins/tpms/tpmsplugin.h b/plugins/tpms/tpmsplugin.h index f0f2668..7ed87af 100644 --- a/plugins/tpms/tpmsplugin.h +++ b/plugins/tpms/tpmsplugin.h @@ -30,7 +30,7 @@ class TpmsPlugin: public AbstractSource public: TpmsPlugin(AbstractRoutingEngine* re, map config); - string uuid(); + const string uuid(); void getPropertyAsync(AsyncPropertyReply *reply); void getRangePropertyAsync(AsyncRangePropertyReply *reply); AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request); @@ -38,7 +38,6 @@ public: void unsubscribeToPropertyChanges(VehicleProperty::Property property); PropertyList supported(); - void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {} void supportedChanged(PropertyList) {} int readValues(); diff --git a/plugins/websocketsink/websocketsink.cpp b/plugins/websocketsink/websocketsink.cpp index 7e74815..5b09ef6 100644 --- a/plugins/websocketsink/websocketsink.cpp +++ b/plugins/websocketsink/websocketsink.cpp @@ -41,16 +41,14 @@ WebSocketSink::WebSocketSink(AbstractRoutingEngine* re,libwebsocket *wsi,string 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(reply->value)); - //uint16_t velocity = boost::any_cast(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. diff --git a/plugins/websocketsink/websocketsink.h b/plugins/websocketsink/websocketsink.h index c65ebff..9c7a288 100644 --- a/plugins/websocketsink/websocketsink.h +++ b/plugins/websocketsink/websocketsink.h @@ -29,8 +29,8 @@ class WebSocketSink : public AbstractSink 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; } diff --git a/plugins/websocketsourceplugin/websocketsource.cpp b/plugins/websocketsourceplugin/websocketsource.cpp index 56fb22d..76a9475 100644 --- a/plugins/websocketsourceplugin/websocketsource.cpp +++ b/plugins/websocketsourceplugin/websocketsource.cpp @@ -518,7 +518,7 @@ int WebSocketSource::supportedOperations() return Get | Set | GetRanged; } -string WebSocketSource::uuid() +const string WebSocketSource::uuid() { return "d293f670-f0b3-11e1-aff1-0800200c9a66"; } diff --git a/plugins/websocketsourceplugin/websocketsource.h b/plugins/websocketsourceplugin/websocketsource.h index 6b9103f..c44c725 100644 --- a/plugins/websocketsourceplugin/websocketsource.h +++ b/plugins/websocketsourceplugin/websocketsource.h @@ -33,7 +33,7 @@ class WebSocketSource : public AbstractSource public: WebSocketSource(AbstractRoutingEngine* re, std::map config); - std::string uuid(); + const std::string uuid(); void getPropertyAsync(AsyncPropertyReply *reply); void getRangePropertyAsync(AsyncRangePropertyReply *reply); AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request); @@ -51,7 +51,6 @@ public: 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 config); //map propertyReplyMap; diff --git a/plugins/wheel/wheelplugin.cpp b/plugins/wheel/wheelplugin.cpp index 78d4ec6..7a541e6 100644 --- a/plugins/wheel/wheelplugin.cpp +++ b/plugins/wheel/wheelplugin.cpp @@ -124,7 +124,7 @@ extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map config); ~WheelSourcePlugin(); - string uuid(); + const string uuid(); void getPropertyAsync(AsyncPropertyReply *reply); void getRangePropertyAsync(AsyncRangePropertyReply *reply){} AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request); @@ -43,7 +43,6 @@ public: int supportedOperations(); - void propertyChanged(VehicleProperty::Property property, AbstractPropertyType* value, string uuid) {} void supportedChanged(PropertyList) {} map getConfiguration() { return configuration; }