Bluez DBus API 将重复过滤器设置为禁用

问题描述 投票:0回答:1

如何设置扫描参数并禁用重复过滤器,以便我可以接收来自控制器的所有广告? StartDiscovery API 仅在识别出新设备时发出通知,但我想将重复过滤器设置为禁用,以便我可以接收来自控制器的每个广告? 但我没有找到任何 DBus API 来设置扫描参数,也没有找到设置扫描启用 API。

我的目标很简单,我需要将控制器上收到的每个广告通知到我的客户端应用程序,我如何使用 Bluez 做到这一点?

注意:由于对蓝牙和 bluez 不熟悉,我可能会遗漏一些基本点。

bluetooth dbus bluez bluetooth-device-discovery
1个回答
0
投票

在下面的输出中,您可以看到设备“Parthiban”已存在于/org/bluez/hci0/dev_44_D8_84_02_A3_17下。我已经开始扫描,这又会触发“StartDiscovery()”方法,并且同一设备会使用 RSSI 值进行更新。

root@mx6q:~# bluetoothctl 
[NEW] Controller 5C:F3:70:6E:26:02 Adapter [default]
**[NEW] Device 44:D8:84:02:A3:17 Parthiban**
[NEW] Device 2C:F0:A2:26:D7:F5 iPhone tteam
[NEW] Device 78:F8:82:10:E7:0C Nexus 5X
[bluetooth]# scan on
Discovery started
[CHG] Controller 5C:F3:70:6E:26:02 Discovering: yes
**[CHG] Device 44:D8:84:02:A3:17 RSSI: -52**

因此,您可以在接口“org.freedesktop.DBus.Properties”上使用“g_dbus_connection_signal_subscribe”作为“PropertiesChanged”信号。

while(g_variant_iter_loop(&iter, "{sv}", &property, &value)) {
    if(strcasecmp(property, "RSSI") == 0) {
        /*
         * - Extract the device address from object path
         *  /org/bluez/hci0/dev_44_D8_84_02_A3_17
         *  - Play with the device
         */
    }
© www.soinside.com 2019 - 2024. All rights reserved.