本页内容

QBluetoothDeviceInfo Class

QBluetoothDeviceInfo 类用于存储有关蓝牙设备的信息。更多内容...

头文件: #include <QBluetoothDeviceInfo>
CMake: find_package(Qt6 REQUIRED COMPONENTS Bluetooth)
target_link_libraries(mytarget PRIVATE Qt6::Bluetooth)
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)

详细说明

QBluetoothDeviceInfo 提供有关蓝牙设备的名称、地址和设备类别的信息。

成员类型文档

enum QBluetoothDeviceInfo::CoreConfiguration
flags QBluetoothDeviceInfo::CoreConfigurations

此枚举描述了设备的配置。

常量值描述
QBluetoothDeviceInfo::UnknownCoreConfiguration0x0无法确定蓝牙设备的类型。
QBluetoothDeviceInfo::BaseRateCoreConfiguration0x02该设备为标准蓝牙设备。
QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration0x03该设备是支持标准和低功耗设备的蓝牙智能设备。
QBluetoothDeviceInfo::LowEnergyCoreConfiguration0x01该设备是蓝牙低功耗设备。

CoreConfigurations 类型是QFlags<CoreConfiguration> 的 typedef 定义。它存储 CoreConfiguration 值的或(OR)组合。

enum class QBluetoothDeviceInfo::Field
flags QBluetoothDeviceInfo::Fields

该枚举与QBluetoothDeviceDiscoveryAgent::deviceUpdated()信号配合使用,用于指示发生变化的字段。

常量值描述
QBluetoothDeviceInfo::Field::None0x0000没有任何值发生变化。
QBluetoothDeviceInfo::Field::RSSI0x0001设备的rssi() 值发生了变化。
QBluetoothDeviceInfo::Field::ManufacturerData0x0002manufacturerData() 字段已发生变化
QBluetoothDeviceInfo::Field::ServiceData0x0004serviceData() 字段已发生变化
QBluetoothDeviceInfo::Field::All0x7fff匹配所有可能的字段。

Fields 类型是QFlags<Field> 的 typedef。它存储 Field 值的“或”组合。

enum QBluetoothDeviceInfo::MajorDeviceClass

此枚举描述了蓝牙设备的主要设备类。

常量值描述
QBluetoothDeviceInfo::MiscellaneousDevice0其他设备。
QBluetoothDeviceInfo::ComputerDevice1计算机设备或 PDA。
QBluetoothDeviceInfo::PhoneDevice2电话设备。
QBluetoothDeviceInfo::NetworkDevice3可访问局域网的设备(自 Qt 5.13 起)。
QBluetoothDeviceInfo::AudioVideoDevice4能够播放或捕获音频和/或视频的设备。
QBluetoothDeviceInfo::PeripheralDevice5外围设备,例如键盘、鼠标等。
QBluetoothDeviceInfo::ImagingDevice6成像设备,例如显示器、打印机、扫描仪或相机。
QBluetoothDeviceInfo::WearableDevice7可穿戴设备,例如手表或寻呼机。
QBluetoothDeviceInfo::ToyDevice8玩具。
QBluetoothDeviceInfo::HealthDevice9与健康相关的设备,例如心率或体温监测仪。
QBluetoothDeviceInfo::UncategorizedDevice31不属于上述任何一类的外设。

enum QBluetoothDeviceInfo::MinorAudioVideoClass

该枚举描述了音频/视频设备的次级设备类。

常量值描述
QBluetoothDeviceInfo::UncategorizedAudioVideoDevice0未分类的音频/视频设备。
QBluetoothDeviceInfo::WearableHeadsetDevice1可穿戴耳机设备。
QBluetoothDeviceInfo::HandsFreeDevice2免提设备。
QBluetoothDeviceInfo::Microphone4麦克风。
QBluetoothDeviceInfo::Loudspeaker5扬声器。
QBluetoothDeviceInfo::Headphones6耳机。
QBluetoothDeviceInfo::PortableAudioDevice7便携式音频设备。
QBluetoothDeviceInfo::CarAudio8车载音频设备。
QBluetoothDeviceInfo::SetTopBox9机顶盒。
QBluetoothDeviceInfo::HiFiAudioDevice10HiFi音频设备。
QBluetoothDeviceInfo::Vcr11录像机。
QBluetoothDeviceInfo::VideoCamera12摄像机。
QBluetoothDeviceInfo::Camcorder13摄像机。
QBluetoothDeviceInfo::VideoMonitor14视频监视器。
QBluetoothDeviceInfo::VideoDisplayAndLoudspeaker15带内置扬声器的视频显示器。
QBluetoothDeviceInfo::VideoConferencing16视频会议设备。
QBluetoothDeviceInfo::GamingDevice18游戏设备。

enum QBluetoothDeviceInfo::MinorComputerClass

该枚举描述了计算机设备的次级设备类。

