Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
BluetoothHost.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorServiceBluetooth/phosphorservicebluetooth_export.h>
7
8#include <QList>
9#include <QObject>
10#include <QString>
11
12#include <memory>
13
14class QDBusConnection;
15
17
19class BluetoothAgent;
20class BluetoothDevice;
21
35class PHOSPHORSERVICEBLUETOOTH_EXPORT BluetoothHost : public QObject
36{
37 Q_OBJECT
38 Q_PROPERTY(int adapterCount READ adapterCount NOTIFY adapterCountChanged)
39 Q_PROPERTY(int deviceCount READ deviceCount NOTIFY deviceCountChanged)
41
42public:
44 explicit BluetoothHost(QObject* parent = nullptr);
45
48 BluetoothHost(QDBusConnection connection, QString service, QObject* parent = nullptr);
49
50 ~BluetoothHost() override;
51 Q_INVOKABLE void refresh();
52
53 [[nodiscard]] QList<BluetoothAdapter*> adapters() const;
54 [[nodiscard]] QList<BluetoothDevice*> devices() const;
55 [[nodiscard]] int adapterCount() const;
56 [[nodiscard]] int deviceCount() const;
57
64 [[nodiscard]] BluetoothAgent* agent() const;
65
67 [[nodiscard]] Q_INVOKABLE PhosphorServiceBluetooth::BluetoothAdapter* adapterAt(int index) const;
68 [[nodiscard]] Q_INVOKABLE PhosphorServiceBluetooth::BluetoothDevice* deviceAt(int index) const;
69
70Q_SIGNALS:
77
78private:
79 Q_DISABLE_COPY_MOVE(BluetoothHost)
80 class Private;
81 std::unique_ptr<Private> d;
82};
83
84} // namespace PhosphorServiceBluetooth
One BlueZ adapter (org.bluez.Adapter1), e.g.
Definition BluetoothAdapter.h:31
Implements org.bluez.Agent1, the pairing agent BlueZ calls back into during a Pair() handshake.
Definition BluetoothAgent.h:39
One BlueZ device (org.bluez.Device1), e.g.
Definition BluetoothDevice.h:35
BluetoothHost(QObject *parent=nullptr)
Observes the system bus's org.bluez (the production wiring).
void adapterAdded(PhosphorServiceBluetooth::BluetoothAdapter *adapter)
PhosphorServiceBluetooth::BluetoothAdapter * adapterAt(int index) const
Adapter / device at index, or nullptr when out of range.
BluetoothHost(QDBusConnection connection, QString service, QObject *parent=nullptr)
Observes service on connection.
void deviceRemoved(PhosphorServiceBluetooth::BluetoothDevice *device)
QList< BluetoothAdapter * > adapters() const
BluetoothAgent * agent() const
The pairing agent registered with BlueZ (KeyboardDisplay capability).
void deviceAdded(PhosphorServiceBluetooth::BluetoothDevice *device)
QList< BluetoothDevice * > devices() const
void adapterRemoved(PhosphorServiceBluetooth::BluetoothAdapter *adapter)
PhosphorServiceBluetooth::BluetoothDevice * deviceAt(int index) const
Definition BluetoothAdapter.h:16