summaryrefslogtreecommitdiffstats
path: root/qt/qdbusstandardinterfaces.cpp
blob: e444d9763bb3be86b4bc7d2f26fe29346313d53e (plain)
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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
/* -*- 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.
 *
 */

#include "qdbusstandardinterfaces.h"

/*!
    \page StandardInterfaces Standard D-Bus Interfaces

    The standard, well-known interfaces provided by D-Bus are as follows:
    \value org.freedesktop.DBus.Peer            Peer detection
    \value org.freedesktop.DBus.Introspectable  Introspection of remote object's contents
    \value org.freedesktop.DBus.Properties      Access to remote object's properties

    The QtDBus implementation provides easy access to those three interfaces with the
    QDBusPeerInterface, QDBusIntrospectableInterface and QDBusPropertiesInterface classes. As a
    convenience form, they can also be accessed by the classes org::freedesktop::DBus::Peer,
    org::freedesktop::DBus::Introspectable and org::freedesktop::DBus::Properties.

    Those three classes also illustrate code-generation by the \ref dbusidl2cpp tool: the methods
    defined in those three interfaces are provided as member functions in the QtDBus classes, which
    are capable of type-checking the parameters at compile-time, in order to guarantee that they
    conform to the types expected by the remote objects.
*/

/*!
    \typedef org::freedesktop::DBus::Peer
*/

/*!
    \typedef org::freedesktop::DBus::Introspectable
*/

/*!
    \typedef org::freedesktop::DBus::Properties
*/

/*!
    \class QDBusPeerInterface
    \brief Provides access to the \a org.freedesktop.DBus.Peer interface.

    This interface has only one method: ping(). Calling this method will generate a success reply if
    the target service exists or a failure if it doesn't. The target object path is irrelevant in
    this case.
*/

/*!
    \fn QDBusPeerInterface::staticInterfaceName
    Returns the interface name: "org.freedesktop.DBus.Peer"
*/

/*!
    \fn QDBusPeerInterface::staticIntrospectionData
    Returns the XML fragment corresponding to this interface's definition.
*/

/*!
    \fn QDBusPeerInterface::QDBusPeerInterface(const QDBusObject &)
    Creates a QDBusPeerInterface object accessing interface the \a org.freedesktop.DBus.Peer
    interface on object \p obj.
*/

/*!
    \fn QDBusPeerInterface::introspectionData() const
    Returns the XML fragment corresponding to this interface's definition.
*/

/*!
    \fn QDBusPeerInterface::ping
    Emits an \a org.freedesktop.DBus.Peer.Ping call to the remote object.
*/

/*!
    Destroys this object.
*/
QDBusPeerInterface::~QDBusPeerInterface()
{
}

/*!
    \class QDBusIntrospectableInterface
     \brief  Provides access to the \a org.freedesktop.DBus.Introspectable interface.

    The \a Introspectable interface is used to obtain information about the remote object's
    internals. Its one method, \a introspect(), returns a XML document describing the interfaces and
    child objects of a remote object in the D-Bus bus.

    The QtDBus implementation automatically introspects remote objects in order to construct the
    introspection structures found in QDBusIntrospection and QDBusInterface.

    \sa QDBusInterface, QDBusIntrospection, QDBusObject::interfaces, QDBusObject::childObjects,
        QDBusObject::introspect
*/

/*!
    \fn QDBusIntrospectableInterface::staticInterfaceName
    Returns the interface name: "org.freedesktop.DBus.Introspection"
*/

/*!
    \fn QDBusIntrospectableInterface::staticIntrospectionData
    Returns the XML fragment corresponding to this interface's definition.
*/

/*!
    \fn QDBusIntrospectableInterface::QDBusIntrospectableInterface(const QDBusObject &)
    Creates a QDBusIntrospectableInterface object accessing interface the \a
    org.freedesktop.DBus.Introspectable interface on object \p obj.
*/

/*!
    \fn QDBusIntrospectableInterface::introspectionData() const
    Returns the XML fragment corresponding to this interface's definition.
*/

/*!
    \fn QDBusIntrospectableInterface::introspect
    Places an \a org.freedesktop.DBus.Introspectable.Introspect call to the remote object and
    return the XML result.
*/

/*!
    Destroys the object.
*/
QDBusIntrospectableInterface::~QDBusIntrospectableInterface()
{
}

/*!
    \class QDBusPropertiesInterface
    \brief Provides access to the \a org.freedesktop.DBus.Properties interface

    D-Bus interfaces can export properties, much like the ones used in QObject. In order to access
    those properties, two methods are defined in the \a org.freedesktop.DBus.Properties interface:
    get() and set(), which are similar in functionality to QObject::property and
    QObject::setProperty.
*/

/*!
    \fn QDBusPropertiesInterface::staticInterfaceName
    Returns the interface name: "org.freedesktop.DBus.Properties"
*/

/*!
    \fn QDBusPropertiesInterface::staticIntrospectionData
    Returns the XML fragment corresponding to this interface's definition.
*/

