gpt4 book ai didi

bluetooth - 如何使用像 hcitool lescan 这样的 bluetoothctl 来报告重复的邻近信标

转载 作者:行者123 更新时间:2023-12-02 19:38:57 24 4
gpt4 key购买 nike

我可以使用带有 --duplicates 标志的 hcitool lescan 从两个附近的 BLE 设备捕获定期 LE 广告报告(邻近信标):

$ sudo hcitool lescan --duplicates
LE Scan ...
C8:0F:10:29:4D:98 MI1S
C8:0F:10:29:4E:75 MI1S
C8:0F:10:29:4E:75 MI1S
C8:0F:10:29:4D:98 MI1S
C8:0F:10:29:4E:75 MI1S
C8:0F:10:29:4D:98 MI1S
<snip>

这是再次扫描,添加了时间戳以显示周期性:

$ sudo stdbuf -i0 -o0 -e0 hcitool lescan --duplicates | perl -nle 'print scalar(localtime), " ", $_'
Wed Apr 13 13:46:45 2016 LE Scan ...
Wed Apr 13 13:46:46 2016 C8:0F:10:29:4E:75 MI1S
Wed Apr 13 13:46:47 2016 C8:0F:10:29:4D:98 MI1S
Wed Apr 13 13:46:48 2016 C8:0F:10:29:4E:75 MI1S
Wed Apr 13 13:46:48 2016 C8:0F:10:29:4D:98 MI1S
Wed Apr 13 13:46:50 2016 C8:0F:10:29:4D:98 MI1S
Wed Apr 13 13:46:52 2016 C8:0F:10:29:4E:75 MI1S
<snip>

在上周(2016 年 4 月)的嵌入式 Linux session 和 IoT 峰会上,一位从事 BlueZ 堆栈工作的演讲者表示不再使用 hcitool,而是使用 bluetoothctl。

我今天尝试了这一点,但它只显示设备的第一个 LE 广告报告(就像 hcitool 没有 --duplicates 选项一样):

$ sudo bluetoothctl
[NEW] Controller 5C:F3:70:62:68:28 BlueZ 5.38 [default]

[bluetooth]# power on
Changing power on succeeded
[CHG] Controller 5C:F3:70:62:68:28 Powered: yes

[bluetooth]# scan on
Discovery started
[CHG] Controller 5C:F3:70:62:68:28 Discovering: yes
[CHG] Device C8:0F:10:29:4E:75 RSSI: -72
[CHG] Device C8:0F:10:29:4D:98 RSSI: -65

[bluetooth]# devices
Device C8:0F:10:29:4D:98 MI1S
Device C8:0F:10:29:4E:75 MI1S

如何使用 bluetoothctl 从同一设备捕获重复的 LE 广告报告,就像 hcitool 使用 --duplicates 选项所做的那样?

最佳答案

刚刚发现以下内容对我有用(Ubuntu 18.04.1,bluez 5.48):

$ bluetoothctl
[bluetooth]# scan on
[bluetooth]# menu scan
[bluetooth]# clear
SetDiscoveryFilter success
[NEW] Device de:ad:be:ef:ca:fe SampleDev
[CHG] Device de:ad:be:ef:ca:fe RSSI: -73
[CHG] Device de:ad:be:ef:ca:fe RSSI: -73
[CHG] Device de:ad:be:ef:ca:fe RSSI: -74

看起来有一个默认的扫描过滤器处于事件状态,可以阻止大多数广告。

关于bluetooth - 如何使用像 hcitool lescan 这样的 bluetoothctl 来报告重复的邻近信标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36607626/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com