BluezQt 5.109.0
Public Types | Properties | Signals | Public Slots | Public Member Functions | Static Public Member Functions | List of all members
BluezQt::Device

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

PendingCallcancelPairing ()
 Cancels a pairing with the device.
 
PendingCallconnectProfile (const QString &uuid)
 Connects a specific profile of the device.
 
PendingCallconnectToDevice ()
 Connects all auto-connectable profiles of the device.
 
PendingCalldisconnectFromDevice ()
 Disconnects all connected profiles of the device.
 
PendingCalldisconnectProfile (const QString &uuid)
 Disconnects a specific profile of the device.
 
PendingCallpair ()
 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.
 
PendingCallsetBlocked (bool blocked)
 Sets the blocked state of the device.
 
PendingCallsetName (const QString &name)
 Sets the name of the device.
 
PendingCallsetTrusted (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.
 

Detailed Description

Bluetooth device.

This class represents a Bluetooth device.

Member Enumeration Documentation

◆ Type

Device types.

Enumerator
Phone 

The device is a phone.

Modem 

The device is a modem.

Computer 

The device is a computer.

Network 

The device is a network.

Headset 

The device is a headset.

Headphones 

The device is a headphones.

AudioVideo 

The device is an uncategorized audio video device.

Keyboard 

The device is a keyboard.

Mouse 

The device is a mouse.

Joypad 

The device is a joypad.

Tablet 

The device is a graphics tablet (input device).

Peripheral 

The device is an uncategorized peripheral device.

Camera 

The device is a camera.

Printer 

The device is a printer.

Imaging 

The device is an uncategorized imaging device.

Wearable 

The device is a wearable device.

Toy 

The device is a toy.

Health 

The device is a health device.

Uncategorized 

The device is not of any of the known types.

Constructor & Destructor Documentation

◆ ~Device()

BluezQt::Device::~Device ( )
override

Destroys a Device object.

Member Function Documentation

◆ adapter()

AdapterPtr BluezQt::Device::adapter ( ) const

Returns an adapter that discovered this device.

Returns
adapter of device

◆ address()

QString BluezQt::Device::address ( ) const

Returns an address of the device.

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

Returns
address of device

◆ addressChanged

void BluezQt::Device::addressChanged ( const QString &  address)
signal

Indicates that device's address have changed.

◆ appearance()

quint16 BluezQt::Device::appearance ( ) const

Returns an appearance of the device.

Returns
appearance of device

◆ appearanceChanged

void BluezQt::Device::appearanceChanged ( quint16  appearance)
signal

Indicates that device's appearance have changed.

◆ battery()

BatteryPtr BluezQt::Device::battery ( ) const

Returns the battery interface for the device.

Returns
null if device has no battery
Since
5.66

◆ batteryChanged

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

Indicates that device's battery has changed.

◆ blockedChanged

void BluezQt::Device::blockedChanged ( bool  blocked)
signal

Indicates that device's blocked state have changed.

◆ cancelPairing

PendingCall * BluezQt::Device::cancelPairing ( )
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

Returns
void pending call

◆ connectedChanged

void BluezQt::Device::connectedChanged ( bool  connected)
signal

Indicates that device's connected state have changed.

◆ connectProfile

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

Connects a specific profile of the device.

Possible errors: PendingCall::DoesNotExist, PendingCall::AlreadyConnected, PendingCall::ConnectFailed

Parameters
uuidservice UUID
Returns
void pending call

◆ connectToDevice

PendingCall * BluezQt::Device::connectToDevice ( )
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

Returns
void pending call

◆ deviceChanged

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

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

◆ deviceClass()

quint32 BluezQt::Device::deviceClass ( ) const

Returns a class of the device.

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

See also
type() const
Returns
class of device

◆ deviceClassChanged

void BluezQt::Device::deviceClassChanged ( quint32  deviceClass)
signal

Indicates that device's class have changed.

◆ deviceRemoved

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

Indicates that the device was removed.

◆ disconnectFromDevice

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

Disconnects all connected profiles of the device.

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

Possible errors: PendingCall::NotConnected

Returns
void pending call

◆ disconnectProfile

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

Disconnects a specific profile of the device.

Possible errors: PendingCall::DoesNotExist, PendingCall::Failed, PendingCall::NotConnected, PendingCall::NotSupported

Parameters
uuidservice UUID
Returns
void pending call

◆ friendlyName()

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.

Returns
friendly name of device

◆ friendlyNameChanged

void BluezQt::Device::friendlyNameChanged ( const QString &  friendlyName)
signal

Indicates that device's friendly name have changed.

◆ gattServiceAdded

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

Indicates that a new service was added (eg.

found by connection).

◆ gattServiceChanged

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

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

◆ gattServiceRemoved

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

Indicates that a service was removed.

◆ gattServices()

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

Returns list of services known by the device.

Returns
list of services

◆ gattServicesChanged

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

Indicates that device GATT services list has changed.

◆ hasLegacyPairing()

bool BluezQt::Device::hasLegacyPairing ( ) const

Returns whether the device has legacy pairing.

Returns
true if device has legacy pairing

◆ icon()

QString BluezQt::Device::icon ( ) const

Returns an icon name of the device.

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

Returns
icon name of device

◆ iconChanged

void BluezQt::Device::iconChanged ( const QString &  icon)
signal

Indicates that device's icon have changed.

◆ input()

InputPtr BluezQt::Device::input ( ) const

Returns the input interface for the device.

Only input devices will have valid input interface.

Returns
null if device have no input

◆ inputChanged

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

Indicates that device's input have changed.

◆ isBlocked()

bool BluezQt::Device::isBlocked ( ) const

Returns whether the device is blocked.

Returns
true if device is blocked

◆ isConnected()

bool BluezQt::Device::isConnected ( ) const

Returns whether the device is connected.

Returns
true if connected

◆ isPaired()

bool BluezQt::Device::isPaired ( ) const

Returns whether the device is paired.

Returns
true if device is paired

◆ isServicesResolved()

bool BluezQt::Device::isServicesResolved ( ) const

Returns whether or not service discovery has been resolved.

Returns
true if servicesResolved

◆ isTrusted()

bool BluezQt::Device::isTrusted ( ) const

Returns whether the device is trusted.

Returns
true if device is trusted

◆ legacyPairingChanged

void BluezQt::Device::legacyPairingChanged ( bool  legacyPairing)
signal

Indicates that device's legacy pairing state have changed.

◆ manufacturerData()

ManData BluezQt::Device::manufacturerData ( ) const

Returns manufacturer specific advertisement data.

Note
Keys are 16 bits Manufacturer ID followed by its byte array value.
Returns
manufacturerData of device.

◆ manufacturerDataChanged

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

Indicates that device's manufacturer data have changed.

◆ mediaPlayer()

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.

Returns
null if device have no media player

◆ mediaPlayerChanged

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

Indicates that device's media player have changed.

◆ mediaTransport()

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.

Returns
null if device have no media transport

◆ mediaTransportChanged

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

Indicates that device's media transport have changed.

◆ modalias()

QString BluezQt::Device::modalias ( ) const

Returns remote device ID in modalias format.

Returns
device modalias

◆ modaliasChanged

void BluezQt::Device::modaliasChanged ( const QString &  modalias)
signal

Indicates that device's modalias have changed.

◆ name()

QString BluezQt::Device::name ( ) const

Returns a name of the device.

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

Returns
name of device

◆ nameChanged

void BluezQt::Device::nameChanged ( const QString &  name)
signal

Indicates that device's name have changed.

◆ pair

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

◆ pairedChanged

void BluezQt::Device::pairedChanged ( bool  paired)
signal

Indicates that device's paired state have changed.

◆ remoteName()

QString BluezQt::Device::remoteName ( ) const

Returns a remote name of the device.

Returns
remote name of device

◆ remoteNameChanged

void BluezQt::Device::remoteNameChanged ( const QString &  remoteName)
signal

Indicates that device's remote name have changed.

◆ rssi()

qint16 BluezQt::Device::rssi ( ) const

Returns Received Signal Strength Indicator of the device.

The bigger value indicates better signal strength.

Note
RSSI is only updated during discovery.
Returns
RSSI of device

◆ rssiChanged

void BluezQt::Device::rssiChanged ( qint16  rssi)
signal

Indicates that device's RSSI have changed.

◆ serviceData()

QHash< QString, QByteArray > BluezQt::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.
Since
5.72

◆ serviceDataChanged

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

Indicates that the device's service data has changed.

Since
5.72

◆ servicesResolvedChanged

void BluezQt::Device::servicesResolvedChanged ( bool  servicesResolved)
signal

Indicates that device's servicesResolved state have changed.

◆ setBlocked()

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

Sets the blocked state of the device.

Parameters
blockedblocked state
Returns
void pending call

◆ setName()

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

Sets the name of the device.

Parameters
namename for device
Returns
void pending call

◆ setTrusted()

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

Sets the trusted state of the device.

Parameters
trustedtrusted state
Returns
void pending call

◆ stringToType()

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

Returns a device type for string.

Parameters
typeStringtype string
Returns
device type

◆ toSharedPtr()

DevicePtr BluezQt::Device::toSharedPtr ( ) const

Returns a shared pointer from this.

Returns
DevicePtr

◆ trustedChanged

void BluezQt::Device::trustedChanged ( bool  trusted)
signal

Indicates that device's trusted state have changed.

◆ type()

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

See also
deviceClass() const
appearance() const
Returns
type of device

◆ typeChanged

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

Indicates that device's type have changed.

◆ typeToString()

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

Returns a string for device type.

Parameters
typedevice type
Returns
device type string

◆ ubi()

QString BluezQt::Device::ubi ( ) const

Returns an UBI of the device.

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

Returns
UBI of device

◆ uuids()

QStringList BluezQt::Device::uuids ( ) const

Returns UUIDs of supported services by the device.

UUIDs will always be returned in uppercase.

Returns
UUIDs of supported services

◆ uuidsChanged

void BluezQt::Device::uuidsChanged ( const QStringList &  uuids)
signal

Indicates that device's UUIDs have changed.