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
- [read-only] adapter : AdapterPtr
- [read-only] address : QString
- [read-only] appearance : quint16
- [read-only] battery : BatteryPtr
- blocked : bool
- [read-only] connected : bool
- [read-only] deviceClass : quint32
- [read-only] friendlyName : QString
- [read-only] gattServices : QList<GattServiceRemotePtr>
- [read-only] icon : QString
- [read-only] input : InputPtr
- [read-only] legacyPairing : bool
- [read-only] manufacturerData : ManData
- [read-only] mediaPlayer : MediaPlayerPtr
- [read-only] mediaTransport : MediaTransportPtr
- [read-only] modalias : QString
- name : QString
- [read-only] paired : bool
- [read-only] remoteName : QString
- [read-only] rssi : qint16
- [read-only] servicesResolved : bool
- trusted : bool
- [read-only] type : Type
- [read-only] ubi : QString
- [read-only] uuids : QStringList
Public Functions
- BluezQt::AdapterPtr adapter() const
- QString address() const
- quint16 appearance() const
- BluezQt::BatteryPtr battery() const
- quint32 deviceClass() const
- QString friendlyName() const
- QList<BluezQt::GattServiceRemotePtr> gattServices() const
- bool hasLegacyPairing() const
- QString icon() const
- BluezQt::InputPtr input() const
- bool isBlocked() const
- bool isConnected() const
- bool isPaired() const
- bool isServicesResolved() const
- bool isTrusted() const
- BluezQt::ManData manufacturerData() const
- BluezQt::MediaPlayerPtr mediaPlayer() const
- BluezQt::MediaTransportPtr mediaTransport() const
- QString modalias() const
- QString name() const
- QString remoteName() const
- qint16 rssi() const
- QHash<QString, QByteArray> serviceData() const
- BluezQt::PendingCall *setBlocked(bool blocked)
- BluezQt::PendingCall *setName(const QString &name)
- BluezQt::PendingCall *setTrusted(bool trusted)
- BluezQt::DevicePtr toSharedPtr() const
- BluezQt::Device::Type type() const
- QString ubi() const
- QStringList uuids() const
Public Slots
- BluezQt::PendingCall *cancelPairing()
- BluezQt::PendingCall *connectProfile(const QString &uuid)
- BluezQt::PendingCall *connectToDevice()
- BluezQt::PendingCall *disconnectFromDevice()
- BluezQt::PendingCall *disconnectProfile(const QString &uuid)
- BluezQt::PendingCall *pair()
Signals
- void addressChanged(const QString &address)
- void appearanceChanged(quint16 appearance)
- void batteryChanged(BluezQt::BatteryPtr battery)
- void blockedChanged(bool blocked)
- void connectedChanged(bool connected)
- void deviceChanged(BluezQt::DevicePtr device)
- void deviceClassChanged(quint32 deviceClass)
- void deviceRemoved(BluezQt::DevicePtr device)
- void friendlyNameChanged(const QString &friendlyName)
- void gattServiceAdded(BluezQt::GattServiceRemotePtr service)
- void gattServiceChanged(BluezQt::GattServiceRemotePtr service)
- void gattServiceRemoved(BluezQt::GattServiceRemotePtr service)
- void gattServicesChanged(QList<BluezQt::GattServiceRemotePtr> services)
- void iconChanged(const QString &icon)
- void inputChanged(BluezQt::InputPtr input)
- void legacyPairingChanged(bool legacyPairing)
- void manufacturerDataChanged(BluezQt::ManData man)
- void mediaPlayerChanged(BluezQt::MediaPlayerPtr mediaPlayer)
- void mediaTransportChanged(BluezQt::MediaTransportPtr mediaTransport)
- void modaliasChanged(const QString &modalias)
- void nameChanged(const QString &name)
- void pairedChanged(bool paired)
- void remoteNameChanged(const QString &remoteName)
- void rssiChanged(qint16 rssi)
- void serviceDataChanged(const QHash<QString, QByteArray> &serviceData)
- void servicesResolvedChanged(bool servicesResolved)
- void trustedChanged(bool trusted)
- void typeChanged(BluezQt::Device::Type type)
- void uuidsChanged(const QStringList &uuids)
Static Public Members
- BluezQt::Device::Type stringToType(const QString &typeString)
- QString typeToString(BluezQt::Device::Type type)
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::AdapterPtradapter() const
[read-only] address : QString
Access functions:
QStringaddress() const
Notifier signal:
voidaddressChanged(constQString&address)
[read-only] appearance : quint16
Access functions:
quint16appearance() const
Notifier signal:
voidappearanceChanged(quint16appearance)
[read-only] battery : BatteryPtr
Access functions:
BluezQt::BatteryPtrbattery() const
Notifier signal:
voidbatteryChanged(BluezQt::BatteryPtrbattery)
blocked : bool
Access functions:
boolisBlocked() constBluezQt::PendingCall*setBlocked(boolblocked)
Notifier signal:
voidblockedChanged(boolblocked)
[read-only] connected : bool
Access functions:
boolisConnected() const
Notifier signal:
voidconnectedChanged(boolconnected)
[read-only] deviceClass : quint32
Access functions:
quint32deviceClass() const
Notifier signal:
voiddeviceClassChanged(quint32deviceClass)
[read-only] friendlyName : QString
Access functions:
QStringfriendlyName() const
Notifier signal:
voidfriendlyNameChanged(constQString&friendlyName)
[read-only] gattServices : QList<GattServiceRemotePtr>
Access functions:
QList<BluezQt::GattServiceRemotePtr> gattServices() const
Notifier signal:
voidgattServicesChanged(QList<BluezQt::GattServiceRemotePtr> services)
[read-only] icon : QString
Access functions:
QStringicon() const
Notifier signal:
voidiconChanged(constQString&icon)
[read-only] input : InputPtr
Access functions:
BluezQt::InputPtrinput() const
Notifier signal:
voidinputChanged(BluezQt::InputPtrinput)
[read-only] legacyPairing : bool
Access functions:
boolhasLegacyPairing() const
Notifier signal:
voidlegacyPairingChanged(boollegacyPairing)
[read-only] manufacturerData : ManData
Access functions:
BluezQt::ManDatamanufacturerData() const
Notifier signal:
voidmanufacturerDataChanged(BluezQt::ManDataman)
[read-only] mediaPlayer : MediaPlayerPtr
Access functions:
BluezQt::MediaPlayerPtrmediaPlayer() const
Notifier signal:
voidmediaPlayerChanged(BluezQt::MediaPlayerPtrmediaPlayer)
[read-only] mediaTransport : MediaTransportPtr
Access functions:
BluezQt::MediaTransportPtrmediaTransport() const
Notifier signal:
voidmediaTransportChanged(BluezQt::MediaTransportPtrmediaTransport)
[read-only] modalias : QString
Access functions:
QStringmodalias() const
Notifier signal:
voidmodaliasChanged(constQString&modalias)
name : QString
Access functions:
Notifier signal:
voidnameChanged(constQString&name)
[read-only] paired : bool
Access functions:
boolisPaired() const
Notifier signal:
voidpairedChanged(boolpaired)
[read-only] remoteName : QString
Access functions:
QStringremoteName() const
Notifier signal:
voidremoteNameChanged(constQString&remoteName)
[read-only] rssi : qint16
Access functions:
qint16rssi() const
Notifier signal:
voidrssiChanged(qint16rssi)
[read-only] servicesResolved : bool
Access functions:
boolisServicesResolved() const
Notifier signal:
voidservicesResolvedChanged(boolservicesResolved)
trusted : bool
Access functions:
boolisTrusted() constBluezQt::PendingCall*setTrusted(booltrusted)
Notifier signal:
voidtrustedChanged(booltrusted)
[read-only] type : Type
Access functions:
BluezQt::Device::Typetype() const
Notifier signal:
voidtypeChanged(BluezQt::Device::Typetype)
[read-only] ubi : QString
Access functions:
QStringubi() const
[read-only] uuids : QStringList
Access functions:
QStringListuuids() const
Notifier signal:
voiduuidsChanged(constQStringList&uuids)
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:
- PendingCall::InvalidArguments
- PendingCall::Failed
- PendingCall::AlreadyExists
- PendingCall::AuthenticationCanceled
- PendingCall::AuthenticationFailed
- PendingCall::AuthenticationRejected
- PendingCall::AuthenticationTimeout
- PendingCall::ConnectionAttemptFailed
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.