timestamp: fix currentTime() problem
[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 = std::map<std::string, std::string>());
33         virtual ~DBusSink()
34         {
35                 for(auto i : propertyDBusMap)
36                 {
37                         delete i;
38                 }
39         }
40         virtual void supportedChanged(const PropertyList & supportedProperties);
41         virtual void propertyChanged(AbstractPropertyType *value);
42         virtual const std::string uuid();
43
44         static std::map<std::string, std::string> dbusConfig;
45
46         PropertyList wantsProperties()
47         {
48                 PropertyList l;
49                 for(auto i : propertyDBusMap)
50                 {
51                         l.push_back(i->ambPropertyName());
52                 }
53
54                 return l;
55         }
56
57         void setSourceFilter(std::string sourceFilter)
58         {
59                 mSourceFilter = sourceFilter;
60         }
61
62         void setZoneFilter(Zone::Type zone)
63         {
64                 zoneFilter = zone;
65         }
66
67         void wantPropertyVariant(VehicleProperty::Property ambProperty, std::string propertyName, VariantType::Access access)
68         {
69                 propertyDBusMap.push_back(new VariantType(routingEngine, ambProperty, propertyName, access));
70         }
71
72 };
73
74 #endif