reverted varianttype
[profile/ivi/automotive-message-broker.git] / plugins / common / dbusplugin.h
1 /*
2         Copyright (C) 2012  Intel Corporation
3
4         This library is free software; you can redistribute it and/or
5         modify it under the terms of the GNU Lesser General Public
6         License as published by the Free Software Foundation; either
7         version 2.1 of the License, or (at your option) any later version.
8
9         This library is distributed in the hope that it will be useful,
10         but WITHOUT ANY WARRANTY; without even the implied warranty of
11         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12         Lesser General Public License for more details.
13
14         You should have received a copy of the GNU Lesser General Public
15         License along with this library; if not, write to the Free Software
16         Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
17 */
18
19 #ifndef DBUSSINK_H_
20 #define DBUSSINK_H_
21
22 #include "abstractsink.h"
23 #include "abstractdbusinterface.h"
24 #include "varianttype.h"
25
26 #include <map>
27
28 class DBusSink : public AbstractSink, public AbstractDBusInterface
29 {
30
31 public:
32         DBusSink(std::string objectName, AbstractRoutingEngine* engine, GDBusConnection* connection, map<string, string> config);
33         virtual ~DBusSink() {
34                 for(auto i : propertyDBusMap)
35                 {
36                         delete i;
37                 }
38         }
39         virtual void supportedChanged(const PropertyList & supportedProperties);
40         virtual void propertyChanged(AbstractPropertyType *value);
41         virtual const std::string uuid();
42
43         PropertyList wantsProperties()
44         {
45                 PropertyList l;
46                 for(auto i : propertyDBusMap)
47                 {
48                         l.push_back(i->ambPropertyName());
49                 }
50
51                 return l;
52         }
53
54         void setSourceFilter(std::string sourceFilter)
55         {
56                 mSourceFilter = sourceFilter;
57         }
58
59         void setZoneFilter(Zone::Type zone)
60         {
61                 zoneFilter = zone;
62         }
63
64 protected:
65
66         void wantPropertyVariant(VehicleProperty::Property ambProperty, std::string propertyName, VariantType::Access access)
67         {
68                 propertyDBusMap.push_back(new VariantType(routingEngine, ambProperty, propertyName, access));
69         }
70
71 };
72
73 #endif