4

我有以下 Python 代码:

import bluetooth
print(bluetooth.discover_devices())

这总是等待几秒钟并打印出一个空列表。

我的蓝牙适配器似乎正在工作,因为我可以bluetoothctl通过键入轻松发现设备scan on

我该如何解决/解决这个问题?

4

2 回答 2

1

尝试使用: print(bluetooth.discover_devices(duration=8, lookup_names=True, flush_cache=True, lookup_class=False)) 正如这个例子所暗示的

于 2020-01-08T16:29:23.960 回答
0

看起来 PyBlueZ 不支持 BLE,但您可以尝试使用其他库,如bluepypygatt

我目前正在使用bluepy。从文档开始有点困难,但最后,它工作得很好。

于 2021-09-29T08:59:19.163 回答