adbus.client package

Submodules

adbus.client.call module

adbus.client.call.call(service, address, path, interface, method, args=(), response_signature=None, timeout_ms=30000)[source]

Calls a D-Bus Method in another process.

This is a co-routine, so must be await-ed from within a asyncio mainloop.

Parameters:
  • service (adbus.server.Service) – service to connect to
  • address (str) – address (name) of the D-Bus Service to call
  • path (str) – path of method to call, ie. /com/awesome/Settings1
  • interface (str) – interface label to call, ie. com.awesome.settings
  • method (str) – name of the method to call, ie. TestMethod
  • args (list or tuple) – optional, list of arguments to pass to the method
  • response_signature (str) – optional, D-Bus Signature of the expected response, if None the signature will be created at run-time, specifying it here will speed up the message post-processing
  • timeout_ms (int) – maximum time to wait for a response in milli-seconds

adbus.client.getset module

adbus.client.getset.get(service, address, path, interface, name, timeout_ms=30000)[source]

Gets a D-Bus Property from another process.

This is a co-routine, so must be await-ed from within a asyncio mainloop.

Parameters:
  • service (adbus.server.Service) – service to connect to
  • address (str) – address (name) of the D-Bus Service to call
  • path (str) – path of method to call, ie. /com/awesome/Settings1
  • interface (str) – interface label to call, ie. com.awesome.settings
  • name (str) – name of the name to get, ie. TestProperty
  • timeout_ms (int) – maximum time to wait for a response in milli-seconds
Returns:

Value of the name.

adbus.client.getset.get_all(service, address, path, interface, timeout_ms=30000)[source]

Gets a All D-Bus Properties from another process.

This is a co-routine, so must be await-ed from within a asyncio mainloop.

Parameters:
  • service (adbus.server.Service) – service to connect to
  • address (str) – address (name) of the D-Bus Service to call
  • path (str) – path of method to call, ie. /com/awesome/Settings1
  • interface (str) – interface label to call, ie. com.awesome.settings
  • timeout_ms (int) – maximum time to wait for a response in milli-seconds
Returns:

A dictionary, keys are the name names and values are the name values.

adbus.client.getset.set_(service, address, path, interface, name, value, timeout_ms=30000)[source]

Sets a D-Bus Property in another process.

This is a co-routine, so must be await-ed from within a asyncio mainloop.

Parameters:
  • service (adbus.server.Service) – service to connect to
  • address (str) – address (name) of the D-Bus Service to call
  • path (str) – path of method to call, ie. /com/awesome/Settings1
  • interface (str) – interface label to call, ie. com.awesome.settings
  • name (str) – name of the name to get, ie. TestProperty
  • value (object) – value to set the name to, must be compatible with the defined D-Bus Property type
  • timeout_ms (int) – maximum time to wait for a response in milli-seconds

adbus.client.listen module

class adbus.client.listen.Listen(service, address, path, interface, signal, coroutine, args=(), signature=False)[source]

Bases: object

Listens for a D-Bus Signal from another process.

Parameters:
  • service (adbus.server.Service) – service to connect to
  • address (str) – address (name) of the D-Bus Service to call
  • path (str) – path of method to call, ie. /com/awesome/Settings1
  • interface (str) – interface label to call, ie. com.awesome.settings
  • signal (str) – name of the signal to listen to, ie. TestSignal
  • coroutine (coroutine) – coroutine to schedule when signal is received
  • args (list or tuple) – optional, list of argument values to match, the argument must be a string, useful for listening to property changes
  • signature (str) – optional, signature of the signal, if False the types of the coroutine arguments will be used to create the signature and the coroutine will be called with one argument per signal argument, if defined the coroutine will be called with a list of arguments, if None the coroutine will be called with a list of types determined at run-time

adbus.client.proxy module

D-Bus Proxy

class adbus.client.proxy.Interface(parent, service, address, path, etree, camel_convert, timeout_ms, changed_coroutine)[source]

Bases: object

properties_changed(interface: str, changed: Dict[str, Any], invalidated: List[str])[source]
set_changed_coroutine(changed_coroutine)[source]

Set the Interface’s Changed Co-Routine.

update_properties()[source]
class adbus.client.proxy.Method(parent, service, address, path, interface, etree, timeout_ms)[source]

Bases: object

class adbus.client.proxy.Property(parent, service, address, path, interface, etree, timeout_ms)[source]

Bases: object

cached_value = None
emits_changed_signal = 'true'
get()[source]
set(value)[source]
track(coroutine)[source]
untrack(coroutine)[source]
class adbus.client.proxy.Proxy(service, address, path, interface=None, changed_coroutines=None, timeout_ms=30000, camel_convert=True)[source]

Bases: object

Creates a Python Object that maps to an Interface that already exists on the D-Bus.

Parameters:
  • service (adbus.server.Service) – service to connect to
  • address (str) – address (name) of the application to connect to on the D-Bus.
  • path (str) – path to create on the service ie. /com/awesome/Settings1
  • interface (str) – optional, default interface to access, if None will use address
  • changed_coroutines – optional, coroutine dictionary of changed coroutines, the key is the name of the interface to attach to. The coroutine will be called with a single argument which is a list of property names.
  • timeout_ms (int) – optional, maximum time to wait for a response in milli-seconds
  • camel_convert (bool) – optional, D-Bus method and property names are typically defined in Camel Case, but Python methods and arguments are typically defined in Snake Case, if this is set the cases will be automatically converted between the two
update()[source]

Use Introspection on remote server to update the proxy. Must be run once before using the Proxy.

class adbus.client.proxy.Signal(parent, service, address, path, interface, etree, timeout_ms)[source]

Bases: object

add(coroutine, signature=False)[source]

Add a listening coroutine to this signal.

Parameters:
  • coroutine (coroutine) – coroutine to schedule when signal received
  • signature (str) – optional, signature of the signal, if False the types of the coroutine arguments will be used to create the signature and the coroutine will be called with one argument per signal argument, if defined the coroutine will be called with a list of arguments, if None the coroutine will be called with a list of types determined at run-time
remove(coroutine)[source]

Module contents