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

Service-agnostic observer for org.freedesktop.DBus.ObjectManager. More...

#include <phosphor-dbus/include/PhosphorDBus/ObjectManager.h>

Inheritance diagram for PhosphorDBus::ObjectManager:
[legend]

Signals

void interfacesAdded (const QString &path, const PhosphorDBus::InterfaceMap &interfaces)
 A managed object appeared, or the initial walk surfaced it.
 
void interfacesRemoved (const QString &path, const QStringList &interfaces)
 Some of an object's interfaces went away.
 
void ready ()
 Emitted once after the initial GetManagedObjects round-trip completes.
 

Public Member Functions

 ObjectManager (QDBusConnection connection, QString service, QString rootPath=QStringLiteral("/"), QObject *parent=nullptr, const QLoggingCategory *log=nullptr)
 
 ~ObjectManager () override
 
QString service () const
 
QString rootPath () const
 
bool isReady () const
 True once the initial GetManagedObjects round-trip has completed (success or error).
 

Detailed Description

Service-agnostic observer for org.freedesktop.DBus.ObjectManager.

Binds a (connection, service, rootPath) triple, issues an async GetManagedObjects on construction, and subscribes to InterfacesAdded / InterfacesRemoved. It does NOT materialise typed objects — it emits the raw (path, interfaces) payloads and lets each consumer build its own domain objects from them. This keeps the helper reusable across every ObjectManager-rooted service (BlueZ devices, logind sessions, etc.).

The initial enumeration and both signals are delivered as raw QDBusMessages and demarshalled by hand, so no nested-container metatype (a{oa{sa{sv}}}) ever needs registering.

Lifetime: the observer is inert if the bus is disconnected at construction (no call is issued and ready never fires). Otherwise ready fires exactly once, after the initial GetManagedObjects round-trip completes — whether it succeeded or errored — so consumers get a deterministic "initial snapshot delivered" edge before relying on incremental signals.

Constructor & Destructor Documentation

◆ ObjectManager()

PhosphorDBus::ObjectManager::ObjectManager ( QDBusConnection  connection,
QString  service,
QString  rootPath = QStringLiteral("/"),
QObject *  parent = nullptr,
const QLoggingCategory *  log = nullptr 
)
explicit
Parameters
connectionBus the service lives on (e.g. system bus for BlueZ).
serviceDestination D-Bus service name (e.g. org.bluez).
rootPathPath of the ObjectManager (the GetManagedObjects target and the signal-match path); BlueZ uses /.
parentQObject parent.
logLogging category for call-failure warnings; when null, lcPhosphorDBus() is used. Must have static / program lifetime (an async callback dereferences it).

◆ ~ObjectManager()

PhosphorDBus::ObjectManager::~ObjectManager ( )
override

Member Function Documentation

◆ interfacesAdded

void PhosphorDBus::ObjectManager::interfacesAdded ( const QString &  path,
const PhosphorDBus::InterfaceMap interfaces 
)
signal

A managed object appeared, or the initial walk surfaced it.

Carries the object path and every interface (with properties) the object exposes.

◆ interfacesRemoved

void PhosphorDBus::ObjectManager::interfacesRemoved ( const QString &  path,
const QStringList &  interfaces 
)
signal

Some of an object's interfaces went away.

interfaces lists the interface names removed; when it covers the object's last interface the object itself is gone.

◆ isReady()

bool PhosphorDBus::ObjectManager::isReady ( ) const

True once the initial GetManagedObjects round-trip has completed (success or error).

Always false while the bus is disconnected.

◆ ready

void PhosphorDBus::ObjectManager::ready ( )
signal

Emitted once after the initial GetManagedObjects round-trip completes.

◆ rootPath()

QString PhosphorDBus::ObjectManager::rootPath ( ) const

◆ service()

QString PhosphorDBus::ObjectManager::service ( ) const

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