dasbus.connection module

class AddressedMessageBus(address, *args, **kwargs)[source]

Bases: MessageBus

Representation of a connection for the specified address.

property address

The bus address.

class GLibConnection[source]

Bases: object

The low-level DBus connection library based on GLib.

DEFAULT_FLAGS = <flags G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION of type Gio.DBusConnectionFlags>
static get_addressed_bus_connection(bus_address, flags=<flags G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT | G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION of type Gio.DBusConnectionFlags>, observer=None, cancellable=None)[source]

Get a connection to a bus at the specified address.

static get_session_bus_connection(cancellable=None)[source]

Get a session bus connection.

static get_system_bus_connection(cancellable=None)[source]

Get a system bus connection.

class MessageBus(error_mapper=None, provider=<class 'dasbus.connection.GLibConnection'>)[source]

Bases: AbstractMessageBus

Representation of a message bus based on D-Bus.

property connection

The DBus connection.

disconnect()[source]

Disconnect from DBus.

get_proxy(service_name, object_path, interface_name=None, proxy_factory=None, **proxy_arguments)[source]

Returns a proxy of a remote DBus object.

If the proxy factory is not specified, we will use a default one. If the interface name is set, we will choose InterfaceProxy, otherwise ObjectProxy.

If the interface name is set, we will add it to the additional arguments for the proxy factory.

Parameters
  • service_name – a DBus name of a service

  • object_path – a DBus path of an object

  • interface_name – a DBus name of an interface or None

  • proxy_factory – a factory of a DBus object proxy

  • proxy_arguments – additional arguments for the proxy factory

Returns

a proxy object

property proxy

The proxy of DBus.

publish_object(object_path, obj, server_factory=<class 'dasbus.server.handler.ServerObjectHandler'>, **server_arguments)[source]

Publish an object on DBus.

Parameters
  • object_path – a DBus path of an object

  • obj – an instance of @dbus_interface or @dbus_class

  • server_factory – a factory of a DBus server object handler

  • server_arguments – additional arguments for the server factory

register_service(service_name, flags=1)[source]

Register a service on DBus.

Parameters
  • service_name – a DBus name of a service

  • flags – the flags argument of the RequestName DBus method

unpublish_object(object_path)[source]
unregister_service(object_path)[source]
class SessionMessageBus(error_mapper=None, provider=<class 'dasbus.connection.GLibConnection'>)[source]

Bases: MessageBus

Representation of a session bus connection.

class SystemMessageBus(error_mapper=None, provider=<class 'dasbus.connection.GLibConnection'>)[source]

Bases: MessageBus

Representation of a system bus connection.