QBluetooth Namespace

QBluetooth 命名空间提供与蓝牙相关的类和函数。更多

Header: #include <QBluetooth>
qmake: QT += bluetooth

类型

enum class AttAccessConstraint { AttAuthorizationRequired, AttAuthenticationRequired, AttEncryptionRequired }
flags AttAccessConstraints
QLowEnergyHandle
enum class Security { NoSecurity, Authorization, Authentication, Encryption, Secure }
flags SecurityFlags

详细说明

类型文档

枚举类 QBluetooth::AttAccessConstraints
flags QBluetooth::AttAccessConstraints

该枚举描述了读取或写入 ATT 属性的可能要求。

常量说明
QBluetooth::AttAccessConstraint::AttAuthorizationRequired0x1客户端需要 ATT 服务器授权才能访问属性。
QBluetooth::AttAccessConstraint::AttAuthenticationRequired0x2客户端需要通过身份验证才能访问属性。
QBluetooth::AttAccessConstraint::AttEncryptionRequired0x4只有加密连接才能访问该属性。

AttAccessConstraints 类型是QFlags<AttAccessConstraint> 的类型定义。它存储 AttAccessConstraint 值的 OR 组合。

QLowEnergyHandle

蓝牙低功耗 ATT 属性句柄的类型定义。

枚举类 QBluetooth::Security
flags QBluetooth::SecurityFlags

该枚举描述了蓝牙服务的安全要求。

常量描述
QBluetooth::Security::NoSecurity0x00服务不需要任何安全性。
QBluetooth::Security::Authorization0x01服务需要用户授权,除非设备已授权配对。
QBluetooth::Security::Authentication0x02服务需要验证。设备必须配对,除非设备已授权配对,否则连接时会提示用户。
QBluetooth::Security::Encryption0x04服务要求对通信链路进行加密。这要求设备已配对。
QBluetooth::Security::Secure0x08服务要求通信链路安全。需要蓝牙 2.1 或更高版本的简单配对。不允许传统配对。

SecurityFlags 类型是QFlags<Security> 的类型定义。它存储安全值的 OR 组合。

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.