Thin wrapper around QDBusConnection::sessionBus() that bakes in a pre-configured endpoint. More...
#include <PhosphorControl/DBusBridge.h>
Public Member Functions | |
| DBusBridge (DBusEndpoint endpoint, QObject *parent=nullptr) | |
| ~DBusBridge () override | |
| DBusEndpoint | endpoint () const |
| QDBusMessage | call (const QString &method, const QVariantList &args={}) const |
| Synchronous call on the endpoint's default interface, bounded by syncTimeoutMs. | |
| QDBusMessage | callOn (const QString &interfaceName, const QString &method, const QVariantList &args={}) const |
| Synchronous call on a specified interface (for services with multiple interfaces on the same object path). | |
| void | asyncCall (const QString &method, const QVariantList &args={}) |
| Fire-and-forget call on the endpoint's default interface. | |
| void | asyncCallOn (const QString &interfaceName, const QString &method, const QVariantList &args={}) |
| Fire-and-forget call on a specified interface. | |
Thin wrapper around QDBusConnection::sessionBus() that bakes in a pre-configured endpoint.
Replaces the ad-hoc pattern of repeating service / path / interface constants at every call site.
The bridge holds no state beyond its endpoint and is safe to construct once per settings app and pass to whatever pages need daemon access.
Signal subscription (QDBusConnection::sessionBus().connect(...)) is not wrapped — D-Bus signals require string-based slot signatures that Qt's member-function-pointer overloads cannot synthesise, and the current settings-app callers prefer to keep that one-off plumbing local to the subscribing class. Add a typed subscribe() helper here if a future consumer needs symmetric subscribe/unsubscribe at the bridge level.
|
explicit |
|
override |
| void PhosphorControl::DBusBridge::asyncCall | ( | const QString & | method, |
| const QVariantList & | args = {} ) |
Fire-and-forget call on the endpoint's default interface.
Non-const: the implementation parents a QDBusPendingCallWatcher to this so the QObject child tree mutates.
| void PhosphorControl::DBusBridge::asyncCallOn | ( | const QString & | interfaceName, |
| const QString & | method, | ||
| const QVariantList & | args = {} ) |
Fire-and-forget call on a specified interface.
Non-const for the same parenting rationale as asyncCall.
| QDBusMessage PhosphorControl::DBusBridge::call | ( | const QString & | method, |
| const QVariantList & | args = {} ) const |
Synchronous call on the endpoint's default interface, bounded by syncTimeoutMs.
Returns the reply (which may be an error message).
| QDBusMessage PhosphorControl::DBusBridge::callOn | ( | const QString & | interfaceName, |
| const QString & | method, | ||
| const QVariantList & | args = {} ) const |
Synchronous call on a specified interface (for services with multiple interfaces on the same object path).
| DBusEndpoint PhosphorControl::DBusBridge::endpoint | ( | ) | const |