Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qdbuspendingcall_p.h
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// Qt-Security score:significant reason:default
5
6//
7// W A R N I N G
8// -------------
9//
10// This file is not part of the public API. This header file may
11// change from version to version without notice, or even be
12// removed.
13//
14// We mean it.
15//
16//
17
18#ifndef QDBUSPENDINGCALL_P_H
19#define QDBUSPENDINGCALL_P_H
20
21#include <QtDBus/private/qtdbusglobal_p.h>
22#include <qlist.h>
23#include <qmutex.h>
24#include <qpointer.h>
25#include <qshareddata.h>
26#include <qwaitcondition.h>
27
28#include "qdbusmessage.h"
30
31#ifndef QT_NO_DBUS
32
34
35class QDBusPendingCall;
36class QDBusPendingCallWatcher;
38class QDBusConnectionPrivate;
39
41{
42public:
43 // {
44 // set only during construction:
45 const QDBusMessage sentMessage;
46 QDBusConnectionPrivate * const connection;
47
48 // for the callback mechanism (see setReplyCallback and QDBusConnectionPrivate::sendWithReplyAsync)
52
53 // }
54
55 mutable QMutex mutex;
57
58 // {
59 // protected by the mutex above:
61 QDBusMessage replyMessage;
62 DBusPendingCall *pending;
64 // }
65
66 QDBusPendingCallPrivate(const QDBusMessage &sent, QDBusConnectionPrivate *connection)
67 : sentMessage(sent), connection(connection), watcherHelper(nullptr), pending(nullptr)
68 { }
70 bool setReplyCallback(QObject *target, const char *member);
71 void waitForFinished();
73 void setMetaTypes(int count, const QMetaType *types);
75};
76
78{
80public:
82
83 void emitSignals(const QDBusMessage &replyMessage, const QDBusMessage &sentMessage)
84 {
85 if (replyMessage.type() == QDBusMessage::ReplyMessage)
86 emit reply(replyMessage);
87 else
88 emit error(QDBusError(replyMessage), sentMessage);
89 emit finished();
90 }
91
93 void finished();
94 void reply(const QDBusMessage &msg);
95 void error(const QDBusError &error, const QDBusMessage &msg);
96};
97
98QT_END_NAMESPACE
99
100#endif // QT_NO_DBUS
101#endif
static QDBusConnectionManager * instance()
QDBusConnectionPrivate * busConnection(QDBusConnection::BusType type)
void removeConnections(const QStringList &names)
QPointer< QObject > receiver
QDBusPendingCallWatcherHelper * watcherHelper
QWaitCondition waitForFinishedCondition
bool setReplyCallback(QObject *target, const char *member)
QDBusConnectionPrivate *const connection
QList< QMetaType > metaTypes
void setMetaTypes(int count, const QMetaType *types)
QDBusPendingCallPrivate(const QDBusMessage &sent, QDBusConnectionPrivate *connection)
const QDBusMessage sentMessage
void error(const QDBusError &error, const QDBusMessage &msg)
void emitSignals(const QDBusMessage &replyMessage, const QDBusMessage &sentMessage)
void reply(const QDBusMessage &msg)
\inmodule QtCore
Definition qshareddata.h:19