aio.ProxyInterface — dbus-next 0.2.3 documentation (original) (raw)

Bases: dbus_next.proxy_object.BaseProxyInterface

A class representing a proxy to an interface exported on the bus by another client for the asyncio MessageBus implementation.

This class is not meant to be constructed directly by the user. UseProxyObject.get_interface() on a asyncio proxy object to get a proxy interface.

This class exposes methods to call DBus methods, listen to signals, and get and set properties on the interface that are created dynamically based on the introspection data passed to the proxy object that made this proxy interface.

A method call takes this form:

result = await interface.call_METHOD

Where METHOD is the name of the method converted to snake case.

DBus methods are exposed as coroutines that take arguments that correpond to the in args of the interface method definition and return a resultthat corresponds to the out arg. If the method has more than one out arg, they are returned within a list.

To listen to a signal use this form:

interface.on_SIGNAL

To stop listening to a signal use this form:

interface.off_SIGNAL

Where SIGNAL is the name of the signal converted to snake case.

DBus signals are exposed with an event-callback interface. The providedcallback will be called when the signal is emitted with arguments that correspond to the out args of the interface signal definition.

To get or set a property use this form:

value = await interface.get_PROPERTY await interface.set_PROPERTY

Where PROPERTY is the name of the property converted to snake case.

DBus property getters and setters are exposed as coroutines. The valuemust correspond to the type of the property in the interface definition.

If the service returns an error for a DBus call, a DBusError will be raised with information about the error.