Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorControl::DBusBridge Class Reference

Thin wrapper around QDBusConnection::sessionBus() that bakes in a pre-configured endpoint. More...

#include <PhosphorControl/DBusBridge.h>

Inheritance diagram for PhosphorControl::DBusBridge:
[legend]

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ DBusBridge()

PhosphorControl::DBusBridge::DBusBridge ( DBusEndpoint endpoint,
QObject * parent = nullptr )
explicit

◆ ~DBusBridge()

PhosphorControl::DBusBridge::~DBusBridge ( )
override

Member Function Documentation

◆ asyncCall()

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.

◆ asyncCallOn()

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.

◆ call()

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).

◆ callOn()

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).

◆ endpoint()

DBusEndpoint PhosphorControl::DBusBridge::endpoint ( ) const

The documentation for this class was generated from the following file: