1

我今天尝试使用 Qt 宣传 BluetoothLE 服务。我首先测试了蓝牙低功耗心率服务器示例,它在我的 Android 手机上运行良好。不过,在我的 Ubuntu 18.04 笔记本电脑上,我无法让它工作。

当我以 root 身份运行示例时,出现错误qt.bluetooth.bluez: received advertising error。启用调试消息后,我得到了这个日志:

qt.bluetooth: Using BlueZ kernel ATT interface
qt.bluetooth.bluez: Bluez 5 detected.
qt.bluetooth.bluez: Starting to advertise
qt.bluetooth.bluez: sending command; ogf: 8 ocf: 7
qt.bluetooth.bluez: command sent successfully
qt.bluetooth.bluez: HCI event triggered, type: e
qt.bluetooth.bluez: command 7 failed with status 12
qt.bluetooth.bluez: reading power level failed, leaving it out of the advertising data
qt.bluetooth.bluez: advertising parameters: "000800080000000000000000000700"
qt.bluetooth.bluez: advertising data: "18020106100948656172745261746553657276657203030d1800000000000000"
qt.bluetooth.bluez: scan response data: "15100948656172745261746553657276657203030d1800000000000000000000"
qt.bluetooth.bluez: sending command; ogf: 8 ocf: 10
qt.bluetooth.bluez: command sent successfully
qt.bluetooth.bluez: HCI event triggered, type: e
qt.bluetooth.bluez: command 10 failed with status 12
qt.bluetooth.bluez: Advertising disable failed, ignoring
qt.bluetooth.bluez: sending command; ogf: 8 ocf: 6
qt.bluetooth.bluez: command sent successfully
qt.bluetooth.bluez: HCI event triggered, type: e
qt.bluetooth.bluez: command 6 failed with status 12
qt.bluetooth.bluez: received advertising error

有人知道所有这些错误消息的含义吗?
感谢帮助!

4

1 回答 1

0

我在英特尔 NUC 设备上尝试使用https://github.com/nymea/nymea-networkmanager时遇到了类似的问题。每当它尝试发出蓝牙 LE 命令时,我都会通过 btmon 看到“命令不允许”。

发行hcitool cmd 0x03 0x000将重置设备并让它开始广告,但它很快就会再次崩溃。似乎在 4.19 内核中引入了许多蓝牙更改,并导致 LE 系统调用出现问题。

我能够通过使用具有 4.15 内核的旧 Ubuntu 版本来使其工作。

更多细节在这里 https://github.com/nymea/nymea-networkmanager/issues/46

于 2021-03-29T17:22:36.103 回答