'Bluez 5 migration. DiscoverServices does not exist
I'm porting an application from Bluez 4 to Bluez 5 using DBus capabilities. In the Bluez 4, I checked remote services presence using the Device.DiscoverServices(..) method. Right now, I don't see any direct replacement in Bluez 5. As a solution, it might be a good idea to use the UUIDs property from the Device1 group, but I'm not sure whether they are the same since now it returns 128-bit UUIDs list and before we had 8/16-bit handles.
Here is part of the documentation from Bluez 4.
DiscoverServices returns a dictionary with the record handles as keys and the service record in XML format as values. The key is uint32, and the value a is a string for this dictionary.
And the information returned by StartDiscovery(..) method
<?xml version="1.0" encoding="UTF-8" ?>
<record>
<attribute id="0x0000">
<uint32 value="0x00010018" />
</attribute>
<attribute id="0x0001">
<sequence>
<uuid value="0x1105" />
</sequence>
</attribute>
<attribute id="0x0004">
<sequence>
<sequence>
<uuid value="0x0100" />
</sequence>
<sequence>
<uuid value="0x0003" />
<uint8 value="0x04" />
</sequence>
<sequence>
<uuid value="0x0008" />
</sequence>
</sequence>
</attribute>
<attribute id="0x0005">
<sequence>
<uuid value="0x1002" />
</sequence>
</attribute>
<attribute id="0x0100">
<text value="OBEX Object Push" />
</attribute>
<attribute id="0x0303">
<sequence>
<uint8 value="0xff" />
</sequence>
</attribute>
</record>
And here is a Bluez 5.
org.bluez.Device1
Properties
array{string} UUIDs [readonly, optional]
List of 128-bit UUIDs that represents the available remote services.
So, how can I get remote services in the right way using Bluez 5 and DBus? Perhaps I'm looking for solutions like the output from the sdptool browse and Protocol Descriptor List fields. Still, in my case, I see only discovered UUIDs without any additional information.
I really appreciate any help.
Solution 1:[1]
I am not familiar with BueZ 4 but reading the BlueZ 5 API introduction and porting guide it says the following:
Because most tasks of managing and discovering objects can be done through ObjectManager many methods, signals and properties in BlueZ 4 became redundant and were decided to be removed.
So I suspect that the specific command has been replaced with the generic D-Bus GetManagedObjects method.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ukBaz |
