我尝试从基于 BLE 的传感器中读取特征数据。因此我使用 pygatt 模块
import pygatt
adapter = pygatt.GATTToolBackend()
try:
adapter.start()
device = adapter.connect("2B:01:56:6C:F4:E6")
value= device.char_read("00007502-0000-1000-8000-00805f9b34fb")
finally:
adapter.stop()
每次我尝试在我的 Linux 控制台(使用 Python 2.7.16)中运行它时,我都会收到一个错误:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pi/.local/lib/python2.7/site-packages/pygatt/backends/gatttool/device.py", line 17, in wrapper
return func(self, *args, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/pygatt/backends/gatttool/device.py", line 40, in char_read
return self._backend.char_read(self, uuid, *args, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/pygatt/backends/gatttool/gatttool.py", line 50, in wrapper
return func(self, *args, **kwargs)
File "/home/pi/.local/lib/python2.7/site-packages/pygatt/backends/gatttool/gatttool.py", line 593, in char_read
self.sendline('char-read-uuid %s' % uuid)
File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/home/pi/.local/lib/python2.7/site-packages/pygatt/backends/gatttool/gatttool.py", line 191, in event
self.wait(event, timeout)
File "/home/pi/.local/lib/python2.7/site-packages/pygatt/backends/gatttool/gatttool.py", line 157, in wait
raise NotificationTimeout()
pygatt.exceptions.NotificationTimeout: None
我完全迷失了这个错误。你知道如何解决这个问题吗?对此非常感谢任何帮助。提前致谢...