Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorServiceBluetooth::BluetoothDevice Class Reference

One BlueZ device (org.bluez.Device1), e.g. More...

#include <PhosphorServiceBluetooth/BluetoothDevice.h>

Inheritance diagram for PhosphorServiceBluetooth::BluetoothDevice:
[legend]

Signals

void operationFinished (const QString &operation, const QString &errorName)
 Completion of a write request; state follows BlueZ properties.
void addressChanged ()
void nameChanged ()
void aliasChanged ()
void iconChanged ()
void pairedChanged ()
void trustedChanged ()
void blockedChanged ()
void connectedChanged ()
void rssiChanged ()
void batteryPercentageChanged ()
void adapterChanged ()
void uuidsChanged ()

Public Member Functions

 BluetoothDevice (QDBusConnection connection, const QString &dbusPath, const QVariantMap &initialProperties, QObject *parent=nullptr)
 ~BluetoothDevice () override
QString dbusPath () const
QString address () const
QString name () const
QString alias () const
QString icon () const
bool paired () const
bool trusted () const
bool blocked () const
bool connected () const
int rssi () const
int batteryPercentage () const
 -1 when the device does not report Battery1.Percentage.
void applyBattery (const QVariantMap &properties)
 Internal ObjectManager update, including removal (empty map).
QString adapter () const
QStringList uuids () const
void connectDevice ()
 Establish / tear down a connection to this device (org.bluez.Device1.Connect / Disconnect).
void disconnectDevice ()
void setTrusted (bool trusted)
 Mark the device (un)trusted / (un)blocked (org.bluez.Device1 Properties.Set).
void setBlocked (bool blocked)
void pair ()
 Begin / abort pairing (org.bluez.Device1.Pair / CancelPairing).
void cancelPairing ()

Detailed Description

One BlueZ device (org.bluez.Device1), e.g.

/org/bluez/hci0/dev_AA_BB_CC_DD_EE_FF.

Initial properties are supplied by BluetoothHost from the ObjectManager enumeration; subsequent changes arrive via PropertiesChanged. The write surface is exposed via connectDevice / disconnectDevice / setTrusted / setBlocked / pair / cancelPairing (fire-and-forget; cached state moves on the PropertiesChanged echo).

rssi is only reported by BlueZ for devices currently in range (during discovery): it is 0 for a never-seen / cached device, and is reset to 0 when BlueZ invalidates it as the device goes out of range. Owned by BluetoothHost; never constructed from QML.

Constructor & Destructor Documentation

◆ BluetoothDevice()

PhosphorServiceBluetooth::BluetoothDevice::BluetoothDevice ( QDBusConnection connection,
const QString & dbusPath,
const QVariantMap & initialProperties,
QObject * parent = nullptr )

◆ ~BluetoothDevice()

PhosphorServiceBluetooth::BluetoothDevice::~BluetoothDevice ( )
override

Member Function Documentation

◆ adapter()

QString PhosphorServiceBluetooth::BluetoothDevice::adapter ( ) const
nodiscard

◆ adapterChanged

void PhosphorServiceBluetooth::BluetoothDevice::adapterChanged ( )
signal

◆ address()

QString PhosphorServiceBluetooth::BluetoothDevice::address ( ) const
nodiscard

◆ addressChanged

void PhosphorServiceBluetooth::BluetoothDevice::addressChanged ( )
signal

◆ alias()

QString PhosphorServiceBluetooth::BluetoothDevice::alias ( ) const
nodiscard

◆ aliasChanged

void PhosphorServiceBluetooth::BluetoothDevice::aliasChanged ( )
signal

◆ applyBattery()

void PhosphorServiceBluetooth::BluetoothDevice::applyBattery ( const QVariantMap & properties)

Internal ObjectManager update, including removal (empty map).

◆ batteryPercentage()

int PhosphorServiceBluetooth::BluetoothDevice::batteryPercentage ( ) const
nodiscard

-1 when the device does not report Battery1.Percentage.

◆ batteryPercentageChanged

void PhosphorServiceBluetooth::BluetoothDevice::batteryPercentageChanged ( )
signal

◆ blocked()

bool PhosphorServiceBluetooth::BluetoothDevice::blocked ( ) const
nodiscard

◆ blockedChanged

void PhosphorServiceBluetooth::BluetoothDevice::blockedChanged ( )
signal

◆ cancelPairing()

void PhosphorServiceBluetooth::BluetoothDevice::cancelPairing ( )

◆ connectDevice()

void PhosphorServiceBluetooth::BluetoothDevice::connectDevice ( )

Establish / tear down a connection to this device (org.bluez.Device1.Connect / Disconnect).

Fire-and-forget; connected reflects the outcome via PropertiesChanged. Named *Device to avoid shadowing the static QObject::connect / disconnect.

◆ connected()

bool PhosphorServiceBluetooth::BluetoothDevice::connected ( ) const
nodiscard

◆ connectedChanged

void PhosphorServiceBluetooth::BluetoothDevice::connectedChanged ( )
signal

◆ dbusPath()

QString PhosphorServiceBluetooth::BluetoothDevice::dbusPath ( ) const
nodiscard

◆ disconnectDevice()

void PhosphorServiceBluetooth::BluetoothDevice::disconnectDevice ( )

◆ icon()

QString PhosphorServiceBluetooth::BluetoothDevice::icon ( ) const
nodiscard

◆ iconChanged

void PhosphorServiceBluetooth::BluetoothDevice::iconChanged ( )
signal

◆ name()

QString PhosphorServiceBluetooth::BluetoothDevice::name ( ) const
nodiscard

◆ nameChanged

void PhosphorServiceBluetooth::BluetoothDevice::nameChanged ( )
signal

◆ operationFinished

void PhosphorServiceBluetooth::BluetoothDevice::operationFinished ( const QString & operation,
const QString & errorName )
signal

Completion of a write request; state follows BlueZ properties.

◆ pair()

void PhosphorServiceBluetooth::BluetoothDevice::pair ( )

Begin / abort pairing (org.bluez.Device1.Pair / CancelPairing).

Fire-and-forget; during Pair() BlueZ drives the registered BluetoothAgent's callbacks, and paired reflects the outcome via PropertiesChanged.

◆ paired()

bool PhosphorServiceBluetooth::BluetoothDevice::paired ( ) const
nodiscard

◆ pairedChanged

void PhosphorServiceBluetooth::BluetoothDevice::pairedChanged ( )
signal

◆ rssi()

int PhosphorServiceBluetooth::BluetoothDevice::rssi ( ) const
nodiscard

◆ rssiChanged

void PhosphorServiceBluetooth::BluetoothDevice::rssiChanged ( )
signal

◆ setBlocked()

void PhosphorServiceBluetooth::BluetoothDevice::setBlocked ( bool blocked)

◆ setTrusted()

void PhosphorServiceBluetooth::BluetoothDevice::setTrusted ( bool trusted)

Mark the device (un)trusted / (un)blocked (org.bluez.Device1 Properties.Set).

Fire-and-forget; the cached value moves only on the PropertiesChanged echo, never optimistically.

◆ trusted()

bool PhosphorServiceBluetooth::BluetoothDevice::trusted ( ) const
nodiscard

◆ trustedChanged

void PhosphorServiceBluetooth::BluetoothDevice::trustedChanged ( )
signal

◆ uuids()

QStringList PhosphorServiceBluetooth::BluetoothDevice::uuids ( ) const
nodiscard

◆ uuidsChanged

void PhosphorServiceBluetooth::BluetoothDevice::uuidsChanged ( )
signal

The documentation for this class was generated from the following file: