![]() |
Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
|
\inmodule QtBluetooth More...
#include <qbluetoothdeviceinfo.h>
Public Member Functions | |
QBluetoothDeviceInfo () | |
Constructs an invalid QBluetoothDeviceInfo object. | |
QBluetoothDeviceInfo (const QBluetoothAddress &address, const QString &name, quint32 classOfDevice) | |
Constructs a QBluetoothDeviceInfo object with Bluetooth address address, device name name and the encoded class of device classOfDevice. | |
QBluetoothDeviceInfo (const QBluetoothUuid &uuid, const QString &name, quint32 classOfDevice) | |
Constructs a QBluetoothDeviceInfo object with unique uuid, device name name and the encoded class of device classOfDevice. | |
QBluetoothDeviceInfo (const QBluetoothDeviceInfo &other) | |
Constructs a QBluetoothDeviceInfo that is a copy of other. | |
~QBluetoothDeviceInfo () | |
Destroys the QBluetoothDeviceInfo. | |
bool | isValid () const |
Returns true if the QBluetoothDeviceInfo object is valid, otherwise returns false. | |
bool | isCached () const |
Returns true if the QBluetoothDeviceInfo object is created from cached data. | |
void | setCached (bool cached) |
Used by the system to set the cached flag if the QBluetoothDeviceInfo is created from cached data. | |
QBluetoothDeviceInfo & | operator= (const QBluetoothDeviceInfo &other) |
Makes a copy of the other and assigns it to this QBluetoothDeviceInfo object. | |
QBluetoothAddress | address () const |
Returns the address of the device. | |
QString | name () const |
Returns the name assigned to the device. | |
void | setName (const QString &name) |
Sets the name of the device. | |
ServiceClasses | serviceClasses () const |
Returns the service class of the device. | |
MajorDeviceClass | majorDeviceClass () const |
Returns the major device class of the device. | |
quint8 | minorDeviceClass () const |
Returns the minor device class of the device. | |
qint16 | rssi () const |
Returns the signal strength when the device was last scanned. | |
void | setRssi (qint16 signal) |
Set the signal strength value, used internally. | |
QList< QBluetoothUuid > | serviceUuids () const |
Returns the list of service UUIDs supported by the device. | |
void | setServiceUuids (const QList< QBluetoothUuid > &uuids) |
Sets the list of service UUIDs to uuids. | |
QList< quint16 > | manufacturerIds () const |
Returns all manufacturer IDs from advertisement packets attached to this device information. | |
QByteArray | manufacturerData (quint16 manufacturerId) const |
Returns the data associated with the given manufacturerId. | |
bool | setManufacturerData (quint16 manufacturerId, const QByteArray &data) |
Sets the advertised manufacturer data for the given manufacturerId. | |
QMultiHash< quint16, QByteArray > | manufacturerData () const |
Returns the complete set of all manufacturer data from advertisement packets. | |
QList< QBluetoothUuid > | serviceIds () const |
Returns all service data IDs from advertisement packets attached to this device information. | |
QByteArray | serviceData (const QBluetoothUuid &serviceId) const |
Returns the data associated with the given serviceId. | |
bool | setServiceData (const QBluetoothUuid &serviceId, const QByteArray &data) |
Sets the advertised service data for the given serviceId. | |
QMultiHash< QBluetoothUuid, QByteArray > | serviceData () const |
Returns the complete set of all service data from advertisement packets. | |
void | setCoreConfigurations (QBluetoothDeviceInfo::CoreConfigurations coreConfigs) |
Sets the CoreConfigurations of the device to coreConfigs. | |
QBluetoothDeviceInfo::CoreConfigurations | coreConfigurations () const |
Returns the configuration of the device. | |
void | setDeviceUuid (const QBluetoothUuid &uuid) |
Sets the unique identifier uuid for Bluetooth devices, that do not have addresses. | |
QBluetoothUuid | deviceUuid () const |
Returns a unique identifier for a Bluetooth device without an address. | |
Protected Attributes | |
QBluetoothDeviceInfoPrivate * | d_ptr |
Friends | |
bool | operator== (const QBluetoothDeviceInfo &a, const QBluetoothDeviceInfo &b) |
Returns true if the two QBluetoothDeviceInfo objects a and b are equal. | |
bool | operator!= (const QBluetoothDeviceInfo &a, const QBluetoothDeviceInfo &b) |
Returns true if the two QBluetoothDeviceInfo objects a and b are not equal. | |
\inmodule QtBluetooth
The QBluetoothDeviceInfo class stores information about the Bluetooth device.
QBluetoothDeviceInfo provides information about a Bluetooth device's name, address and class of device.
Definition at line 21 of file qbluetoothdeviceinfo.h.
This enum describes the configuration of the device.
\value UnknownCoreConfiguration The type of the Bluetooth device cannot be determined. \value BaseRateCoreConfiguration The device is a standard Bluetooth device. \value BaseRateAndLowEnergyCoreConfiguration The device is a Bluetooth Smart device with support for standard and Low Energy device. \value LowEnergyCoreConfiguration The device is a Bluetooth Low Energy device.
Enumerator | |
---|---|
UnknownCoreConfiguration | |
LowEnergyCoreConfiguration | |
BaseRateCoreConfiguration | |
BaseRateAndLowEnergyCoreConfiguration |
Definition at line 168 of file qbluetoothdeviceinfo.h.
|
strong |
This enum is used in conjuntion with the \l QBluetoothDeviceDiscoveryAgent::deviceUpdated() signal and indicates the field that changed.
\value None None of the values changed. \value RSSI The \l rssi() value of the device changed. \value ManufacturerData The \l manufacturerData() field changed \value ServiceData The \l serviceData() field changed \value All Matches every possible field.
Enumerator | |
---|---|
None | |
RSSI | |
ManufacturerData | |
ServiceData | |
All |
Definition at line 159 of file qbluetoothdeviceinfo.h.
This enum describes a Bluetooth device's major device class.
\value MiscellaneousDevice A miscellaneous device. \value ComputerDevice A computer device or PDA. \value PhoneDevice A telephone device. \value NetworkDevice A device that provides access to a local area network (since Qt 5.13). \value AudioVideoDevice A device capable of playback or capture of audio and/or video. \value PeripheralDevice A peripheral device such as a keyboard, mouse, and so on. \value ImagingDevice An imaging device such as a display, printer, scanner or camera. \value WearableDevice A wearable device such as a watch or pager. \value ToyDevice A toy. \value HealthDevice A health reated device such as heart rate or temperature monitor. \value UncategorizedDevice A device that does not fit into any of the other device classes.
Enumerator | |
---|---|
MiscellaneousDevice | |
ComputerDevice | |
PhoneDevice | |
NetworkDevice | |
AudioVideoDevice | |
PeripheralDevice | |
ImagingDevice | |
WearableDevice | |
ToyDevice | |
HealthDevice | |
UncategorizedDevice |
Definition at line 24 of file qbluetoothdeviceinfo.h.
This enum describes the minor device classes for audio/video devices.
\value UncategorizedAudioVideoDevice An uncategorized audio/video device. \value WearableHeadsetDevice A wearable headset device. \value HandsFreeDevice A handsfree device. \value Microphone A microphone. \value Loudspeaker A loudspeaker. \value Headphones Headphones. \value PortableAudioDevice A portable audio device. \value CarAudio A car audio device. \value SetTopBox A settop box. \value HiFiAudioDevice A HiFi audio device. \value Vcr A video cassette recorder. \value VideoCamera A video camera. \value Camcorder A video camera. \value VideoMonitor A video monitor. \value VideoDisplayAndLoudspeaker A video display with built-in loudspeaker. \value VideoConferencing A video conferencing device. \value GamingDevice A gaming device.
Definition at line 72 of file qbluetoothdeviceinfo.h.
This enum describes the minor device classes for computer devices.
\value UncategorizedComputer An uncategorized computer device. \value DesktopComputer A desktop computer. \value ServerComputer A server computer. \value LaptopComputer A laptop computer. \value HandheldClamShellComputer A clamshell handheld computer or PDA. \value HandheldComputer A handheld computer or PDA. \value WearableComputer A wearable computer.
Enumerator | |
---|---|
UncategorizedComputer | |
DesktopComputer | |
ServerComputer | |
LaptopComputer | |
HandheldClamShellComputer | |
HandheldComputer | |
WearableComputer |
Definition at line 42 of file qbluetoothdeviceinfo.h.
This enum describes the minor device classes for health devices.
\value UncategorizedHealthDevice An uncategorized health device. \value HealthBloodPressureMonitor A blood pressure monitor. \value HealthThermometer A Thermometer. \value HealthWeightScale A scale. \value HealthGlucoseMeter A glucose meter. \value HealthPulseOximeter A blood oxygen saturation meter. \value HealthDataDisplay A data display. \value HealthStepCounter A pedometer.
Enumerator | |
---|---|
UncategorizedHealthDevice | |
HealthBloodPressureMonitor | |
HealthThermometer | |
HealthWeightScale | |
HealthGlucoseMeter | |
HealthPulseOximeter | |
HealthDataDisplay | |
HealthStepCounter |
Definition at line 134 of file qbluetoothdeviceinfo.h.
This enum describes the minor device classes for imaging devices.
\value UncategorizedImagingDevice An uncategorized imaging device. \value ImageDisplay A device capable of displaying images. \value ImageCamera A camera. \value ImageScanner An image scanner. \value ImagePrinter A printer.
Enumerator | |
---|---|
UncategorizedImagingDevice | |
ImageDisplay | |
ImageCamera | |
ImageScanner | |
ImagePrinter |
Definition at line 108 of file qbluetoothdeviceinfo.h.
This enum describes the minor device classes for miscellaneous Bluetooth devices.
\value UncategorizedMiscellaneous An uncategorized miscellaneous device.
Enumerator | |
---|---|
UncategorizedMiscellaneous |
Definition at line 38 of file qbluetoothdeviceinfo.h.
This enum describes the minor device classes for local area network access devices.
Local area network access devices use the minor device class to specify the current network utilization.
\value NetworkFullService 100% of the total bandwidth is available. \value NetworkLoadFactorOne 0 - 17% of the total bandwidth is currently being used. \value NetworkLoadFactorTwo 17 - 33% of the total bandwidth is currently being used. \value NetworkLoadFactorThree 33 - 50% of the total bandwidth is currently being used. \value NetworkLoadFactorFour 50 - 67% of the total bandwidth is currently being used. \value NetworkLoadFactorFive 67 - 83% of the total bandwidth is currently being used. \value NetworkLoadFactorSix 83 - 99% of the total bandwidth is currently being used. \value NetworkNoService No network service available.
Enumerator | |
---|---|
NetworkFullService | |
NetworkLoadFactorOne | |
NetworkLoadFactorTwo | |
NetworkLoadFactorThree | |
NetworkLoadFactorFour | |
NetworkLoadFactorFive | |
NetworkLoadFactorSix | |
NetworkNoService |
Definition at line 61 of file qbluetoothdeviceinfo.h.
This enum describes the minor device classes for peripheral devices.
\value UncategorizedPeripheral An uncategorized peripheral device. \value KeyboardPeripheral A keyboard. \value PointingDevicePeripheral A pointing device, for example a mouse. \value KeyboardWithPointingDevicePeripheral A keyboard with built-in pointing device. \value JoystickPeripheral A joystick. \value GamepadPeripheral A game pad. \value RemoteControlPeripheral A remote control. \value SensingDevicePeripheral A sensing device. \value DigitizerTabletPeripheral A digitizer tablet peripheral. \value CardReaderPeripheral A card reader peripheral.
Definition at line 94 of file qbluetoothdeviceinfo.h.
This enum describes the minor device classes for phone devices.
\value UncategorizedPhone An uncategorized phone device. \value CellularPhone A cellular phone. \value CordlessPhone A cordless phone. \value SmartPhone A smart phone. \value WiredModemOrVoiceGatewayPhone A wired modem or voice gateway. \value CommonIsdnAccessPhone A device that provides ISDN access.
Enumerator | |
---|---|
UncategorizedPhone | |
CellularPhone | |
CordlessPhone | |
SmartPhone | |
WiredModemOrVoiceGatewayPhone | |
CommonIsdnAccessPhone |
Definition at line 52 of file qbluetoothdeviceinfo.h.
This enum describes the minor device classes for toy devices.
\value UncategorizedToy An uncategorized toy. \value ToyRobot A toy robot. \value ToyVehicle A toy vehicle. \value ToyDoll A toy doll or action figure. \value ToyController A controller. \value ToyGame A game.
Enumerator | |
---|---|
UncategorizedToy | |
ToyRobot | |
ToyVehicle | |
ToyDoll | |
ToyController | |
ToyGame |
Definition at line 125 of file qbluetoothdeviceinfo.h.
This enum describes the minor device classes for wearable devices.
\value UncategorizedWearableDevice An uncategorized wearable device. \value WearableWristWatch A wristwatch. \value WearablePager A pager. \value WearableJacket A jacket. \value WearableHelmet A helmet. \value WearableGlasses A pair of glasses.
Enumerator | |
---|---|
UncategorizedWearableDevice | |
WearableWristWatch | |
WearablePager | |
WearableJacket | |
WearableHelmet | |
WearableGlasses |
Definition at line 116 of file qbluetoothdeviceinfo.h.
This enum describes the service class of the Bluetooth device.
The service class is used as a rudimentary form of service discovery. It is meant to provide a list of the types of services that the device might provide.
\value NoService The device does not provide any services. \value PositioningService The device provides positioning services. \value NetworkingService The device provides networking services. \value RenderingService The device provides rendering services. \value CapturingService The device provides capturing services. \value ObjectTransferService The device provides object transfer services. \value AudioService The device provides audio services. \value TelephonyService The device provides telephony services. \value InformationService The device provides information services. \value AllServices The device provides services of all types.
Enumerator | |
---|---|
NoService | |
PositioningService | |
NetworkingService | |
RenderingService | |
CapturingService | |
ObjectTransferService | |
AudioService | |
TelephonyService | |
InformationService | |
AllServices |
Definition at line 145 of file qbluetoothdeviceinfo.h.
QBluetoothDeviceInfo::QBluetoothDeviceInfo | ( | ) |
Constructs an invalid QBluetoothDeviceInfo object.
Definition at line 241 of file qbluetoothdeviceinfo.cpp.
QBluetoothDeviceInfo::QBluetoothDeviceInfo | ( | const QBluetoothAddress & | address, |
const QString & | name, | ||
quint32 | classOfDevice ) |
Constructs a QBluetoothDeviceInfo object with Bluetooth address address, device name name and the encoded class of device classOfDevice.
The classOfDevice parameter is encoded in the following format
\table \header
Definition at line 260 of file qbluetoothdeviceinfo.cpp.
QBluetoothDeviceInfo::QBluetoothDeviceInfo | ( | const QBluetoothUuid & | uuid, |
const QString & | name, | ||
quint32 | classOfDevice ) |
Constructs a QBluetoothDeviceInfo object with unique uuid, device name name and the encoded class of device classOfDevice.
This constructor is required for Low Energy devices on \macos and iOS. CoreBluetooth API hides addresses and provides unique UUIDs to identify a device. This UUID is not the same thing as a service UUID and is required to work later with CoreBluetooth API and discovered devices.
Definition at line 289 of file qbluetoothdeviceinfo.cpp.
QBluetoothDeviceInfo::QBluetoothDeviceInfo | ( | const QBluetoothDeviceInfo & | other | ) |
Constructs a QBluetoothDeviceInfo that is a copy of other.
Definition at line 310 of file qbluetoothdeviceinfo.cpp.
QBluetoothDeviceInfo::~QBluetoothDeviceInfo | ( | ) |
Destroys the QBluetoothDeviceInfo.
Definition at line 319 of file qbluetoothdeviceinfo.cpp.
QBluetoothAddress QBluetoothDeviceInfo::address | ( | ) | const |
Returns the address of the device.
Definition at line 434 of file qbluetoothdeviceinfo.cpp.
QBluetoothDeviceInfo::CoreConfigurations QBluetoothDeviceInfo::coreConfigurations | ( | ) | const |
Returns the configuration of the device.
If device configuration is not set, basic rate device configuration will be returned.
Definition at line 701 of file qbluetoothdeviceinfo.cpp.
QBluetoothUuid QBluetoothDeviceInfo::deviceUuid | ( | ) | const |
Returns a unique identifier for a Bluetooth device without an address.
In general, this uuid is invalid on every platform but \macos and iOS. It is used as a workaround for those two platforms as they do not provide Bluetooth addresses for found Bluetooth Low Energy devices. Every other platform uses \l address() instead.
Definition at line 757 of file qbluetoothdeviceinfo.cpp.
bool QBluetoothDeviceInfo::isCached | ( | ) | const |
Returns true if the QBluetoothDeviceInfo object is created from cached data.
Definition at line 711 of file qbluetoothdeviceinfo.cpp.
bool QBluetoothDeviceInfo::isValid | ( | ) | const |
Returns true if the QBluetoothDeviceInfo object is valid, otherwise returns false.
Definition at line 327 of file qbluetoothdeviceinfo.cpp.
QBluetoothDeviceInfo::MajorDeviceClass QBluetoothDeviceInfo::majorDeviceClass | ( | ) | const |
Returns the major device class of the device.
Definition at line 476 of file qbluetoothdeviceinfo.cpp.
QMultiHash< quint16, QByteArray > QBluetoothDeviceInfo::manufacturerData | ( | ) | const |
Returns the complete set of all manufacturer data from advertisement packets.
Some devices may provide multiple manufacturer data entries per manufacturer ID. An example might be a Bluetooth Low Energy device that sends a different manufacturer data via advertisement packets and scan response packets respectively. Therefore the returned hash table may have multiple entries per manufacturer ID or hash key.
Definition at line 599 of file qbluetoothdeviceinfo.cpp.
QByteArray QBluetoothDeviceInfo::manufacturerData | ( | quint16 | manufacturerId | ) | const |
Returns the data associated with the given manufacturerId.
Manufacturer data is defined by the Supplement to the Bluetooth Core Specification and consists of two segments:
\list
The interpretation of the data octets is defined by the manufacturer specified by the company identifier.
Definition at line 558 of file qbluetoothdeviceinfo.cpp.
Returns all manufacturer IDs from advertisement packets attached to this device information.
Definition at line 529 of file qbluetoothdeviceinfo.cpp.
quint8 QBluetoothDeviceInfo::minorDeviceClass | ( | ) | const |
Returns the minor device class of the device.
The actual information is context dependent on the value of \l majorDeviceClass().
Definition at line 491 of file qbluetoothdeviceinfo.cpp.
QString QBluetoothDeviceInfo::name | ( | ) | const |
Returns the name assigned to the device.
Definition at line 444 of file qbluetoothdeviceinfo.cpp.
QBluetoothDeviceInfo & QBluetoothDeviceInfo::operator= | ( | const QBluetoothDeviceInfo & | other | ) |
Makes a copy of the other and assigns it to this QBluetoothDeviceInfo object.
Definition at line 356 of file qbluetoothdeviceinfo.cpp.
qint16 QBluetoothDeviceInfo::rssi | ( | ) | const |
Returns the signal strength when the device was last scanned.
Definition at line 337 of file qbluetoothdeviceinfo.cpp.
QBluetoothDeviceInfo::ServiceClasses QBluetoothDeviceInfo::serviceClasses | ( | ) | const |
Returns the service class of the device.
Definition at line 466 of file qbluetoothdeviceinfo.cpp.
QMultiHash< QBluetoothUuid, QByteArray > QBluetoothDeviceInfo::serviceData | ( | ) | const |
Returns the complete set of all service data from advertisement packets.
Some devices may provide multiple service data entries per service data ID. An example might be a Bluetooth Low Energy device that sends a different service data via advertisement packets and scan response packets respectively. Therefore the returned hash table may have multiple entries per service data ID or hash key.
Definition at line 673 of file qbluetoothdeviceinfo.cpp.
QByteArray QBluetoothDeviceInfo::serviceData | ( | const QBluetoothUuid & | serviceId | ) | const |
Returns the data associated with the given serviceId.
Service data is defined by the Supplement to the Bluetooth Core Specification and consists of two segments:
\list
Definition at line 635 of file qbluetoothdeviceinfo.cpp.
QList< QBluetoothUuid > QBluetoothDeviceInfo::serviceIds | ( | ) | const |
Returns all service data IDs from advertisement packets attached to this device information.
Definition at line 611 of file qbluetoothdeviceinfo.cpp.
QList< QBluetoothUuid > QBluetoothDeviceInfo::serviceUuids | ( | ) | const |
Returns the list of service UUIDs supported by the device.
Most commonly this list of UUIDs represents custom service UUIDs or a service UUID value specified by \l QBluetoothUuid::ServiceClassUuid.
Definition at line 516 of file qbluetoothdeviceinfo.cpp.
void QBluetoothDeviceInfo::setCached | ( | bool | cached | ) |
Used by the system to set the cached flag if the QBluetoothDeviceInfo is created from cached data.
Cached information may not be as accurate as data read from an active device.
Definition at line 722 of file qbluetoothdeviceinfo.cpp.
void QBluetoothDeviceInfo::setCoreConfigurations | ( | QBluetoothDeviceInfo::CoreConfigurations | coreConfigs | ) |
Sets the CoreConfigurations of the device to coreConfigs.
This will help to make a difference between regular and Low Energy devices.
Definition at line 686 of file qbluetoothdeviceinfo.cpp.
void QBluetoothDeviceInfo::setDeviceUuid | ( | const QBluetoothUuid & | uuid | ) |
Sets the unique identifier uuid for Bluetooth devices, that do not have addresses.
This happens on \macos and iOS, where the CoreBluetooth API hides addresses, but provides UUIDs to identify devices/peripherals.
This uuid is invalid on any other platform.
Definition at line 739 of file qbluetoothdeviceinfo.cpp.
bool QBluetoothDeviceInfo::setManufacturerData | ( | quint16 | manufacturerId, |
const QByteArray & | data ) |
Sets the advertised manufacturer data for the given manufacturerId.
Returns true
if it was inserted, false
if it was already known.
Since Qt 5.14, different values for data and the same manufacturerId no longer replace each other but are accumulated for the duration of a device scan.
Definition at line 574 of file qbluetoothdeviceinfo.cpp.
Set the signal strength value, used internally.
Definition at line 347 of file qbluetoothdeviceinfo.cpp.
bool QBluetoothDeviceInfo::setServiceData | ( | const QBluetoothUuid & | serviceId, |
const QByteArray & | data ) |
Sets the advertised service data for the given serviceId.
Returns true
if it was inserted, false
if it was already known.
Definition at line 648 of file qbluetoothdeviceinfo.cpp.
void QBluetoothDeviceInfo::setServiceUuids | ( | const QList< QBluetoothUuid > & | uuids | ) |
Sets the list of service UUIDs to uuids.
Definition at line 502 of file qbluetoothdeviceinfo.cpp.
|
friend |
Returns true
if the two QBluetoothDeviceInfo objects a and b are not equal.
Definition at line 194 of file qbluetoothdeviceinfo.h.
|
friend |
Returns true
if the two QBluetoothDeviceInfo objects a and b are equal.
Definition at line 190 of file qbluetoothdeviceinfo.h.
|
protected |
Definition at line 230 of file qbluetoothdeviceinfo.h.