常量值描述
QBluetoothDeviceInfo::UncategorizedComputer0未分类的计算机设备。
QBluetoothDeviceInfo::DesktopComputer1台式计算机。
QBluetoothDeviceInfo::ServerComputer2一台服务器。
QBluetoothDeviceInfo::LaptopComputer3一台笔记本电脑。
QBluetoothDeviceInfo::HandheldClamShellComputer4翻盖式掌上电脑或PDA。
QBluetoothDeviceInfo::HandheldComputer5手持式计算机或PDA。
QBluetoothDeviceInfo::WearableComputer6可穿戴计算机。

enum QBluetoothDeviceInfo::MinorHealthClass

此枚举描述了健康设备的次级设备类。

常量值描述
QBluetoothDeviceInfo::UncategorizedHealthDevice0未分类的健康设备。
QBluetoothDeviceInfo::HealthBloodPressureMonitor0x1血压计。
QBluetoothDeviceInfo::HealthThermometer0x2体温计。
QBluetoothDeviceInfo::HealthWeightScale0x3体重秤。
QBluetoothDeviceInfo::HealthGlucoseMeter0x4血糖仪。
QBluetoothDeviceInfo::HealthPulseOximeter0x5血氧饱和度监测仪。
QBluetoothDeviceInfo::HealthDataDisplay0x7数据显示屏。
QBluetoothDeviceInfo::HealthStepCounter0x8计步器。

enum QBluetoothDeviceInfo::MinorImagingClass

此枚举描述了成像设备的次级设备类。

常量值描述
QBluetoothDeviceInfo::UncategorizedImagingDevice0未分类的成像设备。
QBluetoothDeviceInfo::ImageDisplay0x04能够显示图像的设备。
QBluetoothDeviceInfo::ImageCamera0x08相机。
QBluetoothDeviceInfo::ImageScanner0x10图像扫描仪。
QBluetoothDeviceInfo::ImagePrinter0x20打印机。

enum QBluetoothDeviceInfo::MinorMiscellaneousClass

此枚举描述了各类其他蓝牙设备的次级设备类。

常量值描述
QBluetoothDeviceInfo::UncategorizedMiscellaneous0未分类的杂项设备。

enum QBluetoothDeviceInfo::MinorNetworkClass

该枚举描述了局域网接入设备的次级设备类。局域网接入设备使用次级设备类来指定当前的网络利用率。

常量值描述
QBluetoothDeviceInfo::NetworkFullService0x00总带宽的 100% 可用。
QBluetoothDeviceInfo::NetworkLoadFactorOne0x08当前正在使用总带宽的 0 - 17%。
QBluetoothDeviceInfo::NetworkLoadFactorTwo0x10当前正在使用总带宽的 17% 至 33%。
QBluetoothDeviceInfo::NetworkLoadFactorThree0x18当前占用了总带宽的 33 - 50%。
QBluetoothDeviceInfo::NetworkLoadFactorFour0x20当前正在使用 50 - 67% 的总带宽。
QBluetoothDeviceInfo::NetworkLoadFactorFive0x28当前正在使用的总带宽为 67 - 83%。
QBluetoothDeviceInfo::NetworkLoadFactorSix0x30当前正在使用总带宽的 83 - 99%。
QBluetoothDeviceInfo::NetworkNoService0x38没有可用的网络服务。

enum QBluetoothDeviceInfo::MinorPeripheralClass

此枚举描述了外围设备的次级设备类。

常量值描述
QBluetoothDeviceInfo::UncategorizedPeripheral0未分类的外围设备。
QBluetoothDeviceInfo::KeyboardPeripheral0x10键盘。
QBluetoothDeviceInfo::PointingDevicePeripheral0x20指点设备,例如鼠标。
QBluetoothDeviceInfo::KeyboardWithPointingDevicePeripheral0x30带内置指点设备的键盘。
QBluetoothDeviceInfo::JoystickPeripheral0x01操纵杆。
QBluetoothDeviceInfo::GamepadPeripheral0x02游戏手柄。
QBluetoothDeviceInfo::RemoteControlPeripheral0x03一个遥控器。
QBluetoothDeviceInfo::SensingDevicePeripheral0x04一个传感设备。
QBluetoothDeviceInfo::DigitizerTabletPeripheral0x05数位板外设。
QBluetoothDeviceInfo::CardReaderPeripheral0x06读卡器外设。

enum QBluetoothDeviceInfo::MinorPhoneClass

此枚举描述了手机设备的次级设备类。

常量值描述
QBluetoothDeviceInfo::UncategorizedPhone0未分类的电话设备。
QBluetoothDeviceInfo::CellularPhone1一部手机。
QBluetoothDeviceInfo::CordlessPhone2一部无绳电话。
QBluetoothDeviceInfo::SmartPhone3智能手机。
QBluetoothDeviceInfo::WiredModemOrVoiceGatewayPhone4有线调制解调器或语音网关。
QBluetoothDeviceInfo::CommonIsdnAccessPhone5提供ISDN接入的设备。

enum QBluetoothDeviceInfo::MinorToyClass

此枚举描述了玩具设备的次级设备类。

