QBluetoothDeviceInfo Class | Qt Bluetooth 5.9

Qt 5.9 | Qt Bluetooth | C++ Classes | QBluetoothDeviceInfo

Qt 5.9.9 Reference Documentation

# QBluetoothDeviceInfo Class

The QBluetoothDeviceInfo class stores information about the Bluetooth device. More...

Header: | #include <QBluetoothDeviceInfo>
qmake: | QT += bluetooth
Since: | Qt 5.2

- List of all members, including inherited members

## Public Types

enum | CoreConfiguration { UnknownCoreConfiguration, BaseRateCoreConfiguration, BaseRateAndLowEnergyCoreConfiguration, LowEnergyCoreConfiguration }
flags | CoreConfigurations
enum | DataCompleteness { DataComplete, DataIncomplete, DataUnavailable }
enum | MajorDeviceClass { MiscellaneousDevice, ComputerDevice, PhoneDevice, LANAccessDevice, ..., UncategorizedDevice }
enum | MinorAudioVideoClass { UncategorizedAudioVideoDevice, WearableHeadsetDevice, HandsFreeDevice, Microphone, ..., GamingDevice }
enum | MinorComputerClass { UncategorizedComputer, DesktopComputer, ServerComputer, LaptopComputer, ..., WearableComputer }
enum | MinorHealthClass { UncategorizedHealthDevice, HealthBloodPressureMonitor, HealthThermometer, HealthWeightScale, ..., HealthStepCounter }
enum | MinorImagingClass { UncategorizedImagingDevice, ImageDisplay, ImageCamera, ImageScanner, ImagePrinter }
enum | MinorMiscellaneousClass { UncategorizedMiscellaneous }
enum | MinorNetworkClass { NetworkFullService, NetworkLoadFactorOne, NetworkLoadFactorTwo, NetworkLoadFactorThree, ..., NetworkNoService }
enum | MinorPeripheralClass { UncategorizedPeripheral, KeyboardPeripheral, PointingDevicePeripheral, KeyboardWithPointingDevicePeripheral, ..., CardReaderPeripheral }
enum | MinorPhoneClass { UncategorizedPhone, CellularPhone, CordlessPhone, SmartPhone, WiredModemOrVoiceGatewayPhone, CommonIsdnAccessPhone }
enum | MinorToyClass { UncategorizedToy, ToyRobot, ToyVehicle, ToyDoll, ToyController, ToyGame }
enum | MinorWearableClass { UncategorizedWearableDevice, WearableWristWatch, WearablePager, WearableJacket, WearableHelmet, WearableGlasses }
enum | ServiceClass { NoService, PositioningService, NetworkingService, RenderingService, ..., AllServices }
flags | ServiceClasses

## Public Functions

| QBluetoothDeviceInfo()
| QBluetoothDeviceInfo(const QBluetoothAddress &address, const QString &name, quint32 classOfDevice)
| QBluetoothDeviceInfo(const QBluetoothUuid &uuid, const QString &name, quint32 classOfDevice)
| QBluetoothDeviceInfo(const QBluetoothDeviceInfo &other)
| ~QBluetoothDeviceInfo()
QBluetoothAddress | address() const
QBluetoothDeviceInfo::CoreConfigurations | coreConfigurations() const
QBluetoothUuid | deviceUuid() const
bool | isCached() const
bool | isValid() const
MajorDeviceClass | majorDeviceClass() const
quint8 | minorDeviceClass() const
QString | name() const
qint16 | rssi() const
ServiceClasses | serviceClasses() const
QList<QBluetoothUuid> | serviceUuids(DataCompleteness *completeness = Q_NULLPTR) const
DataCompleteness | serviceUuidsCompleteness() const
void | setCached(bool cached)
void | setCoreConfigurations(QBluetoothDeviceInfo::CoreConfigurations coreConfigs)
void | setDeviceUuid(const QBluetoothUuid &uuid)
void | setRssi(qint16 signal)
void | setServiceUuids(const QList<QBluetoothUuid> &uuids, DataCompleteness completeness)
bool | operator!=(const QBluetoothDeviceInfo &other) const
QBluetoothDeviceInfo & | operator=(const QBluetoothDeviceInfo &other)
bool | operator==(const QBluetoothDeviceInfo &other) const

## Detailed Description

The QBluetoothDeviceInfo class stores information about the Bluetooth device.

QBluetoothDeviceInfo provides information about a Bluetooth device's name, address and class of device.

## Member Type Documentation

### enum QBluetoothDeviceInfo::CoreConfiguration
flags QBluetoothDeviceInfo::CoreConfigurations

This enum describes the configuration of the device.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::UnknownCoreConfiguration` | `0x0` | The type of the Bluetooth device cannot be determined.
`QBluetoothDeviceInfo::BaseRateCoreConfiguration` | `0x02` | The device is a standard Bluetooth device.
`QBluetoothDeviceInfo::BaseRateAndLowEnergyCoreConfiguration` | `0x03` | The device is a Bluetooth Smart device with support for standard and Low Energy device.
`QBluetoothDeviceInfo::LowEnergyCoreConfiguration` | `0x01` | The device is a Bluetooth Low Energy device.

This enum was introduced or modified in Qt 5.4.

The CoreConfigurations type is a typedef for QFlags<CoreConfiguration>. It stores an OR combination of CoreConfiguration values.

### enum QBluetoothDeviceInfo::DataCompleteness

This enum describes the completeness of the received data.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::DataComplete` | `0` | The data is complete.
`QBluetoothDeviceInfo::DataIncomplete` | `1` | The data is incomplete. Addition datum is available via other interfaces.
`QBluetoothDeviceInfo::DataUnavailable` | `2` | No data is available.

### enum QBluetoothDeviceInfo::MajorDeviceClass

This enum describes a Bluetooth device's major device class.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::MiscellaneousDevice` | `0` | A miscellaneous device.
`QBluetoothDeviceInfo::ComputerDevice` | `1` | A computer device or PDA.
`QBluetoothDeviceInfo::PhoneDevice` | `2` | A telephone device.
`QBluetoothDeviceInfo::LANAccessDevice` | `3` | A device that provides access to a local area network.
`QBluetoothDeviceInfo::AudioVideoDevice` | `4` | A device capable of playback or capture of audio and/or video.
`QBluetoothDeviceInfo::PeripheralDevice` | `5` | A peripheral device such as a keyboard, mouse, and so on.
`QBluetoothDeviceInfo::ImagingDevice` | `6` | An imaging device such as a display, printer, scanner or camera.
`QBluetoothDeviceInfo::WearableDevice` | `7` | A wearable device such as a watch or pager.
`QBluetoothDeviceInfo::ToyDevice` | `8` | A toy.
`QBluetoothDeviceInfo::HealthDevice` | `9` | A health reated device such as heart rate or temperature monitor.
`QBluetoothDeviceInfo::UncategorizedDevice` | `31` | A device that does not fit into any of the other device classes.

### enum QBluetoothDeviceInfo::MinorAudioVideoClass

This enum describes the minor device classes for audio/video devices.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::UncategorizedAudioVideoDevice` | `0` | An uncategorized audio/video device.
`QBluetoothDeviceInfo::WearableHeadsetDevice` | `1` | A wearable headset device.
`QBluetoothDeviceInfo::HandsFreeDevice` | `2` | A handsfree device.
`QBluetoothDeviceInfo::Microphone` | `4` | A microphone.
`QBluetoothDeviceInfo::Loudspeaker` | `5` | A loudspeaker.
`QBluetoothDeviceInfo::Headphones` | `6` | Headphones.
`QBluetoothDeviceInfo::PortableAudioDevice` | `7` | A portable audio device.
`QBluetoothDeviceInfo::CarAudio` | `8` | A car audio device.
`QBluetoothDeviceInfo::SetTopBox` | `9` | A settop box.
`QBluetoothDeviceInfo::HiFiAudioDevice` | `10` | A HiFi audio device.
`QBluetoothDeviceInfo::Vcr` | `11` | A video cassette recorder.
`QBluetoothDeviceInfo::VideoCamera` | `12` | A video camera.
`QBluetoothDeviceInfo::Camcorder` | `13` | A video camera.
`QBluetoothDeviceInfo::VideoMonitor` | `14` | A video monitor.
`QBluetoothDeviceInfo::VideoDisplayAndLoudspeaker` | `15` | A video display with built-in loudspeaker.
`QBluetoothDeviceInfo::VideoConferencing` | `16` | A video conferencing device.
`QBluetoothDeviceInfo::GamingDevice` | `18` | A gaming device.

### enum QBluetoothDeviceInfo::MinorComputerClass

This enum describes the minor device classes for computer devices.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::UncategorizedComputer` | `0` | An uncategorized computer device.
`QBluetoothDeviceInfo::DesktopComputer` | `1` | A desktop computer.
`QBluetoothDeviceInfo::ServerComputer` | `2` | A server computer.
`QBluetoothDeviceInfo::LaptopComputer` | `3` | A laptop computer.
`QBluetoothDeviceInfo::HandheldClamShellComputer` | `4` | A clamshell handheld computer or PDA.
`QBluetoothDeviceInfo::HandheldComputer` | `5` | A handheld computer or PDA.
`QBluetoothDeviceInfo::WearableComputer` | `6` | A wearable computer.

### enum QBluetoothDeviceInfo::MinorHealthClass

This enum describes the minor device classes for health devices.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::UncategorizedHealthDevice` | `0` | An uncategorized health device.
`QBluetoothDeviceInfo::HealthBloodPressureMonitor` | `0x1` | A blood pressure monitor.
`QBluetoothDeviceInfo::HealthThermometer` | `0x2` | A Thermometer.
`QBluetoothDeviceInfo::HealthWeightScale` | `0x3` | A scale.
`QBluetoothDeviceInfo::HealthGlucoseMeter` | `0x4` | A glucose meter.
`QBluetoothDeviceInfo::HealthPulseOximeter` | `0x5` | A blood oxygen saturation meter.
`QBluetoothDeviceInfo::HealthDataDisplay` | `0x7` | A data display.
`QBluetoothDeviceInfo::HealthStepCounter` | `0x8` | A pedometer.

### enum QBluetoothDeviceInfo::MinorImagingClass

This enum describes the minor device classes for imaging devices.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::UncategorizedImagingDevice` | `0` | An uncategorized imaging device.
`QBluetoothDeviceInfo::ImageDisplay` | `0x04` | A device capable of displaying images.
`QBluetoothDeviceInfo::ImageCamera` | `0x08` | A camera.
`QBluetoothDeviceInfo::ImageScanner` | `0x10` | An image scanner.
`QBluetoothDeviceInfo::ImagePrinter` | `0x20` | A printer.

### enum QBluetoothDeviceInfo::MinorMiscellaneousClass

This enum describes the minor device classes for miscellaneous Bluetooth devices.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::UncategorizedMiscellaneous` | `0` | An uncategorized miscellaneous device.

### enum QBluetoothDeviceInfo::MinorNetworkClass

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.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::NetworkFullService` | `0x00` | 100% of the total bandwidth is available.
`QBluetoothDeviceInfo::NetworkLoadFactorOne` | `0x08` | 0 - 17% of the total bandwidth is currently being used.
`QBluetoothDeviceInfo::NetworkLoadFactorTwo` | `0x10` | 17 - 33% of the total bandwidth is currently being used.
`QBluetoothDeviceInfo::NetworkLoadFactorThree` | `0x18` | 33 - 50% of the total bandwidth is currently being used.
`QBluetoothDeviceInfo::NetworkLoadFactorFour` | `0x20` | 50 - 67% of the total bandwidth is currently being used.
`QBluetoothDeviceInfo::NetworkLoadFactorFive` | `0x28` | 67 - 83% of the total bandwidth is currently being used.
`QBluetoothDeviceInfo::NetworkLoadFactorSix` | `0x30` | 83 - 99% of the total bandwidth is currently being used.
`QBluetoothDeviceInfo::NetworkNoService` | `0x38` | No network service available.

### enum QBluetoothDeviceInfo::MinorPeripheralClass

This enum describes the minor device classes for peripheral devices.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::UncategorizedPeripheral` | `0` | An uncategorized peripheral device.
`QBluetoothDeviceInfo::KeyboardPeripheral` | `0x10` | A keyboard.
`QBluetoothDeviceInfo::PointingDevicePeripheral` | `0x20` | A pointing device, for example a mouse.
`QBluetoothDeviceInfo::KeyboardWithPointingDevicePeripheral` | `0x30` | A keyboard with built-in pointing device.
`QBluetoothDeviceInfo::JoystickPeripheral` | `0x01` | A joystick.
`QBluetoothDeviceInfo::GamepadPeripheral` | `0x02` | A game pad.
`QBluetoothDeviceInfo::RemoteControlPeripheral` | `0x03` | A remote control.
`QBluetoothDeviceInfo::SensingDevicePeripheral` | `0x04` | A sensing device.
`QBluetoothDeviceInfo::DigitizerTabletPeripheral` | `0x05` | A digitizer tablet peripheral.
`QBluetoothDeviceInfo::CardReaderPeripheral` | `0x06` | A card reader peripheral.

### enum QBluetoothDeviceInfo::MinorPhoneClass

This enum describes the minor device classes for phone devices.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::UncategorizedPhone` | `0` | An uncategorized phone device.
`QBluetoothDeviceInfo::CellularPhone` | `1` | A cellular phone.
`QBluetoothDeviceInfo::CordlessPhone` | `2` | A cordless phone.
`QBluetoothDeviceInfo::SmartPhone` | `3` | A smart phone.
`QBluetoothDeviceInfo::WiredModemOrVoiceGatewayPhone` | `4` | A wired modem or voice gateway.
`QBluetoothDeviceInfo::CommonIsdnAccessPhone` | `5` | A device that provides ISDN access.

### enum QBluetoothDeviceInfo::MinorToyClass

This enum describes the minor device classes for toy devices.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::UncategorizedToy` | `0` | An uncategorized toy.
`QBluetoothDeviceInfo::ToyRobot` | `1` | A toy robot.
`QBluetoothDeviceInfo::ToyVehicle` | `2` | A toy vehicle.
`QBluetoothDeviceInfo::ToyDoll` | `3` | A toy doll or action figure.
`QBluetoothDeviceInfo::ToyController` | `4` | A controller.
`QBluetoothDeviceInfo::ToyGame` | `5` | A game.

### enum QBluetoothDeviceInfo::MinorWearableClass

This enum describes the minor device classes for wearable devices.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::UncategorizedWearableDevice` | `0` | An uncategorized wearable device.
`QBluetoothDeviceInfo::WearableWristWatch` | `1` | A wristwatch.
`QBluetoothDeviceInfo::WearablePager` | `2` | A pager.
`QBluetoothDeviceInfo::WearableJacket` | `3` | A jacket.
`QBluetoothDeviceInfo::WearableHelmet` | `4` | A helmet.
`QBluetoothDeviceInfo::WearableGlasses` | `5` | A pair of glasses.

### enum QBluetoothDeviceInfo::ServiceClass
flags QBluetoothDeviceInfo::ServiceClasses

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.

Constant | Value | Description
--- | --- | ---
`QBluetoothDeviceInfo::NoService` | `0x0000` | The device does not provide any services.
`QBluetoothDeviceInfo::PositioningService` | `0x0001` | The device provides positioning services.
`QBluetoothDeviceInfo::NetworkingService` | `0x0002` | The device provides networking services.
`QBluetoothDeviceInfo::RenderingService` | `0x0004` | The device provides rendering services.
`QBluetoothDeviceInfo::CapturingService` | `0x0008` | The device provides capturing services.
`QBluetoothDeviceInfo::ObjectTransferService` | `0x0010` | The device provides object transfer services.
`QBluetoothDeviceInfo::AudioService` | `0x0020` | The device provides audio services.
`QBluetoothDeviceInfo::TelephonyService` | `0x0040` | The device provides telephony services.
`QBluetoothDeviceInfo::InformationService` | `0x0080` | The device provides information services.
`QBluetoothDeviceInfo::AllServices` | `0x07ff` | The device provides services of all types.

The ServiceClasses type is a typedef for QFlags<ServiceClass>. It stores an OR combination of ServiceClass values.

## Member Function Documentation

### QBluetoothDeviceInfo::QBluetoothDeviceInfo()

Constructs an invalid QBluetoothDeviceInfo object.

### 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

Bits | Size | Description
--- | --- | ---
0 - 1 | 2 | Unused, set to 0.
2 - 7 | 6 | Minor device class.
8 - 12 | 5 | Major device class.
13 - 23 | 11 | Service class.

### 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.

This function was introduced in Qt 5.5.

### QBluetoothDeviceInfo::QBluetoothDeviceInfo(const QBluetoothDeviceInfo &other)

Constructs a QBluetoothDeviceInfo that is a copy of other.

### QBluetoothDeviceInfo::~QBluetoothDeviceInfo()

Destroys the QBluetoothDeviceInfo.

### QBluetoothAddress QBluetoothDeviceInfo::address() const

Returns the address of the device.

Note: On iOS and macOS this address is invalid. Instead deviceUuid() should be used. Those two platforms do not expose Bluetooth addresses for found Bluetooth devices and utilize unique device identifiers.

See also deviceUuid().

### QBluetoothDeviceInfo::CoreConfigurations QBluetoothDeviceInfo::coreConfigurations() const

Returns the configuration of the device. If device configuration is not set, basic rate device configuration will be returned.

This function was introduced in Qt 5.4.

See also setCoreConfigurations().

### 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 address() instead.

This function was introduced in Qt 5.5.

See also setDeviceUuid().

### bool QBluetoothDeviceInfo::isCached() const

Returns true if the QBluetoothDeviceInfo object is created from cached data.

### bool QBluetoothDeviceInfo::isValid() const

Returns true if the QBluetoothDeviceInfo object is valid, otherwise returns false.

### MajorDeviceClass QBluetoothDeviceInfo::majorDeviceClass() const

Returns the major device class of the device.

### quint8 QBluetoothDeviceInfo::minorDeviceClass() const

Returns the minor device class of the device. The actual information is context dependent on the value of majorDeviceClass().

See also MinorAudioVideoClass, MinorComputerClass, MinorHealthClass, MinorImagingClass, MinorMiscellaneousClass, MinorNetworkClass, MinorPeripheralClass, MinorPhoneClass, MinorToyClass, and MinorWearableClass.

### QString QBluetoothDeviceInfo::name() const

Returns the name assigned to the device.

### qint16 QBluetoothDeviceInfo::rssi() const

Returns the signal strength when the device was last scanned

See also setRssi().

### ServiceClasses QBluetoothDeviceInfo::serviceClasses() const

Returns the service class of the device.

### QList<QBluetoothUuid> QBluetoothDeviceInfo::serviceUuids(DataCompleteness *completeness = Q_NULLPTR) const

Returns the list of service UUIDS supported by the device. If completeness is not 0 it will be set to DataComplete and the complete list of UUIDs supported by the device is returned. DataIncomplete if additional service UUIDs are supported by the device and DataUnavailable if no service UUID information is available.

This function requires both the Bluetooth devices to support the 2.1 specification.

See also setServiceUuids().

### DataCompleteness QBluetoothDeviceInfo::serviceUuidsCompleteness() const

Returns the completeness of the service UUID list. If DataComplete is returned, serviceUuids() returns the complete list of service UUIDs supported by the device, otherwise only the partial or empty list of service UUIDs. To get a list of all services supported by the device, a full service discovery needs to be performed.

### 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.

See also isCached().

### 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.

This function was introduced in Qt 5.4.

See also coreConfigurations().

### 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.

This function was introduced in Qt 5.5.

See also deviceUuid().

### void QBluetoothDeviceInfo::setRssi(qint16 signal)

Set the signal strength value, used internally.

See also rssi().

### void QBluetoothDeviceInfo::setServiceUuids(const QList<QBluetoothUuid> &uuids, DataCompleteness completeness)

Sets the list of service UUIDs to uuids and the completeness of the data to completeness.

See also serviceUuids().

### bool QBluetoothDeviceInfo::operator!=(const QBluetoothDeviceInfo &other) const

Returns true if this object is different from other, or false otherwise.

See also operator==().

### QBluetoothDeviceInfo &QBluetoothDeviceInfo::operator=(const QBluetoothDeviceInfo &other)

Makes a copy of the other and assigns it to this QBluetoothDeviceInfo object.

### bool QBluetoothDeviceInfo::operator==(const QBluetoothDeviceInfo &other) const

Returns true if the other QBluetoothDeviceInfo object and this are identical.