2 Copyright (C) 2012 Intel Corporation
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.
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.
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
19 #ifndef ABSTRACTDBUSINTERFACE_H
20 #define ABSTRACTDBUSINTERFACE_H
24 #include <unordered_map>
26 #include <boost/any.hpp>
29 class AbstractProperty;
33 class AbstractDBusInterface
37 AbstractDBusInterface(string interfaceName, string objectPath, GDBusConnection* connection);
40 void setDBusConnection(GDBusConnection* connection)
42 mConnection = connection;
45 void registerObject();
46 void unregisterObject();
48 void addProperty(AbstractProperty* property);
49 virtual void updateValue(AbstractProperty* property);
53 void startRegistration();
55 static GVariant *getProperty(GDBusConnection * connection, const gchar * sender, const gchar *objectPath,
56 const gchar *interfaceName, const gchar * propertyName, GError** error,
58 static gboolean setProperty(GDBusConnection * connection, const gchar * sender, const gchar *objectPath,
59 const gchar *interfaceName, const gchar * propertyName, GVariant *value,
60 GError** error, gpointer userData);
62 virtual void setProperty(string propertyName, GVariant * value);
63 virtual GVariant * getProperty(string propertyName);
65 unordered_map<string, AbstractProperty*> properties;
68 string mInterfaceName;
70 string introspectionXml;
71 GDBusConnection * mConnection;
72 static unordered_map<string, AbstractDBusInterface*> interfaceMap;
76 #endif // ABSTRACTDBUSINTERFACE_H