Pages
API Documentation
On this page

BluezQt::Device Class

Bluetooth device. More...

  • Header: #include <BluezQt/Device>
  • CMake: find_package(KF6 REQUIRED COMPONENTS BluezQt)
    target_link_libraries(mytarget PRIVATE KF6::BluezQt)
  • Inherits: QObject

List of all members, including inherited members

Public Types

Properties

Public Functions

Public Slots

Signals

Static Public Members

Detailed Description

This class represents a Bluetooth device.

Member Type Documentation

enum Device::Type

Device types.

Constant Value Description
BluezQt::Device::Phone 0 The device is a phone.
BluezQt::Device::Modem 1 The device is a modem.
BluezQt::Device::Computer 2 The device is a computer.
BluezQt::Device::Network 3 The device is a computer.
BluezQt::Device::Headset 4 The device is a headset.
BluezQt::Device::Headphones 5 The device is a headphone.
BluezQt::Device::AudioVideo 6 The device is an uncategorized audio/video device.
BluezQt::Device::Keyboard 7 The device is a keyboard.
BluezQt::Device::Mouse 8 The device is a mouse.
BluezQt::Device::Joypad 9 The device is a joypad.
BluezQt::Device::Tablet 10 The device is a graphics tablet (input device).
BluezQt::Device::Peripheral 11 The device is an uncategorized peripheral device.
BluezQt::Device::Camera 12 The device is a camera.
BluezQt::Device::Printer 13 The device is a printer.
BluezQt::Device::Imaging 14 The device is an uncategorized imaging device.
BluezQt::Device::Wearable 15 The device is a wearable device.
BluezQt::Device::Toy 16 The device is a toy.
BluezQt::Device::Health 17 The device is a health device.
BluezQt::Device::Uncategorized 18 The device is not of any of the known types.

Property Documentation

[read-only] adapter : AdapterPtr

Access functions:

  • BluezQt::AdapterPtr adapter() const

[read-only] address : QString

Access functions:

Notifier signal:

[read-only] appearance : quint16

Access functions:

Notifier signal:

[read-only] battery : BatteryPtr

Access functions:

  • BluezQt::BatteryPtr battery() const

Notifier signal:

blocked : bool

Access functions:

Notifier signal:

[read-only] connected : bool

Access functions:

Notifier signal:

[read-only] deviceClass : quint32

Access functions:

Notifier signal:

[read-only] friendlyName : QString

Access functions:

Notifier signal:

[read-only] gattServices : QList<GattServiceRemotePtr>

Access functions:

Notifier signal:

[read-only] icon : QString

Access functions:

  • QString icon() const

Notifier signal:

[read-only] input : InputPtr

Access functions:

  • BluezQt::InputPtr input() const

Notifier signal:

[read-only] legacyPairing : bool

Access functions:

Notifier signal:

[read-only] manufacturerData : ManData

Access functions:

Notifier signal:

[read-only] mediaPlayer : MediaPlayerPtr

Access functions:

Notifier signal:

[read-only] mediaTransport : MediaTransportPtr

Access functions:

Notifier signal:

[read-only] modalias : QString

Access functions:

Notifier signal:

name : QString

Access functions:

  • QString name() const
  • BluezQt::PendingCall *setName(const QString &name)

Notifier signal:

[read-only] paired : bool

Access functions:

Notifier signal:

[read-only] remoteName : QString

Access functions:

Notifier signal:

[read-only] rssi : qint16

Access functions:

  • qint16 rssi() const

Notifier signal:

[read-only] servicesResolved : bool

Access functions:

Notifier signal:

trusted : bool

Access functions:

Notifier signal:

[read-only] type : Type

Access functions:

  • BluezQt::Device::Type type() const

Notifier signal:

[read-only] ubi : QString

Access functions:

  • QString ubi() const

[read-only] uuids : QStringList

Access functions:

  • QStringList uuids() const

Notifier signal:

Member Function Documentation

BluezQt::AdapterPtr Device::adapter() const

Returns the adapter that discovered this device.

Note: Getter function for property adapter.

QString Device::address() const

Returns the address of the device.

Example address: "40:79:6A:0C:39:75"

Note: Getter function for property address.

[signal] void Device::addressChanged(const QString &address)

Indicates that the device's address has changed.

Note: Notifier signal for property address.

quint16 Device::appearance() const

Returns the appearance of the device.

Note: Getter function for property appearance.

[signal] void Device::appearanceChanged(quint16 appearance)

Indicates that the device's appearance has changed.

Note: Notifier signal for property appearance.

BluezQt::BatteryPtr Device::battery() const

Returns the battery interface for the device.

Returns null if device has no battery.

Note: Getter function for property battery.

