Phosphor
Qt6 / Wayland library suite for window-management tools
 
Loading...
Searching...
No Matches
PhosphorProtocol::ClientHelpers Namespace Reference

Daemon-bound convenience wrappers around PhosphorDBus::Client. More...

Functions

void fireAndForget (QObject *parent, const QString &interface, const QString &method, const QVariantList &args, const QString &logContext={})
 Fire-and-forget async call to the daemon, with error logging.
 
void sendOneWay (const QString &interface, const QString &method, const QVariantList &args={})
 One-way notification to the daemon with no expected reply.
 
QDBusPendingCall asyncCall (const QString &interface, const QString &method, const QVariantList &args={})
 Async method call to the daemon; caller attaches its own watcher.
 
QDBusMessage syncCall (const QString &interface, const QString &method, const QVariantList &args={})
 Blocking daemon call bounded by Service::SyncCallTimeoutMs.
 
void reloadDaemonSettings (QObject *parent, const QString &logContext={})
 Ask the daemon to reparse config.json from disk.
 
void reloadDaemonSettingsBlocking ()
 Blocking form of reloadDaemonSettings.
 
template<typename Fn >
void loadSettingAsync (QObject *parent, const QString &name, Fn &&onValue)
 Async helper for loading a single daemon setting.
 

Detailed Description

Daemon-bound convenience wrappers around PhosphorDBus::Client.

These talk to the canonical Phosphor daemon. Code that needs to address a different service should construct its own PhosphorDBus::Client.

Function Documentation

◆ asyncCall()

QDBusPendingCall PhosphorProtocol::ClientHelpers::asyncCall ( const QString &  interface,
const QString &  method,
const QVariantList &  args = {} 
)
inline

Async method call to the daemon; caller attaches its own watcher.

See also
PhosphorDBus::Client::asyncCall

◆ fireAndForget()

void PhosphorProtocol::ClientHelpers::fireAndForget ( QObject *  parent,
const QString &  interface,
const QString &  method,
const QVariantList &  args,
const QString &  logContext = {} 
)
inline

Fire-and-forget async call to the daemon, with error logging.

See also
PhosphorDBus::Client::fireAndForget

◆ loadSettingAsync()

template<typename Fn >
void PhosphorProtocol::ClientHelpers::loadSettingAsync ( QObject *  parent,
const QString &  name,
Fn &&  onValue 
)

Async helper for loading a single daemon setting.

Sends getSetting(name) to the Settings interface, unwraps the QDBusVariant, and calls onValue with the extracted QVariant.

Parameters
parentQObject parent for the watcher
nameSetting name to load
onValueCallback receiving the unwrapped QVariant value (captured by move into the lambda — callers must pass a fresh rvalue each call)

◆ reloadDaemonSettings()

void PhosphorProtocol::ClientHelpers::reloadDaemonSettings ( QObject *  parent,
const QString &  logContext = {} 
)
inline

Ask the daemon to reparse config.json from disk.

Every settings writer in the tree writes config.json IN PROCESS and then tells the daemon to reparse — nothing writes a setting over the bus. The reload is not a courtesy: a backend sync rewrites the WHOLE document from its in-memory root, so a daemon still holding the pre-write snapshot would put the old values back on its next flush, from any source, at any later time.

Async and error-logged. Prefer this: the notification's only consumer is the daemon, so a caller with nothing to order against the reply gains nothing from blocking on it. Blocking does NOT close the clobber window either — the daemon can flush between the write and the reparse whether or not the writer waits — it only makes the writer wait out the round trip.

Parameters
parentOwns the reply watcher; must outlive the round trip.
logContextPrefix for the failure warning.

◆ reloadDaemonSettingsBlocking()

void PhosphorProtocol::ClientHelpers::reloadDaemonSettingsBlocking ( )
inline

Blocking form of reloadDaemonSettings.

Only for a caller with a real ordering requirement against the reply — the settings app's SettingsController clears its m_saving guard once this returns (the KCM is only a launcher for it), and an async call there races: the daemon's settingsChanged can land after the guard is clear and trigger a spurious load() that reverts the just-saved assignments. A caller that only needs the daemon to catch up eventually wants the async form.

Bounded by Service::SyncCallTimeoutMs.

◆ sendOneWay()

void PhosphorProtocol::ClientHelpers::sendOneWay ( const QString &  interface,
const QString &  method,
const QVariantList &  args = {} 
)
inline

One-way notification to the daemon with no expected reply.

See also
PhosphorDBus::Client::sendOneWay

◆ syncCall()

QDBusMessage PhosphorProtocol::ClientHelpers::syncCall ( const QString &  interface,
const QString &  method,
const QVariantList &  args = {} 
)
inline

Blocking daemon call bounded by Service::SyncCallTimeoutMs.

Prefer asyncCall whenever the caller can tolerate a callback.

See also
PhosphorDBus::Client::syncCall