QBluetoothDeviceInfo Class
QBluetoothDeviceInfo 类存储有关蓝牙设备的信息。更多
Header: | #include <QBluetoothDeviceInfo> |
qmake: | QT += bluetooth |
公共类型
enum | CoreConfiguration { UnknownCoreConfiguration, BaseRateCoreConfiguration, BaseRateAndLowEnergyCoreConfiguration, LowEnergyCoreConfiguration } |
flags | CoreConfigurations |
enum class | Field { None, RSSI, ManufacturerData, ServiceData, All } |
flags | Fields |
enum | MajorDeviceClass { MiscellaneousDevice, ComputerDevice, PhoneDevice, NetworkDevice, AudioVideoDevice, …, UncategorizedDevice } |
enum | MinorAudioVideoClass { UncategorizedAudioVideoDevice, WearableHeadsetDevice, HandsFreeDevice, Microphone, Loudspeaker, …, GamingDevice } |
enum | MinorComputerClass { UncategorizedComputer, DesktopComputer, ServerComputer, LaptopComputer, HandheldClamShellComputer, …, WearableComputer } |
enum | MinorHealthClass { UncategorizedHealthDevice, HealthBloodPressureMonitor, HealthThermometer, HealthWeightScale, HealthGlucoseMeter, …, HealthStepCounter } |
enum | MinorImagingClass { UncategorizedImagingDevice, ImageDisplay, ImageCamera, ImageScanner, ImagePrinter } |
enum | MinorMiscellaneousClass { UncategorizedMiscellaneous } |
enum | MinorNetworkClass { NetworkFullService, NetworkLoadFactorOne, NetworkLoadFactorTwo, NetworkLoadFactorThree, NetworkLoadFactorFour, …, NetworkNoService } |
enum | MinorPeripheralClass { UncategorizedPeripheral, KeyboardPeripheral, PointingDevicePeripheral, KeyboardWithPointingDevicePeripheral, JoystickPeripheral, …, CardReaderPeripheral } |
enum | MinorPhoneClass { UncategorizedPhone, CellularPhone, CordlessPhone, SmartPhone, WiredModemOrVoiceGatewayPhone, CommonIsdnAccessPhone } |
enum | MinorToyClass { UncategorizedToy, ToyRobot, ToyVehicle, ToyDoll, ToyController, ToyGame } |
enum | MinorWearableClass { UncategorizedWearableDevice, WearableWristWatch, WearablePager, WearableJacket, WearableHelmet, WearableGlasses } |
enum | ServiceClass { NoService, PositioningService, NetworkingService, RenderingService, CapturingService, …, AllServices } |
flags | ServiceClasses |
公共函数
QBluetoothDeviceInfo() | |
QBluetoothDeviceInfo(const QBluetoothAddress &address, const QString &name, quint32 classOfDevice) | |
QBluetoothDeviceInfo(const QBluetoothUuid &uuid, const QString &name, quint32 classOfDevice) | |
QBluetoothDeviceInfo(const QBluetoothDeviceInfo &other) | |
~QBluetoothDeviceInfo() | |
QBluetoothAddress | address() const |
QBluetoothDeviceInfo::CoreConfigurations | coreConfigurations() const |
QBluetoothUuid | deviceUuid() const |
bool | isCached() const |
bool | isValid() const |
QBluetoothDeviceInfo::MajorDeviceClass | majorDeviceClass() const |
QMultiHash<quint16, QByteArray> | manufacturerData() const |
QByteArray | manufacturerData(quint16 manufacturerId) const |
QList<quint16> | manufacturerIds() const |
quint8 | minorDeviceClass() const |
QString | name() const |
qint16 | rssi() const |
QBluetoothDeviceInfo::ServiceClasses | serviceClasses() const |
(since 6.3) QMultiHash<QBluetoothUuid, QByteArray> | serviceData() const |
(since 6.3) QByteArray | serviceData(const QBluetoothUuid &serviceId) const |
(since 6.3) QList<QBluetoothUuid> | serviceIds() const |
(since 6.0) QList<QBluetoothUuid> | serviceUuids() const |
void | setCached(bool cached) |
void | setCoreConfigurations(QBluetoothDeviceInfo::CoreConfigurations coreConfigs) |
void | setDeviceUuid(const QBluetoothUuid &uuid) |
bool | setManufacturerData(quint16 manufacturerId, const QByteArray &data) |
(since 6.2) void | setName(const QString &name) |
void | setRssi(qint16 signal) |
(since 6.3) bool | setServiceData(const QBluetoothUuid &serviceId, const QByteArray &data) |
void | setServiceUuids(const QList<QBluetoothUuid> &uuids) |
QBluetoothDeviceInfo & | operator=(const QBluetoothDeviceInfo &other) |
相关非成员
bool | operator!=(const QBluetoothDeviceInfo &a, const QBluetoothDeviceInfo &b) |
bool | operator==(const QBluetoothDeviceInfo &a, const QBluetoothDeviceInfo &b) |
成员类型文档
enum QBluetoothDeviceInfo::CoreConfiguration
flags QBluetoothDeviceInfo::CoreConfigurations
此枚举描述设备的配置。
常量 | 值 | 描述 |
---|---|---|
QBluetoothDeviceInfo::UnknownCoreConfiguration | 0x0 | 蓝牙设备的类型无法确定。 |
QBluetoothDeviceInfo::BaseRateCoreConfiguration | 0x02 | 设备是标准蓝牙设备。 |
QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration | 0x03 | 设备是蓝牙智能设备,支持标准和低能耗设备。 |
QBluetoothDeviceInfo::LowEnergyCoreConfiguration | 0x01 | 设备是蓝牙低能耗设备。 |
CoreConfigurations 类型是QFlags<CoreConfiguration> 的类型定义。它存储 CoreConfiguration 值的 OR 组合。
枚举类 QBluetoothDeviceInfo::Field
flags QBluetoothDeviceInfo::Fields
该枚举与QBluetoothDeviceDiscoveryAgent::deviceUpdated() 信号结合使用,指示已更改的字段。
常量 | 值 | 说明 |
---|---|---|
QBluetoothDeviceInfo::Field::None | 0x0000 | 所有值均未更改。 |
QBluetoothDeviceInfo::Field::RSSI | 0x0001 | 设备的rssi() 值发生变化。 |
QBluetoothDeviceInfo::Field::ManufacturerData | 0x0002 | manufacturerData() 字段已更改 |
QBluetoothDeviceInfo::Field::ServiceData | 0x0004 | serviceData() 字段已更改 |
QBluetoothDeviceInfo::Field::All | 0x7fff | 匹配所有可能的字段。 |
字段类型是QFlags<Field> 的类型定义。它存储字段值的 OR 组合。
enum QBluetoothDeviceInfo::MajorDeviceClass
该枚举描述蓝牙设备的主要设备类别。
常量 | 值 | 描述 |
---|---|---|
QBluetoothDeviceInfo::MiscellaneousDevice | 0 | 杂项设备。 |
QBluetoothDeviceInfo::ComputerDevice | 1 | 计算机设备或 PDA。 |
QBluetoothDeviceInfo::PhoneDevice | 2 | 电话设备。 |
QBluetoothDeviceInfo::NetworkDevice | 3 | 可接入局域网的设备(自 Qt 5.13 起)。 |
QBluetoothDeviceInfo::AudioVideoDevice | 4 | 可播放或捕获音频和/或视频的设备。 |
QBluetoothDeviceInfo::PeripheralDevice | 5 | 外围设备,如键盘、鼠标等。 |
QBluetoothDeviceInfo::ImagingDevice | 6 | 成像设备,如显示器、打印机、扫描仪或摄像头。 |
QBluetoothDeviceInfo::WearableDevice | 7 | 手表或寻呼机等可穿戴设备。 |
QBluetoothDeviceInfo::ToyDevice | 8 | 玩具。 |
QBluetoothDeviceInfo::HealthDevice | 9 | 健康监测设备,如心率或体温监测器。 |
QBluetoothDeviceInfo::UncategorizedDevice | 31 | 不属于任何其他设备类别的设备。 |
enum QBluetoothDeviceInfo::MinorAudioVideoClass
该枚举描述了音频/视频设备的次要设备类别。
常量 | 值 | 描述 |
---|---|---|
QBluetoothDeviceInfo::UncategorizedAudioVideoDevice | 0 | 未分类的音频/视频设备。 |
QBluetoothDeviceInfo::WearableHeadsetDevice | 1 | 可佩戴耳机设备。 |
QBluetoothDeviceInfo::HandsFreeDevice | 2 | 免提设备。 |
QBluetoothDeviceInfo::Microphone | 4 | 麦克风。 |
QBluetoothDeviceInfo::Loudspeaker | 5 | 扬声器 |
QBluetoothDeviceInfo::Headphones | 6 | 耳机 |
QBluetoothDeviceInfo::PortableAudioDevice | 7 | 便携式音频设备。 |
QBluetoothDeviceInfo::CarAudio | 8 | 车载音频设备。 |
QBluetoothDeviceInfo::SetTopBox | 9 | 机顶盒 |
QBluetoothDeviceInfo::HiFiAudioDevice | 10 | 高保真音频设备。 |
QBluetoothDeviceInfo::Vcr | 11 | 录像机 |
QBluetoothDeviceInfo::VideoCamera | 12 | 一台摄像机。 |
QBluetoothDeviceInfo::Camcorder | 13 | 摄像机 |
QBluetoothDeviceInfo::VideoMonitor | 14 | 视频监视器 |
QBluetoothDeviceInfo::VideoDisplayAndLoudspeaker | 15 | 内置扬声器的视频显示器。 |
QBluetoothDeviceInfo::VideoConferencing | 16 | 视频会议设备。 |
QBluetoothDeviceInfo::GamingDevice | 18 | 游戏设备 |
enum QBluetoothDeviceInfo::MinorComputerClass
该枚举描述了计算机设备的次要设备类别。
常量 | 值 | 描述 |
---|---|---|
QBluetoothDeviceInfo::UncategorizedComputer | 0 | 未分类的计算机设备。 |
QBluetoothDeviceInfo::DesktopComputer | 1 | 台式计算机。 |
QBluetoothDeviceInfo::ServerComputer | 2 | 服务器计算机。 |
QBluetoothDeviceInfo::LaptopComputer | 3 | 笔记本电脑。 |
QBluetoothDeviceInfo::HandheldClamShellComputer | 4 | 蛤壳式掌上电脑或 PDA。 |
QBluetoothDeviceInfo::HandheldComputer | 5 | 掌上电脑或 PDA。 |
QBluetoothDeviceInfo::WearableComputer | 6 | 可穿戴计算机 |
enum QBluetoothDeviceInfo::MinorHealthClass
该枚举描述了健康设备的次要设备类别。
常量 | 值 | 描述 |
---|---|---|
QBluetoothDeviceInfo::UncategorizedHealthDevice | 0 | 未分类的健康设备。 |
QBluetoothDeviceInfo::HealthBloodPressureMonitor | 0x1 | 血压计。 |
QBluetoothDeviceInfo::HealthThermometer | 0x2 | 温度计。 |
QBluetoothDeviceInfo::HealthWeightScale | 0x3 | 体重秤 |
QBluetoothDeviceInfo::HealthGlucoseMeter | 0x4 | 血糖仪 |
QBluetoothDeviceInfo::HealthPulseOximeter | 0x5 | 血氧饱和度仪 |
QBluetoothDeviceInfo::HealthDataDisplay | 0x7 | 数据显示器 |
QBluetoothDeviceInfo::HealthStepCounter | 0x8 | 计步器 |
enum QBluetoothDeviceInfo::MinorImagingClass
该枚举描述了成像设备的次要设备类别。
常数 | 值 | 描述 |
---|---|---|
QBluetoothDeviceInfo::UncategorizedImagingDevice | 0 | 未分类的成像设备。 |
QBluetoothDeviceInfo::ImageDisplay | 0x04 | 能显示图像的设备。 |
QBluetoothDeviceInfo::ImageCamera | 0x08 | 照相机。 |
QBluetoothDeviceInfo::ImageScanner | 0x10 | 图像扫描仪。 |
QBluetoothDeviceInfo::ImagePrinter | 0x20 | 打印机 |
enum QBluetoothDeviceInfo::MinorMiscellaneousClass
该枚举描述了各种蓝牙设备的次要设备类别。
常量 | 值 | 描述 |
---|---|---|
QBluetoothDeviceInfo::UncategorizedMiscellaneous | 0 | 未分类的其他设备。 |
enum QBluetoothDeviceInfo::MinorNetworkClass
该枚举描述了局域网访问设备的次要设备类别。局域网访问设备使用次设备类别来指定当前的网络利用率。
常数 | 值 | 说明 |
---|---|---|
QBluetoothDeviceInfo::NetworkFullService | 0x00 | 总带宽的 100% 可用。 |
QBluetoothDeviceInfo::NetworkLoadFactorOne | 0x08 | 当前正在使用总带宽的 0 - 17%。 |
QBluetoothDeviceInfo::NetworkLoadFactorTwo | 0x10 | 17 - 33% 的总带宽正在使用中。 |
QBluetoothDeviceInfo::NetworkLoadFactorThree | 0x18 | 33 - 当前正在使用总带宽的 50%。 |
QBluetoothDeviceInfo::NetworkLoadFactorFour | 0x20 | 当前正在使用总带宽的 50 - 67%。 |
QBluetoothDeviceInfo::NetworkLoadFactorFive | 0x28 | 67 - 83% 的总带宽正在使用中。 |
QBluetoothDeviceInfo::NetworkLoadFactorSix | 0x30 | 目前正在使用总带宽的 83 - 99%。 |
QBluetoothDeviceInfo::NetworkNoService | 0x38 | 无网络服务可用。 |
enum QBluetoothDeviceInfo::MinorPeripheralClass
该枚举描述了外围设备的次要设备类别。
常量 | 值 | 描述 |
---|---|---|
QBluetoothDeviceInfo::UncategorizedPeripheral | 0 | 未分类的外围设备。 |
QBluetoothDeviceInfo::KeyboardPeripheral | 0x10 | 键盘。 |
QBluetoothDeviceInfo::PointingDevicePeripheral | 0x20 | 指向设备,例如鼠标。 |
QBluetoothDeviceInfo::KeyboardWithPointingDevicePeripheral | 0x30 | 内置指向设备的键盘。 |
QBluetoothDeviceInfo::JoystickPeripheral | 0x01 | 操纵杆 |
QBluetoothDeviceInfo::GamepadPeripheral | 0x02 | 游戏手柄 |
QBluetoothDeviceInfo::RemoteControlPeripheral | 0x03 | 遥控器 |
QBluetoothDeviceInfo::SensingDevicePeripheral | 0x04 | 感应装置 |
QBluetoothDeviceInfo::DigitizerTabletPeripheral | 0x05 | 数字化平板周边设备。 |
QBluetoothDeviceInfo::CardReaderPeripheral | 0x06 | 读卡器外设 |
enum QBluetoothDeviceInfo::MinorPhoneClass
该枚举描述了手机设备的次要设备类别。
常量 | 值 | 描述 |
---|---|---|
QBluetoothDeviceInfo::UncategorizedPhone | 0 | 未分类的电话设备。 |
QBluetoothDeviceInfo::CellularPhone | 1 | 蜂窝电话。 |
QBluetoothDeviceInfo::CordlessPhone | 2 | 无绳电话。 |
QBluetoothDeviceInfo::SmartPhone | 3 | 智能电话。 |
QBluetoothDeviceInfo::WiredModemOrVoiceGatewayPhone | 4 | 有线调制解调器或语音网关。 |
QBluetoothDeviceInfo::CommonIsdnAccessPhone | 5 | 提供 ISDN 接入的设备。 |
enum QBluetoothDeviceInfo::MinorToyClass
该枚举描述了玩具设备的次要设备类别。
常量 | 值 | 描述 |
---|---|---|
QBluetoothDeviceInfo::UncategorizedToy | 0 | 未分类的玩具。 |
QBluetoothDeviceInfo::ToyRobot | 1 | 玩具机器人。 |
QBluetoothDeviceInfo::ToyVehicle | 2 | 玩具车。 |
QBluetoothDeviceInfo::ToyDoll | 3 | 玩具娃娃或动作模型。 |
QBluetoothDeviceInfo::ToyController | 4 | 一个控制器。 |
QBluetoothDeviceInfo::ToyGame | 5 | 一款游戏 |
enum QBluetoothDeviceInfo::MinorWearableClass
该枚举描述了可穿戴设备的次要设备类别。
常量 | 值 | 描述 |
---|---|---|
QBluetoothDeviceInfo::UncategorizedWearableDevice | 0 | 未分类的可穿戴设备。 |
QBluetoothDeviceInfo::WearableWristWatch | 1 | 手表 |
QBluetoothDeviceInfo::WearablePager | 2 | 寻呼机。 |
QBluetoothDeviceInfo::WearableJacket | 3 | 一件夹克。 |
QBluetoothDeviceInfo::WearableHelmet | 4 | 一顶头盔 |
QBluetoothDeviceInfo::WearableGlasses | 5 | 一副眼镜。 |
枚举 QBluetoothDeviceInfo::ServiceClass
标志 QBluetoothDeviceInfo::ServiceClasses
该枚举描述蓝牙设备的服务类别。服务类别是服务发现的基本形式。它旨在提供设备可能提供的服务类型列表。
常量 | 值 | 说明 |
---|---|---|
QBluetoothDeviceInfo::NoService | 0x0000 | 设备不提供任何服务。 |
QBluetoothDeviceInfo::PositioningService | 0x0001 | 设备提供定位服务。 |
QBluetoothDeviceInfo::NetworkingService | 0x0002 | 设备提供联网服务。 |
QBluetoothDeviceInfo::RenderingService | 0x0004 | 设备提供渲染服务。 |
QBluetoothDeviceInfo::CapturingService | 0x0008 | 设备提供捕获服务。 |
QBluetoothDeviceInfo::ObjectTransferService | 0x0010 | 设备提供对象传输服务。 |
QBluetoothDeviceInfo::AudioService | 0x0020 | 设备提供音频服务。 |
QBluetoothDeviceInfo::TelephonyService | 0x0040 | 设备提供电话服务。 |
QBluetoothDeviceInfo::InformationService | 0x0080 | 设备提供信息服务。 |
QBluetoothDeviceInfo::AllServices | 0x07ff | 设备提供所有类型的服务。 |
ServiceClasses 类型是QFlags<ServiceClass> 的类型定义。它存储服务类值的 OR 组合。
成员函数文档
QBluetoothDeviceInfo::QBluetoothDeviceInfo()
构造一个无效的 QBluetoothDeviceInfo 对象。
QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothAddress &address, const QString &name, quint32 classOfDevice)
构造一个 QBluetoothDeviceInfo 对象,其中包含蓝牙地址address 、设备名称name 和设备的编码类classOfDevice 。
classOfDevice 参数的编码格式如下
位数 | 大小 | 说明 |
---|---|---|
0 - 1 | 2 | 未使用,设置为 0。 |
2 - 7 | 6 | 次设备级别。 |
8 - 12 | 5 | 主要设备级别。 |
13 - 23 | 11 | 服务等级。 |
QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothUuid &uuid, const QString &name, quint32 classOfDevice)
构造一个 QBluetoothDeviceInfo 对象,其中包含唯一的uuid 、设备名称name 和设备的编码类classOfDevice 。
macOS 和 iOS 上的低能耗设备需要使用此构造函数。CoreBluetooth API 隐藏地址并提供唯一的 UUID 来识别设备。此 UUID 与服务 UUID 不同,需要在以后使用 CoreBluetooth API 和发现的设备时使用。
QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothDeviceInfo &other)
构造一个 QBluetoothDeviceInfo,它是other 的副本。
[noexcept]
QBluetoothDeviceInfo::~QBluetoothDeviceInfo()
QBluetoothAddress QBluetoothDeviceInfo::address() const
返回设备的地址。
注意: 在 iOS 和 macOS 上,该地址无效。应使用deviceUuid() 代替。这两个平台不公开找到的蓝牙设备的蓝牙地址,而是使用唯一的设备标识符。
另请参阅 deviceUuid()。
QBluetoothDeviceInfo::CoreConfigurations QBluetoothDeviceInfo::coreConfigurations() const
返回设备配置。如果未设置设备配置,则将返回基本速率设备配置。
另请参阅 setCoreConfigurations()。
QBluetoothUuid QBluetoothDeviceInfo::deviceUuid() const
返回无地址蓝牙设备的唯一标识符。
一般来说,除 macOS 和 iOS 外,该 uuid 在其他平台上都无效。由于这两个平台不为找到的蓝牙低功耗设备提供蓝牙地址,因此它被用作这两个平台的变通方法。其他所有平台都使用address() 代替。
另请参见 setDeviceUuid()。
bool QBluetoothDeviceInfo::isCached() const
如果QBluetoothDeviceInfo 对象是根据缓存数据创建的,则返回 true。
bool QBluetoothDeviceInfo::isValid() const
如果QBluetoothDeviceInfo 对象有效,则返回 true,否则返回 false。
QBluetoothDeviceInfo::MajorDeviceClass QBluetoothDeviceInfo::majorDeviceClass() const
返回设备的主要设备类别。
QMultiHash<quint16, QByteArray> QBluetoothDeviceInfo::manufacturerData() const
返回广告数据包中所有制造商数据的完整集合。
某些设备可能会为每个制造商 ID 提供多个制造商数据条目。例如,蓝牙低功耗设备会通过广告数据包和扫描响应数据包分别发送不同的制造商数据。因此,返回的哈希表中每个制造商 ID 或哈希键可能有多个条目。
另请参阅 setManufacturerData 。
QByteArray QBluetoothDeviceInfo::manufacturerData(quint16 manufacturerId) const
返回与给定manufacturerId 相关的数据。
制造商数据由蓝牙核心规范补编定义,包括两个部分:
- 指定号码公司标识符文件中的特定制造商标识符代码
- 任意数据八位位组序列
数据八位字节的解释由公司标识符指定的制造商定义。
注意: 远程设备可为每个制造商标识符提供多个数据项。该函数只返回第一个条目。如果需要所有条目,请使用manufacturerData() 返回一个多散列。
另请参阅 manufacturerIds() 和setManufacturerData()。
QList<quint16> QBluetoothDeviceInfo::manufacturerIds() const
返回此设备信息所附广告数据包中的所有制造商 ID。
另请参阅 manufacturerData() 和setManufacturerData()。
quint8 QBluetoothDeviceInfo::minorDeviceClass() const
返回设备的次设备类别。实际信息取决于majorDeviceClass() 的值。
另请参阅 MinorAudioVideoClass,MinorComputerClass,MinorHealthClass,MinorImagingClass,MinorMiscellaneousClass,MinorNetworkClass,MinorPeripheralClass,MinorPhoneClass,MinorToyClass 和MinorWearableClass 。
QString QBluetoothDeviceInfo::name() const
返回分配给设备的名称。
另请参阅 setName()。
qint16 QBluetoothDeviceInfo::rssi() const
返回上次扫描设备时的信号强度
另请参阅 setRssi().
QBluetoothDeviceInfo::ServiceClasses QBluetoothDeviceInfo::serviceClasses() const
返回设备的服务类别。
[since 6.3]
QMultiHash<QBluetoothUuid, QByteArray> QBluetoothDeviceInfo::serviceData() const
返回广告数据包中所有服务数据的完整集合。
某些设备可能会为每个服务数据 ID 提供多个服务数据条目。例如,蓝牙低功耗设备会通过广告数据包和扫描响应数据包分别发送不同的服务数据。因此,返回的哈希表中每个服务数据 ID 或哈希键可能有多个条目。
此函数在 Qt 6.3 中引入。
另请参见 setServiceData 。
[since 6.3]
QByteArray QBluetoothDeviceInfo::serviceData(const QBluetoothUuid &serviceId) const
返回与给定serviceId 相关的数据。
服务数据由蓝牙核心规范补编定义,由两部分组成:
- 服务 UUID
- 任意数据八位位组序列
注: 远程设备可为每个serviceId 提供多个数据项。此函数仅返回第一个条目。如果需要所有条目,请使用serviceData() 返回一个多散列。
此函数在 Qt 6.3 中引入。
另请参阅 serviceIds() 和setServiceData()。
[since 6.3]
QList<QBluetoothUuid> QBluetoothDeviceInfo::serviceIds() const
返回附加到此设备信息的广告数据包中的所有服务数据 ID。
此函数在 Qt 6.3 中引入。
另请参阅 serviceData() 和setServiceData()。
[since 6.0]
QList<QBluetoothUuid> QBluetoothDeviceInfo::serviceUuids() const
返回设备支持的服务 UUID 列表。通常,该 UUID 列表代表自定义服务 UUID 或由QBluetoothUuid::ServiceClassUuid 指定的服务 UUID 值。
此函数在 Qt 6.0 中引入。
另请参阅 setServiceUuids() 和 serviceUuids()。
void QBluetoothDeviceInfo::setCached(bool cached)
如果QBluetoothDeviceInfo 是根据缓存数据创建的,系统会使用它来设置cached 标志。缓存的信息可能不如从活动设备读取的数据准确。
另请参阅 isCached() 。
void QBluetoothDeviceInfo::setCoreConfigurations(QBluetoothDeviceInfo::CoreConfigurations coreConfigs)
将设备的CoreConfigurations 设置为coreConfigs 。这将有助于区分普通设备和低能耗设备。
另请参阅 coreConfigurations()。
void QBluetoothDeviceInfo::setDeviceUuid(const QBluetoothUuid &uuid)
为没有地址的蓝牙设备设置唯一标识符uuid 。这种情况发生在 macOS 和 iOS 上,因为 CoreBluetooth API 隐藏了地址,但提供了 UUID 来识别设备/外设。
这种 Uuid 在任何其他平台上都是无效的。
另请参见 deviceUuid()。
bool QBluetoothDeviceInfo::setManufacturerData(quint16 manufacturerId, const QByteArray &data)
为给定的manufacturerId 设置广告制造商data 。如果已插入,则返回true
;如果已知,则返回false
。
自 Qt XML 5.14 起,data 和同一manufacturerId 的不同值不再相互替换,而是在设备扫描期间累积。
另请参阅 manufacturerData 。
[since 6.2]
void QBluetoothDeviceInfo::setName(const QString &name)
设置设备的name 。
此函数在 Qt 6.2 中引入。
另请参阅 name().
void QBluetoothDeviceInfo::setRssi(qint16 signal)
设置signal 强度值,内部使用。
另请参阅 rssi().
[since 6.3]
bool QBluetoothDeviceInfo::setServiceData(const QBluetoothUuid &serviceId, const QByteArray &data)
为给定的serviceId 设置广告服务data 。如果已插入,则返回true
;如果已知,则返回false
。
此函数在 Qt 6.3 中引入。
另请参阅 serviceData 。
void QBluetoothDeviceInfo::setServiceUuids(const QList<QBluetoothUuid> &uuids)
将服务 UUID 列表设置为uuids 。
另请参阅 serviceUuids() 。
QBluetoothDeviceInfo &QBluetoothDeviceInfo::operator=(const QBluetoothDeviceInfo &other)
复制other 并将其分配给此QBluetoothDeviceInfo 对象。
相关非会员
bool operator!=(const QBluetoothDeviceInfo &a, const QBluetoothDeviceInfo &b)
如果两个QBluetoothDeviceInfo 对象a 和b 不相等,则返回true
。
bool operator==(const QBluetoothDeviceInfo &a, const QBluetoothDeviceInfo &b)
如果两个QBluetoothDeviceInfo 对象a 和b 相等,则返回true
。
© 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.