问题
I develop an application in C++ on Linux, which interacts with blueooth devices (such as bluetooth sockets or speakers). I use D-Bus command to get list of paired devices:
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 (e.g. "linvor" or "GT-I9300").
Please, help me with a proper way to get those names.
回答1:
Try this command: 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 , you will get all information about that device
来源:https://stackoverflow.com/questions/19094897/how-to-get-device-name-with-d-bus