1/****************************************************************************
2**
3** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4** Contact: http://www.qt-project.org/legal
5**
6** This file is part of the QtDBus module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Digia. For licensing terms and
14** conditions see http://qt.digia.com/licensing. For further information
15** use the contact form at http://qt.digia.com/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 2.1 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 2.1 requirements
23** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24**
25** In addition, as a special exception, Digia gives you certain additional
26** rights. These rights are described in the Digia Qt LGPL Exception
27** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28**
29** GNU General Public License Usage
30** Alternatively, this file may be used under the terms of the GNU
31** General Public License version 3.0 as published by the Free Software
32** Foundation and appearing in the file LICENSE.GPL included in the
33** packaging of this file. Please review the following information to
34** ensure the GNU General Public License version 3.0 requirements will be
35** met: http://www.gnu.org/copyleft/gpl.html.
36**
37**
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QDBUSABSTRACTINTERFACE_H
43#define QDBUSABSTRACTINTERFACE_H
44
45#include <QtCore/qstring.h>
46#include <QtCore/qvariant.h>
47#include <QtCore/qlist.h>
48#include <QtCore/qobject.h>
49
50#include <QtDBus/qdbusmessage.h>
51#include <QtDBus/qdbusextratypes.h>
52#include <QtDBus/qdbusconnection.h>
53
54#ifndef QT_NO_DBUS
55
56QT_BEGIN_HEADER
57
58QT_BEGIN_NAMESPACE
59
60QT_MODULE(DBus)
61
62class QDBusError;
63class QDBusPendingCall;
64
65class QDBusAbstractInterfacePrivate;
66
67class Q_DBUS_EXPORT QDBusAbstractInterfaceBase: public QObject
68{
69public:
70 int qt_metacall(QMetaObject::Call, int, void**);
71protected:
72 QDBusAbstractInterfaceBase(QDBusAbstractInterfacePrivate &dd, QObject *parent);
73private:
74 Q_DECLARE_PRIVATE(QDBusAbstractInterface)
75};
76
77class Q_DBUS_EXPORT QDBusAbstractInterface:
78#ifdef Q_QDOC
79 public QObject
80#else
81 public QDBusAbstractInterfaceBase
82#endif
83{
84 Q_OBJECT
85
86public:
87 virtual ~QDBusAbstractInterface();
88 bool isValid() const;
89
90 QDBusConnection connection() const;
91
92 QString service() const;
93 QString path() const;
94 QString interface() const;
95
96 QDBusError lastError() const;
97
98 void setTimeout(int timeout);
99 int timeout() const;
100
101 QDBusMessage call(const QString &method,
102 const QVariant &arg1 = QVariant(),
103 const QVariant &arg2 = QVariant(),
104 const QVariant &arg3 = QVariant(),
105 const QVariant &arg4 = QVariant(),
106 const QVariant &arg5 = QVariant(),
107 const QVariant &arg6 = QVariant(),
108 const QVariant &arg7 = QVariant(),
109 const QVariant &arg8 = QVariant());
110
111 QDBusMessage call(QDBus::CallMode mode,
112 const QString &method,
113 const QVariant &arg1 = QVariant(),
114 const QVariant &arg2 = QVariant(),
115 const QVariant &arg3 = QVariant(),
116 const QVariant &arg4 = QVariant(),
117 const QVariant &arg5 = QVariant(),
118 const QVariant &arg6 = QVariant(),
119 const QVariant &arg7 = QVariant(),
120 const QVariant &arg8 = QVariant());
121
122 QDBusMessage callWithArgumentList(QDBus::CallMode mode,
123 const QString &method,
124 const QList<QVariant> &args);
125
126 bool callWithCallback(const QString &method,
127 const QList<QVariant> &args,
128 QObject *receiver, const char *member, const char *errorSlot);
129 bool callWithCallback(const QString &method,
130 const QList<QVariant> &args,
131 QObject *receiver, const char *member);
132
133 QDBusPendingCall asyncCall(const QString &method,
134 const QVariant &arg1 = QVariant(),
135 const QVariant &arg2 = QVariant(),
136 const QVariant &arg3 = QVariant(),
137 const QVariant &arg4 = QVariant(),
138 const QVariant &arg5 = QVariant(),
139 const QVariant &arg6 = QVariant(),
140 const QVariant &arg7 = QVariant(),
141 const QVariant &arg8 = QVariant());
142 QDBusPendingCall asyncCallWithArgumentList(const QString &method,
143 const QList<QVariant> &args);
144
145protected:
146 QDBusAbstractInterface(const QString &service, const QString &path, const char *interface,
147 const QDBusConnection &connection, QObject *parent);
148 QDBusAbstractInterface(QDBusAbstractInterfacePrivate &, QObject *parent);
149
150 void connectNotify(const char *signal);
151 void disconnectNotify(const char *signal);
152 QVariant internalPropGet(const char *propname) const;
153 void internalPropSet(const char *propname, const QVariant &value);
154 QDBusMessage internalConstCall(QDBus::CallMode mode,
155 const QString &method,
156 const QList<QVariant> &args = QList<QVariant>()) const;
157
158private:
159 Q_DECLARE_PRIVATE(QDBusAbstractInterface)
160 Q_PRIVATE_SLOT(d_func(), void _q_serviceOwnerChanged(QString,QString,QString))
161};
162
163QT_END_NAMESPACE
164
165QT_END_HEADER
166
167#endif // QT_NO_DBUS
168#endif
169