DBusObjectManagerServer

Added in version 2.30.

class DBusObjectManagerServer(**properties: Any)

Superclasses: Object

Implemented Interfaces: DBusObjectManager

GDBusObjectManagerServer is used to export DBusObject instances using the standardized `org.freedesktop.DBus.ObjectManager <http://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-objectmanager>`_ interface. For example, remote D-Bus clients can get all objects and properties in a single call. Additionally, any change in the object hierarchy is broadcast using signals. This means that D-Bus clients can keep caches up to date by only listening to D-Bus signals.

The recommended path to export an object manager at is the path form of the well-known name of a D-Bus service, or below. For example, if a D-Bus service is available at the well-known name net.example.ExampleService1, the object manager should typically be exported at /net/example/ExampleService1, or below (to allow for multiple object managers in a service).

It is supported, but not recommended, to export an object manager at the root path, /.

See DBusObjectManagerClient for the client-side code that is intended to be used with GDBusObjectManagerServer or any D-Bus object implementing the org.freedesktop.DBus.ObjectManager interface.

Constructors

class DBusObjectManagerServer
classmethod new(object_path: str) DBusObjectManagerServer

Creates a new DBusObjectManagerServer object.

The returned server isn’t yet exported on any connection. To do so, use set_connection(). Normally you want to export all of your objects before doing so to avoid InterfacesAdded signals being emitted.

Added in version 2.30.

Parameters:

object_path – The object path to export the manager object at.

Methods

class DBusObjectManagerServer
export(object: DBusObjectSkeleton) None

Exports object on manager.

If there is already a DBusObject exported at the object path, then the old object is removed.

The object path for object must be in the hierarchy rooted by the object path for manager.

Note that manager will take a reference on object for as long as it is exported.

Added in version 2.30.

Parameters:

object – A DBusObjectSkeleton.

export_uniquely(object: DBusObjectSkeleton) None

Like export() but appends a string of the form _N (with N being a natural number) to object’s object path if an object with the given path already exists. As such, the DBusObjectProxy:g-object-path property of object may be modified.

Added in version 2.30.

Parameters:

object – An object.

get_connection() DBusConnection | None

Gets the DBusConnection used by manager.

Added in version 2.30.

is_exported(object: DBusObjectSkeleton) bool

Returns whether object is currently exported on manager.

Added in version 2.34.

Parameters:

object – An object.

set_connection(connection: DBusConnection | None = None) None

Exports all objects managed by manager on connection. If connection is None, stops exporting objects.

Parameters:

connection – A DBusConnection or None.

unexport(object_path: str) bool

If manager has an object at path, removes the object. Otherwise does nothing.

Note that object_path must be in the hierarchy rooted by the object path for manager.

Added in version 2.30.

Parameters:

object_path – An object path.

Properties

class DBusObjectManagerServer
props.connection: DBusConnection

The DBusConnection to export objects on.

Added in version 2.30.

props.object_path: str

The object path to register the manager object at.

Added in version 2.30.

Fields

class DBusObjectManagerServer
parent_instance
priv