简体   繁体   English

Qt 配对蓝牙设备 Ubuntu

[英]Qt Pairing Blutooth Device Ubuntu

I am building an application in which I would like to pair a bluetooth low energy device and connect to it.我正在构建一个应用程序,我想在其中配对蓝牙低功耗设备并连接到它。 What should be the typical workflow for this这应该是什么典型的工作流程

  1. if the device bluetooth address is known如果设备蓝牙地址已知
  2. if the device bluetooth address is not known如果设备蓝牙地址未知

Is QBluetoothDeviceDiscoveryAgent the class to do all this? QBluetoothDeviceDiscoveryAgent 是做这一切的类吗? If so, do you need to pair in the OS level (for instance using bluetooth icon in task bar) first or can it be done programmatically?如果是这样,您是否需要先在操作系统级别配对(例如使用任务栏中的蓝牙图标)还是可以通过编程方式完成?

Thanks!谢谢!

I believe that ble devices cannot be paired via settings in OS, because they can discover only bt classic devices.我相信ble设备无法通过操作系统中的设置进行配对,因为它们只能发现bt经典设备。 In ble devices bonding is not necessary, but sometimes is done for security reasons.在 ble 设备中,绑定不是必需的,但有时出于安全原因会这样做。

QBluetoothDeviceDiscoveryAgent class is only for discovering devices. QBluetoothDeviceDiscoveryAgent 类仅用于发现设备。 For connecting to device is used QLowEnergyController class.使用QLowEnergyController类连接到设备。 For more info I would refer to Qt quides as I have only experience with Qt only with bluetooth classic devices有关更多信息,我会参考Qt quides ,因为我只使用过蓝牙经典设备的 Qt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM