dbus.server module

class dbus.server.Server(*args, **kwargs)

Bases: _dbus_bindings._Server

An opaque object representing a server that listens for connections from other applications.

This class is not useful to instantiate directly: you must subclass it and either extend the method connection_added, or append to the list on_connection_added.

Since:0.83
address

get_address() -> str

Returns the address of the server.

connection_added(conn)

Respond to the creation of a new Connection.

This base-class implementation just invokes the callbacks in the on_connection_added attribute.

Parameters:
conn : dbus.connection.Connection

A D-Bus connection which has just been added.

The type of this parameter is whatever was passed to the Server constructor as the connection_class.

connection_removed(conn)

Respond to the disconnection of a Connection.

This base-class implementation just invokes the callbacks in the on_connection_removed attribute.

Parameters:
conn : dbus.connection.Connection

A D-Bus connection which has just become disconnected.

The type of this parameter is whatever was passed to the Server constructor as the connection_class.

id

get_id() -> str

Returns the unique ID of the server.

is_connected

get_is_connected() -> bool

Return true if this Server is still listening for new connections.

on_connection_added = None

A list of callbacks to invoke when a connection is added. They receive two arguments: this Server and the new Connection.

on_connection_removed = None

A list of callbacks to invoke when a connection becomes disconnected. They receive two arguments: this Server and the removed Connection.