初心者はdbusで、bash dbus-sendコマンドでbluetoothスキャンを実行しようとしています。私はこのラインを使用します。dbusを使用してBluetooth検出を実行するにはどうすればよいですか?
$dbus-send --system --type=method_call --dest=org.bluez --print-reply /org/bluez/hci0 org.bluez.Adapter1.StartDiscovery
をしかし、何の発見は、私が見るのdbus-モニターで...
を開始しません:
method call time=1511273024.833459 sender=:1.55 -> destination=org.freedesktop.DBus serial=1 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=Hello
method return time=1511273024.921444 sender=org.freedesktop.DBus -> destination=:1.55 serial=1 reply_serial=1
string ":1.55"
signal time=1511273024.923719 sender=org.freedesktop.DBus -> destination=(null destination) serial=101 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string ":1.55"
string ""
string ":1.55"
signal time=1511273024.926411 sender=org.freedesktop.DBus -> destination=:1.55 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.55"
method call time=1511273024.927109 sender=:1.55 -> destination=org.bluez serial=2 path=/org/bluez/hci0; interface=org.bluez.Adapter1; member=StartDiscovery
method call time=1511273024.927628 sender=:1.1 -> destination=org.freedesktop.DBus serial=69 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
string "type='signal',sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.55'"
method return time=1511273024.928272 sender=org.freedesktop.DBus -> destination=:1.1 serial=43 reply_serial=69
method return time=1511273024.928729 sender=:1.1 -> destination=:1.55 serial=70 reply_serial=2
signal time=1511273024.929236 sender=org.freedesktop.DBus -> destination=:1.55 serial=5 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
string ":1.55"
signal time=1511273024.929945 sender=org.freedesktop.DBus -> destination=(null destination) serial=44 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
string ":1.55"
string ":1.55"
string ""
method call time=1511273024.930956 sender=:1.1 -> destination=org.freedesktop.DBus serial=71 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=RemoveMatch
string "type='signal',sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.55'"
method return time=1511273024.931635 sender=org.freedesktop.DBus -> destination=:1.1 serial=45 reply_serial=71
signal time=1511273024.932142 sender=:1.1 -> destination=(null destination) serial=72 path=/org/bluez/hci0; interface=org.freedesktop.DBus.Properties; member=PropertiesChanged
string "org.bluez.Adapter1"
array [
dict entry(
string "Discovering"
variant boolean false
)
]
array [
]
私はscan on
でbluetoothctl
を使用すると私はブルートゥーススキャンを実行することができます。私はbluetoothctlツールと私のbashのdbusメッセージを比較しようとしました。私はbashでdbusのを使用する場合、私は私を陰謀常にRemoveMatch
続く信号NameOwnerChanged
の多くを受ける....
その他のdbus方法作品(ListNames
、GetManagedObjects
、Connect
、RemoveDevice
) 私は同じ問題で、この記事を見ました:How to use dbus-send to call org.bluez.Adapter1.StartDiscovery?
しかし、私は "どのようにD-Busプロキシオブジェクトをアダプタに保存しておくのか"を知りません。
あなたのリードはありますか?私が一緒に仕事
:dbusのデーモン1.10.10、のbluezお時間を5.41
おかげ