Reputation: 31
We are currently using the dbus API to connect with specific devices. We are using the classic method which is the subscription on the PropertiesChanged, but because of the tremendous number of bluetooth advertiser devices around, we decided to try to use the whitelist just like hcitool provides :
hcitool lewladd <MAC>
hcitool lescan --whitelist
We want to connect BR/EDR and LE devices but only LE devices that are in the whitelist.
I wrote a small C spike program that adds a device calling the following methods :
hci_le_add_white_list(...) // To add devices to the WL
hci_le_set_scan_parameters(...) // With "whitelist only" policy
However, as soon as I call the StartDiscovery() dbus method :
busctl call org.bluez /org/bluez/hci0 org.bluez.Adapter1 StartDiscovery
I see in the HCI events, that the "LESetScanParameters" is called again with an "Accept All" Policy (even if I already set it before to "Ignore not in whitelist". We are using bluez 5.50.
So my question is,
Is it possible to set the LE Scan parameters and then call the StartDiscovery() dbus call without resetting the former ?
NB: I know that it's possible to directly interact with the hci lib provided in bluez but it would require a complete refacto of the soft we are developping.
Thank you
EDIT : I forgot to mention that I want to use the whitelist because I want to filter by MAC addr and not by UUID.
Upvotes: 1
Views: 471
Reputation: 1648
hcitool
is a legacy tool/command. With BlueZ D-Bus the Adapter API contains a SetDiscoveryFilter() method, which allows you to install a corresponding filter.
Upvotes: 1