1// qdbusconnection.sip generated by MetaSIP
2//
3// This file is part of the QtDBus Python extension module.
4//
5// Copyright (c) 2021 Riverbank Computing Limited <info@riverbankcomputing.com>
6//
7// This file is part of PyQt5.
8//
9// This file may be used under the terms of the GNU General Public License
10// version 3.0 as published by the Free Software Foundation and appearing in
11// the file LICENSE included in the packaging of this file.  Please review the
12// following information to ensure the GNU General Public License version 3.0
13// requirements will be met: http://www.gnu.org/copyleft/gpl.html.
14//
15// If you do not wish to use this file under the terms of the GPL version 3.0
16// then you may purchase a commercial license.  For more information contact
17// info@riverbankcomputing.com.
18//
19// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
20// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
21
22
23namespace QDBus
24{
25%TypeHeaderCode
26#include <qdbusconnection.h>
27%End
28
29    enum CallMode
30    {
31        NoBlock,
32        Block,
33        BlockWithGui,
34        AutoDetect,
35    };
36};
37
38class QDBusConnection
39{
40%TypeHeaderCode
41#include <qdbusconnection.h>
42%End
43
44public:
45    enum BusType
46    {
47        SessionBus,
48        SystemBus,
49        ActivationBus,
50    };
51
52    enum RegisterOption
53    {
54        ExportAdaptors,
55        ExportScriptableSlots,
56        ExportScriptableSignals,
57        ExportScriptableProperties,
58        ExportScriptableInvokables,
59        ExportScriptableContents,
60        ExportNonScriptableSlots,
61        ExportNonScriptableSignals,
62        ExportNonScriptableProperties,
63        ExportNonScriptableInvokables,
64        ExportNonScriptableContents,
65        ExportAllSlots,
66        ExportAllSignals,
67        ExportAllProperties,
68        ExportAllInvokables,
69        ExportAllContents,
70        ExportAllSignal,
71        ExportChildObjects,
72    };
73
74    enum UnregisterMode
75    {
76        UnregisterNode,
77        UnregisterTree,
78    };
79
80    typedef QFlags<QDBusConnection::RegisterOption> RegisterOptions;
81
82    enum ConnectionCapability
83    {
84        UnixFileDescriptorPassing,
85    };
86
87    typedef QFlags<QDBusConnection::ConnectionCapability> ConnectionCapabilities;
88    explicit QDBusConnection(const QString &name);
89    QDBusConnection(const QDBusConnection &other);
90    ~QDBusConnection();
91    bool isConnected() const;
92    QString baseService() const;
93    QDBusError lastError() const;
94    QString name() const;
95    QDBusConnection::ConnectionCapabilities connectionCapabilities() const;
96    bool send(const QDBusMessage &message) const;
97    bool callWithCallback(const QDBusMessage &message, SIP_PYOBJECT returnMethod /TypeHint="PYQT_SLOT"/, SIP_PYOBJECT errorMethod /TypeHint="PYQT_SLOT"/, int timeout = -1) const;
98%MethodCode
99        QObject *receiver;
100        QByteArray return_slot;
101
102        if ((sipError = pyqt5_qtdbus_get_pyqtslot_parts(a1, &receiver, return_slot)) == sipErrorNone)
103        {
104            QObject *error_receiver;
105            QByteArray error_slot;
106
107            if ((sipError = pyqt5_qtdbus_get_pyqtslot_parts(a2, &error_receiver, error_slot)) == sipErrorNone)
108            {
109                if (receiver == error_receiver)
110                {
111                    sipRes = sipCpp->callWithCallback(*a0, receiver, return_slot.constData(), error_slot.constData(), a3);
112                }
113                else
114                {
115                    PyErr_SetString(PyExc_ValueError,
116                            "the return and error methods must be bound to the same QObject instance");
117                    sipError = sipErrorFail;
118                }
119            }
120            else if (sipError == sipErrorContinue)
121            {
122                sipError = sipBadCallableArg(2, a2);
123            }
124        }
125        else if (sipError == sipErrorContinue)
126        {
127            sipError = sipBadCallableArg(1, a1);
128        }
129%End
130
131    QDBusMessage call(const QDBusMessage &message, QDBus::CallMode mode = QDBus::Block, int timeout = -1) const /ReleaseGIL/;
132    QDBusPendingCall asyncCall(const QDBusMessage &message, int timeout = -1) const;
133    bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/;
134%MethodCode
135        QObject *receiver;
136        QByteArray slot;
137
138        if ((sipError = pyqt5_qtdbus_get_pyqtslot_parts(a4, &receiver, slot)) == sipErrorNone)
139        {
140            Py_BEGIN_ALLOW_THREADS
141            sipRes = sipCpp->connect(*a0, *a1, *a2, *a3, receiver, slot.constData());
142            Py_END_ALLOW_THREADS
143        }
144        else if (sipError == sipErrorContinue)
145        {
146            sipError = sipBadCallableArg(4, a4);
147        }
148%End
149
150    bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, const QString &signature, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/;
151%MethodCode
152        QObject *receiver;
153        QByteArray slot;
154
155        if ((sipError = pyqt5_qtdbus_get_pyqtslot_parts(a5, &receiver, slot)) == sipErrorNone)
156        {
157            Py_BEGIN_ALLOW_THREADS
158            sipRes = sipCpp->connect(*a0, *a1, *a2, *a3, *a4, receiver, slot.constData());
159            Py_END_ALLOW_THREADS
160        }
161        else if (sipError == sipErrorContinue)
162        {
163            sipError = sipBadCallableArg(5, a5);
164        }
165%End
166
167    bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, const QStringList &argumentMatch, const QString &signature, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/;
168%MethodCode
169        QObject *receiver;
170        QByteArray slot;
171
172        if ((sipError = pyqt5_qtdbus_get_pyqtslot_parts(a6, &receiver, slot)) == sipErrorNone)
173        {
174            Py_BEGIN_ALLOW_THREADS
175            sipRes = sipCpp->connect(*a0, *a1, *a2, *a3, *a4, *a5, receiver, slot.constData());
176            Py_END_ALLOW_THREADS
177        }
178        else if (sipError == sipErrorContinue)
179        {
180            sipError = sipBadCallableArg(6, a6);
181        }
182%End
183
184    bool disconnect(const QString &service, const QString &path, const QString &interface, const QString &name, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/;
185%MethodCode
186        QObject *receiver;
187        QByteArray slot;
188
189        if ((sipError = pyqt5_qtdbus_get_pyqtslot_parts(a4, &receiver, slot)) == sipErrorNone)
190        {
191            Py_BEGIN_ALLOW_THREADS
192            sipRes = sipCpp->disconnect(*a0, *a1, *a2, *a3, receiver, slot.constData());
193            Py_END_ALLOW_THREADS
194        }
195        else if (sipError == sipErrorContinue)
196        {
197            sipError = sipBadCallableArg(4, a4);
198        }
199%End
200
201    bool disconnect(const QString &service, const QString &path, const QString &interface, const QString &name, const QString &signature, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/;
202%MethodCode
203        QObject *receiver;
204        QByteArray slot;
205
206        if ((sipError = pyqt5_qtdbus_get_pyqtslot_parts(a5, &receiver, slot)) == sipErrorNone)
207        {
208            Py_BEGIN_ALLOW_THREADS
209            sipRes = sipCpp->disconnect(*a0, *a1, *a2, *a3, *a4, receiver, slot.constData());
210            Py_END_ALLOW_THREADS
211        }
212        else if (sipError == sipErrorContinue)
213        {
214            sipError = sipBadCallableArg(5, a5);
215        }
216%End
217
218    bool disconnect(const QString &service, const QString &path, const QString &interface, const QString &name, const QStringList &argumentMatch, const QString &signature, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/;
219%MethodCode
220        QObject *receiver;
221        QByteArray slot;
222
223        if ((sipError = pyqt5_qtdbus_get_pyqtslot_parts(a6, &receiver, slot)) == sipErrorNone)
224        {
225            Py_BEGIN_ALLOW_THREADS
226            sipRes = sipCpp->disconnect(*a0, *a1, *a2, *a3, *a4, *a5, receiver, slot.constData());
227            Py_END_ALLOW_THREADS
228        }
229        else if (sipError == sipErrorContinue)
230        {
231            sipError = sipBadCallableArg(6, a6);
232        }
233%End
234
235    bool registerObject(const QString &path, QObject *object, QDBusConnection::RegisterOptions options = QDBusConnection::ExportAdaptors);
236%If (Qt_5_5_0 -)
237    bool registerObject(const QString &path, const QString &interface, QObject *object, QDBusConnection::RegisterOptions options = QDBusConnection::ExportAdaptors);
238%End
239    void unregisterObject(const QString &path, QDBusConnection::UnregisterMode mode = QDBusConnection::UnregisterNode);
240    QObject *objectRegisteredAt(const QString &path) const;
241    bool registerService(const QString &serviceName);
242    bool unregisterService(const QString &serviceName);
243    QDBusConnectionInterface *interface() const;
244    static QDBusConnection connectToBus(QDBusConnection::BusType type, const QString &name) /ReleaseGIL/;
245    static QDBusConnection connectToBus(const QString &address, const QString &name) /ReleaseGIL/;
246    static QDBusConnection connectToPeer(const QString &address, const QString &name) /ReleaseGIL/;
247    static void disconnectFromBus(const QString &name) /ReleaseGIL/;
248    static void disconnectFromPeer(const QString &name) /ReleaseGIL/;
249    static QByteArray localMachineId();
250    static QDBusConnection sessionBus();
251    static QDBusConnection systemBus();
252    static QDBusConnection sender();
253%If (Qt_5_6_0 -)
254    void swap(QDBusConnection &other /Constrained/);
255%End
256};
257
258QFlags<QDBusConnection::RegisterOption> operator|(QDBusConnection::RegisterOption f1, QFlags<QDBusConnection::RegisterOption> f2);
259QFlags<QDBusConnection::RegisterOption> operator|(QDBusConnection::RegisterOption f1, QDBusConnection::RegisterOption f2);
260%If (Qt_5_6_0 -)
261QFlags<QDBusConnection::ConnectionCapability> operator|(QDBusConnection::ConnectionCapability f1, QFlags<QDBusConnection::ConnectionCapability> f2);
262%End
263