当前位置:网站首页>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入门完整教程:复制配置
- Contribution of Writing Series
- Redis getting started complete tutorial: replication configuration
- 哈希表及完整注释
- Code debugging core step memory
- MySQL
- Statistics of radar data in nuscenes data set
- Safety delivery engineer
- Andrews - multimedia programming
- A complete tutorial for getting started with redis: RDB persistence
猜你喜欢
How to design interface test cases? Teach you a few tips to draft easily
MySQL --- 常用函数 - 字符串函数
A complete tutorial for getting started with redis: problem location and optimization
The third season of ape table school is about to launch, opening a new vision for developers under the wave of going to sea
Huitong programming introductory course - 2A breakthrough
【2022国赛模拟】多边形——计算几何、二分答案、倍增
Hash table and full comments
Redis introduction complete tutorial: client case analysis
Redis入门完整教程:复制原理
uniapp的表单验证
随机推荐
A complete tutorial for getting started with redis: RDB persistence
Difference and the difference between array and array structure and linked list
MySQL is an optimization artifact to improve the efficiency of massive data query
[socket] ① overview of socket technology
一文读懂Faster RCNN
widerperson数据集转化为YOLO格式
Hash table and full comments
C language exercises_ one
Redis入门完整教程:客户端常见异常
慧通编程入门课程 - 2A闯关
ERROR: Could not find a version that satisfies the requirement xxxxx (from versions: none)解决办法
Redis入门完整教程:复制配置
牛客编程题--必刷101之双指针篇
Redis入门完整教程:RDB持久化
测试优惠券要怎么写测试用例?
Redis入门完整教程:客户端管理
Classify the features of pictures with full connection +softmax
Fundamentals of process management
uniapp适配问题
实施MES管理系统时,哪些管理点是需要注意的