SetDiscoveryFilter not working
chenwq3 opened this issue · 1 comments
chenwq3 commented
Hello,
Thank you for developing the python Bluetooth LE library.
I'm trying to learn Bluetooth, and I am testing a dwm1001-dev device.
It uuid is 680c21d9-c946-4c1f-9c11-baa1c21329e7
, I check for many times.
Here is my debugging code:
#!/usr/bin/env python3
import dbus
import gatt
class DeviceManager(gatt.DeviceManager):
def device_discovered(self,device):
print("Discovered [%s] %s" %
(device.mac_address, device.alias()))
if __name__ == '__main__':
manager = DeviceManager(adapter_name='hci0')
list = manager._adapter.GetDiscoveryFilters()
uuid = '680c21d9-c946-4c1f-9c11-baa1c21329e7'
print(list)
print(list[0])
print(list[1])
print(list[2])
print(list[3])
print(list[4])
if False:
manager.start_discovery([uuid])
else:
if False:
manager._adapter.SetDiscoveryFilter({
dbus.String("UUIDs"):[dbus.String(uuid)],
dbus.String("Transport"):dbus.String("le")
})
else:
manager._adapter.SetDiscoveryFilter({
dbus.String("Transport"):dbus.String("le")
})
manager._adapter.StartDiscovery()
manager.run()
while True:
pass
Output: when i set a filter with "UUIDs":['<uuid>']
, it can't not discovery any devices.
device: Raspberry Pi B2
Bluetooth dongle: Bus 001 Device 004: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
version:
$ bluetoothd --version
5.48
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04 LTS
Release: 18.04
Codename: bionic
chenwq3 commented
#!/usr/bin/env python3
import dbus
import gatt
class DeviceManager(gatt.DeviceManager):
def device_discovered(self,device):
print("Discovered [%s] %s" %
(device.mac_address, device.alias()))
if __name__ == '__main__':
manager = DeviceManager(adapter_name='hci0')
uuid = '680c21d9-c946-4c1f-9c11-baa1c21329e7'
if True:
manager.start_discovery([uuid])
else:
if False:
manager._adapter.SetDiscoveryFilter({
dbus.String("UUIDs"):[dbus.String(uuid)],
})
else:
manager._adapter.SetDiscoveryFilter({
dbus.String("Transport"):dbus.String("le")
})
manager._adapter.StartDiscovery()
manager.run()
while True:
pass
Not work at Raspberry Pi 3 with image of mate 16.04.2.(official image).
version
$ bluetoothd --version
5.41
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
~$ uname -a
Linux rpi-desktop 4.4.38-v7+ #938 SMP Thu Dec 15 15:22:21 GMT 2016 armv7l armv7l armv7l GNU/Linux