如何使用 D-Bus 获取设备名称
How to get device name with D-Bus?
我在Linux上用C++开发了一个应用程序,它与blueooth设备(如蓝牙插座或扬声器)进行交互。我使用 D-Bus 命令获取配对设备的列表:
dbus-send --system --dest=org.bluez --print-reply $BTADAPTER org.bluez.Adapter.ListDevices
它返回:
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"
]
这很棒,但我不仅需要 MAC,还需要设备名称(例如"linvor"或"GT-I9300")。
请帮助我以正确的方式获得这些名字。
试试这个命令: 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 ,您将获得有关该设备的所有信息
相关文章:
- 如何在 Windows 上获取带有 c++ 且没有 <dirent.h> 的特定扩展名的所有文件的列表
- 谁能告诉我,程序中的错误是什么?该程序仅用于获取文件扩展名
- 让 iaxClient 将音频发送到缓冲区而不是音频设备/从缓冲区获取音频
- 如何在 c++ 中使用 ffmpeg 获取 DirectShow 设备列表?
- 从C++中的主机名获取计算机名
- 如何从安卓、高通设备获取射频/NV项目?
- 在子类上调用模板化静态方法时获取类的类型名
- 如何在 Windows 中获取 USB 设备的友好名称?
- 从 Android 上的 c++ 获取唯一的设备标识符
- 在模板实例化期间获取原始结构/类名C++
- 在yaml-cpp中,是否可以获取文档中的顶级键名
- 如何使用 asio 库获取 IP 地址的主机名
- 从类型名获取type_info
- 在安卓设备上获取 COCOS2D-X 中文件的完整路径
- 如何按文件扩展名获取电子邮件附件MIME类型
- Windows Core Audio Api在捕获设备上获取所有支持的格式
- 从USB设备的设备路径获取卷名
- 从非托管库的方法名获取参数类型
- 如何仅从类名获取QMetaObject
- C++从设备上下文获取窗口句柄