diff options
author | Kevron Rees <tripzero.kev@gmail.com> | 2014-12-29 21:09:29 -0800 |
---|---|---|
committer | Kevron Rees <tripzero.kev@gmail.com> | 2014-12-29 21:10:14 -0800 |
commit | c29570fe11555e886f92215b4338de8fca527faa (patch) | |
tree | b8205291d82bde1ef5e57b7478a9cfbe46f230d4 | |
parent | ebd2286536ed11b3ae903e9123f3a6ebc9dc73db (diff) | |
download | automotive-message-broker-c29570fe11555e886f92215b4338de8fca527faa.tar.gz |
reverted varianttype
45 files changed, 571 insertions, 672 deletions
diff --git a/ambd/core.cpp b/ambd/core.cpp index 979cf778..02e4a08e 100644 --- a/ambd/core.cpp +++ b/ambd/core.cpp @@ -197,7 +197,6 @@ void Core::updateProperty(AbstractPropertyType * value) performance.propertiesPerSecond++; - //auto sinks = propertySinkMap[property]; !!! this will insert empty std::set<AbstractSink*> into propertySinkMap !!! auto filteredSourceSinkMapIt = propertySinkMap.find(property); auto cbMapItr = propertyCbMap.find(property); diff --git a/ambd/main.cpp b/ambd/main.cpp index 58a8abde..11601df2 100644 --- a/ambd/main.cpp +++ b/ambd/main.cpp @@ -166,11 +166,6 @@ int main(int argc, char **argv) PluginLoader loader(config, argc, argv); - if(!loader.sources().size()) - { - throw std::runtime_error("No sources present. aborting"); - } - mainloop = loader.mainloop(); /* Register signal handler */ diff --git a/ambd/pluginloader.cpp b/ambd/pluginloader.cpp index f821907b..e38547e1 100644 --- a/ambd/pluginloader.cpp +++ b/ambd/pluginloader.cpp @@ -24,10 +24,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include <iostream> #include <stdexcept> #include <boost/concept_check.hpp> -//#include <json-glib/json-glib.h> - - -using namespace std; std::string get_file_contents(const char *filename) { @@ -43,6 +39,7 @@ std::string get_file_contents(const char *filename) } return output; } + PluginLoader::PluginLoader(string configFile, int argc, char** argv): f_create(NULL), routingEngine(nullptr), mMainLoop(nullptr) { DebugOut()<<"Loading config file: "<<configFile<<endl; @@ -179,12 +176,8 @@ PluginLoader::PluginLoader(string configFile, int argc, char** argv): f_create(N string path = configurationMap["path"]; - AbstractSource* plugin = loadPlugin<AbstractSource*>(path,configurationMap); - - if(plugin != nullptr) - { - mSources.push_back(plugin); - } + if(!loadPlugin(path,configurationMap)) + DebugOut(DebugOut::Warning) << "Failed to load plugin: " << path <<endl; } //json_object_put(sourcesobject); @@ -224,23 +217,7 @@ PluginLoader::PluginLoader(string configFile, int argc, char** argv): f_create(N string path = configurationMap["path"]; - AbstractSinkManager* plugin = loadPlugin<AbstractSinkManager*>(path, configurationMap); - - if(plugin == nullptr) - { - DebugOut()<<"plugin is not a SinkManager"<<endl; - - AbstractSink* sink = loadPlugin<AbstractSink*>(path, configurationMap); - - if(!sink) - { - DebugOut(DebugOut::Warning)<<"plugin seems to be invalid: "<<path<<endl; - } - } - else - { - mSinkManagers.push_back(plugin); - } + loadPlugin(path, configurationMap); } //json_object_put(sinksobject); @@ -256,11 +233,6 @@ PluginLoader::PluginLoader(string configFile, int argc, char** argv): f_create(N PluginLoader::~PluginLoader() { - for(auto i :mSinkManagers) - { - delete i; - } - for(auto handle : openHandles) dlclose(handle); } @@ -270,11 +242,6 @@ IMainLoop *PluginLoader::mainloop() return mMainLoop; } -SourceList PluginLoader::sources() -{ - return mSources; -} - std::string PluginLoader::errorString() { return mErrorString; diff --git a/ambd/pluginloader.h b/ambd/pluginloader.h index cdc6e8f7..fb2494da 100644 --- a/ambd/pluginloader.h +++ b/ambd/pluginloader.h @@ -33,7 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA using namespace std; -typedef void* create_t(AbstractRoutingEngine*, map<string, string> ); +typedef void create_t(AbstractRoutingEngine*, map<string, string> ); typedef void* create_mainloop_t(int argc, char** argv); typedef void* createRoutingEngine(void); @@ -44,8 +44,6 @@ public: PluginLoader(string configFile, int argc, char** argv); ~PluginLoader(); - SourceList sources(); - IMainLoop* mainloop(); std::string errorString(); @@ -53,8 +51,7 @@ public: private: ///methods: - template<class T> - T loadPlugin(string pluginName, map<string, string> config) + bool loadPlugin(string pluginName, map<string, string> config) { DebugOut()<<"Loading plugin: "<<pluginName<<endl; @@ -64,7 +61,7 @@ private: ///methods: { mErrorString = dlerror(); DebugOut(DebugOut::Error)<<"error opening plugin: "<<pluginName<<" in "<<__FILE__<<" - "<<__FUNCTION__<<":"<<__LINE__<<" "<<mErrorString<<endl; - return nullptr; + return false; } openHandles.push_back(handle); @@ -73,11 +70,11 @@ private: ///methods: if(f_create) { - void* obj = f_create(routingEngine, config); - return static_cast<T>(obj); + f_create(routingEngine, config); + return true; } - return nullptr; + return false; } IMainLoop* loadMainLoop(string pluginName, int argc, char** argv) @@ -138,14 +135,10 @@ private: AbstractRoutingEngine* routingEngine; - SourceList mSources; - list<AbstractSinkManager*> mSinkManagers; - create_t * f_create; create_mainloop_t * m_create; createRoutingEngine * r_create; - IMainLoop* mMainLoop; std::vector<void*> openHandles; diff --git a/lib/abstractsink.cpp b/lib/abstractsink.cpp index 70587a0e..e87c2f92 100644 --- a/lib/abstractsink.cpp +++ b/lib/abstractsink.cpp @@ -33,11 +33,5 @@ AbstractSink::~AbstractSink() routingEngine->unregisterSink(this); } -AbstractSinkManager::AbstractSinkManager(AbstractRoutingEngine* engine, map<string, string> config) -:routingEngine(engine) -{ - configuration = config; -} - diff --git a/lib/abstractsink.h b/lib/abstractsink.h index 1b4ed9db..a24b3570 100644 --- a/lib/abstractsink.h +++ b/lib/abstractsink.h @@ -72,18 +72,4 @@ protected: map<string, string> configuration; }; - -/// TODO: deprecate in 0.14. -class AbstractSinkManager -{ -public: - - AbstractSinkManager(AbstractRoutingEngine* engine, map<string, string> config); - virtual ~AbstractSinkManager(){} - -protected: - AbstractRoutingEngine* routingEngine; - map<string, string> configuration; -}; - #endif // ABSTRACTSINK_H diff --git a/plugins/bluemonkey/bluemonkey.cpp b/plugins/bluemonkey/bluemonkey.cpp index 48cf662d..fed743fc 100644 --- a/plugins/bluemonkey/bluemonkey.cpp +++ b/plugins/bluemonkey/bluemonkey.cpp @@ -36,12 +36,10 @@ typedef std::map<std::string, QObject*> create_bluemonkey_module_t(std::map<std::string, std::string> config, QObject* parent); -extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) { auto plugin = new AmbPlugin<BluemonkeySink>(routingengine, config); plugin->init(); - - return plugin; } QVariant gvariantToQVariant(GVariant *value) diff --git a/plugins/bluetooth/bluetoothplugin.cpp b/plugins/bluetooth/bluetoothplugin.cpp index e5ffa328..ddfdcaa0 100644 --- a/plugins/bluetooth/bluetoothplugin.cpp +++ b/plugins/bluetooth/bluetoothplugin.cpp @@ -64,10 +64,9 @@ BluetoothSinkPlugin::BluetoothSinkPlugin(AbstractRoutingEngine* re, map<string, } -extern "C" AbstractSink * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) { - return new BluetoothSinkPlugin(routingengine, config); - + new BluetoothSinkPlugin(routingengine, config); } const string BluetoothSinkPlugin::uuid() diff --git a/plugins/cangenplugin/cangenplugin.cpp b/plugins/cangenplugin/cangenplugin.cpp index c5ccdd6d..73d32538 100644 --- a/plugins/cangenplugin/cangenplugin.cpp +++ b/plugins/cangenplugin/cangenplugin.cpp @@ -33,18 +33,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //---------------------------------------------------------------------------- // library exported function for plugin loader -extern "C" AbstractSource* create(AbstractRoutingEngine* routingengine, std::map<std::string, std::string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, std::map<std::string, std::string> config) { #ifndef UNIT_TESTS DEBUG_CONF("cangenplugin", - CUtil::Logger::file_off|CUtil::Logger::screen_on, + CUtil::Logger::file_off | CUtil::Logger::screen_on, CUtil::Logger::EInfo, CUtil::Logger::EInfo ); #endif - std::unique_ptr< AmbPlugin<CANGenPlugin> > plugin(new AmbPlugin<CANGenPlugin>(routingengine, config)); + AmbPlugin<CANGenPlugin> * plugin = new AmbPlugin<CANGenPlugin>(routingengine, config); plugin->init(); - return plugin.release(); } //---------------------------------------------------------------------------- diff --git a/plugins/cansimplugin/cansimplugin.cpp b/plugins/cansimplugin/cansimplugin.cpp index 319104a6..44bfa3dc 100644 --- a/plugins/cansimplugin/cansimplugin.cpp +++ b/plugins/cansimplugin/cansimplugin.cpp @@ -35,7 +35,7 @@ static const char* DEFAULT_CAN_IF_NAME = "vcan0"; //---------------------------------------------------------------------------- // library exported function for plugin loader -extern "C" AbstractSource* create(AbstractRoutingEngine* routingengine, std::map<std::string, std::string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, std::map<std::string, std::string> config) { #ifndef UNIT_TESTS DEBUG_CONF("cansimplugin", @@ -43,9 +43,8 @@ extern "C" AbstractSource* create(AbstractRoutingEngine* routingengine, std::map CUtil::Logger::EInfo, CUtil::Logger::EInfo ); #endif - std::unique_ptr< AmbPlugin<CANSimPlugin> > plugin(new AmbPlugin<CANSimPlugin>(routingengine, config)); + AmbPlugin<CANSimPlugin> * plugin = new AmbPlugin<CANSimPlugin>(routingengine, config); plugin->init(); - return plugin.release(); } //---------------------------------------------------------------------------- diff --git a/plugins/common/CMakeLists.txt b/plugins/common/CMakeLists.txt index 24de68dd..aa3faa2c 100644 --- a/plugins/common/CMakeLists.txt +++ b/plugins/common/CMakeLists.txt @@ -1,7 +1,9 @@ -set(plugins_common_sources abstractio.hpp serialport.hpp bluetoothadapterproxy.c bluetooth.hpp bluetoothmanagerproxy.c bluetoothserialproxy.c bluetooth5.cpp canadapter.cpp cansocket.cpp cansocketreader.cpp - canbusimpl.cpp cansocketadapter.cpp logger.cpp mutex.cpp thread.cpp dbusexport.hpp) -set(plugins_common_headers_install abstractio.hpp serialport.hpp bluetooth.hpp bluetoothadapterproxy.h bluetoothmanagerproxy.h bluetoothserialproxy.h bluetooth5.h canbus.h canadapter.h cansocket.h cansocketreader.h - canbusimpl.h cansocketadapter.h canobserver.h logger.h mutex.h thread.h dbusexport.hpp) +set(plugins_common_sources abstractio.hpp serialport.hpp bluetoothadapterproxy.c bluetooth.hpp bluetoothmanagerproxy.c bluetoothserialproxy.c bluetooth5.cpp + canadapter.cpp cansocket.cpp cansocketreader.cpp canbusimpl.cpp cansocketadapter.cpp logger.cpp mutex.cpp thread.cpp dbusexport.hpp dbusplugin.cpp + abstractdbusinterface.cpp dbussignaller.cpp varianttype.cpp) +set(plugins_common_headers_install abstractio.hpp serialport.hpp bluetooth.hpp bluetoothadapterproxy.h bluetoothmanagerproxy.h bluetoothserialproxy.h + bluetooth5.h canbus.h canadapter.h cansocket.h cansocketreader.h canbusimpl.h cansocketadapter.h canobserver.h logger.h mutex.h thread.h + dbusexport.hpp dbusplugin.h abstractdbusinterface.h dbussignaller.h varianttype.h) add_library(amb-plugins-common SHARED ${plugins_common_sources}) diff --git a/plugins/dbus/abstractdbusinterface.cpp b/plugins/common/abstractdbusinterface.cpp index 4de26fdf..64337d57 100644 --- a/plugins/dbus/abstractdbusinterface.cpp +++ b/plugins/common/abstractdbusinterface.cpp @@ -26,7 +26,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include <listplusplus.h> #include "varianttype.h" - #include "dbussignaller.h" static DBusSignaller* signaller = nullptr; @@ -101,7 +100,7 @@ static void handleMyMethodCall(GDBusConnection *connection, for(auto itr = propertyMap.begin(); itr != propertyMap.end(); itr++) { - AbstractProperty* prop = (*itr).second; + VariantType* prop = (*itr).second; if(!contains(propertyList, prop->ambPropertyName())) propertyList.push_back(prop->ambPropertyName()); @@ -165,14 +164,14 @@ static void handleMyMethodCall(GDBusConnection *connection, return; } - AbstractProperty* property = propertyMap[propertyName]; + VariantType * property = propertyMap[propertyName]; GError *error = NULL; GVariant **params = g_new(GVariant*,4); GVariant *val = g_variant_ref(property->value()->toVariant()); params[0] = g_variant_new("v", val); - params[1] = g_variant_new("d",property->timestamp); + params[1] = g_variant_new("d",property->timestamp()); params[2] = g_variant_new("i",property->value()->sequence); params[3] = g_variant_new("i",property->updateFrequency()); @@ -223,22 +222,22 @@ AbstractDBusInterface::~AbstractDBusInterface() } -void AbstractDBusInterface::addProperty(AbstractProperty* property) +void AbstractDBusInterface::addProperty(VariantType * property) { - string nameToLower = property->name; + string nameToLower = property->name(); boost::algorithm::to_lower<string>(nameToLower); string access; - if(property->access() == AbstractProperty::Read) + if(property->access() == VariantType::Read) access = "read"; - else if(property->access() == AbstractProperty::Write) + else if(property->access() == VariantType::Write) access = "write"; - else if(property->access() == AbstractProperty::ReadWrite) + else if(property->access() == VariantType::ReadWrite) access = "readwrite"; else throw -1; //FIXME: don't throw - std::string pn = property->name; + std::string pn = property->name(); ///see which properties are supported: introspectionXml += @@ -253,9 +252,9 @@ void AbstractDBusInterface::addProperty(AbstractProperty* property) " <arg type='v' name='" + nameToLower + "' direction='out' />" " <arg type='d' name='imestamp' direction='out' />" "</signal>" - "<property type='i' name='" + property->name + "Sequence' access='read' />"; + "<property type='i' name='" + pn + "Sequence' access='read' />"; - properties[property->name] = property; + properties[pn] = property; if(!contains(mimplementedProperties, property->ambPropertyName())) { @@ -334,7 +333,7 @@ void AbstractDBusInterface::unregisterObject() regId=0; } -void AbstractDBusInterface::updateValue(AbstractProperty *property) +void AbstractDBusInterface::updateValue(VariantType *property) { if(mConnection == nullptr) { @@ -440,7 +439,7 @@ GVariant* AbstractDBusInterface::getProperty(GDBusConnection* connection, const std::string p = pn.substr(0,pos); - AbstractProperty* theProperty = t->property(p); + VariantType * theProperty = t->property(p); if(!theProperty) { @@ -448,7 +447,7 @@ GVariant* AbstractDBusInterface::getProperty(GDBusConnection* connection, const return nullptr; } - int sequence = theProperty->sequence; + int sequence = theProperty->sequence(); GVariant* value = g_variant_new("i", sequence); return value; diff --git a/plugins/dbus/abstractdbusinterface.h b/plugins/common/abstractdbusinterface.h index 033bb4db..db4ac5d1 100644 --- a/plugins/dbus/abstractdbusinterface.h +++ b/plugins/common/abstractdbusinterface.h @@ -29,7 +29,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include "abstractpropertytype.h" #include <abstractroutingengine.h> #include "varianttype.h" -#include "dbussignaller.h" const uint getPid(const char *owner); @@ -51,8 +50,8 @@ public: void registerObject(); void unregisterObject(); - void addProperty(AbstractProperty* property); - virtual void updateValue(AbstractProperty* property); + void addProperty(VariantType* property); + virtual void updateValue(VariantType* property); static PropertyList implementedProperties() { return mimplementedProperties; } @@ -76,7 +75,7 @@ public: for(auto i : propertyDBusMap) { - if(i->dbusName() == attributeName) + if(i->name() == attributeName) { return true; } @@ -91,7 +90,7 @@ public: double time() { return mTime; } - AbstractProperty* property(std::string propertyName) + VariantType* property(std::string propertyName) { if(properties.find(propertyName) != properties.end()) return properties[propertyName]; @@ -115,7 +114,7 @@ public: std::string source() { return mSourceFilter; } - std::unordered_map<std::string, AbstractProperty*> getProperties() { return properties; } + std::unordered_map<std::string, VariantType*> getProperties() { return properties; } bool isRegistered() { return regId > 0; } @@ -135,7 +134,7 @@ protected: void setTimeout(int timeout); - std::unordered_map<std::string, AbstractProperty*> properties; + std::unordered_map<std::string, VariantType*> properties; Zone::Type zoneFilter; diff --git a/plugins/common/dbusexport.hpp b/plugins/common/dbusexport.hpp new file mode 100644 index 00000000..5a5697f7 --- /dev/null +++ b/plugins/common/dbusexport.hpp @@ -0,0 +1,96 @@ +#include <string> +#include <unordered_map> +#include <unordered_set> +#include <listplusplus.h> +#include <abstractsink.h> +#include <abstractroutingengine.h> + +namespace amb +{ + +std::unordered_map<std::string, std::unordered_set<Zone::Type>> getUniqueSourcesList(AbstractRoutingEngine *re, PropertyList implementedProperties) +{ + std::unordered_map<std::string, std::unordered_set<Zone::Type>> uniqueSourcesList; + + for(auto property : implementedProperties) + { + std::vector<std::string> sources = re->sourcesForProperty(property); + + for(auto source : sources) + { + PropertyInfo info = re->getPropertyInfo(property, source); + + std::unordered_set<Zone::Type> uniqueZoneList; + + if(uniqueSourcesList.count(source)) + { + uniqueZoneList = uniqueSourcesList[source]; + } + + Zone::ZoneList zoneList = info.zones(); + + if(!zoneList.size()) + { + uniqueZoneList.emplace(Zone::None); + } + + for(auto zoneItr : zoneList) + { + uniqueZoneList.emplace(zoneItr); + } + + uniqueSourcesList[source] = uniqueZoneList; + } + } + + return uniqueSourcesList; +} + +template <typename T> +void exportProperty(VehicleProperty::Property prop, AbstractRoutingEngine *re, GDBusConnection *connection) +{ + T* t = new T(prop, re, connection); + + prop = t->objectName(); + + /// check if we need more than one instance: + + PropertyList implementedProperties = t->wantsProperties(); + + std::unordered_map<std::string, std::unordered_set<Zone::Type> > uniqueSourcesList = getUniqueSourcesList(re, implementedProperties); + + delete t; + + PropertyList supported = re->supported(); + + for(auto itr : uniqueSourcesList) + { + std::unordered_set<Zone::Type> zones = itr.second; + + std::string source = itr.first; + + std::string objectPath = "/" + source; + + boost::algorithm::erase_all(objectPath, "-"); + + for(auto zone : zones) + { + T* t = new T(prop, re, connection); + std::stringstream fullobjectPath; + fullobjectPath<< objectPath << "/" << zone << "/" <<t->objectName(); + t->setObjectPath(fullobjectPath.str()); + t->setSourceFilter(source); + t->setZoneFilter(zone); + t->supportedChanged(supported); + } + + } +} + +template <typename T> +void exportProperty(AbstractRoutingEngine *re, GDBusConnection *connection) +{ + exportProperty<T>("", re, connection); +} + +} diff --git a/plugins/dbus/dbusplugin.cpp b/plugins/common/dbusplugin.cpp index ed950268..46067b68 100644 --- a/plugins/dbus/dbusplugin.cpp +++ b/plugins/common/dbusplugin.cpp @@ -20,15 +20,9 @@ #include "dbusplugin.h" #include "abstractroutingengine.h" -#include "dbusinterfacemanager.h" #include "debugout.h" #include "listplusplus.h" -extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine, map<string, string> config) -{ - return new DBusSinkManager(routingengine, config); -} - DBusSink::DBusSink(string propertyName, AbstractRoutingEngine* engine, GDBusConnection* connection, map<string, string> config = map<string, string>()) :AbstractDBusInterface("org.automotive."+propertyName, propertyName, connection), AbstractSink(engine, config) @@ -86,7 +80,7 @@ void DBusSink::propertyChanged(AbstractPropertyType *value) { if(i->ambPropertyName() == property) { - AbstractProperty* prop = i; + VariantType* prop = i; mTime = value->timestamp; prop->updateValue(value); updateValue(prop); @@ -98,18 +92,3 @@ const string DBusSink::uuid() { return "c2e6cafa-eef5-4b8a-99a0-0f2c9be1057d"; } - -DBusSinkManager::DBusSinkManager(AbstractRoutingEngine *engine, map<string, string> config) : - AbstractSinkManager(engine, config), - manager(nullptr) -{ - manager = new DBusInterfaceManager(engine, config); -} - -DBusSinkManager::~DBusSinkManager() -{ - if(manager){ - // delete manager; <-- currently AbstractSink* instances are deleted in Core::~Core() - manager = nullptr; - } -} diff --git a/plugins/dbus/dbusplugin.h b/plugins/common/dbusplugin.h index 5d3663a8..8d0e3654 100644 --- a/plugins/dbus/dbusplugin.h +++ b/plugins/common/dbusplugin.h @@ -63,20 +63,11 @@ public: protected: - void wantPropertyVariant(VehicleProperty::Property ambProperty, std::string propertyName, AbstractProperty::Access access) + void wantPropertyVariant(VehicleProperty::Property ambProperty, std::string propertyName, VariantType::Access access) { propertyDBusMap.push_back(new VariantType(routingEngine, ambProperty, propertyName, access)); } }; -class DBusInterfaceManager; -class DBusSinkManager: public AbstractSinkManager -{ - DBusInterfaceManager* manager; -public: - DBusSinkManager(AbstractRoutingEngine* engine, map<string, string> config); - ~DBusSinkManager(); -}; - #endif diff --git a/plugins/dbus/dbussignaller.cpp b/plugins/common/dbussignaller.cpp index b016bd94..b016bd94 100644 --- a/plugins/dbus/dbussignaller.cpp +++ b/plugins/common/dbussignaller.cpp diff --git a/plugins/dbus/dbussignaller.h b/plugins/common/dbussignaller.h index 6cfb2260..fb82383d 100644 --- a/plugins/dbus/dbussignaller.h +++ b/plugins/common/dbussignaller.h @@ -41,7 +41,7 @@ public: std::string objectPath; std::string interface; std::string signalName; - AbstractProperty* property; + VariantType* property; }; class DBusSignaller @@ -56,7 +56,7 @@ public: } void fireSignal(GDBusConnection* conn, const std::string & objPath, const std::string & iface, - const std::string & sigName, AbstractProperty* prop) + const std::string & sigName, VariantType* prop) { DBusSignal * signal = new DBusSignal(conn, objPath, iface, sigName, prop); @@ -109,14 +109,14 @@ private: interfaceName = signal->interface; signalName = signal->signalName; - AbstractProperty* property = signal->property; + VariantType* property = signal->property; - auto val = amb::make_super(property->toVariant()); - std::string sequenceName = property->name + "Sequence"; + auto val = g_variant_ref(property->toVariant()); + std::string sequenceName = property->name() + "Sequence"; - variantMap[property->name] = val.get(); - variantMap[sequenceName] = g_variant_new("i", property->sequence); - variantMap["Time"] = g_variant_new("d", property->timestamp); + variantMap[property->name()] = val; + variantMap[sequenceName] = g_variant_new("i", property->sequence()); + variantMap["Time"] = g_variant_new("d", property->timestamp()); variantMap["Zone"] = g_variant_new("i", property->zoneFilter()); } diff --git a/plugins/dbus/varianttype.cpp b/plugins/common/varianttype.cpp index 7b121de9..46e5ec80 100644 --- a/plugins/dbus/varianttype.cpp +++ b/plugins/common/varianttype.cpp @@ -1,25 +1,42 @@ +/* +Copyright (C) 2012 Intel Corporation + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + #include "varianttype.h" -#include "abstractroutingengine.h" #include "abstractdbusinterface.h" -#include "debugout.h" -#include "listplusplus.h" +#include <listplusplus.h> VariantType::VariantType(AbstractRoutingEngine* re, VehicleProperty::Property ambPropertyName, std::string propertyName, Access access) - :AbstractPropertyType(ambPropertyName), mInitialized(false), mAccess(access), mPropertyName(propertyName), - routingEngine(re) + :mPropertyName(propertyName), mAccess(access), mValue(nullptr), mZoneFilter(Zone::None), mUpdateFrequency(0), mInitialized(false) { - name = ambPropertyName; + mAmbPropertyName = ambPropertyName; + routingEngine = re; //set default value: - setValue(VehicleProperty::getPropertyTypeForPropertyNameValue(name)); + setValue(VehicleProperty::getPropertyTypeForPropertyNameValue(mAmbPropertyName)); } void VariantType::initialize() { if(mInitialized) return; AsyncPropertyRequest request; - request.property = name; - request.sourceUuidFilter = sourceUuid; - request.zoneFilter = zone; + request.property = mAmbPropertyName; + request.sourceUuidFilter = mSourceFilter; + request.zoneFilter = mZoneFilter; using namespace std::placeholders; request.completed = [this](AsyncPropertyReply* r) @@ -36,15 +53,23 @@ void VariantType::initialize() /// do not request if not supported: PropertyList proplist = routingEngine->supported(); - if(contains(proplist, name)) + if(contains(proplist, mAmbPropertyName)) routingEngine->getPropertyAsync(request); } +VariantType::~VariantType() +{ + if(mValue){ + delete mValue; + mValue = nullptr; + } +} + GVariant *VariantType::toVariant() { if(!value()) { - setValue(VehicleProperty::getPropertyTypeForPropertyNameValue(name)); + setValue(VehicleProperty::getPropertyTypeForPropertyNameValue(name())); } auto v = value(); @@ -54,13 +79,13 @@ GVariant *VariantType::toVariant() void VariantType::fromVariant(GVariant *val) { - AbstractPropertyType *v = VehicleProperty::getPropertyTypeForPropertyNameValue(name); + AbstractPropertyType *v = VehicleProperty::getPropertyTypeForPropertyNameValue(name()); v->fromVariant(val); AsyncSetPropertyRequest request; - request.property = name; + request.property = name(); request.value = v; - request.zoneFilter = zone; + request.zoneFilter = zoneFilter(); request.completed = [&](AsyncPropertyReply* r) { auto reply = amb::make_unique(r); @@ -73,4 +98,3 @@ void VariantType::fromVariant(GVariant *val) routingEngine->setProperty(request); } - diff --git a/plugins/common/varianttype.h b/plugins/common/varianttype.h new file mode 100644 index 00000000..1c83d9cc --- /dev/null +++ b/plugins/common/varianttype.h @@ -0,0 +1,178 @@ +/* +Copyright (C) 2012 Intel Corporation + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU Lesser General Public +License as published by the Free Software Foundation; either +version 2.1 of the License, or (at your option) any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef VARIANTTYPE_H_ +#define VARIANTTYPE_H_ + +#include <string> +#include <functional> +#include <boost/any.hpp> +#include <glib.h> + +#include "debugout.h" +#include "abstractpropertytype.h" +#include "abstractroutingengine.h" +#include "vehicleproperty.h" + +class AbstractDBusInterface; + +using namespace std; + +typedef function<void (boost::any)> SetterFunc; + +class VariantType +{ + +public: + + enum Access { + Read, + Write, + ReadWrite + }; + + VariantType(AbstractRoutingEngine* re, VehicleProperty::Property ambPropertyName, std::string propertyName, Access access); + virtual ~VariantType(); + + bool operator == (VariantType & other) + { + return (other.name() == name() + && other.ambPropertyName() == ambPropertyName() + && other.sourceFilter() == sourceFilter() + && other.zoneFilter() == zoneFilter()); + } + + virtual void setSetterFunction(SetterFunc setterFunc) + { + mSetterFunc = setterFunc; + } + + virtual const string signature() + { + GVariant* var = toVariant(); + if(!var) return ""; + + const string s = g_variant_get_type_string(var); + g_variant_unref(var); + return s; + } + + virtual string name() + { + return mPropertyName; + } + + virtual VehicleProperty::Property ambPropertyName() + { + return mAmbPropertyName; + } + + virtual Access access() + { + return mAccess; + } + + void setSourceFilter(std::string filter) { mSourceFilter = filter; } + void setZoneFilter(Zone::Type zone) + { + if(mValue) + mValue->zone = zone; + + mZoneFilter = zone; + } + + std::string sourceFilter() { return mSourceFilter; } + Zone::Type zoneFilter() { return mZoneFilter; } + + virtual GVariant* toVariant(); + virtual void fromVariant(GVariant *value); + + double timestamp() + { + if(mValue) + return mValue->timestamp; + return 0; + } + + int sequence() + { + if(mValue) + return mValue->sequence; + return 0; + } + + virtual void setValue(AbstractPropertyType* val) + { + if(!val) + return; + + if(!mValue) + { + mValue = val->copy(); + } + else + { + mValue->quickCopy(val); + } + + if(mUpdateFrequency == 0) + { + PropertyInfo info = routingEngine->getPropertyInfo(mValue->name, mValue->sourceUuid); + + if(info.isValid()) + mUpdateFrequency = info.updateFrequency(); + else + mUpdateFrequency = -1; + } + } + + virtual void updateValue(AbstractPropertyType* val) + { + setValue(val); + } + + int updateFrequency() + { + return mUpdateFrequency; + } + + AbstractPropertyType* value() + { + return mValue; + } + + void initialize(); + +protected: + + std::string mSourceFilter; + Zone::Type mZoneFilter; + int mUpdateFrequency; + AbstractRoutingEngine* routingEngine; + string mPropertyName; + VehicleProperty::Property mAmbPropertyName; + SetterFunc mSetterFunc; + Access mAccess; + AbstractPropertyType* mValue; + AbstractDBusInterface* mInterface; + +private: + bool mInitialized; +}; + +#endif // ABSTRACTPROPERTY_H diff --git a/plugins/database/databasesink.cpp b/plugins/database/databasesink.cpp index 9bfe5b25..8b3b0c6d 100644 --- a/plugins/database/databasesink.cpp +++ b/plugins/database/databasesink.cpp @@ -10,12 +10,10 @@ int bufferLength = 100; int timeout=1000; -extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) { auto plugin = new AmbPlugin<DatabaseSink>(routingengine, config); plugin->init(); - - return plugin; } static void * cbFunc(Shared* shared) diff --git a/plugins/dbus/CMakeLists.txt b/plugins/dbus/CMakeLists.txt index 9d9c6c80..67d6ba65 100644 --- a/plugins/dbus/CMakeLists.txt +++ b/plugins/dbus/CMakeLists.txt @@ -3,10 +3,10 @@ include_directories(${CMAKE_SOURCE_DIR}/lib ${include_dirs} ${CMAKE_SOURCE_DIR}/ pkg_check_modules(gio REQUIRED gio-2.0) -set(dbussinkplugin_headers dbussignaller.h automotivemanager.h dbusplugin.h abstractdbusinterface.h dbusinterfacemanager.h runningstatus.h varianttype.h -custompropertyinterface.h uncategorizedproperty.h environmentproperties.h vehicleinfo.h maintenance.h parking.h fakeidlheader.h drivingsafety.h personalization.h) -set(dbussinkplugin_sources dbussignaller.cpp automotivemanager.cpp dbusplugin.cpp abstractdbusinterface.cpp dbusinterfacemanager.cpp runningstatus.cpp -varianttype.cpp custompropertyinterface.cpp uncategorizedproperty.cpp environmentproperties.cpp vehicleinfo.cpp maintenance.cpp parking.cpp drivingsafety.cpp personalization.cpp) +set(dbussinkplugin_headers automotivemanager.h dbusinterfacemanager.h runningstatus.h + custompropertyinterface.h uncategorizedproperty.h environmentproperties.h vehicleinfo.h maintenance.h parking.h fakeidlheader.h drivingsafety.h personalization.h) +set(dbussinkplugin_sources automotivemanager.cpp dbusinterfacemanager.cpp runningstatus.cpp + custompropertyinterface.cpp uncategorizedproperty.cpp environmentproperties.cpp vehicleinfo.cpp maintenance.cpp parking.cpp drivingsafety.cpp personalization.cpp) add_library(dbussinkplugin MODULE ${dbussinkplugin_sources}) set_target_properties(dbussinkplugin PROPERTIES PREFIX "") diff --git a/plugins/dbus/abstractproperty.cpp b/plugins/dbus/abstractproperty.cpp deleted file mode 100644 index f2a587bb..00000000 --- a/plugins/dbus/abstractproperty.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright (C) 2012 Intel Corporation - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public -License as published by the Free Software Foundation; either -version 2.1 of the License, or (at your option) any later version. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public -License along with this library; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ - - -#include "abstractproperty.h" -#include "abstractdbusinterface.h" - -AbstractProperty::AbstractProperty(string pn, Access access) - : mPropertyName(pn), mAccess(access), mValue(nullptr), mZoneFilter(Zone::None), mUpdateFrequency(0) -{ - -} - -AbstractProperty::~AbstractProperty() -{ - if(mValue){ - delete mValue; - mValue = nullptr; - } -} diff --git a/plugins/dbus/dbusinterfacemanager.cpp b/plugins/dbus/dbusinterfacemanager.cpp index e8af6ad8..b20cf04e 100644 --- a/plugins/dbus/dbusinterfacemanager.cpp +++ b/plugins/dbus/dbusinterfacemanager.cpp @@ -39,6 +39,11 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include "drivingsafety.h" #include "personalization.h" +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) +{ + new DBusInterfaceManager(routingengine, config); +} + static void on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data) { diff --git a/plugins/dbus/drivingsafety.h b/plugins/dbus/drivingsafety.h index 4fec8c7b..0c1a0d48 100644 --- a/plugins/dbus/drivingsafety.h +++ b/plugins/dbus/drivingsafety.h @@ -12,9 +12,9 @@ public: :DBusSink("AntilockBrakingSystem", re, connection, map<string, string>()) { /// TODO: Deprecated. Remove in 0.14 - wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "AntilockBrakingSystem", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "Engaged", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::AntilockBrakingSystemEnabled, "Enabled", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "AntilockBrakingSystem", VariantType::Read); + wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "Engaged", VariantType::Read); + wantPropertyVariant(VehicleProperty::AntilockBrakingSystemEnabled, "Enabled", VariantType::Read); } }; @@ -25,9 +25,9 @@ public: :DBusSink("TractionControlSystem", re, connection, map<string, string>()) { /// TODO: Deprecated. Remove in 0.14 - wantPropertyVariant(VehicleProperty::TractionControlSystem, "TractionControlSystem", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::TractionControlSystemEnabled, "Enabled", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::TractionControlSystem, "Engaged", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::TractionControlSystem, "TractionControlSystem", VariantType::Read); + wantPropertyVariant(VehicleProperty::TractionControlSystemEnabled, "Enabled", VariantType::Read); + wantPropertyVariant(VehicleProperty::TractionControlSystem, "Engaged", VariantType::Read); } }; @@ -39,8 +39,8 @@ public: :DBusSink("VehicleTopSpeedLimit", re, connection, map<string, string>()) { /// TODO: Deprecated. Remove in 0.14 - wantPropertyVariant(VehicleProperty::VehicleTopSpeedLimit, "VehicleTopSpeedLimit", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::VehicleTopSpeedLimit, "Speed", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::VehicleTopSpeedLimit, "VehicleTopSpeedLimit", VariantType::Read); + wantPropertyVariant(VehicleProperty::VehicleTopSpeedLimit, "Speed", VariantType::Read); } }; @@ -51,9 +51,9 @@ public: :DBusSink("AirbagStatus", re, connection, map<string, string>()) { /// TODO: Deprecated in 0.14 - wantPropertyVariant(VehicleProperty::AirbagStatus, "AirbagStatus", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::AirbagActivated, "AirbagActivated", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::AirbagDeployed, "AirbagDeployed", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::AirbagStatus, "AirbagStatus", VariantType::Read); + wantPropertyVariant(VehicleProperty::AirbagActivated, "AirbagActivated", VariantType::Read); + wantPropertyVariant(VehicleProperty::AirbagDeployed, "AirbagDeployed", VariantType::Read); } }; @@ -65,12 +65,12 @@ public: :DBusSink("DoorStatus", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::DoorStatus, "DoorStatus", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::DoorStatus, "DoorStatus", VariantType::Read); - wantPropertyVariant(VehicleProperty::DoorLockStatus, "DoorLockStatus", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::DoorLockStatus, "DoorLockStatus", VariantType::Read); ///TODO: Deprecated in 0.14 - wantPropertyVariant(VehicleProperty::ChildLockStatus, "ChildLockStatus", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::ChildLockStatus, "ChildLockStatus", VariantType::Read); } }; @@ -81,12 +81,12 @@ public: :DBusSink("Door", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::DoorStatusW3C, "Status", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::DoorStatusW3C, "Status", VariantType::Read); - wantPropertyVariant(VehicleProperty::DoorLockStatus, "Lock", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::DoorLockStatus, "Lock", VariantType::ReadWrite); ///TODO: Deprecated in 0.14 - wantPropertyVariant(VehicleProperty::ChildLockStatus, "ChildLock", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::ChildLockStatus, "ChildLock", VariantType::Read); } }; @@ -97,7 +97,7 @@ public: SeatBeltStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("SeatBelt", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::SeatBeltStatus, "Status", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::SeatBeltStatus, "Status", VariantType::Read); } }; @@ -108,7 +108,7 @@ public: OccupantStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("OccupantStatus", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::OccupantStatus, "OccupantStatus", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::OccupantStatus, "OccupantStatus", VariantType::Read); } }; @@ -118,7 +118,7 @@ public: ObstacleDistanceProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("ObstacleDistance", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::ObstacleDistance, "ObstacleDistance", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::ObstacleDistance, "ObstacleDistance", VariantType::Read); } }; @@ -128,8 +128,8 @@ public: ElectronicStabilityControl(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("ElectronicStabilityControl", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::ElectronicStabilityControlEnabled, "Enabled", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::ElectronicStabilityControlEngaged, "Engaged", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::ElectronicStabilityControlEnabled, "Enabled", VariantType::Read); + wantPropertyVariant(VehicleProperty::ElectronicStabilityControlEngaged, "Engaged", VariantType::Read); } }; @@ -139,7 +139,7 @@ public: ChildSafetyLock(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("ChildSafetyLock", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::ChildLockStatus, "Lock", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::ChildLockStatus, "Lock", VariantType::ReadWrite); } }; @@ -149,10 +149,10 @@ public: SeatProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("Seat", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::OccupantStatusW3C, "Occupant", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::SeatBeltStatus, "SeatBelt", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::OccupantName, "OccupantName", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::OccupantIdentificationType, "IdentificationType", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::OccupantStatusW3C, "Occupant", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::SeatBeltStatus, "SeatBelt", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::OccupantName, "OccupantName", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::OccupantIdentificationType, "IdentificationType", VariantType::ReadWrite); } }; diff --git a/plugins/dbus/environmentproperties.h b/plugins/dbus/environmentproperties.h index d4097be8..7796865b 100644 --- a/plugins/dbus/environmentproperties.h +++ b/plugins/dbus/environmentproperties.h @@ -12,7 +12,7 @@ public: ExteriorBrightnessProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("ExteriorBrightness", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::ExteriorBrightness, "ExteriorBrightness", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::ExteriorBrightness, "ExteriorBrightness", VariantType::Read); } }; @@ -23,8 +23,8 @@ public: Temperature(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("Temperature", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::InteriorTemperature, "InteriorTemperature", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::ExteriorTemperature, "ExteriorTemperature", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::InteriorTemperature, "InteriorTemperature", VariantType::Read); + wantPropertyVariant(VehicleProperty::ExteriorTemperature, "ExteriorTemperature", VariantType::Read); } }; @@ -35,7 +35,7 @@ public: RainSensor(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("RainSensor", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::RainSensor, "RainIntensity", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::RainSensor, "RainIntensity", VariantType::Read); } }; @@ -45,8 +45,8 @@ public: WindshieldWiperStatus(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("WiperStatus", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::WindshieldWiperSpeed, "WiperSpeed", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::WindshieldWiperSetting, "WiperSetting", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::WindshieldWiperSpeed, "WiperSpeed", VariantType::Read); + wantPropertyVariant(VehicleProperty::WindshieldWiperSetting, "WiperSetting", VariantType::ReadWrite); } }; @@ -56,15 +56,15 @@ public: ClimateControlProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("ClimateControl", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::AirflowDirectionW3C, "AirflowDirection", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::FanSpeed, "FanSpeedLevel", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::TargetTemperature, "TargetTemperature", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::AirConditioning, "AirConditioning", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::AirRecirculation, "AirRecirculation", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::Heater, "Heater", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::SteeringWheelHeater, "SteeringWheelHeater", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::SeatHeater, "SeatHeater", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::SeatCooler, "SeatCooler", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::AirflowDirectionW3C, "AirflowDirection", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::FanSpeed, "FanSpeedLevel", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::TargetTemperature, "TargetTemperature", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::AirConditioning, "AirConditioning", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::AirRecirculation, "AirRecirculation", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::Heater, "Heater", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::SteeringWheelHeater, "SteeringWheelHeater", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::SeatHeater, "SeatHeater", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::SeatCooler, "SeatCooler", VariantType::ReadWrite); } }; @@ -76,8 +76,8 @@ public: WindowStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("WindowStatus", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::WindowStatus, "Openness", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::Defrost, "Defrost", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::WindowStatus, "Openness", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::Defrost, "Defrost", VariantType::ReadWrite); } }; @@ -87,8 +87,8 @@ public: SideWindowStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("SideWindow", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::WindowStatus, "Openness", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::WindowLockStatus, "Lock", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::WindowStatus, "Openness", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::WindowLockStatus, "Lock", VariantType::ReadWrite); } }; @@ -98,8 +98,8 @@ public: DefrostProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("Defrost", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::DefrostWindow, "DefrostWindow", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::DefrostMirror, "DefrostMirror", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::DefrostWindow, "DefrostWindow", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::DefrostMirror, "DefrostMirror", VariantType::ReadWrite); } }; @@ -110,8 +110,8 @@ public: Sunroof(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("Sunroof", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::Sunroof, "Openness", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::SunroofTilt, "Tilt", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::Sunroof, "Openness", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::SunroofTilt, "Tilt", VariantType::ReadWrite); } }; @@ -122,8 +122,8 @@ public: ConvertibleRoof(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("ConvertibleRoof", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::ConvertibleRoof, "Setting", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::ConvertibleRoofStatus, "Status", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::ConvertibleRoof, "Setting", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::ConvertibleRoofStatus, "Status", VariantType::Read); } }; @@ -133,7 +133,7 @@ public: AtmosphericPressure(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("AtmosphericPressure", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::AtmosphericPressure, "Pressure", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::AtmosphericPressure, "Pressure", VariantType::ReadWrite); } }; #endif diff --git a/plugins/dbus/maintenance.h b/plugins/dbus/maintenance.h index a4f9bdef..62a1c4bc 100644 --- a/plugins/dbus/maintenance.h +++ b/plugins/dbus/maintenance.h @@ -18,10 +18,10 @@ public: * @access readonly * @attributeComment \brief MUST return Distance traveled in km **/ - wantPropertyVariant(VehicleProperty::Odometer, "Odometer", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::Odometer, "Odometer", VariantType::Read); - wantPropertyVariant(VehicleProperty::DistanceTotal, "DistanceTotal", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::DistanceSinceStart, "DistanceSinceStart", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::DistanceTotal, "DistanceTotal", VariantType::Read); + wantPropertyVariant(VehicleProperty::DistanceSinceStart, "DistanceSinceStart", VariantType::Read); } }; @@ -33,7 +33,7 @@ public: FluidProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("Fluid", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::TransmissionFluidLevel, "Transmission", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::TransmissionFluidLevel, "Transmission", VariantType::Read); } }; @@ -44,9 +44,9 @@ public: BatteryStatusProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("BatteryStatus", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::BatteryVoltage, "Voltage", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::BatteryCurrent, "Current", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::BatteryChargeLevel, "ChargeLevel", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::BatteryVoltage, "Voltage", VariantType::Read); + wantPropertyVariant(VehicleProperty::BatteryCurrent, "Current", VariantType::Read); + wantPropertyVariant(VehicleProperty::BatteryChargeLevel, "ChargeLevel", VariantType::Read); } }; @@ -57,9 +57,9 @@ public: TireProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("Tire", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::TirePressure, "Pressure", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::TirePressureLow, "PressureLow", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::TireTemperature, "Temperature", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::TirePressure, "Pressure", VariantType::Read); + wantPropertyVariant(VehicleProperty::TirePressureLow, "PressureLow", VariantType::Read); + wantPropertyVariant(VehicleProperty::TireTemperature, "Temperature", VariantType::Read); } }; @@ -70,8 +70,8 @@ public: EngineCoolant(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("EngineCoolant", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::EngineCoolantLevel, "Level", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::EngineCoolantTemperature, "Temperature", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::EngineCoolantLevel, "Level", VariantType::Read); + wantPropertyVariant(VehicleProperty::EngineCoolantTemperature, "Temperature", VariantType::Read); } }; @@ -81,8 +81,8 @@ public: TransmissionOil(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("TransmissionOil", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::TransmissionOilWear, "Wear", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::TransmissionOilTemperature, "Temperature", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::TransmissionOilWear, "Wear", VariantType::Read); + wantPropertyVariant(VehicleProperty::TransmissionOilTemperature, "Temperature", VariantType::Read); } }; @@ -92,7 +92,7 @@ public: TransmissionClutch(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("TransmissionClutch", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::TransmissionClutchWear, "Wear", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::TransmissionClutchWear, "Wear", VariantType::Read); } }; @@ -102,9 +102,9 @@ public: BrakeMaintenance(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("BrakeMaintenance", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::BrakePadWear, "PadWear", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::BrakeFluidLevel, "FluidLevel", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::BrakeFluidLevelLow, "FluidLevelLow", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::BrakePadWear, "PadWear", VariantType::Read); + wantPropertyVariant(VehicleProperty::BrakeFluidLevel, "FluidLevel", VariantType::Read); + wantPropertyVariant(VehicleProperty::BrakeFluidLevelLow, "FluidLevelLow", VariantType::Read); } }; @@ -114,8 +114,8 @@ public: WasherFluid(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("WasherFluid", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::WasherFluidLevel, "Level", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::WasherFluidLevelLow, "LevelLow", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::WasherFluidLevel, "Level", VariantType::Read); + wantPropertyVariant(VehicleProperty::WasherFluidLevelLow, "LevelLow", VariantType::Read); } }; @@ -125,7 +125,7 @@ public: MalfunctionIndicator(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("MalfunctionIndicator", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::MalfunctionIndicatorOn, "On", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::MalfunctionIndicatorOn, "On", VariantType::Read); } }; @@ -135,11 +135,11 @@ public: Diagnostics(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("Diagnostics", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::AccumulatedEngineRuntime, "AccumulatedEngineRuntime", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::DistanceWithMILOn, "DistanceWithMILOn", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::DistanceSinceCodeCleared, "DistanceSinceCodeCleared", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::TimeRunMILOn, "TimeRunMILOn", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::TimeTroubleCodeClear, "TimeTroubleCodeClear", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::AccumulatedEngineRuntime, "AccumulatedEngineRuntime", VariantType::Read); + wantPropertyVariant(VehicleProperty::DistanceWithMILOn, "DistanceWithMILOn", VariantType::Read); + wantPropertyVariant(VehicleProperty::DistanceSinceCodeCleared, "DistanceSinceCodeCleared", VariantType::Read); + wantPropertyVariant(VehicleProperty::TimeRunMILOn, "TimeRunMILOn", VariantType::Read); + wantPropertyVariant(VehicleProperty::TimeTroubleCodeClear, "TimeTroubleCodeClear", VariantType::Read); } }; diff --git a/plugins/dbus/parking.h b/plugins/dbus/parking.h index f597e006..1e86c742 100644 --- a/plugins/dbus/parking.h +++ b/plugins/dbus/parking.h @@ -13,7 +13,7 @@ public: ParkingBrakeProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("ParkingBrake", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::ParkingBrakeStatusW3C, "Status", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::ParkingBrakeStatusW3C, "Status", VariantType::Read); } }; @@ -24,7 +24,7 @@ public: HazardLightProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("HazardLight", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::HazardLightStatus, "HazardLight", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::HazardLightStatus, "HazardLight", VariantType::ReadWrite); } }; @@ -34,7 +34,7 @@ public: LaneDepartureStatus(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("LaneDepartureDetection", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::LaneDepartureStatus, "Status", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::LaneDepartureStatus, "Status", VariantType::Read); } }; @@ -44,7 +44,7 @@ public: AlarmStatus(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("Alarm", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::AlarmStatus, "Status", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::AlarmStatus, "Status", VariantType::ReadWrite); } }; diff --git a/plugins/dbus/personalization.h b/plugins/dbus/personalization.h index 801b10e2..20e2f2c6 100644 --- a/plugins/dbus/personalization.h +++ b/plugins/dbus/personalization.h @@ -11,8 +11,8 @@ public: SteeringWheelPositionProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("SteeringWheelPosition", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::SteeringWheelPositionSlide, "Slide", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::SteeringWheelPositionTilt, "Tilt", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::SteeringWheelPositionSlide, "Slide", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::SteeringWheelPositionTilt, "Tilt", VariantType::ReadWrite); } }; @@ -22,8 +22,8 @@ public: MirrorProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("Mirror", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::MirrorSettingPan, "MirrorPan", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::MirrorSettingTilt, "MirrorTilt", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::MirrorSettingPan, "MirrorPan", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::MirrorSettingTilt, "MirrorTilt", VariantType::ReadWrite); } }; @@ -33,12 +33,12 @@ public: SeatAdjustment(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("SeatAdjustment", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::SeatPositionBackCushion, "SeatBackCushion", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::SeatPositionRecline, "SeatReclineBack", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::SeatPositionSlide, "SeatSlide", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::SeatPositionCushionHeight, "SeatCushionHeight", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::SeatPositionHeadrest, "SeatHeadrest", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::SeatPositionSideCushion, "SeatSideCushion", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::SeatPositionBackCushion, "SeatBackCushion", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::SeatPositionRecline, "SeatReclineBack", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::SeatPositionSlide, "SeatSlide", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::SeatPositionCushionHeight, "SeatCushionHeight", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::SeatPositionHeadrest, "SeatHeadrest", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::SeatPositionSideCushion, "SeatSideCushion", VariantType::ReadWrite); } }; @@ -48,7 +48,7 @@ public: DriveMode(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("DriveMode", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::VehicleDriveMode, "DriveMode", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::VehicleDriveMode, "DriveMode", VariantType::ReadWrite); } }; @@ -58,9 +58,9 @@ public: VehicleSound(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("VehicleSound", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::ActiveNoiseControlMode, "ActiveNoiseControlMode", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::EngineSoundEnhancementMode, "EngineSoundEnhancementMode", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::AvailableSounds, "AvailableSounds", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::ActiveNoiseControlMode, "ActiveNoiseControlMode", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::EngineSoundEnhancementMode, "EngineSoundEnhancementMode", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::AvailableSounds, "AvailableSounds", VariantType::ReadWrite); } }; diff --git a/plugins/dbus/runningstatus.h b/plugins/dbus/runningstatus.h index a97086e6..16321cb2 100644 --- a/plugins/dbus/runningstatus.h +++ b/plugins/dbus/runningstatus.h @@ -30,7 +30,7 @@ public: VehicleSpeedProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("VehicleSpeed", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::VehicleSpeed, "Speed", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::VehicleSpeed, "Speed", VariantType::Read); } }; @@ -41,7 +41,7 @@ public: EngineSpeedProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("EngineSpeed", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::EngineSpeed, "Speed", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::EngineSpeed, "Speed", VariantType::Read); } }; @@ -52,7 +52,7 @@ public: VehiclePowerModeProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("VehiclePowerMode", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::VehiclePowerMode, "VehiclePowerMode",AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::VehiclePowerMode, "VehiclePowerMode",VariantType::Read); } }; @@ -63,7 +63,7 @@ public: TripMeterProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("TripMeter", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::TripMeters, "TripMeters", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::TripMeters, "TripMeters", VariantType::ReadWrite); } }; @@ -74,9 +74,9 @@ public: AccelerationProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("Acceleration", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::AccelerationX, "X", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::AccelerationY, "Y", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::AccelerationZ, "Z", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::AccelerationX, "X", VariantType::Read); + wantPropertyVariant(VehicleProperty::AccelerationY, "Y", VariantType::Read); + wantPropertyVariant(VehicleProperty::AccelerationZ, "Z", VariantType::Read); } }; @@ -87,11 +87,11 @@ public: TransmissionProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("Transmission", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::TransmissionShiftPosition, "ShiftPosition", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::TransmissionGearPosition, "GearPosition", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::TransmissionGearPosition, "Gear", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::TransmissionModeW3C, "Mode", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::TransmissionGearType, "Type", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::TransmissionShiftPosition, "ShiftPosition", VariantType::Read); + wantPropertyVariant(VehicleProperty::TransmissionGearPosition, "GearPosition", VariantType::Read); + wantPropertyVariant(VehicleProperty::TransmissionGearPosition, "Gear", VariantType::Read); + wantPropertyVariant(VehicleProperty::TransmissionModeW3C, "Mode", VariantType::Read); + wantPropertyVariant(VehicleProperty::TransmissionGearType, "Type", VariantType::Read); } }; @@ -102,8 +102,8 @@ public: CruiseControlProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("CruiseControlStatus", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::CruiseControlSpeed, "Speed", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::CruiseControlActive, "Status", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::CruiseControlSpeed, "Speed", VariantType::Read); + wantPropertyVariant(VehicleProperty::CruiseControlActive, "Status", VariantType::Read); } }; @@ -114,7 +114,7 @@ public: BrakeOperation(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("BrakeOperation", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::WheelBrake, "BrakePedalDepressed", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::WheelBrake, "BrakePedalDepressed", VariantType::Read); } }; @@ -125,16 +125,16 @@ public: LightStatusProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("LightStatus", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::LightHead, "Head", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::LightRightTurn, "RightTurn", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::LightLeftTurn, "LeftTurn", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::LightBrake, "Brake", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::LightFog, "Fog", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::LightHazard, "Hazard", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::LightParking, "Parking", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::LightHighBeam, "HighBeam", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::LightAutomatic, "AutomaticHeadlights", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::LightDynamicHighBeam, "DynamicHighBeam", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::LightHead, "Head", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::LightRightTurn, "RightTurn", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::LightLeftTurn, "LeftTurn", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::LightBrake, "Brake", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::LightFog, "Fog", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::LightHazard, "Hazard", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::LightParking, "Parking", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::LightHighBeam, "HighBeam", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::LightAutomatic, "AutomaticHeadlights", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::LightDynamicHighBeam, "DynamicHighBeam", VariantType::ReadWrite); } }; @@ -144,7 +144,7 @@ public: InteriorLightStatusProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("InteriorLightStatus", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::InteriorLightStatus, "Status", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::InteriorLightStatus, "Status", VariantType::ReadWrite); } }; @@ -155,7 +155,7 @@ public: HornProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("Horn", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::Horn, "Status", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::Horn, "Status", VariantType::Read); } }; @@ -166,14 +166,14 @@ public: FuelProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("Fuel", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::FuelLevel, "Level", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::FuelRange, "Range", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::FuelConsumption, "InstantConsumption", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::FuelEconomy, "InstantEconomy", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::FuelAverageEconomy, "AverageEconomy", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::FuelAverageConsumption, "AverageConsumption", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::FuelConsumptionSinceRestart, "FuelConsumedSinceRestart", AbstractProperty::ReadWrite); - wantPropertyVariant(VehicleProperty::FuelTimeSinceRestart, "TimeSinceRestart", AbstractProperty::ReadWrite); + wantPropertyVariant(VehicleProperty::FuelLevel, "Level", VariantType::Read); + wantPropertyVariant(VehicleProperty::FuelRange, "Range", VariantType::Read); + wantPropertyVariant(VehicleProperty::FuelConsumption, "InstantConsumption", VariantType::Read); + wantPropertyVariant(VehicleProperty::FuelEconomy, "InstantEconomy", VariantType::Read); + wantPropertyVariant(VehicleProperty::FuelAverageEconomy, "AverageEconomy", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::FuelAverageConsumption, "AverageConsumption", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::FuelConsumptionSinceRestart, "FuelConsumedSinceRestart", VariantType::ReadWrite); + wantPropertyVariant(VehicleProperty::FuelTimeSinceRestart, "TimeSinceRestart", VariantType::ReadWrite); } }; @@ -184,11 +184,11 @@ public: EngineOilProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("EngineOil", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::EngineOilRemaining, "Level", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::EngineOilTemperature, "Temperature", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::EngineOilPressure, "Pressure", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::EngineOilChangeIndicator, "Change", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::EngineOilLifeRemaining, "LifeRemaining", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::EngineOilRemaining, "Level", VariantType::Read); + wantPropertyVariant(VehicleProperty::EngineOilTemperature, "Temperature", VariantType::Read); + wantPropertyVariant(VehicleProperty::EngineOilPressure, "Pressure", VariantType::Read); + wantPropertyVariant(VehicleProperty::EngineOilChangeIndicator, "Change", VariantType::Read); + wantPropertyVariant(VehicleProperty::EngineOilLifeRemaining, "LifeRemaining", VariantType::Read); } }; @@ -199,10 +199,10 @@ public: LocationProperty(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("Location", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::Latitude, "Latitude", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::Longitude, "Longitude", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::Altitude, "Altitude", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::Direction, "Direction", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::Latitude, "Latitude", VariantType::Read); + wantPropertyVariant(VehicleProperty::Longitude, "Longitude", VariantType::Read); + wantPropertyVariant(VehicleProperty::Altitude, "Altitude", VariantType::Read); + wantPropertyVariant(VehicleProperty::Direction, "Direction", VariantType::Read); } }; @@ -213,7 +213,7 @@ public: SteeringWheel(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("SteeringWheel", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::SteeringWheelAngleW3C, "Angle", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::SteeringWheelAngleW3C, "Angle", VariantType::Read); } }; @@ -223,7 +223,7 @@ public: ThrottlePosition(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("ThrottlePosition", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::ThrottlePosition, "Value", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::ThrottlePosition, "Value", VariantType::Read); } }; @@ -233,8 +233,8 @@ public: NightMode(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("NightMode", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::NightMode, "NightMode", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::NightMode, "Mode", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::NightMode, "NightMode", VariantType::Read); + wantPropertyVariant(VehicleProperty::NightMode, "Mode", VariantType::Read); } }; @@ -244,8 +244,8 @@ public: DrivingMode(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("DrivingMode", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::DrivingMode, "DrivingMode", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::DrivingModeW3C, "Mode", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::DrivingMode, "DrivingMode", VariantType::Read); + wantPropertyVariant(VehicleProperty::DrivingModeW3C, "Mode", VariantType::Read); } }; @@ -255,7 +255,7 @@ public: PowertrainTorque(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("PowertrainTorque", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::PowertrainTorque, "Value", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::PowertrainTorque, "Value", VariantType::Read); } }; @@ -265,7 +265,7 @@ public: AcceleratorPedalPosition(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("AcceleratorPedalPosition", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::AcceleratorPedalPosition, "Value", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::AcceleratorPedalPosition, "Value", VariantType::Read); } }; @@ -275,7 +275,7 @@ public: Chime(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("Chime", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::Chime, "Status", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::Chime, "Status", VariantType::Read); } }; @@ -285,7 +285,7 @@ public: WheelTick(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("WheelTick", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::WheelTick, "Value", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::WheelTick, "Value", VariantType::Read); } }; @@ -295,8 +295,8 @@ public: IgnitionTime(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("IgnitionTime", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::IgnitionTimeOn, "IgnitionTimeOn", AbstractProperty::Read); - wantPropertyVariant(VehicleProperty::IgnitionTimeOff, "IgnitionTimeOff", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::IgnitionTimeOn, "IgnitionTimeOn", VariantType::Read); + wantPropertyVariant(VehicleProperty::IgnitionTimeOff, "IgnitionTimeOff", VariantType::Read); } }; @@ -306,7 +306,7 @@ public: YawRate(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("YawRate", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::YawRate, "Value", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::YawRate, "Value", VariantType::Read); } }; @@ -316,7 +316,7 @@ public: ButtonEvent(VehicleProperty::Property, AbstractRoutingEngine *re, GDBusConnection *connection) :DBusSink("ButtonEvent", re, connection, map<string, string>()) { - wantPropertyVariant(VehicleProperty::YawRate, "Value", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::YawRate, "Value", VariantType::Read); } }; diff --git a/plugins/dbus/varianttype.h b/plugins/dbus/varianttype.h deleted file mode 100644 index a90d9ef4..00000000 --- a/plugins/dbus/varianttype.h +++ /dev/null @@ -1,134 +0,0 @@ -#ifndef _VARIANT_TYPE_H_ -#define _VARIANT_TYPE_H_ - -#include "abstractpropertytype.h" -#include "abstractroutingengine.h" - -class AbstractDBusInterface; - -class VariantType: public AbstractPropertyType -{ -public: - - typedef function<void (boost::any)> SetterFunc; - - enum Access { - Read, - Write, - ReadWrite - }; - - VariantType(AbstractRoutingEngine* re, VehicleProperty::Property ambPropertyName, string propertyName, Access access); - - void initialize(); - - GVariant* toVariant(); - void fromVariant(GVariant *value); - - bool operator == (VariantType & other) - { - return (other.dbusName() == dbusName() - && other.ambPropertyName() == ambPropertyName() - && other.sourceFilter() == sourceFilter() - && other.zoneFilter() == zoneFilter()); - } - - virtual void setSetterFunction(SetterFunc setterFunc) - { - mSetterFunc = setterFunc; - } - - virtual std::string dbusName() - { - return mPropertyName; - } - - virtual std::string ambPropertyName() - { - return name; - } - - virtual Access access() - { - return mAccess; - } - - void setSourceFilter(std::string filter) - { - sourceUuid = filter; - } - void setZoneFilter(Zone::Type z) - { - zone = z; - } - - std::string sourceFilter() { return sourceUuid; } - Zone::Type zoneFilter() { return zone; } - - virtual void setValue(AbstractPropertyType* val) - { - if(!val) - return; - - mValue->quickCopy(val); - - if(mUpdateFrequency == 0) - { - PropertyInfo info = routingEngine->getPropertyInfo(mValue->name, mValue->sourceUuid); - - if(info.isValid()) - mUpdateFrequency = info.updateFrequency(); - else - mUpdateFrequency = -1; - } - } - - virtual void updateValue(AbstractPropertyType* val) - { - setValue(val); - } - - int updateFrequency() - { - return mUpdateFrequency; - } - - AbstractPropertyType* value() - { - return mValue; - } - - std::string toString() const - { - return ""; - } - - void fromString(std::string str) - { - - } - - AbstractPropertyType * copy() - { - return new VariantType(routingEngine, name, mPropertyName, mAccess); - } - -protected: - int mUpdateFrequency; - AbstractRoutingEngine* routingEngine; - string mPropertyName; - SetterFunc mSetterFunc; - Access mAccess; - AbstractPropertyType* mValue; - AbstractDBusInterface* mInterface; - -private: - void asyncReply(AsyncPropertyReply*); - bool mInitialized; - - -}; - -typedef VariantType AbstractProperty; - -#endif diff --git a/plugins/dbus/vehicleinfo.h b/plugins/dbus/vehicleinfo.h index 8dbd6025..16d9a304 100644 --- a/plugins/dbus/vehicleinfo.h +++ b/plugins/dbus/vehicleinfo.h @@ -13,22 +13,8 @@ public: VehicleId(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("VehicleId", re, connection, map<string, string>()) { - /** @attributeName WMI - * @type DOMString - * @access readonly - * @attributeComment \brief MUST return World Manufacturer Identifier (WMI) - * @attributeComment WMI is defined by SAE ISO 3780:2009. 3 characters. - **/ - wantPropertyVariant(VehicleProperty::WMI, "WMI", AbstractProperty::Read); - - /** @attributeName VIN - * @type DOMString - * @access readonly - * @attributeComment \brief MUST return Vehicle Identification Number (VIN) as defined by ISO 3779. 17 characters. - **/ - wantPropertyVariant(VehicleProperty::VIN, "VIN", AbstractProperty::Read); - - + wantPropertyVariant(VehicleProperty::WMI, "WMI", VariantType::Read); + wantPropertyVariant(VehicleProperty::VIN, "VIN", VariantType::Read); } }; @@ -44,21 +30,21 @@ public: * @access readonly * @attributeComment \brief MUST return width of vehicle in mm **/ - wantPropertyVariant(VehicleProperty::VehicleWidth, "Width", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::VehicleWidth, "Width", VariantType::Read); /** @attributeName Height * @type unsigned long * @access readonly * @attributeComment \brief MUST return height of vehicle in mm **/ - wantPropertyVariant(VehicleProperty::VehicleHeight, "Height", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::VehicleHeight, "Height", VariantType::Read); /** @attributeName Length * @type unsigned long * @access readonly * @attributeComment \brief MUST return length of vehicle in mm **/ - wantPropertyVariant(VehicleProperty::VehicleLength, "Length", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::VehicleLength, "Length", VariantType::Read); } @@ -71,36 +57,8 @@ public: FuelInfoProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("FuelInfo", re, connection, map<string, string>()) { - /** - * @enum const unsigned short FUELTYPE_GASOLINE = 0; - * @enum const unsigned short FUELTYPE_HIGH_OCTANE= 1; - * @enum const unsigned short FUELTYPE_DIESEL = 2; - * @enum const unsigned short FUELTYPE_ELECTRIC = 3; - * @enum const unsigned short FUELTYPE_HYDROGEN = 4; - **/ - - /** @attributeName Type - * @type unsigned short - * @access readonly - * @attributeComment \brief MUST return type of fuel. integer 0-4 (see FUELTYPE_*) - **/ - wantPropertyVariant(VehicleProperty::FuelType, "Type", AbstractProperty::Read); - - /** - * @enum const unsigned short REFUELPOSITION_LEFT = 0; - * @enum const unsigned short REFUELPOSITION_RIGHT= 1; - * @enum const unsigned short REFUELPOSITION_FRONT = 2; - * @enum const unsigned short REFUELPOSITION_REAR = 3; - **/ - - /** @attributeName RefuelPosition - * @type unsigned short - * @access readonly - * @attributeComment \brief MUST return position of refuling (see REFUELPOSITION_*) - **/ - wantPropertyVariant(VehicleProperty::FuelPositionSide, "RefuelPosition", AbstractProperty::Read); - - + wantPropertyVariant(VehicleProperty::FuelType, "Type", VariantType::Read); + wantPropertyVariant(VehicleProperty::FuelPositionSide, "RefuelPosition", VariantType::Read); } }; @@ -111,23 +69,7 @@ public: VehicleTypeProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("VehicleType", re, connection, map<string, string>()) { - /** - * @enum const unsigned short VEHICLETYPE_SEDAN = 0; - * @enum const unsigned short VEHICLETYPE_COUPE= 1; - * @enum const unsigned short VEHICLETYPE_CABRIOLE = 2; - * @enum const unsigned short VEHICLETYPE_ROADSTER = 3; - * @enum const unsigned short VEHICLETYPE_SUV = 4; - * @enum const unsigned short VEHICLETYPE_TRUCK = 5; - **/ - - /** @attributeName Type - * @type unsigned short - * @access readonly - * @attributeComment \brief MUST return type of Vehicle. Integer 0-5 (see VEHICLETYPE_*) - **/ - wantPropertyVariant(VehicleProperty::VehicleType, "Type", AbstractProperty::Read); - - + wantPropertyVariant(VehicleProperty::VehicleType, "Type", VariantType::Read); } }; @@ -138,17 +80,7 @@ public: DoorsProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("Doors", re, connection, map<string, string>()) { - /** @attributeName DoorsPerRow - * @type sequence<unsigned short> - * @access readonly - * @attributeComment \brief MUST return Number of doors in each row. The index represents the row. Position '0' - * @attributeComment represents the first row, '1' the second row etc. - * @attributeComment Example a common mini-van may have Doors[0] = 2 doors, - * @attributeComment Doors[1] = 1 (side door), Doors[2] = 1 (trunk). - **/ - wantPropertyVariant(VehicleProperty::DoorsPerRow, "DoorsPerRow", AbstractProperty::Read); - - + wantPropertyVariant(VehicleProperty::DoorsPerRow, "DoorsPerRow", VariantType::Read); } }; @@ -159,34 +91,10 @@ public: WheelInformationProperty(VehicleProperty::Property, AbstractRoutingEngine* re, GDBusConnection* connection) :DBusSink("WheelInformation", re, connection, map<string, string>()) { - - /** @attributeName FrontWheelRadius - * @type unsigned short - * @access readonly - * @attributeComment \brief MUST return Radius of Front Wheel(s) in mm. - **/ - wantPropertyVariant(VehicleProperty::FrontWheelRadius, "FrontWheelRadius", AbstractProperty::Read); - - /** @attributeName RearWheelRadius - * @type unsigned short - * @access readonly - * @attributeComment \brief MUST return Radius of Rear Wheel(s) in mm. - **/ - wantPropertyVariant(VehicleProperty::RearWheelRadius, "RearWheelRadius", AbstractProperty::Read); - - /** @attributeName WheelTrack - * @type unsigned long - * @access readonly - * @attributeComment \brief MUST return Wheel Track in mm. - **/ - wantPropertyVariant(VehicleProperty::WheelTrack, "WheelTrack", AbstractProperty::Read); - - /** @attributeName ABS - * @type boolean - * @access readonly - * @attributeComment \brief MUST return Antilock Brake System status: on = true, off = false. - **/ - wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "AntilockBrakingSystem", AbstractProperty::Read); + wantPropertyVariant(VehicleProperty::FrontWheelRadius, "FrontWheelRadius", VariantType::Read); + wantPropertyVariant(VehicleProperty::RearWheelRadius, "RearWheelRadius", VariantType::Read); + wantPropertyVariant(VehicleProperty::WheelTrack, "WheelTrack", VariantType::Read); + wantPropertyVariant(VehicleProperty::AntilockBrakingSystem, "AntilockBrakingSystem", VariantType::Read); } }; diff --git a/plugins/demosink/demosinkplugin.cpp b/plugins/demosink/demosinkplugin.cpp index 54a68a74..b7658351 100644 --- a/plugins/demosink/demosinkplugin.cpp +++ b/plugins/demosink/demosinkplugin.cpp @@ -66,9 +66,9 @@ DemoSink::~DemoSink() } -extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingEngine, map<string, string> config) { - return new DemoSinkManager(routingengine, config); + new DemoSink(routingEngine, config); } const string DemoSink::uuid() diff --git a/plugins/demosink/demosinkplugin.h b/plugins/demosink/demosinkplugin.h index ef28bcba..ce57a5da 100644 --- a/plugins/demosink/demosinkplugin.h +++ b/plugins/demosink/demosinkplugin.h @@ -43,19 +43,5 @@ private: PropertySet mRequests; }; -class DemoSinkManager: public AbstractSinkManager -{ -public: - DemoSinkManager(AbstractRoutingEngine* engine, map<string, string> config) - :AbstractSinkManager(engine, config) - { - DemoSink* sink = new DemoSink(routingEngine, config); - } - - void setConfiguration(map<string, string> config) - { - - } -}; #endif // WHEELPLUGIN_H diff --git a/plugins/exampleplugin.cpp b/plugins/exampleplugin.cpp index f94a0739..32901731 100644 --- a/plugins/exampleplugin.cpp +++ b/plugins/exampleplugin.cpp @@ -107,10 +107,9 @@ ExampleSourcePlugin::ExampleSourcePlugin(AbstractRoutingEngine* re, map<string, -extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) { - return new ExampleSourcePlugin(routingengine, config); - + new ExampleSourcePlugin(routingengine, config); } const string ExampleSourcePlugin::uuid() diff --git a/plugins/examplesink.cpp b/plugins/examplesink.cpp index bad3c42a..85f3d39f 100644 --- a/plugins/examplesink.cpp +++ b/plugins/examplesink.cpp @@ -25,9 +25,9 @@ #include <glib.h> -extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingEngine, map<string, string> config) { - return new ExampleSinkManager(routingengine, config); + new ExampleSink(routingEngine, config); } ExampleSink::ExampleSink(AbstractRoutingEngine* engine, map<string, string> config): AbstractSink(engine, config) diff --git a/plugins/examplesink.h b/plugins/examplesink.h index 430ab0e6..d75feb48 100644 --- a/plugins/examplesink.h +++ b/plugins/examplesink.h @@ -34,14 +34,4 @@ public: virtual const std::string uuid(); }; -class ExampleSinkManager: public AbstractSinkManager -{ -public: - ExampleSinkManager(AbstractRoutingEngine* engine, map<string, string> config) - :AbstractSinkManager(engine, config) - { - new ExampleSink(routingEngine, config); - } -}; - #endif // EXAMPLESINK_H diff --git a/plugins/gpsnmea/gpsnmea.cpp b/plugins/gpsnmea/gpsnmea.cpp index 695e15df..ee0518be 100644 --- a/plugins/gpsnmea/gpsnmea.cpp +++ b/plugins/gpsnmea/gpsnmea.cpp @@ -387,10 +387,9 @@ bool readCallback(GIOChannel *source, GIOCondition condition, gpointer data) return true; } -extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) { - return new GpsNmeaSource(routingengine, config); - + new GpsNmeaSource(routingengine, config); } GpsNmeaSource::GpsNmeaSource(AbstractRoutingEngine *re, map<string, string> config) diff --git a/plugins/murphyplugin/murphysource.cpp b/plugins/murphyplugin/murphysource.cpp index dc319914..6ec37b17 100644 --- a/plugins/murphyplugin/murphysource.cpp +++ b/plugins/murphyplugin/murphysource.cpp @@ -27,20 +27,10 @@ #include <timestamp.h> #include <murphy/common.h> - -/*#ifdef USE_QT_CORE -#include <murphy/qt/qt-glue.h> -#else*/ - #include <murphy/glib/glib-glue.h> -//#endif - -// #include <vehicleproperty.h> -// #include <abstractpropertytype.h> #include "debugout.h" - void MurphySource::processValue(string propertyName, AbstractPropertyType *prop) { if (murphyProperties.find(propertyName) != murphyProperties.end()) @@ -54,7 +44,6 @@ void MurphySource::processValue(string propertyName, AbstractPropertyType *prop) m_re->updateSupported(supported(), PropertyList(), this); } - // cout << "updating property!" << endl; m_re->updateProperty(prop, uuid()); } @@ -466,8 +455,8 @@ AsyncPropertyReply *MurphySource::setProperty(AsyncSetPropertyRequest request) } #if 1 -extern "C" AbstractSource *create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) { - return new MurphySource(routingengine, config); + new MurphySource(routingengine, config); } #endif diff --git a/plugins/obd2plugin/obd2source.cpp b/plugins/obd2plugin/obd2source.cpp index 4aa6b7ba..35f9b38f 100644 --- a/plugins/obd2plugin/obd2source.cpp +++ b/plugins/obd2plugin/obd2source.cpp @@ -694,15 +694,16 @@ int OBD2Source::supportedOperations() return Get | Set; } -extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) { - return new OBD2Source(routingengine, config); - + new OBD2Source(routingengine, config); } + const string OBD2Source::uuid() { return "f77af740-f1f8-11e1-aff1-0800200c9a66"; } + void OBD2Source::subscribeToPropertyChanges(VehicleProperty::Property property) { if (property == VehicleProperty::VIN) diff --git a/plugins/opencvlux/opencvluxplugin.cpp b/plugins/opencvlux/opencvluxplugin.cpp index 5205d076..2ee49482 100644 --- a/plugins/opencvlux/opencvluxplugin.cpp +++ b/plugins/opencvlux/opencvluxplugin.cpp @@ -42,12 +42,10 @@ const std::string OpenCL = "OpenCL"; #include "debugout.h" -extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) { auto plugin = new AmbPlugin<OpenCvLuxPlugin>(routingengine, config); plugin->init(); - - return plugin; } OpenCvLuxPlugin::OpenCvLuxPlugin(AbstractRoutingEngine* re, map<string, string> config, AbstractSource &parent) diff --git a/plugins/testplugin/testplugin.cpp b/plugins/testplugin/testplugin.cpp index 58f35159..5fa32c56 100644 --- a/plugins/testplugin/testplugin.cpp +++ b/plugins/testplugin/testplugin.cpp @@ -373,10 +373,9 @@ int TestPlugin::supportedOperations() return Get | Set; } -extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) { - return new TestPlugin(routingengine, config); - + new TestPlugin(routingengine, config); } const string TestPlugin::uuid() { diff --git a/plugins/websocket/websocketsinkmanager.cpp b/plugins/websocket/websocketsinkmanager.cpp index 1bc74c93..b75db03a 100644 --- a/plugins/websocket/websocketsinkmanager.cpp +++ b/plugins/websocket/websocketsinkmanager.cpp @@ -43,11 +43,8 @@ static int websocket_callback(struct libwebsocket_context *context,struct libweb bool gioPollingFunc(GIOChannel *source,GIOCondition condition,gpointer data); WebSocketSinkManager::WebSocketSinkManager(AbstractRoutingEngine* engine, map<string, string> config) - :AbstractSinkManager(engine, config), partialMessageIndex(0), expectedMessageFrames(0) + :routingEngine(engine), configuration(config), partialMessageIndex(0), expectedMessageFrames(0) { - m_engine = engine; - - if(config.find("binaryProtocol") != config.end()) { doBinary = config["binaryProtocol"] == "true"; @@ -291,11 +288,10 @@ void WebSocketSinkManager::addSink(libwebsocket* socket, VehicleProperty::Proper WebSocketSink *sink = new WebSocketSink(m_engine, socket, uuid, property, property); m_sinkMap[property].push_back(sink); } -extern "C" AbstractSinkManager * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) { sinkManager = new WebSocketSinkManager(routingengine, config); sinkManager->init(); - return sinkManager; } void WebSocketSinkManager::disconnectAll(libwebsocket* socket) { diff --git a/plugins/websocket/websocketsinkmanager.h b/plugins/websocket/websocketsinkmanager.h index 9ffd3e34..1d1594e8 100644 --- a/plugins/websocket/websocketsinkmanager.h +++ b/plugins/websocket/websocketsinkmanager.h @@ -31,7 +31,7 @@ #include <stdlib.h> #include <QByteArray> -class WebSocketSinkManager: public AbstractSinkManager +class WebSocketSinkManager { public: WebSocketSinkManager(AbstractRoutingEngine* engine, map<string, string> config); @@ -60,6 +60,9 @@ private: AbstractRoutingEngine *m_engine; struct libwebsocket_protocols protocollist[2]; + AbstractRoutingEngine * routingEngine; + std::map<std::string, std::string> configuration; + }; #endif // WEBSOCKETSINKMANAGER_H diff --git a/plugins/wheel/wheelplugin.cpp b/plugins/wheel/wheelplugin.cpp index 6958bb92..0cbdf017 100644 --- a/plugins/wheel/wheelplugin.cpp +++ b/plugins/wheel/wheelplugin.cpp @@ -123,9 +123,9 @@ WheelSourcePlugin::~WheelSourcePlugin() -extern "C" AbstractSource * create(AbstractRoutingEngine* routingengine, map<string, string> config) +extern "C" void create(AbstractRoutingEngine* routingengine, map<string, string> config) { - return new WheelSourcePlugin(routingengine, config); + new WheelSourcePlugin(routingengine, config); } const string WheelSourcePlugin::uuid() |