当前位置:网站首页>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 .
边栏推荐
- Redis入门完整教程:客户端案例分析
- 2022 spring recruitment begins, and a collection of 10000 word interview questions will help you
- Cloud Mail . NET Edition
- HAVE FUN | “飞船计划”活动最新进展
- 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?
- PSINS中19维组合导航模块sinsgps详解(时间同步部分)
- 从控制理论的角度谈数据分析
- 记一次JAP查询导致OOM的问题分析
- Redis getting started complete tutorial: replication configuration
- Contribution of Writing Series
猜你喜欢

A complete tutorial for getting started with redis: AOF persistence

Redis入门完整教程:客户端管理

软件测试——Jmeter接口测试之常用断言

Five reasons for clothing enterprises to deploy MES management system

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

Digital scrolling increases effect

Es6中Promise的使用

普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
![[socket] ① overview of socket technology](/img/91/dccbf27a17418ea632c343551bccc0.png)
[socket] ① overview of socket technology

Install redis from zero
随机推荐
差异与阵列和阵列结构和链表的区别
Redis introduction complete tutorial: client case analysis
Redis getting started complete tutorial: replication topology
AWS learning notes (I)
The panel floating with the mouse in unity can adapt to the size of text content
Redis入门完整教程:复制拓扑
Electrical engineering and automation
wireshark安装
慧通编程入门课程 - 2A闯关
PSINS中19维组合导航模块sinsgps详解(初始赋值部分)
Introduction to ins/gps integrated navigation type
How to write test cases for test coupons?
简单冒泡排序
NuScenes数据集关于Radar数据的统计
从零安装Redis
Hash table and full comments
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?
A complete tutorial for getting started with redis: AOF persistence
[leetcode]Search for a Range
Redis入門完整教程:問題定比特與優化