BluezQt 5.109.0
|
Bluetooth device. More...
#include <BluezQt/Device>
Public Types | |
enum | Type { Phone , Modem , Computer , Network , Headset , Headphones , AudioVideo , Keyboard , Mouse , Joypad , Tablet , Peripheral , Camera , Printer , Imaging , Wearable , Toy , Health , Uncategorized } |
Device types. More... | |
Properties | |
AdapterPtr | adapter |
QString | address |
quint16 | appearance |
BatteryPtr | battery |
bool | blocked |
bool | connected |
quint32 | deviceClass |
QString | friendlyName |
QList< GattServiceRemotePtr > | gattServices |
QString | icon |
InputPtr | input |
bool | legacyPairing |
ManData | manufacturerData |
MediaPlayerPtr | mediaPlayer |
MediaTransportPtr | mediaTransport |
QString | modalias |
QString | name |
bool | paired |
QString | remoteName |
qint16 | rssi |
bool | servicesResolved |
bool | trusted |
Type | type |
QString | ubi |
QStringList | uuids |
Signals | |
void | addressChanged (const QString &address) |
Indicates that device's address have changed. | |
void | appearanceChanged (quint16 appearance) |
Indicates that device's appearance have changed. | |
void | batteryChanged (BatteryPtr battery) |
Indicates that device's battery has changed. | |
void | blockedChanged (bool blocked) |
Indicates that device's blocked state have changed. | |
void | connectedChanged (bool connected) |
Indicates that device's connected state have changed. | |
void | deviceChanged (DevicePtr device) |
Indicates that at least one of the device's properties have changed. | |
void | deviceClassChanged (quint32 deviceClass) |
Indicates that device's class have changed. | |
void | deviceRemoved (DevicePtr device) |
Indicates that the device was removed. | |
void | friendlyNameChanged (const QString &friendlyName) |
Indicates that device's friendly name have changed. | |
void | gattServiceAdded (GattServiceRemotePtr service) |
Indicates that a new service was added (eg. | |
void | gattServiceChanged (GattServiceRemotePtr service) |
Indicates that at least one of the device's services have changed. | |
void | gattServiceRemoved (GattServiceRemotePtr service) |
Indicates that a service was removed. | |
void | gattServicesChanged (QList< GattServiceRemotePtr > services) |
Indicates that device GATT services list has changed. | |
void | iconChanged (const QString &icon) |
Indicates that device's icon have changed. | |
void | inputChanged (InputPtr input) |
Indicates that device's input have changed. | |
void | legacyPairingChanged (bool legacyPairing) |
Indicates that device's legacy pairing state have changed. | |
void | manufacturerDataChanged (ManData man) |
Indicates that device's manufacturer data have changed. | |
void | mediaPlayerChanged (MediaPlayerPtr mediaPlayer) |
Indicates that device's media player have changed. | |
void | mediaTransportChanged (MediaTransportPtr mediaTransport) |
Indicates that device's media transport have changed. | |
void | modaliasChanged (const QString &modalias) |
Indicates that device's modalias have changed. | |
void | nameChanged (const QString &name) |
Indicates that device's name have changed. | |
void | pairedChanged (bool paired) |
Indicates that device's paired state have changed. | |
void | remoteNameChanged (const QString &remoteName) |
Indicates that device's remote name have changed. | |
void | rssiChanged (qint16 rssi) |
Indicates that device's RSSI have changed. | |
void | serviceDataChanged (const QHash< QString, QByteArray > &serviceData) |
Indicates that the device's service data has changed. | |
void | servicesResolvedChanged (bool servicesResolved) |
Indicates that device's servicesResolved state have changed. | |
void | trustedChanged (bool trusted) |
Indicates that device's trusted state have changed. | |
void | typeChanged (Type type) |
Indicates that device's type have changed. | |
void | uuidsChanged (const QStringList &uuids) |
Indicates that device's UUIDs have changed. | |
Public Slots | |
PendingCall * | cancelPairing () |
Cancels a pairing with the device. | |
PendingCall * | connectProfile (const QString &uuid) |
Connects a specific profile of the device. | |
PendingCall * | connectToDevice () |
Connects all auto-connectable profiles of the device. | |
PendingCall * | disconnectFromDevice () |
Disconnects all connected profiles of the device. | |
PendingCall * | disconnectProfile (const QString &uuid) |
Disconnects a specific profile of the device. | |
PendingCall * | pair () |
Initiates a pairing with the device. | |
Public Member Functions | |
~Device () override | |
Destroys a Device object. | |
AdapterPtr | adapter () const |
Returns an adapter that discovered this device. | |
QString | address () const |
Returns an address of the device. | |
quint16 | appearance () const |
Returns an appearance of the device. | |
BatteryPtr | battery () const |
Returns the battery interface for the device. | |
quint32 | deviceClass () const |
Returns a class of the device. | |
QString | friendlyName () const |
Returns a friendly name of the device. | |
QList< GattServiceRemotePtr > | gattServices () const |
Returns list of services known by the device. | |
bool | hasLegacyPairing () const |
Returns whether the device has legacy pairing. | |
QString | icon () const |
Returns an icon name of the device. | |
InputPtr | input () const |
Returns the input interface for the device. | |
bool | isBlocked () const |
Returns whether the device is blocked. | |
bool | isConnected () const |
Returns whether the device is connected. | |
bool | isPaired () const |
Returns whether the device is paired. | |
bool | isServicesResolved () const |
Returns whether or not service discovery has been resolved. | |
bool | isTrusted () const |
Returns whether the device is trusted. | |
ManData | manufacturerData () const |
Returns manufacturer specific advertisement data. | |
MediaPlayerPtr | mediaPlayer () const |
Returns the media player interface for the device. | |
MediaTransportPtr | mediaTransport () const |
Returns the media transport interface for the device. | |
QString | modalias () const |
Returns remote device ID in modalias format. | |
QString | name () const |
Returns a name of the device. | |
QString | remoteName () const |
Returns a remote name of the device. | |
qint16 | rssi () const |
Returns Received Signal Strength Indicator of the device. | |
QHash< QString, QByteArray > | serviceData () const |
Returns the service advertisement data. | |
PendingCall * | setBlocked (bool blocked) |
Sets the blocked state of the device. | |
PendingCall * | setName (const QString &name) |
Sets the name of the device. | |
PendingCall * | setTrusted (bool trusted) |
Sets the trusted state of the device. | |
DevicePtr | toSharedPtr () const |
Returns a shared pointer from this. | |
Device::Type | type () const |
Returns a type of the device. | |
QString | ubi () const |
Returns an UBI of the device. | |
QStringList | uuids () const |
Returns UUIDs of supported services by the device. | |
Static Public Member Functions | |
static Device::Type | stringToType (const QString &typeString) |
Returns a device type for string. | |
static QString | typeToString (Device::Type type) |
Returns a string for device type. | |
Bluetooth device.
This class represents a Bluetooth device.
Device types.
|
override |
Destroys a Device object.
AdapterPtr BluezQt::Device::adapter | ( | ) | const |
Returns an adapter that discovered this device.
QString BluezQt::Device::address | ( | ) | const |
Returns an address of the device.
Example address: "40:79:6A:0C:39:75"
|
signal |
Indicates that device's address have changed.
quint16 BluezQt::Device::appearance | ( | ) | const |
Returns an appearance of the device.
|
signal |
Indicates that device's appearance have changed.
BatteryPtr BluezQt::Device::battery | ( | ) | const |
Returns the battery interface for the device.
|
signal |
Indicates that device's battery has changed.
|
signal |
Indicates that device's blocked state have changed.
|
slot |
Cancels a pairing with the device.
This method can be used to cancel pairing operation initiated with pair().
Possible errors: PendingCall::DoesNotExist, PendingCall::Failed
|
signal |
Indicates that device's connected state have changed.
|
slot |
Connects a specific profile of the device.
Possible errors: PendingCall::DoesNotExist, PendingCall::AlreadyConnected, PendingCall::ConnectFailed
uuid | service UUID |
|
slot |
Connects all auto-connectable profiles of the device.
This method indicates success if at least one profile was connected.
Possible errors: PendingCall::NotReady, PendingCall::Failed, PendingCall::InProgress, PendingCall::AlreadyConnected
|
signal |
Indicates that at least one of the device's properties have changed.
quint32 BluezQt::Device::deviceClass | ( | ) | const |
Returns a class of the device.
In case of Bluetooth Low Energy only devices, device class is invalid (0).
|
signal |
Indicates that device's class have changed.
|
signal |
Indicates that the device was removed.
|
slot |
Disconnects all connected profiles of the device.
This method can be used to cancel not-yet finished connectDevice() call.
Possible errors: PendingCall::NotConnected
|
slot |
Disconnects a specific profile of the device.
Possible errors: PendingCall::DoesNotExist, PendingCall::Failed, PendingCall::NotConnected, PendingCall::NotSupported
uuid | service UUID |
QString BluezQt::Device::friendlyName | ( | ) | const |
Returns a friendly name of the device.
Friendly name is a string "name (remoteName)". If the remoteName is same as name, it returns just name.
|
signal |
Indicates that device's friendly name have changed.
|
signal |
Indicates that a new service was added (eg.
found by connection).
|
signal |
Indicates that at least one of the device's services have changed.
|
signal |
Indicates that a service was removed.
QList< GattServiceRemotePtr > BluezQt::Device::gattServices | ( | ) | const |
Returns list of services known by the device.
|
signal |
Indicates that device GATT services list has changed.
bool BluezQt::Device::hasLegacyPairing | ( | ) | const |
Returns whether the device has legacy pairing.
QString BluezQt::Device::icon | ( | ) | const |
Returns an icon name of the device.
In case the icon is empty, "preferences-system-bluetooth" is returned.
|
signal |
Indicates that device's icon have changed.
InputPtr BluezQt::Device::input | ( | ) | const |
Returns the input interface for the device.
Only input devices will have valid input interface.
|
signal |
Indicates that device's input have changed.
bool BluezQt::Device::isBlocked | ( | ) | const |
Returns whether the device is blocked.
bool BluezQt::Device::isConnected | ( | ) | const |
Returns whether the device is connected.
bool BluezQt::Device::isPaired | ( | ) | const |
Returns whether the device is paired.
bool BluezQt::Device::isServicesResolved | ( | ) | const |
Returns whether or not service discovery has been resolved.
bool BluezQt::Device::isTrusted | ( | ) | const |
Returns whether the device is trusted.
|
signal |
Indicates that device's legacy pairing state have changed.
ManData BluezQt::Device::manufacturerData | ( | ) | const |
Returns manufacturer specific advertisement data.
|
signal |
Indicates that device's manufacturer data have changed.
MediaPlayerPtr BluezQt::Device::mediaPlayer | ( | ) | const |
Returns the media player interface for the device.
Only devices with connected appropriate profile will have valid media player interface.
|
signal |
Indicates that device's media player have changed.
MediaTransportPtr BluezQt::Device::mediaTransport | ( | ) | const |
Returns the media transport interface for the device.
Only devices with connected appropriate profile will have valid media transport interface.
|
signal |
Indicates that device's media transport have changed.
QString BluezQt::Device::modalias | ( | ) | const |
Returns remote device ID in modalias format.
|
signal |
Indicates that device's modalias have changed.
QString BluezQt::Device::name | ( | ) | const |
Returns a name of the device.
If the name of the device wasn't previously changed, remoteName is returned.
|
signal |
Indicates that device's name have changed.
|
slot |
Initiates a pairing with the device.
Possible errors: PendingCall::InvalidArguments, PendingCall::Failed, PendingCall::AlreadyExists, PendingCall::AuthenticationCanceled, PendingCall::AuthenticationFailed, PendingCall::AuthenticationRejected, PendingCall::AuthenticationTimeout, PendingCall::ConnectionAttemptFailed
|
signal |
Indicates that device's paired state have changed.
QString BluezQt::Device::remoteName | ( | ) | const |
Returns a remote name of the device.
|
signal |
Indicates that device's remote name have changed.
qint16 BluezQt::Device::rssi | ( | ) | const |
Returns Received Signal Strength Indicator of the device.
The bigger value indicates better signal strength.
|
signal |
Indicates that device's RSSI have changed.
QHash< QString, QByteArray > BluezQt::Device::serviceData | ( | ) | const |
Returns the service advertisement data.
|
signal |
Indicates that the device's service data has changed.
|
signal |
Indicates that device's servicesResolved state have changed.
PendingCall * BluezQt::Device::setBlocked | ( | bool | blocked | ) |
Sets the blocked state of the device.
blocked | blocked state |
PendingCall * BluezQt::Device::setName | ( | const QString & | name | ) |
Sets the name of the device.
name | name for device |
PendingCall * BluezQt::Device::setTrusted | ( | bool | trusted | ) |
Sets the trusted state of the device.
trusted | trusted state |
|
static |
Returns a device type for string.
typeString | type string |
DevicePtr BluezQt::Device::toSharedPtr | ( | ) | const |
Returns a shared pointer from this.
|
signal |
Indicates that device's trusted state have changed.
Device::Type BluezQt::Device::type | ( | ) | const |
Returns a type of the device.
Type of device is deduced from its class (for Bluetooth Classic devices) or its appearance (for Bluetooth Low Energy devices).
|
signal |
Indicates that device's type have changed.
|
static |
Returns a string for device type.
type | device type |
QString BluezQt::Device::ubi | ( | ) | const |
Returns an UBI of the device.
Example UBI: "/org/bluez/hci0/dev_40_79_6A_0C_39_75"
QStringList BluezQt::Device::uuids | ( | ) | const |
Returns UUIDs of supported services by the device.
UUIDs will always be returned in uppercase.
|
signal |
Indicates that device's UUIDs have changed.