当前位置:网站首页>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 .
边栏推荐
- How-PIL-to-Tensor
- Redis入门完整教程:AOF持久化
- c语言字符串排序
- Summary of research status of inertial navigation calibration at home and abroad (abridged version)
- Convert widerperson dataset to Yolo format
- Cloud Mail . NET Edition
- Redis getting started complete tutorial: common exceptions on the client
- 差异与阵列和阵列结构和链表的区别
- Es6中Promise的使用
- 【Socket】①Socket技术概述
猜你喜欢

数论 --- 快速幂、快速幂求逆元

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?

Cloud Mail .NET Edition

Left value, right value

Read fast RCNN in one article
Django database (SQLite) basic introductory tutorial

Redis introduction complete tutorial: client case analysis

Five reasons for clothing enterprises to deploy MES management system

Apifox, is your API interface document rolled up like this?

Redis getting started complete tutorial: client management
随机推荐
What are the applications and benefits of MES management system
LeetCode 77:组合
Wireshark installation
Detailed explanation of 19 dimensional integrated navigation module sinsgps in psins (initial assignment part)
Summary of research status of inertial navigation calibration at home and abroad (abridged version)
服装企业部署MES管理系统的五个原因
Electrical engineering and automation
wzoi 1~200
从控制理论的角度谈数据分析
wzoi 1~200
Difference and the difference between array and array structure and linked list
Planning and design of double click hot standby layer 2 network based on ENSP firewall
PSINS中19维组合导航模块sinsgps详解(时间同步部分)
Cloud Mail . NET Edition
Redis getting started complete tutorial: common exceptions on the client
Oracle中日期的使用方法实例
A complete tutorial for getting started with redis: problem location and optimization
Read fast RCNN in one article
PSINS中19维组合导航模块sinsgps详解(滤波部分)
一文读懂Faster RCNN