silence dbus-send output
[harmattan/cameraplus] / src / dbusservice.h
1 // -*- c++ -*-
2
3 /*!
4  * This file is part of CameraPlus.
5  *
6  * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21  */
22
23 #ifndef DBUS_SERVICE_H
24 #define DBUS_SERVICE_H
25
26 #include <QObject>
27 #include <QVariant>
28 #include <QHash>
29
30 class PlatformSettings;
31
32 class DbusService : public QObject {
33   Q_OBJECT
34
35   Q_PROPERTY(PlatformSettings* settings READ settings WRITE setSettings NOTIFY settingsChanged);
36   Q_PROPERTY(bool enabled READ isEnabled NOTIFY isEnabledChanged);
37
38 public:
39   DbusService(QObject *parent = 0);
40   ~DbusService();
41
42   PlatformSettings *settings() const;
43   void setSettings(PlatformSettings *settings);
44
45   void setName(const QString& name);
46
47   bool isEnabled() const;
48
49   bool asyncCall(const QString& method, const QVariant& arg = QVariant());
50
51 signals:
52   void settingsChanged();
53   void nameChanged();
54   void isEnabledChanged();
55
56 private:
57   void init();
58
59   PlatformSettings *m_settings;
60   QString m_name;
61
62   QString m_path;
63   QString m_interface;
64   QString m_dest;
65
66   bool m_enabled;
67
68   QMap<QString, QString> m_methods;
69 };
70
71 #endif /* DBUS_SERVICE_H */