[signal] void Device::batteryChanged(BluezQt::BatteryPtr battery)

Indicates that the device's battery has changed.

Note: Notifier signal for property battery.

[signal] void Device::blockedChanged(bool blocked)

Indicates that the device's blocked state has changed.

Note: Notifier signal for property blocked.

[slot] BluezQt::PendingCall *Device::cancelPairing()

Cancels a pairing with the device.

This method can be used to cancel pairing operation initiated with pair().

Possible errors:

Returns void pending call.

[slot] BluezQt::PendingCall *Device::connectProfile(const QString &uuid)

Connects a specific profile of the device with the given service uuid.

Possible errors:

Returns void pending call.

[slot] BluezQt::PendingCall *Device::connectToDevice()

Connects all auto-connectable profiles of the device.

This method indicates success if at least one profile was connected.

Possible errors:

Returns void pending call.

[signal] void Device::connectedChanged(bool connected)

Indicates that the device's connected state has changed.

Note: Notifier signal for property connected.

[signal] void Device::deviceChanged(BluezQt::DevicePtr device)

Indicates that at least one of the device's properties has changed.

quint32 Device::deviceClass() const

Returns the class of the device.

In case of Bluetooth Low Energy only devices, device class is invalid (0).

Note: Getter function for property deviceClass.

See also type()

[signal] void Device::deviceClassChanged(quint32 deviceClass)

Indicates that the device's class has changed.

Note: Notifier signal for property deviceClass.

[signal] void Device::deviceRemoved(BluezQt::DevicePtr device)

Indicates that the device was removed.

[slot] BluezQt::PendingCall *Device::disconnectFromDevice()

Disconnects all connected profiles of the device.

This method can be used to cancel not-yet finished connectDevice() call.

Possible errors:

Returns void pending call.

[slot] BluezQt::PendingCall *Device::disconnectProfile(const QString &uuid)

Disconnects a specific profile of the device with the given service uuid.

Possible errors:

Returns void pending call.

QString Device::friendlyName() const

Returns the friendly name of the device.

Friendly name is a string "name (remoteName)". If the remoteName is same as name, it returns just name.

Note: Getter function for property friendlyName.

[signal] void Device::friendlyNameChanged(const QString &friendlyName)

Indicates that the device's friendly name has changed.

Note: Notifier signal for property friendlyName.

[signal] void Device::gattServiceAdded(BluezQt::GattServiceRemotePtr service)

Indicates that a new service was added (eg. found by connection).

[signal] void Device::gattServiceChanged(BluezQt::GattServiceRemotePtr service)

Indicates that at least one of the device's services has changed.

[signal] void Device::gattServiceRemoved(BluezQt::GattServiceRemotePtr service)

Indicates that a service was removed.

QList<BluezQt::GattServiceRemotePtr> Device::gattServices() const

Returns a list of services known by the device.

Note: Getter function for property gattServices.

[signal] void Device::gattServicesChanged(QList<BluezQt::GattServiceRemotePtr> services)

Indicates that the device GATT services list has changed.

Note: Notifier signal for property gattServices.

bool Device::hasLegacyPairing() const

Returns whether the device has legacy pairing.

Note: Getter function for property legacyPairing.

QString Device::icon() const

Returns the icon name of the device.

In case the icon is empty, "preferences-system-bluetooth" is returned.

Note: Getter function for property icon.

[signal] void Device::iconChanged(const QString &icon)

Indicates that the device's icon has changed.

Note: Notifier signal for property icon.

BluezQt::InputPtr Device::input() const

Returns the input interface for the device.

Only input devices will have valid input interface.

Returns null if device has no input.

Note: Getter function for property input.

[signal] void Device::inputChanged(BluezQt::InputPtr input)

Indicates that the device's input has changed.

Note: Notifier signal for property input.

bool Device::isBlocked() const

Returns whether the device is blocked.

Note: Getter function for property blocked.

bool Device::isConnected() const

Returns whether the device is connected.

Note: Getter function for property connected.

bool Device::isPaired() const

Returns whether the device is paired.

Note: Getter function for property paired.

bool Device::isServicesResolved() const

Returns whether or not service discovery has been resolved.

Note: Getter function for property servicesResolved.

bool Device::isTrusted() const

Returns whether the device is trusted.

Note: Getter function for property trusted.

[signal] void Device::legacyPairingChanged(bool legacyPairing)

Indicates that the device's legacy pairing state has changed.

Note: Notifier signal for property legacyPairing.

BluezQt::ManData Device::manufacturerData() const

Returns manufacturer specific advertisement data.

Note: Keys are 16 bits Manufacturer ID followed by its byte array value.

Note: Getter function for property manufacturerData.

