Closed zewenhs closed 6 years ago
That is because you're using an old BlueZ library. Please follow the readme of this repository to install a recent version of BlueZ.
closing this now. @zewenhs if you still have any questions, please re-open, thanks!
Hi all: && @larsblumberg @tomster : It's ok after update my BlueZ to 5.44. thank you! I've got a question to consult which is how to stop discovering(scannig) devices after I run _startdiscovery process like in discovering.py? I mean by coding(call some functions) not by CTRL+C. What I want to accomplish is my pi3 can automatic discovery and connect a certain ble device, how can i do this? thanks!
Simply call stop_discovery()
on your ControllerManager
instance.
HI @larsblumberg
But how to call stop_discovery()
? It seem it will go into a loop and block the code process after start_discovery()
&& .run()
shown as below
manager = AnyDeviceManager(adapter_name='hci0')
manager.start_discovery()
manager.run()
Call manager.stop_discovery()
when you discovered the BLE device you were looking for.
Hi @larsblumberg
Like this, thank you for your help~
if device is not None:
Hi all, @larsblumberg
when i run discovery.py which is in example directory on my rpi3, it has same error shown as below, my python version is 3.4 and blueZ is 5.23 who can tell me how to solve this? thanks!
pi@raspberrypi:~/workspace/gatt-python/examples $ ./discovery1.py
Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/gatt/gatt_linux.py", line 137, in start_discovery self._adapter.SetDiscoveryFilter(discovery_filter) File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 70, in call return self._proxy_method(*args, keywords) File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 145, in call keywords) File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking message, timeout) dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "SetDiscoveryFilter" with signature "a{ss}" on interface "org.bluez.Adapter1" doesn't exist
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "./discovery1.py", line 10, in
manager.start_discovery()
File "/usr/local/lib/python3.4/dist-packages/gatt/gatt_linux.py", line 148, in start_discovery
raise _error_from_dbus_error(e)
gatt.errors.Failed: Method "SetDiscoveryFilter" with signature "a{ss}" on interface "org.bluez.Adapter1" doesn't exist