6 #ifndef SWIFT_MISC_GENERICDBUSINTERFACE_H
7 #define SWIFT_MISC_GENERICDBUSINTERFACE_H
9 #include <QDBusAbstractInterface>
10 #include <QDBusPendingCall>
11 #include <QDBusPendingReply>
12 #include <QMetaMethod>
14 #include <QSharedPointer>
24 # define SWIFT_NO_RELAY
48 const QMetaObject *metaObject = this->parent()->metaObject();
52 superMetaObject = superMetaObject->
superClass();
59 if (method.
tag() && strcmp(method.
tag(),
"SWIFT_NO_RELAY") == 0) {
continue; }
63 const bool c = this->connection().connect(this->service(), this->path(), this->interface(),
64 method.
name(), this->parent(), signature);
70 template <
typename... Args>
78 template <
typename Ret,
typename... Args>
86 CLogMessage(
this).
debug(u
"CGenericDBusInterface::callDBusRet(%1) returned: %2")
94 template <
typename Func,
typename... Args>
105 template <
typename Ret,
typename... Args>
111 std::forward<Args>(args)...);
112 return sharedPromise->future();
120 for (
auto w : watchers) {
delete w; }
Used for hand written interface based on virtual methods.
CGenericDBusInterface(const QString &serviceName, const QString &path, const QString &interfaceName, const QDBusConnection &connection, QObject *parent=nullptr)
Constructor.
QFuture< Ret > callDBusFuture(QLatin1String method, Args &&...args)
Call DBus with asynchronous return as a future.
void callDBus(QLatin1String method, Args &&...args)
Call DBus, no return value.
void relayParentSignals()
For each signal in parent, attempt to connect to it an interface signal of the same name.
Ret callDBusRet(QLatin1String method, Args &&...args)
Call DBus with synchronous return value.
void cancelAllPendingAsyncCalls()
Cancel all asynchronous DBus calls which are currently pending.
QDBusPendingCallWatcher * callDBusAsync(QLatin1String method, Func callback, Args &&...args)
Call DBus with asynchronous return value Callback can be any callable object taking a single argument...
Class for emitting a log message.
Derived & error(const char16_t(&format)[N])
Set the severity to error, providing a format string.
Derived & debug()
Set the severity to debug.
Free functions in swift::misc.
QByteArray & prepend(QByteArrayView ba)
QString message() const const
void finished(QDBusPendingCallWatcher *self)
QDBusError error() const const
bool isError() const const
QVariant fromValue(T &&value)
#define SWIFT_MISC_EXPORT
Export a class or function from the library.