当前位置:网站首页>Qt蓝牙:QBluetoothDeviceInfo
Qt蓝牙:QBluetoothDeviceInfo
2022-07-06 19:13:00 【友善啊,朋友】
一、描述
QBluetoothDeviceInfo 类存储有关蓝牙设备的信息。
二、类型成员
1、enum QBluetoothDeviceInfo::CoreConfiguration:此枚举描述了设备的配置。
- UnknownCoreConfiguration:无法确定蓝牙设备的类型。
- BaseRateCoreConfiguration:标准蓝牙设备。
- BaseRateAndLowEnergyCoreConfiguration:蓝牙智能设备,支持标准和低功耗设备。
- LowEnergyCoreConfiguration:低功耗蓝牙设备。
2、enum class QBluetoothDeviceInfo::Field:此枚举与 QBluetoothDeviceDiscoveryAgent::deviceUpdated() 信号结合使用,用于指示已更改的字段。
- Field::None:没有任何值改变。
- Field::RSSI:设备的 rssi() 值已更改。
- Field::ManufacturerData:manufacturerData() 字段已更改
- Field::ServiceData:serviceData() 字段已更改
- Field::All:匹配所有可能的字段。
3、enum QBluetoothDeviceInfo::MajorDeviceClass:此枚举描述了主要蓝牙设备的类型。
- MiscellaneousDevice:杂项设备。
- ComputerDevice:计算机或掌上电脑。
- PhoneDevice:电话设备。
- NetworkDevice:提供对局域网的访问的设备。
- AudioVideoDevice:能够播放或捕获音频和/或视频的设备。
- PeripheralDevice:键盘、鼠标等外围设备。
- ImagingDevice:成像设备,例如显示器、打印机、扫描仪或照相机。
- WearableDevice:可穿戴设备,例如手表或寻呼机。
- ToyDevice:玩具设备。
- HealthDevice:与健康相关的设备,例如心率或温度监测器。
- UncategorizedDevice:其他分类的设备。
4、enum QBluetoothDeviceInfo::MinorAudioVideoClass:此枚举描述了音频/视频设备的次要蓝牙设备。
- UncategorizedAudioVideoDevice:未分类的音频/视频设备。
- WearableHeadsetDevice:可穿戴耳机设备。
- HandsFreeDevice:免提设备。
- Microphone:麦克风。
- Loudspeaker:一个扬声器。
- Headphones:耳机。
- PortableAudioDevice:便携式音频设备。
- CarAudio:汽车音频设备。
- SetTopBox:机顶盒。
- HiFiAudioDevice:HiFi 音频设备。
- Vcr:录像机。
- VideoCamera:摄像机。
- Camcorder:摄像机。
- VideoMonitor:视频监视器。
- VideoDisplayAndLoudspeaker:带有内置扬声器的视频显示器。
- VideoConferencing:视频会议设备。
- GamingDevice:游戏设备。
5、enum QBluetoothDeviceInfo::MinorComputerClass:此枚举描述了计算机设备的次要蓝牙设备。
- UncategorizedComputer:未分类的计算机设备。
- DesktopComputer:台式计算机。
- ServerComputer:服务器计算机。
- LaptopComputer:笔记本电脑。
- HandheldClamShellComputer:翻盖式手持计算机或掌上电脑。
- HandheldComputer:手持计算机或掌上电脑。
- WearableComputer:可穿戴计算机。
6、enum QBluetoothDeviceInfo::MinorHealthClass:此枚举描述了健康设备的次要蓝牙设备。
- UncategorizedHealthDevice:未分类的健康设备。
- HealthBloodPressureMonitor:血压监测器。
- HealthThermometer:温度计。
- HealthWeightScale:体重秤。
- HealthGlucoseMeter:血糖仪。
- HealthPulseOximeter:血氧饱和度计。
- HealthDataDisplay:健康数据显示器。
- HealthStepCounter:计步器。
7、enum QBluetoothDeviceInfo::MinorImagingClass:此枚举描述了成像设备的次要蓝牙设备。
- UncategorizedImagingDevice:未分类的成像设备。
- ImageDisplay:图像显示设备。
- ImageCamera:摄像头。
- ImageScanner:图像扫描仪。
- ImagePrinter:图像打印机。
8、enum QBluetoothDeviceInfo::MinorMiscellaneousClass:此枚举描述了杂项设备的次要蓝牙设备。
- UncategorizedMiscellaneous:未分类的杂项设备。
9、enum QBluetoothDeviceInfo::MinorNetworkClass:此枚举描述了局域网访问设备的当前的网络利用率。
- NetworkFullService:100% 的总带宽可用。
- NetworkLoadFactorOne:当前正在使用总带宽的 0% - 17%。
- NetworkLoadFactorTwo:当前正在使用总带宽的 17% - 33%。
- NetworkLoadFactorThree:当前正在使用总带宽的 33% - 50%。
- NetworkLoadFactorFour:当前正在使用总带宽的 50% - 67%。
- NetworkLoadFactorFive:当前正在使用总带宽的 67% - 83%。
- NetworkLoadFactorSix:当前正在使用总带宽的 83% - 99%。
- NetworkNoService:没有可用的网络服务。
10、enum QBluetoothDeviceInfo::MinorPeripheralClass:此枚举描述外围设备的次要蓝牙设备。
- UncategorizedPeripheral:未分类的外围设备。
- KeyboardPeripheral:键盘。
- PointingDevicePeripheral:指点设备,例如鼠标。
- KeyboardWithPointingDevicePeripheral:带有内置指针设备的键盘。
- JoystickPeripheral:操纵杆。
- GamepadPeripheral:游戏手柄。
- RemoteControlPeripheral:遥控器。
- SensingDevicePeripheral:传感设备。
- DigitizerTabletPeripheral:数位板外设。
- CardReaderPeripheral:读卡器外围设备。
11、enum QBluetoothDeviceInfo::MinorPhoneClass:此枚举描述电话设备的次要蓝牙设备。
- UncategorizedPhone:未分类的电话设备。
- CellularPhone:手机。
- CordlessPhone:无绳电话。
- SmartPhone:智能手机。
- WiredModemOrVoiceGatewayPhone:有线调制解调器或语音网关。
- CommonIsdnAccessPhone:提供 ISDN 访问的设备。
12、enum QBluetoothDeviceInfo::MinorToyClass:此枚举描述了玩具设备的次要蓝牙设备。
- UncategorizedToy:未分类的玩具。
- ToyRobot:玩具机器人。
- ToyVehicle:玩具车。
- ToyDoll:玩具娃娃或人偶。
- ToyController:控制器。
- ToyGam:游戏。
13、enum QBluetoothDeviceInfo::MinorWearableClass:此枚举描述了可穿戴设备的次要蓝牙设备。
- UncategorizedWearableDevice:未分类的可穿戴设备。
- WearableWristWatch:手表。
- WearablePager:寻呼机。
- WearableJacket:夹克。
- WearableHelmet:头盔。
- WearableGlasses:眼镜。
14、enum QBluetoothDeviceInfo::ServiceClass:此枚举描述了蓝牙设备的服务类型。
- NoService:不提供任何服务。
- PositioningService:提供定位服务。
- NetworkingService:提供网络服务。
- RenderingService:提供渲染服务。
- CapturingService:提供捕获服务。
- ObjectTransferService:提供对象传输服务。
- AudioService:提供音频服务。
- TelephonyService:提供电话服务。
- InformationService:提供信息服务。
- AllServices:提供所有类型的服务。
三、成员函数
1、QBluetoothAddressaddress()
返回设备的地址。
在 iOS 和 macOS 上,此地址无效,应该使用 deviceUuid()。 这两个平台不会为找到的蓝牙设备公开蓝牙地址。
2、QBluetoothUuiddeviceUuid() / void setDeviceUuid(const QBluetoothUuid &uuid)
返回没有地址的蓝牙设备的唯一标识符。
一般来说,这个 uuid 在除 macOS 和 iOS 之外的所有平台上都是无效的。
3、bool isCached() / void setCached(bool cached)
当前对象是否从缓存数据创建的。缓存的信息可能不如从活动设备中读取的数据准确。
4、bool isValid()
对象是否有效。
5、QByteArray manufacturerData(quint16 manufacturerId) /
bool setManufacturerData(quint16 producerId, const QByteArray &data)
返回与制造商 ID 关联的数据。
制造商数据由蓝牙核心规范的补充定义,由两部分组成:
- 制造商特定标识符代码
- 任意数据字节的序列
远程设备可以为每个制造商 ID 提供多个数据条目。此函数仅返回第一个条目。如果需要所有条目,使用 manufacturerData()。
6、QMultiHash<quint16, QByteArray> manufacturerData()
返回所有制造商的完整数据集。
#include "widget.h"
#include "ui_widget.h"
#include <QBluetoothDeviceDiscoveryAgent>
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered,this, &Widget::deviceDiscovered);
}
Widget::~Widget()
{
delete ui;
}
void Widget::deviceDiscovered(const QBluetoothDeviceInfo &device)
{
qDebug() << "发现新设备:" << device.name() << '(' << device.address().toString() << ')';
QMultiHash<quint16, QByteArray> data = device.manufacturerData();
for(auto it = data.cbegin();it != data.cend();++it)
{
qDebug() << it.key()<<QString(it.value().toHex());
}
}
void Widget::on_pushButton_clicked()
{
qDebug() << "开始搜索";
discoveryAgent->start();
}
7、QList<quint16> manufacturerIds()
返回所有制造商 ID。
8、QString name() / void setName(const QString &name)
返回分配给设备的名称。
9、qint16 rssi() / void setRssi(qint16 signal)
返回上次扫描设备时的信号强度。
10、QByteArray serviceData(const QBluetoothUuid &serviceId)
bool setServiceData(const QBluetoothUuid &serviceId, const QByteArray &data)
返回与 serviceId 关联的服务数据。
服务数据由蓝牙核心规范的补充定义,由两部分组成:
- 服务 UUID
- 任意数据字节的序列
远程设备可以为每个 serviceId 提供多个数据条目。此函数仅返回第一个条目。需要所有条使用 serviceData()。
11、QMultiHash<QBluetoothUuid, QByteArray> serviceData()
返回完整的所有服务数据集。
#include "widget.h"
#include "ui_widget.h"
#include <QBluetoothDeviceDiscoveryAgent>
Widget::Widget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::Widget)
{
ui->setupUi(this);
discoveryAgent = new QBluetoothDeviceDiscoveryAgent(this);
connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered,this, &Widget::deviceDiscovered);
}
Widget::~Widget()
{
delete ui;
}
void Widget::deviceDiscovered(const QBluetoothDeviceInfo &device)
{
qDebug() << "发现新设备:" << device.name() << '(' << device.address().toString() << ')';
QMultiHash<QBluetoothUuid, QByteArray> data = device.serviceData();
for(auto it = data.cbegin();it != data.cend();++it)
{
qDebug() << it.key()<<QString(it.value().toHex());
}
}
void Widget::on_pushButton_clicked()
{
qDebug() << "开始搜索";
discoveryAgent->start();
}
12、QList<QBluetoothUuid> serviceIds()
返回所有服务数据 ID。
13、QList<QBluetoothUuid> serviceUuids()
void setServiceUuids(const QList<QBluetoothUuid> &uuids)
返回设备支持的服务 UUID 列表。
边栏推荐
- Derivative, partial derivative, directional derivative
- 【2022国赛模拟】多边形——计算几何、二分答案、倍增
- Web3的先锋兵:虚拟人
- Leetcode:minimum_ depth_ of_ binary_ Tree solutions
- Lombok makes the pit of ⽤ @data and @builder at the same time
- HAVE FUN | “飞船计划”活动最新进展
- 【软件测试】最全面试问题和回答,全文背熟不拿下offer算我输
- 写作系列之contribution
- Work of safety inspection
- 数字滚动增加效果
猜你喜欢

