Reputation: 17979
I just tried to run a vala bluez example (found in the DbusClientSamples page) and I got this error:
GDBus.Error:org.freedesktop.DBus.Error.UnknownObject:
Method "DiscoverDevices" with signature "" on interface "org.bluez.Adapter"
doesn't exist
Is the sample using deprecated API? If yes, where can I find an updated document about bluez's DBUS API? All documents I find (by googling) contain the DiscoverDevices
method, so I'm quite confused.
Upvotes: 8
Views: 14871
Reputation: 29697
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))
Upvotes: 1
Reputation: 11317
The best way to get the BlueZ DBus documentation is to download the source from the BlueZ web site, unpack it, then look in the doc
directory. All of the current DBus APIs are listed there.
I've been using those documents a lot lately. You could ask for better, but they're good enough. It is mostly obvious, and the most non-obvious issues are explained.
Upvotes: 5
Reputation: 17532
AFAICT org.bluez.Adapter is gone (I don't see it on my Fedora 20 system, running bluez-5.12). In its place is org.bluez.Adapter1. You can get all the latest documentation for the bluez D-Bus API at https://git.kernel.org/cgit/bluetooth/bluez.git/tree/doc
Upvotes: 11