BluezQt::Device Class
class BluezQt::DeviceBluetooth device. More...
Header: | #include <BluezQt/Device> |
CMake: | find_package(KF6 REQUIRED COMPONENTS BluezQt) target_link_libraries(mytarget PRIVATE KF6::BluezQt) |
Inherits: | QObject |
Public Types
enum | Type { Phone, Modem, Computer, Network, Headset, …, Uncategorized } |
Properties
|
|
Public Functions
BluezQt::AdapterPtr | adapter() const |
QString | address() const |
quint16 | appearance() const |
(since 5.66) 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 |
(since 5.72) 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) |
(since 5.72) 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 : const AdapterPtr
Access functions:
BluezQt::AdapterPtr | adapter() const |
[read-only]
address : const QString
Access functions:
QString | address() const |
Notifier signal:
void | addressChanged(const QString &address) |
[read-only]
appearance : const quint16
Access functions:
quint16 | appearance() const |
Notifier signal:
void | appearanceChanged(quint16 appearance) |
[read-only]
battery : const BatteryPtr
Access functions:
BluezQt::BatteryPtr | battery() const |
Notifier signal:
void | batteryChanged(BluezQt::BatteryPtr battery) |
blocked : bool
Access functions:
bool | isBlocked() const |
BluezQt::PendingCall * | setBlocked(bool blocked) |
Notifier signal:
void | blockedChanged(bool blocked) |
[read-only]
connected : const bool
Access functions:
bool | isConnected() const |
Notifier signal:
void | connectedChanged(bool connected) |
[read-only]
deviceClass : const quint32
Access functions:
quint32 | deviceClass() const |
Notifier signal:
void | deviceClassChanged(quint32 deviceClass) |
[read-only]
friendlyName : const QString
Access functions:
QString | friendlyName() const |
Notifier signal:
void | friendlyNameChanged(const QString &friendlyName) |
[read-only]
gattServices : const QList<GattServiceRemotePtr>
Access functions:
QList<BluezQt::GattServiceRemotePtr> | gattServices() const |
Notifier signal:
void | gattServicesChanged(QList<BluezQt::GattServiceRemotePtr> services) |
[read-only]
icon : const QString
Access functions:
QString | icon() const |
Notifier signal:
void | iconChanged(const QString &icon) |
[read-only]
input : const InputPtr
Access functions:
BluezQt::InputPtr | input() const |
Notifier signal:
void | inputChanged(BluezQt::InputPtr input) |
[read-only]
legacyPairing : const bool
Access functions:
bool | hasLegacyPairing() const |
Notifier signal:
void | legacyPairingChanged(bool legacyPairing) |
[read-only]
manufacturerData : const ManData
Access functions:
BluezQt::ManData | manufacturerData() const |
Notifier signal:
void | manufacturerDataChanged(BluezQt::ManData man) |
[read-only]
mediaPlayer : const MediaPlayerPtr
Access functions:
BluezQt::MediaPlayerPtr | mediaPlayer() const |
Notifier signal:
void | mediaPlayerChanged(BluezQt::MediaPlayerPtr mediaPlayer) |
[read-only]
mediaTransport : const MediaTransportPtr
Access functions:
BluezQt::MediaTransportPtr | mediaTransport() const |
Notifier signal:
void | mediaTransportChanged(BluezQt::MediaTransportPtr mediaTransport) |
[read-only]
modalias : const QString
Access functions:
QString | modalias() const |
Notifier signal:
void | modaliasChanged(const QString &modalias) |
name : QString
Access functions:
Notifier signal:
void | nameChanged(const QString &name) |
[read-only]
paired : const bool
Access functions:
bool | isPaired() const |
Notifier signal:
void | pairedChanged(bool paired) |
[read-only]
remoteName : const QString
Access functions:
QString | remoteName() const |
Notifier signal:
void | remoteNameChanged(const QString &remoteName) |
[read-only]
rssi : const qint16
Access functions:
qint16 | rssi() const |
Notifier signal:
void | rssiChanged(qint16 rssi) |
[read-only]
servicesResolved : const bool
Access functions:
bool | isServicesResolved() const |
Notifier signal:
void | servicesResolvedChanged(bool servicesResolved) |
trusted : bool
Access functions:
bool | isTrusted() const |
BluezQt::PendingCall * | setTrusted(bool trusted) |
Notifier signal:
void | trustedChanged(bool trusted) |
[read-only]
type : const Type
Access functions:
BluezQt::Device::Type | type() const |
Notifier signal:
void | typeChanged(BluezQt::Device::Type type) |
[read-only]
ubi : const QString
Access functions:
QString | ubi() const |
[read-only]
uuids : const QStringList
Access functions:
QStringList | uuids() const |
Notifier signal:
void | uuidsChanged(const QStringList &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.
[since 5.66]
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.
This function was introduced in 5.66.
[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.
[since 5.72]
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.
This function was introduced in 5.72.
[signal, since 5.72]
void Device::serviceDataChanged(const QHash<QString, QByteArray> &serviceData)
Indicates that the device's service data has changed.
This function was introduced in 5.72.
[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() and 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.