Apifox,你的API接口文档卷成这样了吗?

服装企业部署MES管理系统的五个原因

Google Earth Engine(GEE)——Landsat 全球土地调查 1975年数据集

1 -- Xintang nuc980 nuc980 porting uboot, starting from external mx25l

Douban average 9 x. Five God books in the distributed field!

The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?

Redis入门完整教程:客户端案例分析

6-6漏洞利用-SSH安全防御

C#/VB.NET 删除Word文檔中的水印
![leetcode:736. LISP syntax parsing [flowery + stack + status enumaotu + slots]](/img/0d/e07fe970167368040eb09b05c3682e.png)
leetcode:736. LISP syntax parsing [flowery + stack + status enumaotu + slots]
随机推荐
用全连接+softmax对图片的feature进行分类
Draco - gltf model compression tool
4 -- Xintang nuc980 mount initramfs NFS file system
widerperson数据集转化为YOLO格式
Integerset of PostgreSQL
wzoi 1~200
Apifox, is your API interface document rolled up like this?
Unity custom webgl packaging template
Web3的先锋兵:虚拟人
代码调试core-踩内存
Redis入门完整教程:RDB持久化
The annual salary of general test is 15W, and the annual salary of test and development is 30w+. What is the difference between the two?
Read fast RCNN in one article
【软件测试】最全面试问题和回答,全文背熟不拿下offer算我输
Contribution of Writing Series
Common fitting models and application methods of PCL
How to design interface test cases? Teach you a few tips to draft easily
Code debugging core step memory
Untiy文本框的代码换行问题
Number theory --- fast power, fast power inverse element