API Documentation

Base

class dbus_objects.DBusObject(name=None, default_interface_root=None)

Bases: object

This class represents a DBus object. It should be subclassed and to export DBus methods, you must define typed functions with the dbus_objects.dbus_object() decorator.

property dbus_name
Return type

str

get_dbus_methods()

Generator that provides the DBus methods

Return type

Generator[Tuple[Callable[…, Any], _DBusMethod], Tuple[Callable[…, Any], _DBusMethod], None]

get_dbus_properties()

Generator that provides the DBus properties

Return type

Generator[Tuple[Callable[[], Any], Callable[[Any], Any], _DBusProperty], Tuple[Callable[[], Any], Callable[[Any], Any], _DBusProperty], None]

get_dbus_signals()

Generator that provides the DBus signals

Return type

Generator[Tuple[Callable[…, Any], _DBusSignal], Tuple[Callable[…, Any], _DBusSignal], None]

register_server(server, path)
exception dbus_objects.DBusObjectException

Bases: Exception

exception dbus_objects.DBusObjectWarning

Bases: Warning

dbus_objects.custom_dbus_signal(*types, interface=None, name=None)

This method returns a custom DBus signal constructor

Return type

Callable[…, _DBusSignal]

dbus_objects.dbus_method(interface=None, name=None, return_names=None, multiple_returns=False)

This decorator exports a function as a DBus method

The function must have type annotations, they will be used to resolve the method signature.

The function name will be used as the DBus method name unless otherwise specified in the arguments.

Parameters
Return type

Callable[[Callable[…, Any]], _DBusMethod]

dbus_objects.dbus_property(interface=None, name=None, return_names=None, multiple_returns=False)

This decorator exports a method as a DBus property

Works just like dbus_method() and property()

Parameters
Return type

Callable[[Callable[…, Any]], _DBusProperty]

dbus_objects.dbus_signal(*types, **named_types)

This method returns a DBus signal

Return type

_DBusSignal

Signature

class dbus_objects.signature.DBusSignature(annotations, names=None)

Bases: object

classmethod from_parameters(func, skip_first_argument=True)
Return type

DBusSignature

classmethod from_return(func, return_names=None, multiple_returns=False)
Return type

DBusSignature

property names
Return type

Optional[Sequence[str]]

dbus_objects.signature.dbus_case(text)

Converts text to the DBus object capitalization (camel case with the first letter capitalized)

Parameters

text (str) – text to convert

Return type

str

Types

Custom Python types

dbus_objects.types.Byte

DBus byte

alias of int[int]

dbus_objects.types.Int16

DBus int16

alias of int[int]

dbus_objects.types.Int32

DBus int32

alias of int[int]

dbus_objects.types.Int64

DBus int64

alias of int[int]

dbus_objects.types.MultipleReturn

Multiple return type. Used when you want to return multiple variables in a DBus method

alias of Tuple

dbus_objects.types.Signature

DBus signature

alias of str[str]

dbus_objects.types.UInt16

DBus uint16

alias of int[int]

dbus_objects.types.UInt32

DBus uint32

alias of int[int]

dbus_objects.types.UInt64

DBus uint64

alias of int[int]

dbus_objects.types.Variant

DBus variant

alias of Tuple[str, Any][Tuple[str, Any]]

Integration

class dbus_objects.integration.DBusServerBase(bus, name)

Bases: object

get_method(path, interface, method)

Fetches the method for given path, interface and method name

Parameters
  • path (str) – method path

  • interface (str) – method interface

  • interface – method name

Return type

Tuple[Callable[…, Any], _DBusMethod]

get_property(path, interface, method)

Fetches the property for given path, interface and property name

Parameters
  • path (str) – property path

  • interface (str) – property interface

  • interface – property name

Return type

Tuple[Callable[[], Any], Callable[[Any], Any], _DBusProperty]

property name

DBus name

Return type

str

register_object(path, obj)

Registers the object into the server

Parameters
Return type

None

Jeepney

class dbus_objects.integration.jeepney.BlockingDBusServer(bus, name)

Bases: dbus_objects.integration.jeepney._JeepneyServerBase

This class represents a DBus server. It should be instanciated.

close()

Close the DBus connection

Return type

None

emit_signal(signal, path, body)
Return type

None

listen(delay=0.1, event=None)

Start listening and handling messages

Parameters
  • delay (float) – loop delay

  • event (Optional[Event]) – event which can be activated to stop listening

Return type

None

class dbus_objects.integration.jeepney.TrioDBusServer(bus, name)

Bases: dbus_objects.integration.jeepney._JeepneyServerBase

This class represents a DBus server. It should be instanciated.

async close()

Close the DBus connection

Return type

None

async emit_signal(signal, path, body)
Return type

None

async listen()

Start listening and handling messages

Parameters

delay – loop delay

Return type

None

async classmethod new(bus, name)
Return type

TrioDBusServer