Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qdbusserver.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2016 Intel Corporation.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#include "qdbusserver.h"
6#include "qdbusconnection_p.h"
8#include "qdbusutil_p.h"
9
10#include <QtCore/private/qlocking_p.h>
11
12#ifndef QT_NO_DBUS
13
15
29 : QObject(parent), d(nullptr)
30{
31 if (address.isEmpty())
32 return;
33
34 if (!qdbus_loadLibDBus())
35 return;
36
38 if (!instance)
39 return;
40
41 instance->createServer(address, this);
42 Q_ASSERT(d != nullptr);
43}
44
52#ifdef Q_OS_UNIX
53 // Use Unix sockets on Unix systems only
54 QStringLiteral("unix:tmpdir=/tmp"),
55#else
56 QStringLiteral("tcp:"),
57#endif
58 parent)
59{
60}
61
66{
67 if (!d)
68 return;
69
71 if (!manager)
72 return;
73
74 QWriteLocker writeLocker(&d->lock);
75 manager->removeConnections(d->serverConnectionNames);
76 d->serverConnectionNames.clear();
77
78 d->serverObject = nullptr;
79 d->ref.storeRelaxed(0);
80 d->deleteLater();
81}
82
89{
90 return d && d->server && q_dbus_server_get_is_connected(d->server);
91}
92
102
107{
109 if (d && d->server) {
110 char *c = q_dbus_server_get_address(d->server);
112 q_dbus_free(c);
113 }
114
115 return addr;
116}
117
129{
130 if (!d)
131 return;
132
134}
135
144{
145 if (!d)
146 return false;
147
149}
150
159
160#include "moc_qdbusserver.cpp"
161
162#endif // QT_NO_DBUS
void storeRelaxed(T newValue) noexcept
static QDBusConnectionManager * instance()
void createServer(const QString &address, QDBusServer *server)
\inmodule QtDBus
Definition qdbuserror.h:21
\inmodule QtDBus
Definition qdbusserver.h:21
bool isAnonymousAuthenticationAllowed() const
QDBusError lastError() const
Returns the last error that happened in this server.
bool isConnected() const
Returns true if this QDBusServer object is connected.
QString address() const
Returns the address this server is associated with.
QDBusServer(const QString &address, QObject *parent=nullptr)
Constructs a QDBusServer with the given address, and the given parent.
void setAnonymousAuthenticationAllowed(bool value)
virtual ~QDBusServer()
Destructs a QDBusServer.
\inmodule QtCore
Definition qobject.h:103
void deleteLater()
\threadsafe
Definition qobject.cpp:2435
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QString fromUtf8(QByteArrayView utf8)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:6018
\inmodule QtCore
QString disconnectedErrorMessage()
Combined button and popup list for selecting options.
bool qdbus_loadLibDBus()
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
const GLubyte * c
GLenum const void * addr
GLuint GLuint64EXT address
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define QStringLiteral(str)
#define Q_OS_UNIX
QObject::connect nullptr
QNetworkAccessManager manager