qdbusconnection.sip 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. // qdbusconnection.sip generated by MetaSIP
  2. //
  3. // This file is part of the QtDBus Python extension module.
  4. //
  5. // Copyright (c) 2026 Riverbank Computing Limited <info@riverbankcomputing.com>
  6. //
  7. // This file is part of PyQt6.
  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. namespace QDBus
  22. {
  23. %TypeHeaderCode
  24. #include <qdbusconnection.h>
  25. %End
  26. enum CallMode
  27. {
  28. NoBlock,
  29. Block,
  30. BlockWithGui,
  31. AutoDetect,
  32. };
  33. };
  34. class QDBusConnection
  35. {
  36. %TypeHeaderCode
  37. #include <qdbusconnection.h>
  38. %End
  39. public:
  40. enum BusType
  41. {
  42. SessionBus,
  43. SystemBus,
  44. ActivationBus,
  45. };
  46. enum RegisterOption /BaseType=Flag/
  47. {
  48. ExportAdaptors,
  49. ExportScriptableSlots,
  50. ExportScriptableSignals,
  51. ExportScriptableProperties,
  52. ExportScriptableInvokables,
  53. ExportScriptableContents,
  54. ExportNonScriptableSlots,
  55. ExportNonScriptableSignals,
  56. ExportNonScriptableProperties,
  57. ExportNonScriptableInvokables,
  58. ExportNonScriptableContents,
  59. ExportAllSlots,
  60. ExportAllSignals,
  61. ExportAllProperties,
  62. ExportAllInvokables,
  63. ExportAllContents,
  64. ExportAllSignal,
  65. ExportChildObjects,
  66. };
  67. typedef QFlags<QDBusConnection::RegisterOption> RegisterOptions;
  68. enum UnregisterMode
  69. {
  70. UnregisterNode,
  71. UnregisterTree,
  72. };
  73. enum ConnectionCapability /BaseType=Flag/
  74. {
  75. UnixFileDescriptorPassing,
  76. };
  77. typedef QFlags<QDBusConnection::ConnectionCapability> ConnectionCapabilities;
  78. explicit QDBusConnection(const QString &name);
  79. QDBusConnection(const QDBusConnection &other);
  80. ~QDBusConnection();
  81. bool isConnected() const;
  82. QString baseService() const;
  83. QDBusError lastError() const;
  84. QString name() const;
  85. QDBusConnection::ConnectionCapabilities connectionCapabilities() const;
  86. bool send(const QDBusMessage &message) const;
  87. bool callWithCallback(const QDBusMessage &message, SIP_PYOBJECT returnMethod /TypeHint="PYQT_SLOT"/, SIP_PYOBJECT errorMethod /TypeHint="PYQT_SLOT"/, int timeout = -1) const;
  88. %MethodCode
  89. QObject *receiver;
  90. QByteArray return_slot;
  91. if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a1, &receiver, return_slot)) == sipErrorNone)
  92. {
  93. QObject *error_receiver;
  94. QByteArray error_slot;
  95. if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a2, &error_receiver, error_slot)) == sipErrorNone)
  96. {
  97. if (receiver == error_receiver)
  98. {
  99. sipRes = sipCpp->callWithCallback(*a0, receiver, return_slot.constData(), error_slot.constData(), a3);
  100. }
  101. else
  102. {
  103. PyErr_SetString(PyExc_ValueError,
  104. "the return and error methods must be bound to the same QObject instance");
  105. sipError = sipErrorFail;
  106. }
  107. }
  108. else if (sipError == sipErrorContinue)
  109. {
  110. sipError = sipBadCallableArg(2, a2);
  111. }
  112. }
  113. else if (sipError == sipErrorContinue)
  114. {
  115. sipError = sipBadCallableArg(1, a1);
  116. }
  117. %End
  118. QDBusMessage call(const QDBusMessage &message, QDBus::CallMode mode = QDBus::Block, int timeout = -1) const /ReleaseGIL/;
  119. QDBusPendingCall asyncCall(const QDBusMessage &message, int timeout = -1) const;
  120. bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/;
  121. %MethodCode
  122. QObject *receiver;
  123. QByteArray slot;
  124. if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a4, &receiver, slot)) == sipErrorNone)
  125. {
  126. Py_BEGIN_ALLOW_THREADS
  127. sipRes = sipCpp->connect(*a0, *a1, *a2, *a3, receiver, slot.constData());
  128. Py_END_ALLOW_THREADS
  129. }
  130. else if (sipError == sipErrorContinue)
  131. {
  132. sipError = sipBadCallableArg(4, a4);
  133. }
  134. %End
  135. bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, const QString &signature, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/;
  136. %MethodCode
  137. QObject *receiver;
  138. QByteArray slot;
  139. if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a5, &receiver, slot)) == sipErrorNone)
  140. {
  141. Py_BEGIN_ALLOW_THREADS
  142. sipRes = sipCpp->connect(*a0, *a1, *a2, *a3, *a4, receiver, slot.constData());
  143. Py_END_ALLOW_THREADS
  144. }
  145. else if (sipError == sipErrorContinue)
  146. {
  147. sipError = sipBadCallableArg(5, a5);
  148. }
  149. %End
  150. 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/;
  151. %MethodCode
  152. QObject *receiver;
  153. QByteArray slot;
  154. if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a6, &receiver, slot)) == sipErrorNone)
  155. {
  156. Py_BEGIN_ALLOW_THREADS
  157. sipRes = sipCpp->connect(*a0, *a1, *a2, *a3, *a4, *a5, receiver, slot.constData());
  158. Py_END_ALLOW_THREADS
  159. }
  160. else if (sipError == sipErrorContinue)
  161. {
  162. sipError = sipBadCallableArg(6, a6);
  163. }
  164. %End
  165. bool disconnect(const QString &service, const QString &path, const QString &interface, const QString &name, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/;
  166. %MethodCode
  167. QObject *receiver;
  168. QByteArray slot;
  169. if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a4, &receiver, slot)) == sipErrorNone)
  170. {
  171. Py_BEGIN_ALLOW_THREADS
  172. sipRes = sipCpp->disconnect(*a0, *a1, *a2, *a3, receiver, slot.constData());
  173. Py_END_ALLOW_THREADS
  174. }
  175. else if (sipError == sipErrorContinue)
  176. {
  177. sipError = sipBadCallableArg(4, a4);
  178. }
  179. %End
  180. bool disconnect(const QString &service, const QString &path, const QString &interface, const QString &name, const QString &signature, SIP_PYOBJECT slot /TypeHint="PYQT_SLOT"/) /ReleaseGIL/;
  181. %MethodCode
  182. QObject *receiver;
  183. QByteArray slot;
  184. if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a5, &receiver, slot)) == sipErrorNone)
  185. {
  186. Py_BEGIN_ALLOW_THREADS
  187. sipRes = sipCpp->disconnect(*a0, *a1, *a2, *a3, *a4, receiver, slot.constData());
  188. Py_END_ALLOW_THREADS
  189. }
  190. else if (sipError == sipErrorContinue)
  191. {
  192. sipError = sipBadCallableArg(5, a5);
  193. }
  194. %End
  195. 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/;
  196. %MethodCode
  197. QObject *receiver;
  198. QByteArray slot;
  199. if ((sipError = pyqt6_qtdbus_get_pyqtslot_parts(a6, &receiver, slot)) == sipErrorNone)
  200. {
  201. Py_BEGIN_ALLOW_THREADS
  202. sipRes = sipCpp->disconnect(*a0, *a1, *a2, *a3, *a4, *a5, receiver, slot.constData());
  203. Py_END_ALLOW_THREADS
  204. }
  205. else if (sipError == sipErrorContinue)
  206. {
  207. sipError = sipBadCallableArg(6, a6);
  208. }
  209. %End
  210. bool registerObject(const QString &path, QObject *object, QDBusConnection::RegisterOptions options = QDBusConnection::ExportAdaptors);
  211. bool registerObject(const QString &path, const QString &interface, QObject *object, QDBusConnection::RegisterOptions options = QDBusConnection::ExportAdaptors);
  212. void unregisterObject(const QString &path, QDBusConnection::UnregisterMode mode = QDBusConnection::UnregisterNode);
  213. QObject *objectRegisteredAt(const QString &path) const;
  214. bool registerService(const QString &serviceName);
  215. bool unregisterService(const QString &serviceName);
  216. QDBusConnectionInterface *interface() const;
  217. static QDBusConnection connectToBus(QDBusConnection::BusType type, const QString &name) /ReleaseGIL/;
  218. static QDBusConnection connectToBus(const QString &address, const QString &name) /ReleaseGIL/;
  219. static QDBusConnection connectToPeer(const QString &address, const QString &name) /ReleaseGIL/;
  220. static void disconnectFromBus(const QString &name) /ReleaseGIL/;
  221. static void disconnectFromPeer(const QString &name) /ReleaseGIL/;
  222. static QByteArray localMachineId();
  223. static QDBusConnection sessionBus();
  224. static QDBusConnection systemBus();
  225. void swap(QDBusConnection &other /Constrained/);
  226. };