dasbus.server.handler module

class AbstractServerObjectHandler(message_bus, object_path, obj)[source]

Bases: object

The abstract handler of a published object.

abstract connect_object()[source]

Connect the object to DBus.

Handle emitted signals of the object with the _emit_signal method and handle incoming DBus calls with the _handle_call method.

abstract disconnect_object()[source]

Disconnect the object from DBus.

Unregister the object and disconnect all signals.

property specification

DBus specification.

class GLibServer[source]

Bases: object

The low-level DBus server library based on GLib.

classmethod emit_signal(connection, object_path, interface_name, signal_name, parameters, destination=None)[source]

Emit a DBus signal.

classmethod get_call_info(invocation)[source]

Get information about the DBus call.

Supported items:

sender str: The bus name that invoked the method

There can be more supported items in the future.

Parameters

invocation – an invocation of a DBus call

Returns

a dictionary of information about the DBus call

classmethod register_object(connection, object_path, object_xml, callback, callback_args=())[source]

Register an object on DBus.

classmethod set_call_error(invocation, error_name, error_message)[source]

Set the error of the DBus call.

Parameters
  • invocation – an invocation of a DBus call

  • error_name – a DBus name of the error

  • error_message – an error message

classmethod set_call_reply(invocation, out_type, out_value)[source]

Set the reply of the DBus call.

Parameters
  • invocation – an invocation of a DBus call

  • out_type – a type of the reply

  • out_value – a value of the reply

class ServerObjectHandler(message_bus, object_path, obj, error_mapper=None, server=<class 'dasbus.server.handler.GLibServer'>, signal_factory=<class 'dasbus.signal.Signal'>)[source]

Bases: AbstractServerObjectHandler

The handler of an object published on DBus.

connect_object()[source]

Connect the object to DBus.

disconnect_object()[source]

Disconnect the object from DBus.