Gulmwiki/Python/DBus/SDBus.md

1.3 KiB

tags
Python
DBus

Python-sdbus is, according to my experience, the most usable DBus-library for Python, because it is still getting updates, has a simple API and a good documentation. The only disatvantage is that you have to use asyncio to create a service.

Project Github: https://github.com/python-sdbus/python-sdbus

What is DBus?

The name comes from "Desktop Bus". The idea behind DBus is that you have a programing language independend standard for communication between different applications. DBus can be used to send signals to multiple applications, call methods in applications that were written in a different language or just to exchange data between processes.

How does DBus work?

In DBus, you have buses, interfaces and paths. Bus names are similar to ip addresses, they consist of dot-separated characters and numbers, but every service/application can choose its own bus name. Interfaces are objects that contain methods, properties and signals. A bus can have multiple interfaces, because every interface has its own name. An interface name is similar to a bus name. It again consists of dot-separated characters and numbers. A path is a virtual path to a DBus-object. Every interface, for example, must have a path. If you know the name of a service, (bus name) the interface name and the path, then you can interact with it.