1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
/* -*- C++ -*-
*
* Copyright (C) 2005 Thiago Macieira <thiago@kde.org>
* Copyright (C) 2006 Trolltech AS. All rights reserved.
* Author: Thiago Macieira <thiago.macieira@trolltech.com>
*
* Licensed under the Academic Free License version 2.1
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef QDBUS_STANDARD_INTERFACES_H
#define QDBUS_STANDARD_INTERFACES_H
#include "qdbusinterface.h"
#include "qdbusreply.h"
#include <QtCore/qstring.h>
#include <QtCore/qstringlist.h>
#include <dbus/dbus.h>
class QDBusConnection;
class QDBUS_EXPORT QDBusPeerInterface: public QDBusInterface
{
public:
static inline const char* staticInterfaceName()
{ return DBUS_INTERFACE_PEER; }
static inline const char* staticIntrospectionData()
{
return
" <interface name=\"org.freedesktop.DBus.Peer\">\n"
" <method name=\"Ping\" />\n"
" </interface>\n";
}
public:
explicit QDBusPeerInterface(const QDBusObject& obj)
: QDBusInterface(obj, QLatin1String(staticInterfaceName()))
{ }
~QDBusPeerInterface();
inline virtual QString introspectionData() const
{ return QString::fromLatin1(staticIntrospectionData()); }
inline QDBusReply<void> ping()
{ return call(QLatin1String("Ping")); }
};
class QDBUS_EXPORT QDBusIntrospectableInterface: public QDBusInterface
{
public:
static inline const char* staticInterfaceName()
{ return DBUS_INTERFACE_INTROSPECTABLE; }
static inline const char* staticIntrospectionData()
{
return
" <interface name=\"org.freedesktop.DBus.Introspectable\">\n"
" <method name=\"Introspect\">\n"
" <arg name=\"xml_data\" type=\"s\" direction=\"out\"/>\n"
" </method>\n"
" </interface>\n";
}
public:
explicit QDBusIntrospectableInterface(const QDBusObject& obj)
: QDBusInterface(obj, QLatin1String(staticInterfaceName()))
{ }
~QDBusIntrospectableInterface();
inline virtual QString introspectionData() const
{ return QLatin1String(staticIntrospectionData()); }
inline QDBusReply<QString> introspect()
{ return call(QLatin1String("Introspect")); }
};
class QDBUS_EXPORT QDBusPropertiesInterface: public QDBusInterface
{
public:
static inline const char* staticInterfaceName()
{ return DBUS_INTERFACE_PROPERTIES; }
static inline const char* staticIntrospectionData()
{
return
" <interface name=\"org.freedesktop.DBus.Properties\">\n"
" <method name=\"Get\">\n"
" <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n"
" <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n"
" <arg name=\"value\" type=\"v\" direction=\"out\"/>\n"
" </method>\n"
" <method name=\"Set\">\n"
" <arg name=\"interface_name\" type=\"s\" direction=\"in\"/>\n"
" <arg name=\"property_name\" type=\"s\" direction=\"in\"/>\n"
" <arg name=\"value\" type=\"v\" direction=\"in\"/>\n"
" </method>\n"
" </interface>\n";
}
public:
explicit QDBusPropertiesInterface(const QDBusObject& obj)
: QDBusInterface(obj, QLatin1String(staticInterfaceName()))
{ }
~QDBusPropertiesInterface();
inline virtual QString introspectionData() const
{ return QString::fromLatin1(staticIntrospectionData()); }
inline QDBusReply<void> set(const QString& interfaceName, const QString& propertyName,
const QDBusVariant &value)
{ return call(QLatin1String("Set.ssv"), interfaceName, propertyName, value); }
inline QDBusReply<QDBusVariant> get(const QString& interfaceName, const QString& propertyName)
{ return call(QLatin1String("Get.ss"), interfaceName, propertyName); }
};
#if 0
class QDBUS_EXPORT QDBusBusInterface: public QDBusInterface
{
public:
static inline const char* staticInterfaceName()
{ return DBUS_INTERFACE_DBUS; }
static const char* staticIntrospectionData();
public:
explicit QDBusBusInterface(const QDBusObject& obj)
: QDBusInterface(obj, staticInterfaceName())
{ }
~QDBusBusInterface();
inline virtual QString introspectionData() const
{ return staticIntrospectionData(); }
inline QDBusReply<unsigned> requestName(const QString& name, unsigned flags)
{ return call(QLatin1String("RequestName.su"), name, flags); }
inline QDBusReply<unsigned> releaseName(const QString& name)
{ return call(QLatin1String("ReleaseName.s"), name); }
inline QDBusReply<unsigned> startServiceByName(const QString& name, unsigned flags)
{ return call(QLatin1String("StartServiceByName.su"), name, flags); }
inline QDBusReply<QString> Hello()
{ return call(QLatin1String("Hello")); }
inline QDBusReply<bool> nameHasOwner(const QString& name)
{ return call(QLatin1String("NameHasOwner.s"), name); }
inline QDBusReply<QStringList> listNames()
{ return call(QLatin1String("ListNames")); }
inline QDBusReply<void> addMatch(const QString& rule)
{ return call(QLatin1String("AddMatch"), rule); }
inline QDBusReply<void> removeMatch(const QString& rule)
{ return call(QLatin1String("RemoveMatch"), rule); }
inline QDBusReply<QString> getNameOwner(const QString& name)
{ return call(QLatin1String("GetNameOwner.s"), name); }
inline QDBusReply<QStringList> listQueuedOwners(const QString& name)
{ return call(QLatin1String("ListQueuedOwners.s"), name); }
inline QDBusReply<quint32> getConnectionUnixUser(const QString& connectionName)
{ return call(QLatin1String("GetConnectionUnixUser.s"), connectionName); }
inline QDBusReply<quint32> getConnectionUnixProcessID(const QString& connectionName)
{ return call(QLatin1String("GetConnectionUnixProcessID.s"), connectionName); }
inline QDBusReply<QByteArray> getConnectionSELinuxSecurityContext(const QString& connectionName)
{ return call(QLatin1String("GetConnectionSELinuxSecurityContext.s"), connectionName); }
inline QDBusReply<void> reloadConfig()
{ return call(QLatin1String("ReloadConfig")); }
};
#endif
namespace org {
namespace freedesktop {
namespace DBus {
typedef ::QDBusPeerInterface Peer;
typedef ::QDBusIntrospectableInterface Introspectable;
typedef ::QDBusPropertiesInterface Properties;
}
}
}
#endif
|