/*!
    \fn QDBusPropertiesInterface::QDBusPropertiesInterface(const QDBusObject &)
    Creates a QDBusPropertiesInterface object accessing interface the \a
    org.freedesktop.DBus.Properties interface on object \p obj.
*/

/*!
    \fn QDBusPropertiesInterface::introspectionData() const
    Returns the XML fragment corresponding to this interface's definition.
*/

/*!
    \fn QDBusPropertiesInterface::set(const QString &interfaceName, const QString &propertyName,
                                      const QDBusVariant &value)
    Sets the property named \a propertyName in interface \a interfaceName in the remote object this
    QDBusPropertiesInterface object points to to the value specified by \a value. This function is
    analogous to QObject::setProperty.

    If the type of the \a value parameter is not what the remote interface declared, the result is
    undefined. See QDBusInterface::properties for information on remote properties.

    \sa QDBusInterface::setProperty
*/

/*!
    \fn QDBusPropertiesInterface::get(const QString &interfaceName, const QString &propertyName)
    Retrieves the value of property named \a propertyName in interface \a interfaceName in the
    remote object this QDBusPropertiesInterface object points to. This function is analogous to
    QObject::property.

    \sa QDBusInterface::property
*/

/*!
    Destroys the object.
*/
QDBusPropertiesInterface::~QDBusPropertiesInterface()
{
}

#if 0
/*!
    \class QDBusBusInterface
    \internal
    \brief Provides access to the \a org.freedesktop.DBus interface found in the D-Bus server
    daemon.

    The org.freedesktop.DBus interface is found only in the D-Bus daemon server. It is used to
    communicate with it and to request information about the bus itself and other applications in
    it.

    Normally, you don't need to use this interface in your application. Instead, use the methods in
    QDBusConnection.

    \sa QDBusConnection
*/

QDBusBusInterface::~QDBusBusInterface()
{
}

const char* QDBusBusInterface::staticIntrospectionData()
{
    // FIXME!
    // This should be auto-generated!

    return
        "<interface name=\"org.freedesktop.DBus\">"
        "<method name=\"RequestName\">"
        "<arg direction=\"in\" type=\"s\"/>"
        "<arg direction=\"in\" type=\"u\"/>"
        "<arg direction=\"out\" type=\"u\"/>"
        "</method>"
        "<method name=\"ReleaseName\">"
        "<arg direction=\"in\" type=\"s\"/>"
        "<arg direction=\"out\" type=\"u\"/>"
        "</method>"
        "<method name=\"StartServiceByName\">"
        "<arg direction=\"in\" type=\"s\"/>"
        "<arg direction=\"in\" type=\"u\"/>"
        "<arg direction=\"out\" type=\"u\"/>"
        "</method>"
        "<method name=\"Hello\">"
        "<arg direction=\"out\" type=\"s\"/>"
        "</method>"
        "<method name=\"NameHasOwner\">"
        "<arg direction=\"in\" type=\"s\"/>"
        "<arg direction=\"out\" type=\"b\"/>"
        "</method>"
        "<method name=\"ListNames\">"
        "<arg direction=\"out\" type=\"as\"/>"
        "</method>"
        "<method name=\"AddMatch\">"
        "<arg direction=\"in\" type=\"s\"/>"
        "</method>"
        "<method name=\"RemoveMatch\">"
        "<arg direction=\"in\" type=\"s\"/>"
        "</method>"
        "<method name=\"GetNameOwner\">"
        "<arg direction=\"in\" type=\"s\"/>"
        "<arg direction=\"out\" type=\"s\"/>"
        "</method>"
        "<method name=\"ListQueuedOwners\">"
        "<arg direction=\"in\" type=\"s\"/>"
        "<arg direction=\"out\" type=\"as\"/>"
        "</method>"
        "<method name=\"GetConnectionUnixUser\">"
        "<arg direction=\"in\" type=\"s\"/>"
        "<arg direction=\"out\" type=\"u\"/>"
        "</method>"
        "<method name=\"GetConnectionUnixProcessID\">"
        "<arg direction=\"in\" type=\"s\"/>"
        "<arg direction=\"out\" type=\"u\"/>"
        "</method>"
        "<method name=\"GetConnectionSELinuxSecurityContext\">"
        "<arg direction=\"in\" type=\"s\"/>"
        "<arg direction=\"out\" type=\"ay\"/>"
        "</method>"
        "<method name=\"ReloadConfig\">"
        "</method>"
        "<signal name=\"NameOwnerChanged\">"
        "<arg type=\"s\"/>"
        "<arg type=\"s\"/>"
        "<arg type=\"s\"/>"
        "</signal>"
        "<signal name=\"NameLost\">"
        "<arg type=\"s\"/>"
        "</signal>"
        "<signal name=\"NameAcquired\">"
        "<arg type=\"s\"/>"
        "</signal>"
        "</interface>";
}
#endif