[英]How to get device name with D-Bus?
I develop an application in C++ on Linux, which interacts with blueooth devices (such as bluetooth sockets or speakers). 我在Linux上使用C ++开发了一个应用程序,该应用程序可与蓝牙设备(例如蓝牙插座或扬声器)进行交互。 I use D-Bus command to get list of paired devices: 我使用D-Bus命令获取已配对设备的列表:
dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.ListDevices
It returns: 它返回:
method return sender=:1.0 -> dest=:1.90 reply_serial=2
array [
object path "/org/bluez/489/hci0/dev_00_1F_C5_75_45_5E"
object path "/org/bluez/489/hci0/dev_F0_13_C3_00_A1_08"
object path "/org/bluez/489/hci0/dev_00_11_12_30_76_21"
object path "/org/bluez/489/hci0/dev_00_11_12_30_76_22"
object path "/org/bluez/489/hci0/dev_00_11_12_30_76_23"
object path "/org/bluez/489/hci0/dev_00_11_12_30_76_24"
]
It is great, but I need not only MACs, but names of devices also (eg "linvor" or "GT-I9300"). 很好,但我不仅需要MAC,而且还需要设备名称(例如“ linvor”或“ GT-I9300”)。
Please, help me with a proper way to get those names. 请帮助我以适当的方式获得这些名字。
尝试以下命令:dbus-send --system --type = method_call --print-reply --dest = org.bluez“ / org / bluez / 489 / hci0 / dev_00_1F_C5_75_45_5E” org.bluez.Device.GetProperties,您将获得有关该设备的所有信息
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.