本文介绍了如何使用dbus-send调用org.bluez.Adapter1.StartDiscovery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用。



此命令在做什么?

解决方案

问题是dbus-send几乎立即退出。 BlueZ会跟踪正在请求发现的客户端(已打开到适配器的D-Bus代理),并且当没有更多客户端请求该发现时,发现将停止。



d-feet和bluetoothctl是长期存在的过程,它们使适配器的org.bluez.Adapter1代理保持活动状态。



我用glib客户端遇到了同样的问题m正在工作,解决方案是使适配器的D-Bus代理对象保持活动状态。



如果您必须坚持使用dbus-发送。


I am trying to interact with Bluez 5.44 using the dbus-send command line tool. I cannot seem to get it to start discovery properly, although it works fine when I use bluetoothctl's scan on and scan off commands. I can also start and stop discovery using d-feet.

I've tried powering off and on prior to issuing the command, but it doesn't seem to get discovery started.

The command line I'm using is:

dbus-send --system --type=method_call --print-reply --dest=org.bluez \
    /org/bluez/hci0                                                  \
    org.bluez.Adapter1.StartDiscovery

What I usually get upon issuing this command is from dbus-monitor is that the Discovering property is false.

For reference, this is what d-feet shows.

.

What am I doing wrong with this command?

解决方案

The problem is that dbus-send exits almost immediately. BlueZ keeps track of clients that are requesting discovery (have a D-Bus proxy to the adapter open), and the discovery will stop when no more clients are requesting it.

d-feet and bluetoothctl are long-living processes that keep the org.bluez.Adapter1 proxy to the adapter alive.

I hit the same problem with a glib client I'm working on, and there the solution is to keep the D-Bus proxy object to the adapter alive.

This is probably bad news if you have to stick with dbus-send.

这篇关于如何使用dbus-send调用org.bluez.Adapter1.StartDiscovery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 12:35