当前位置:网站首页>QT Bluetooth: qbluetooth DeviceInfo
QT Bluetooth: qbluetooth DeviceInfo
2022-07-07 02:54:00 【Friendly, friend】
One 、 describe
QBluetoothDeviceInfo Class stores information about Bluetooth devices .
Two 、 Type members
1、enum QBluetoothDeviceInfo::CoreConfiguration: This enumeration describes the configuration of the device .
- UnknownCoreConfiguration: Unable to determine the type of Bluetooth device .
- BaseRateCoreConfiguration: Standard Bluetooth device .
- BaseRateAndLowEnergyCoreConfiguration: Bluetooth smart device , Support standard and low-power devices .
- LowEnergyCoreConfiguration: Low power Bluetooth device .
2、enum class QBluetoothDeviceInfo::Field: This enumeration is related to QBluetoothDeviceDiscoveryAgent::deviceUpdated() Signal combination , Used to indicate the changed field .
- Field::None: No value changes .
- Field::RSSI: The equipment rssi() Value changed .
- Field::ManufacturerData:manufacturerData() Field changed
- Field::ServiceData:serviceData() Field changed
- Field::All: Match all possible fields .
3、enum QBluetoothDeviceInfo::MajorDeviceClass: This enumeration describes the types of major Bluetooth devices .
- MiscellaneousDevice: Miscellaneous equipment .
- ComputerDevice: Computer or PDA .
- PhoneDevice: Telephone equipment .
- NetworkDevice: A device that provides access to a local area network .
- AudioVideoDevice: Can play or capture audio and / Or video devices .
- PeripheralDevice: keyboard 、 Peripheral devices such as mouse .
- ImagingDevice: Imaging equipment , For example, a display 、 The printer 、 Scanner or camera .
- WearableDevice: Wearable device , Such as watches or pagers .
- ToyDevice: Toy equipment .
- HealthDevice: Health related equipment , Such as heart rate or temperature monitor .
- UncategorizedDevice: Other classified equipment .
4、enum QBluetoothDeviceInfo::MinorAudioVideoClass: This enumeration describes Audio / Video device Secondary Bluetooth device .
- UncategorizedAudioVideoDevice: Unclassified audio / Video device .
- WearableHeadsetDevice: Wearable headphones .
- HandsFreeDevice: Hands free device .
- Microphone: Microphone .
- Loudspeaker: A loudspeaker .
- Headphones: The headset .
- PortableAudioDevice: Portable audio device .
- CarAudio: Car audio equipment .
- SetTopBox: The set-top box .
- HiFiAudioDevice:HiFi Audio devices .
- Vcr: video recorder .
- VideoCamera: The camera .
- Camcorder: The camera .
- VideoMonitor: Video monitor .
- VideoDisplayAndLoudspeaker: Video display with built-in speakers .
- VideoConferencing: Video conference equipment .
- GamingDevice: Gaming devices .
5、enum QBluetoothDeviceInfo::MinorComputerClass: This enumeration describes Computer equipment Secondary Bluetooth device .
- UncategorizedComputer: Unclassified computer equipment .
- DesktopComputer: Desktop computer .
- ServerComputer: Server computer .
- LaptopComputer: laptop .
- HandheldClamShellComputer: Flip type handheld computer or handheld computer .
- HandheldComputer: Handheld computer or handheld computer .
- WearableComputer: Wearable computer .
6、enum QBluetoothDeviceInfo::MinorHealthClass: This enumeration describes Health equipment Secondary Bluetooth device .
- UncategorizedHealthDevice: Unclassified health equipment .
- HealthBloodPressureMonitor: Blood pressure monitor .
- HealthThermometer: thermometer .
- HealthWeightScale: Weighing scale .
- HealthGlucoseMeter: Blood glucose meter .
- HealthPulseOximeter: Oxygen saturation meter .
- HealthDataDisplay: Health data display .
- HealthStepCounter: Pedometer .
7、enum QBluetoothDeviceInfo::MinorImagingClass: This enumeration describes Imaging equipment Secondary Bluetooth device .
- UncategorizedImagingDevice: Unclassified imaging devices .
- ImageDisplay: Image display device .
- ImageCamera: camera .
- ImageScanner: Image scanners .
- ImagePrinter: Image printer .
8、enum QBluetoothDeviceInfo::MinorMiscellaneousClass: This enumeration describes Miscellaneous equipment Secondary Bluetooth device .
- UncategorizedMiscellaneous: Miscellaneous equipment not classified .
9、enum QBluetoothDeviceInfo::MinorNetworkClass: This enumeration describes LAN access device Current network utilization .
- NetworkFullService:100% Total bandwidth available .
- NetworkLoadFactorOne: Of the total bandwidth currently being used 0% - 17%.
- NetworkLoadFactorTwo: Of the total bandwidth currently being used 17% - 33%.
- NetworkLoadFactorThree: Of the total bandwidth currently being used 33% - 50%.
- NetworkLoadFactorFour: Of the total bandwidth currently being used 50% - 67%.
- NetworkLoadFactorFive: Of the total bandwidth currently being used 67% - 83%.
- NetworkLoadFactorSix: Of the total bandwidth currently being used 83% - 99%.
- NetworkNoService: No network services available .
10、enum QBluetoothDeviceInfo::MinorPeripheralClass: This enumeration describes Peripherals Secondary Bluetooth device .
- UncategorizedPeripheral: Unclassified peripherals .
- KeyboardPeripheral: keyboard .
- PointingDevicePeripheral: Pointing devices , For example, mouse .
- KeyboardWithPointingDevicePeripheral: Keyboard with built-in pointer device .
- JoystickPeripheral: Joystick .
- GamepadPeripheral: Game handle .
- RemoteControlPeripheral: The remote control .
- SensingDevicePeripheral: Sensing device .
- DigitizerTabletPeripheral: Digital board peripherals .
- CardReaderPeripheral: Card reader peripherals .
11、enum QBluetoothDeviceInfo::MinorPhoneClass: This enumeration describes Telephone equipment Secondary Bluetooth device .
- UncategorizedPhone: Unclassified telephone equipment .
- CellularPhone: mobile phone .
- CordlessPhone: Cordless telephone .
- SmartPhone: A smart phone .
- WiredModemOrVoiceGatewayPhone: Wired modem or voice gateway .
- CommonIsdnAccessPhone: Provide ISDN Devices accessed .
12、enum QBluetoothDeviceInfo::MinorToyClass: This enumeration describes Toy equipment Secondary Bluetooth device .
- UncategorizedToy: Unclassified toys .
- ToyRobot: The toy robot .
- ToyVehicle: Toy car .
- ToyDoll: Dolls or dolls .
- ToyController: controller .
- ToyGam: game .
13、enum QBluetoothDeviceInfo::MinorWearableClass: This enumeration describes Wearable device Secondary Bluetooth device .
- UncategorizedWearableDevice: Unclassified wearable devices .
- WearableWristWatch: watch .
- WearablePager: beeper .
- WearableJacket: The jacket .
- WearableHelmet: Helmet .
- WearableGlasses: glasses .
14、enum QBluetoothDeviceInfo::ServiceClass: This enumeration describes the service type of Bluetooth device .
- NoService: No service provided .
- PositioningService: Provide location services .
- NetworkingService: Provide network services .
- RenderingService: Provide rendering services .
- CapturingService: Provide capture Services .
- ObjectTransferService: Provide object transfer services .
- AudioService: Provide audio services .
- TelephonyService: Provide telephone service .
- InformationService: Provide information services .
- AllServices: Provide all types of services .
3、 ... and 、 Member functions
1、QBluetoothAddressaddress()
Return the address of the device .
stay iOS and macOS On , This address is invalid , You should use deviceUuid(). These two platforms will not disclose Bluetooth addresses for Bluetooth devices found .
2、QBluetoothUuiddeviceUuid() / void setDeviceUuid(const QBluetoothUuid &uuid)
Returns the unique identifier of a Bluetooth device without an address .
Generally speaking , This uuid In addition macOS and iOS It is invalid on all platforms except .
3、bool isCached() / void setCached(bool cached)
Whether the current object was created from cached data . Cached information may not be as accurate as data read from active devices .
4、bool isValid()
Whether the object is valid .
5、QByteArray manufacturerData(quint16 manufacturerId) /
bool setManufacturerData(quint16 producerId, const QByteArray &data)
Return to the manufacturer ID Associated data .
The manufacturer's data is supplemented by the Bluetooth core specification , It's made up of two parts :
- Manufacturer specific identifier code
- A sequence of arbitrary data bytes
Remote devices can be made for each manufacturer ID Provide multiple data entries . This function returns only the first entry . If you need all entries , Use manufacturerData().
6、QMultiHash<quint16, QByteArray> manufacturerData()
Return the complete data set of all manufacturers .
#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() << " Discover new equipment :" << 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() << " Begin your search ";
discoveryAgent->start();
}
7、QList<quint16> manufacturerIds()
Return all manufacturers ID.
8、QString name() / void setName(const QString &name)
Returns the name assigned to the device .
9、qint16 rssi() / void setRssi(qint16 signal)
Returns the signal strength when the device was last scanned .
10、QByteArray serviceData(const QBluetoothUuid &serviceId)
bool setServiceData(const QBluetoothUuid &serviceId, const QByteArray &data)
Return and serviceId Associated service data .
Service data is defined by the Bluetooth core specification , It's made up of two parts :
- service UUID
- A sequence of arbitrary data bytes
Remote devices can be used for each serviceId Provide multiple data entries . This function returns only the first entry . All bars are required serviceData().
11、QMultiHash<QBluetoothUuid, QByteArray> serviceData()
Return the complete data set of all services .
#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() << " Discover new equipment :" << 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() << " Begin your search ";
discoveryAgent->start();
}
12、QList<QBluetoothUuid> serviceIds()
Return all service data ID.
13、QList<QBluetoothUuid> serviceUuids()
void setServiceUuids(const QList<QBluetoothUuid> &uuids)
Return to the services supported by the device UUID list .
边栏推荐
- [leetcode]Search for a Range
- A complete tutorial for getting started with redis: AOF persistence
- Redis入门完整教程:客户端管理
- 导数、偏导数、方向导数
- Redis Getting started tutoriel complet: positionnement et optimisation des problèmes
- 牛客编程题--必刷101之双指针篇
- 差异与阵列和阵列结构和链表的区别
- MySQL提升大量数据查询效率的优化神器
- 简单冒泡排序
- [2022 national tournament simulation] polygon - computational geometry, binary answer, multiplication
猜你喜欢
[socket] ① overview of socket technology
S120驱动器基本调试步骤总结
Matlb| economic scheduling with energy storage, opportunity constraints and robust optimization
Five reasons for clothing enterprises to deploy MES management system
What are the applications and benefits of MES management system
Derivative, partial derivative, directional derivative
Niuke programming problem -- double pointer of 101 must be brushed
NuScenes数据集关于Radar数据的统计
换个姿势做运维!GOPS 2022 · 深圳站精彩内容抢先看!
How to write test cases for test coupons?
随机推荐
Convert widerperson dataset to Yolo format
[2022 national tournament simulation] polygon - computational geometry, binary answer, multiplication
Summary of basic debugging steps of S120 driver
Statistics of radar data in nuscenes data set
Dotconnect for DB2 Data Provider
Leetcode:minimum_ depth_ of_ binary_ Tree solutions
[leetcode]Search for a Range
Leetcode:minimum_depth_of_binary_tree解决问题的方法
Huitong programming introductory course - 2A breakthrough
Redis入门完整教程:复制拓扑
Software testing -- common assertions of JMeter interface testing
一本揭秘字节万台节点ClickHouse背后技术实现的白皮书来了!
Apifox, is your API interface document rolled up like this?
Redis入门完整教程:客户端管理
MySQL
Kubernetes源码分析(二)----资源Resource
Cglib agent in agent mode
基于ensp防火墙双击热备二层网络规划与设计
一文读懂Faster RCNN
Qpushbutton- "function refinement"