[signal] void Device::manufacturerDataChanged(BluezQt::ManData man)

Indicates that the device's manufacturer data has changed.

Note: Notifier signal for property manufacturerData.

BluezQt::MediaPlayerPtr Device::mediaPlayer() const

Returns the media player interface for the device.

Only devices with connected appropriate profile will have valid media player interface.

Returns null if device has no media player.

Note: Getter function for property mediaPlayer.

[signal] void Device::mediaPlayerChanged(BluezQt::MediaPlayerPtr mediaPlayer)

Indicates that the device's media player has changed.

Note: Notifier signal for property mediaPlayer.

BluezQt::MediaTransportPtr Device::mediaTransport() const

Returns the media transport interface for the device.

Only devices with connected appropriate profile will have valid media transport interface.

Returns null if device has no media transport.

Note: Getter function for property mediaTransport.

[signal] void Device::mediaTransportChanged(BluezQt::MediaTransportPtr mediaTransport)

Indicates that the device's media transport has changed.

Note: Notifier signal for property mediaTransport.

QString Device::modalias() const

Returns remote device ID in modalias format.

Note: Getter function for property modalias.

[signal] void Device::modaliasChanged(const QString &modalias)

Indicates that the device's modalias has changed.

Note: Notifier signal for property modalias.

QString Device::name() const

Returns the name of the device.

If the name of the device wasn't previously changed, remoteName is returned.

Note: Getter function for property name.

See also setName()

[signal] void Device::nameChanged(const QString &name)

Indicates that the device's name has changed.

Note: Notifier signal for property name.

[slot] BluezQt::PendingCall *Device::pair()

Initiates a pairing with the device.

Possible errors:

Returns void pending call.

[signal] void Device::pairedChanged(bool paired)

Indicates that the device's paired state has changed.

Note: Notifier signal for property paired.

QString Device::remoteName() const

Returns the remote name of the device.

Note: Getter function for property remoteName.

[signal] void Device::remoteNameChanged(const QString &remoteName)

Indicates that the device's remote name has changed.

Note: Notifier signal for property remoteName.

qint16 Device::rssi() const

Returns the Received Signal Strength Indicator of the device.

The bigger value indicates better signal strength.

Note: RSSI is only updated during discovery.

Note: Getter function for property rssi.

[signal] void Device::rssiChanged(qint16 rssi)

Indicates that the device's RSSI has changed.

Note: Notifier signal for property rssi.

QHash<QString, QByteArray> Device::serviceData() const

Returns the service advertisement data.

Returns a hash with keys being the UUIDs in and values being the raw service data value.

[signal] void Device::serviceDataChanged(const QHash<QString, QByteArray> &serviceData)

Indicates that the device's service data has changed.

[signal] void Device::servicesResolvedChanged(bool servicesResolved)

Indicates that the device's servicesResolved state has changed.

Note: Notifier signal for property servicesResolved.

BluezQt::PendingCall *Device::setBlocked(bool blocked)

Sets the blocked state of the device.

Returns void pending call.

Note: Setter function for property blocked.

See also isBlocked()

BluezQt::PendingCall *Device::setName(const QString &name)

Sets the name of the device.

Returns a void pending call.

Note: Setter function for property name.

See also name()

BluezQt::PendingCall *Device::setTrusted(bool trusted)

Sets the trusted state of the device.

Returns void pending call.

Note: Setter function for property trusted.

See also isTrusted()

[static] BluezQt::Device::Type Device::stringToType(const QString &typeString)

Returns a string for the device type typeString.

BluezQt::DevicePtr Device::toSharedPtr() const

Returns a shared pointer from this.

[signal] void Device::trustedChanged(bool trusted)

Indicates that the device's trusted state has changed.

Note: Notifier signal for property trusted.

BluezQt::Device::Type Device::type() const

Returns the type of the device.

Type of device is deduced from its class (for Bluetooth Classic devices) or its appearance (for Bluetooth Low Energy devices).

Note: Getter function for property type.

See also deviceClass(), appearance()

[signal] void Device::typeChanged(BluezQt::Device::Type type)

Indicates that the device's type has changed.

Note: Notifier signal for property type.

[static] QString Device::typeToString(BluezQt::Device::Type type)

Returns a string of the device type.

QString Device::ubi() const

Returns the UBI of the device.

Example UBI: "/org/bluez/hci0/dev_40_79_6A_0C_39_75"

Note: Getter function for property ubi.

QStringList Device::uuids() const

Returns UUIDs of services supported by the device.

UUIDs will always be returned in uppercase.

Note: Getter function for property uuids.

[signal] void Device::uuidsChanged(const QStringList &uuids)

Indicates that the device's UUIDs has changed.

Note: Notifier signal for property uuids.

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.