class QBluetoothDeviceInfo

The QBluetoothDeviceInfo class stores information about the Bluetooth device. More

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

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

class MajorDeviceClass

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

Constant

Description

QBluetoothDeviceInfo.MiscellaneousDevice

A miscellaneous device.

QBluetoothDeviceInfo.ComputerDevice

A computer device or PDA.

QBluetoothDeviceInfo.PhoneDevice

A telephone device.

QBluetoothDeviceInfo.NetworkDevice

A device that provides access to a local area network (since Qt 5.13).

QBluetoothDeviceInfo.AudioVideoDevice

A device capable of playback or capture of audio and/or video.

QBluetoothDeviceInfo.PeripheralDevice

A peripheral device such as a keyboard, mouse, and so on.

QBluetoothDeviceInfo.ImagingDevice

An imaging device such as a display, printer, scanner or camera.

QBluetoothDeviceInfo.WearableDevice

A wearable device such as a watch or pager.

QBluetoothDeviceInfo.ToyDevice

A toy.

QBluetoothDeviceInfo.HealthDevice

A health reated device such as heart rate or temperature monitor.

QBluetoothDeviceInfo.UncategorizedDevice

A device that does not fit into any of the other device classes.

class MinorMiscellaneousClass

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

Constant

Description

QBluetoothDeviceInfo.UncategorizedMiscellaneous

An uncategorized miscellaneous device.

class MinorComputerClass

This enum describes the minor device classes for computer devices.

Constant

Description

QBluetoothDeviceInfo.UncategorizedComputer

An uncategorized computer device.

QBluetoothDeviceInfo.DesktopComputer

A desktop computer.

QBluetoothDeviceInfo.ServerComputer

A server computer.

QBluetoothDeviceInfo.LaptopComputer

A laptop computer.

QBluetoothDeviceInfo.HandheldClamShellComputer

A clamshell handheld computer or PDA.

QBluetoothDeviceInfo.HandheldComputer

A handheld computer or PDA.

QBluetoothDeviceInfo.WearableComputer

A wearable computer.

class MinorPhoneClass

This enum describes the minor device classes for phone devices.

Constant

Description

QBluetoothDeviceInfo.UncategorizedPhone

An uncategorized phone device.

QBluetoothDeviceInfo.CellularPhone

A cellular phone.

QBluetoothDeviceInfo.CordlessPhone

A cordless phone.

QBluetoothDeviceInfo.SmartPhone

A smart phone.

QBluetoothDeviceInfo.WiredModemOrVoiceGatewayPhone

A wired modem or voice gateway.

QBluetoothDeviceInfo.CommonIsdnAccessPhone

A device that provides ISDN access.

class 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

Description

QBluetoothDeviceInfo.NetworkFullService

100% of the total bandwidth is available.

QBluetoothDeviceInfo.NetworkLoadFactorOne

0 - 17% of the total bandwidth is currently being used.

QBluetoothDeviceInfo.NetworkLoadFactorTwo

17 - 33% of the total bandwidth is currently being used.

QBluetoothDeviceInfo.NetworkLoadFactorThree

33 - 50% of the total bandwidth is currently being used.

QBluetoothDeviceInfo.NetworkLoadFactorFour

50 - 67% of the total bandwidth is currently being used.

QBluetoothDeviceInfo.NetworkLoadFactorFive

67 - 83% of the total bandwidth is currently being used.

QBluetoothDeviceInfo.NetworkLoadFactorSix

83 - 99% of the total bandwidth is currently being used.

QBluetoothDeviceInfo.NetworkNoService

No network service available.

class MinorAudioVideoClass

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

Constant

Description

QBluetoothDeviceInfo.UncategorizedAudioVideoDevice

An uncategorized audio/video device.

QBluetoothDeviceInfo.WearableHeadsetDevice

A wearable headset device.

QBluetoothDeviceInfo.HandsFreeDevice

A handsfree device.

QBluetoothDeviceInfo.Microphone

A microphone.

QBluetoothDeviceInfo.Loudspeaker

A loudspeaker.

QBluetoothDeviceInfo.Headphones

Headphones.

QBluetoothDeviceInfo.PortableAudioDevice

A portable audio device.

QBluetoothDeviceInfo.CarAudio

A car audio device.

QBluetoothDeviceInfo.SetTopBox

A settop box.

QBluetoothDeviceInfo.HiFiAudioDevice

A HiFi audio device.

QBluetoothDeviceInfo.Vcr

A video cassette recorder.

QBluetoothDeviceInfo.VideoCamera

A video camera.

QBluetoothDeviceInfo.Camcorder

A video camera.

QBluetoothDeviceInfo.VideoMonitor

A video monitor.

QBluetoothDeviceInfo.VideoDisplayAndLoudspeaker

A video display with built-in loudspeaker.

QBluetoothDeviceInfo.VideoConferencing

A video conferencing device.

QBluetoothDeviceInfo.GamingDevice

A gaming device.

class MinorPeripheralClass

This enum describes the minor device classes for peripheral devices.

Constant

Description

QBluetoothDeviceInfo.UncategorizedPeripheral

An uncategorized peripheral device.

QBluetoothDeviceInfo.KeyboardPeripheral

A keyboard.

QBluetoothDeviceInfo.PointingDevicePeripheral

A pointing device, for example a mouse.

QBluetoothDeviceInfo.KeyboardWithPointingDevicePeripheral

A keyboard with built-in pointing device.

QBluetoothDeviceInfo.JoystickPeripheral

A joystick.

QBluetoothDeviceInfo.GamepadPeripheral

A game pad.

QBluetoothDeviceInfo.RemoteControlPeripheral

A remote control.

QBluetoothDeviceInfo.SensingDevicePeripheral

A sensing device.

QBluetoothDeviceInfo.DigitizerTabletPeripheral

A digitizer tablet peripheral.

QBluetoothDeviceInfo.CardReaderPeripheral

A card reader peripheral.

class MinorImagingClass

This enum describes the minor device classes for imaging devices.

Constant

Description

QBluetoothDeviceInfo.UncategorizedImagingDevice

An uncategorized imaging device.

QBluetoothDeviceInfo.ImageDisplay

A device capable of displaying images.

QBluetoothDeviceInfo.ImageCamera

A camera.

QBluetoothDeviceInfo.ImageScanner

An image scanner.

QBluetoothDeviceInfo.ImagePrinter

A printer.

class MinorWearableClass

This enum describes the minor device classes for wearable devices.

Constant

Description

QBluetoothDeviceInfo.UncategorizedWearableDevice

An uncategorized wearable device.

QBluetoothDeviceInfo.WearableWristWatch

A wristwatch.

QBluetoothDeviceInfo.WearablePager

A pager.

QBluetoothDeviceInfo.WearableJacket

A jacket.

QBluetoothDeviceInfo.WearableHelmet

A helmet.

QBluetoothDeviceInfo.WearableGlasses

A pair of glasses.

class MinorToyClass

This enum describes the minor device classes for toy devices.

Constant

Description

QBluetoothDeviceInfo.UncategorizedToy

An uncategorized toy.

QBluetoothDeviceInfo.ToyRobot

A toy robot.

QBluetoothDeviceInfo.ToyVehicle

A toy vehicle.

QBluetoothDeviceInfo.ToyDoll

A toy doll or action figure.

QBluetoothDeviceInfo.ToyController

A controller.

QBluetoothDeviceInfo.ToyGame

A game.

class MinorHealthClass

This enum describes the minor device classes for health devices.

Constant

Description

QBluetoothDeviceInfo.UncategorizedHealthDevice

An uncategorized health device.

QBluetoothDeviceInfo.HealthBloodPressureMonitor

A blood pressure monitor.

QBluetoothDeviceInfo.HealthThermometer

A Thermometer.

QBluetoothDeviceInfo.HealthWeightScale

A scale.

QBluetoothDeviceInfo.HealthGlucoseMeter

A glucose meter.

QBluetoothDeviceInfo.HealthPulseOximeter

A blood oxygen saturation meter.

QBluetoothDeviceInfo.HealthDataDisplay

A data display.

QBluetoothDeviceInfo.HealthStepCounter

A pedometer.

class ServiceClass

(inherits enum.Flag) 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

Description

QBluetoothDeviceInfo.NoService

The device does not provide any services.

QBluetoothDeviceInfo.PositioningService

The device provides positioning services.

QBluetoothDeviceInfo.NetworkingService

The device provides networking services.

QBluetoothDeviceInfo.RenderingService

The device provides rendering services.

QBluetoothDeviceInfo.CapturingService

The device provides capturing services.

QBluetoothDeviceInfo.ObjectTransferService

The device provides object transfer services.

QBluetoothDeviceInfo.AudioService

The device provides audio services.

QBluetoothDeviceInfo.TelephonyService

The device provides telephony services.

QBluetoothDeviceInfo.InformationService

The device provides information services.

QBluetoothDeviceInfo.AllServices

The device provides services of all types.

class Field

(inherits enum.Flag) This enum is used in conjuntion with the deviceUpdated() signal and indicates the field that changed.

Constant

Description

QBluetoothDeviceInfo.Field.None

None of the values changed.

QBluetoothDeviceInfo.Field.RSSI

The rssi() value of the device changed.

QBluetoothDeviceInfo.Field.ManufacturerData

The manufacturerData() field changed

QBluetoothDeviceInfo.Field.ServiceData

The serviceData() field changed

QBluetoothDeviceInfo.Field.All

Matches every possible field.

class CoreConfiguration

(inherits enum.Flag) This enum describes the configuration of the device.

Constant

Description

QBluetoothDeviceInfo.UnknownCoreConfiguration

The type of the Bluetooth device cannot be determined.

QBluetoothDeviceInfo.BaseRateCoreConfiguration

The device is a standard Bluetooth device.

QBluetoothDeviceInfo.BaseRateAndLowEnergyCoreConfiguration

The device is a Bluetooth Smart device with support for standard and Low Energy device.

QBluetoothDeviceInfo.LowEnergyCoreConfiguration

The device is a Bluetooth Low Energy device.

__init__()

Constructs an invalid QBluetoothDeviceInfo object.

__init__(other)
Parameters:

otherQBluetoothDeviceInfo

Constructs a QBluetoothDeviceInfo that is a copy of other.

__init__(address, name, classOfDevice)
Parameters:

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.

__init__(uuid, name, classOfDevice)
Parameters:

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.

address()
Return type:

QBluetoothAddress

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()

coreConfigurations()
Return type:

Combination of CoreConfiguration

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

deviceUuid()
Return type:

QBluetoothUuid

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.

See also

setDeviceUuid()

isCached()
Return type:

bool

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

isValid()
Return type:

bool

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

majorDeviceClass()
Return type:

MajorDeviceClass

Returns the major device class of the device.

manufacturerData()
Return type:

.QMultiHashquint16,QByteArray

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.

manufacturerData(manufacturerId)
Parameters:

manufacturerId – int

Return type:

QByteArray

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:

  • Manufacturer specific identifier code from the Assigned Numbers Company Identifiers document

  • Sequence of arbitrary data octets

The interpretation of the data octets is defined by the manufacturer specified by the company identifier.

Note

The remote device may provide multiple data entries per manufacturerId. This function only returns the first entry. If all entries are needed use manufacturerData() which returns a multi hash.

manufacturerIds()
Return type:

.list of quint16

Returns all manufacturer IDs from advertisement packets attached to this device information.

minorDeviceClass()
Return type:

int

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

name()
Return type:

str

Returns the name assigned to the device.

See also

setName()

__ne__(b)
Parameters:

bQBluetoothDeviceInfo

Return type:

bool

Returns true if the two QBluetoothDeviceInfo objects a and b are not equal.

__eq__(b)
Parameters:

bQBluetoothDeviceInfo

Return type:

bool

Returns true if the two QBluetoothDeviceInfo objects a and b are equal.

rssi()
Return type:

int

Returns the signal strength when the device was last scanned

See also

setRssi()

serviceClasses()
Return type:

Combination of ServiceClass

Returns the service class of the device.

serviceData()
Return type:

.QMultiHashQBluetoothUuid,QByteArray

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.

See also

setServiceData

serviceData(serviceId)
Parameters:

serviceIdQBluetoothUuid

Return type:

QByteArray

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:

  • Service UUID

  • Sequence of arbitrary data octets

Note

The remote device may provide multiple data entries per serviceId. This function only returns the first entry. If all entries are needed use serviceData() which returns a multi hash.

serviceIds()
Return type:

.list of QBluetoothUuid

Returns all service data IDs from advertisement packets attached to this device information.

serviceUuids()
Return type:

.list of QBluetoothUuid

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

setCached(cached)
Parameters:

cached – bool

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()

setCoreConfigurations(coreConfigs)
Parameters:

coreConfigs – Combination of CoreConfiguration

Sets the CoreConfigurations of the device to coreConfigs. This will help to make a difference between regular and Low Energy devices.

setDeviceUuid(uuid)
Parameters:

uuidQBluetoothUuid

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.

See also

deviceUuid()

setManufacturerData(manufacturerId, data)
Parameters:
Return type:

bool

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.

See also

manufacturerData

setName(name)
Parameters:

name – str

Sets the name of the device.

See also

name()

setRssi(signal)
Parameters:

signal – int

Set the signal strength value, used internally.

See also

rssi()

setServiceData(serviceId, data)
Parameters:
Return type:

bool

Sets the advertised service data for the given serviceId. Returns true if it was inserted, false if it was already known.

See also

serviceData

setServiceUuids(uuids)
Parameters:

uuids – .list of QBluetoothUuid

Sets the list of service UUIDs to uuids.

See also

serviceUuids()