diff options
Diffstat (limited to 'plugins/common/dbusplugin.h')
-rw-r--r-- | plugins/common/dbusplugin.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/plugins/common/dbusplugin.h b/plugins/common/dbusplugin.h new file mode 100644 index 00000000..21fa5fdc --- /dev/null +++ b/plugins/common/dbusplugin.h @@ -0,0 +1,74 @@ +/* + 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 DBUSSINK_H_ +#define DBUSSINK_H_ + +#include "abstractsink.h" +#include "abstractdbusinterface.h" +#include "varianttype.h" + +#include <map> + +class DBusSink : public AbstractSink, public AbstractDBusInterface +{ + +public: + DBusSink(std::string objectName, AbstractRoutingEngine* engine, GDBusConnection* connection, map<string, string> config = std::map<std::string, std::string>()); + virtual ~DBusSink() + { + for(auto i : propertyDBusMap) + { + delete i; + } + } + virtual void supportedChanged(const PropertyList & supportedProperties); + virtual void propertyChanged(AbstractPropertyType *value); + virtual const std::string uuid(); + + static std::map<std::string, std::string> dbusConfig; + + PropertyList wantsProperties() + { + PropertyList l; + for(auto i : propertyDBusMap) + { + l.push_back(i->ambPropertyName()); + } + + return l; + } + + void setSourceFilter(std::string sourceFilter) + { + mSourceFilter = sourceFilter; + } + + void setZoneFilter(Zone::Type zone) + { + zoneFilter = zone; + } + + void wantPropertyVariant(VehicleProperty::Property ambProperty, std::string propertyName, VariantType::Access access) + { + propertyDBusMap.push_back(new VariantType(routingEngine, ambProperty, propertyName, access)); + } + +}; + +#endif |