The official BlueZ site also provides a blog post for BlueZ 5 API introduction and porting guide, that provides some descriptions on their DBus APIs. At the top of the page they wrote:
The BlueZ 5 D-Bus API contains significant changes compared to BlueZ
4. The bulk of the changes are due to the following features in BlueZ 5:
- ...
- Introduction of interface versions (e.g.
org.bluez.Adapter1
). When new versions are introduced we’ll try to keep supporting at least the two latest versions simultaneously.
- ...
There is a section that discusses the DBus Object Manager:
Instead, an application would discover the available adapters by performing a ObjectManager.GetManagedObjects
call and look for any returned objects with an “org.bluez.Adapter1
″ interface.
Also, aside from checking out the docs
directory of the BlueZ source code (as mentioned in the this and this answers), I find it also helpful to check the sample source codes in the test
directory (https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test).
Here are parts of the example-advertisement code:
BLUEZ_SERVICE_NAME = 'org.bluez'
LE_ADVERTISING_MANAGER_IFACE = 'org.bluez.LEAdvertisingManager1'
DBUS_OM_IFACE = 'org.freedesktop.DBus.ObjectManager'
DBUS_PROP_IFACE = 'org.freedesktop.DBus.Properties'
...
def main(timeout=0):
...
adapter_props = dbus.Interface(bus.get_object(BLUEZ_SERVICE_NAME, adapter),
"org.freedesktop.DBus.Properties")
adapter_props.Set("org.bluez.Adapter1", "Powered", dbus.Boolean(1))