常量值描述
QBluetoothDeviceInfo::UncategorizedToy0未分类的玩具。
QBluetoothDeviceInfo::ToyRobot1一个玩具机器人。
QBluetoothDeviceInfo::ToyVehicle2一辆玩具车。
QBluetoothDeviceInfo::ToyDoll3一个玩具娃娃或动作人偶。
QBluetoothDeviceInfo::ToyController4一个控制器。
QBluetoothDeviceInfo::ToyGame5一款游戏。

enum QBluetoothDeviceInfo::MinorWearableClass

此枚举描述了可穿戴设备的次级设备类。

常量值描述
QBluetoothDeviceInfo::UncategorizedWearableDevice0未分类的可穿戴设备。
QBluetoothDeviceInfo::WearableWristWatch1一只手表。
QBluetoothDeviceInfo::WearablePager2寻呼机。
QBluetoothDeviceInfo::WearableJacket3一件夹克。
QBluetoothDeviceInfo::WearableHelmet4一顶头盔。
QBluetoothDeviceInfo::WearableGlasses5一副眼镜。

enum QBluetoothDeviceInfo::ServiceClass
flags QBluetoothDeviceInfo::ServiceClasses

此枚举描述了蓝牙设备的服务类。服务类被用作服务发现的一种基础形式,旨在提供设备可能提供的服务类型的列表。

常量值描述
QBluetoothDeviceInfo::NoService0x0000该设备不提供任何服务。
QBluetoothDeviceInfo::PositioningService0x0001该设备提供定位服务。
QBluetoothDeviceInfo::NetworkingService0x0002该设备提供网络服务。
QBluetoothDeviceInfo::RenderingService0x0004该设备提供渲染服务。
QBluetoothDeviceInfo::CapturingService0x0008该设备提供捕获服务。
QBluetoothDeviceInfo::ObjectTransferService0x0010该设备提供对象传输服务。
QBluetoothDeviceInfo::AudioService0x0020该设备提供音频服务。
QBluetoothDeviceInfo::TelephonyService0x0040该设备提供语音通话服务。
QBluetoothDeviceInfo::InformationService0x0080该设备提供信息服务。
QBluetoothDeviceInfo::AllServices0x07ff该设备提供所有类型的服务。

ServiceClasses 类型是QFlags<ServiceClass> 的 typedef。它存储 ServiceClass 值的“或”组合。

成员函数文档

QBluetoothDeviceInfo::QBluetoothDeviceInfo()

构建了一个无效的 QBluetoothDeviceInfo 对象。

QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothAddress &address, const QString &name, quint32 classOfDevice)

创建一个 QBluetoothDeviceInfo 对象,其蓝牙地址为address ,设备名称为name ,设备类编码为classOfDevice 。

classOfDevice 参数采用以下格式进行编码

位大小描述
0 - 12未使用,设为0。
2 - 76次要设备类。
8 - 125主要设备类别。
13 - 2311服务类。

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()

销毁QBluetoothDeviceInfo 。

QBluetoothAddress QBluetoothDeviceInfo::address() const

返回设备的地址。

注意:在 iOS 和 macOS上, 此地址无效。应改用deviceUuid()。这两个平台不会公开已发现蓝牙设备的蓝牙地址,而是使用唯一的设备标识符。

另请参阅 deviceUuid()。

QBluetoothDeviceInfo::CoreConfigurations QBluetoothDeviceInfo::coreConfigurations() const

返回设备的配置。如果未设置设备配置,则返回基本速率的设备配置。

另请参阅 setCoreConfigurations()。

QBluetoothUuid QBluetoothDeviceInfo::deviceUuid() const

返回一个没有地址的蓝牙设备的唯一标识符。

通常情况下,除了 macOS 和 iOS 之外,该 UUID 在所有平台上均无效。由于 macOS 和 iOS 平台不会为检测到的蓝牙低功耗 (BLE) 设备提供蓝牙地址,因此该 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 提供多个制造商数据条目。例如,蓝牙低功耗 (BLE) 设备可能会分别通过广告数据包和扫描响应数据包发送不同的制造商数据。因此,返回的哈希表中每个制造商 ID 或哈希键可能包含多个条目。

另请参阅 setManufacturerData 。

QByteArray QBluetoothDeviceInfo::manufacturerData(quint16 manufacturerId) const

返回与给定的manufacturerId 相关的数据。

制造商数据由《蓝牙核心规范补充说明》定义,由两个部分组成:

  • 来自《分配号码公司标识符》文档中的制造商特定标识符代码
  • 任意数据八位字节序列

数据字节的解释由公司标识符所指定的制造商定义。

注意: 远程设备 可能为每个 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 提供多个服务数据条目。例如,某些蓝牙低功耗 (BLE) 设备会分别通过广告数据包和扫描响应数据包发送不同的服务数据。因此,返回的哈希表中每个服务数据 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 5.14 起,针对同一manufacturerId 的不同data 值不再相互替换,而是在设备扫描期间被累积。

另请参阅 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 。

© 2026 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.