BluezQt 5.109.0
manager.h
1/*
2 * BluezQt - Asynchronous BlueZ wrapper library
3 *
4 * SPDX-FileCopyrightText: 2014-2015 David Rosca <nowrep@gmail.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#ifndef BLUEZQT_MANAGER_H
10#define BLUEZQT_MANAGER_H
11
12#include <QObject>
13
14#include "adapter.h"
15#include "bluezqt_export.h"
16#include "media.h"
17#include "rfkill.h"
18
19namespace BluezQt
20{
21class Device;
22class Agent;
23class Profile;
24class PendingCall;
25class InitManagerJob;
26
77class BLUEZQT_EXPORT Manager : public QObject
78{
79 Q_OBJECT
80
81 Q_PROPERTY(bool initialized READ isInitialized)
82 Q_PROPERTY(bool operational READ isOperational NOTIFY operationalChanged)
83 Q_PROPERTY(bool bluetoothOperational READ isBluetoothOperational NOTIFY bluetoothOperationalChanged)
84 Q_PROPERTY(bool bluetoothBlocked READ isBluetoothBlocked WRITE setBluetoothBlocked NOTIFY bluetoothBlockedChanged)
85 Q_PROPERTY(AdapterPtr usableAdapter READ usableAdapter NOTIFY usableAdapterChanged)
86 Q_PROPERTY(QList<AdapterPtr> adapters READ adapters)
87 Q_PROPERTY(QList<DevicePtr> devices READ devices)
88 Q_PROPERTY(Rfkill *rfkill READ rfkill CONSTANT)
89
90public:
96 explicit Manager(QObject *parent = nullptr);
97
101 ~Manager() override;
102
109
115 bool isInitialized() const;
116
125 bool isOperational() const;
126
136
147 bool isBluetoothBlocked() const;
148
160 bool setBluetoothBlocked(bool blocked);
161
169 AdapterPtr usableAdapter() const;
170
176 QList<AdapterPtr> adapters() const;
177
183 QList<DevicePtr> devices() const;
184
195
202 AdapterPtr adapterForAddress(const QString &address) const;
203
210 AdapterPtr adapterForUbi(const QString &ubi) const;
211
222 DevicePtr deviceForAddress(const QString &address) const;
223
230 DevicePtr deviceForUbi(const QString &ubi) const;
231
244
254
266
276
286
287#if BLUEZQT_ENABLE_DEPRECATED_SINCE(5, 57)
294 BLUEZQT_DEPRECATED_VERSION(5, 57, "Use Adapter::media()")
295 MediaPtr media() const;
296#endif
297
298 Rfkill *rfkill() const;
299
300Q_SIGNALS:
304 void operationalChanged(bool operational);
305
309 void bluetoothOperationalChanged(bool operational);
310
314 void bluetoothBlockedChanged(bool blocked);
315
319 void adapterAdded(AdapterPtr adapter);
320
324 void adapterRemoved(AdapterPtr adapter);
325
329 void adapterChanged(AdapterPtr adapter);
330
334 void deviceAdded(DevicePtr device);
335
339 void deviceRemoved(DevicePtr device);
340
344 void deviceChanged(DevicePtr device);
345
349 void usableAdapterChanged(AdapterPtr adapter);
350
355
356private:
357 class ManagerPrivate *const d;
358
359 friend class ManagerPrivate;
360 friend class InitManagerJobPrivate;
361};
362
363} // namespace BluezQt
364
365#endif // BLUEZQT_MANAGER_H
Bluetooth agent.
Definition agent.h:37
Init manager job.
Definition initmanagerjob.h:27
Bluetooth manager.
Definition manager.h:78
PendingCall * unregisterAgent(Agent *agent)
Unregisters agent.
void deviceAdded(DevicePtr device)
Indicates that a new device was added (eg.
void adapterChanged(AdapterPtr adapter)
Indicates that at least one of the adapter's properties have changed.
bool setBluetoothBlocked(bool blocked)
Sets a Bluetooth blocked state.
QList< AdapterPtr > adapters() const
Returns a list of all adapters.
~Manager() override
Destroys a Manager object.
PendingCall * registerProfile(Profile *profile)
Registers profile.
AdapterPtr adapterForUbi(const QString &ubi) const
Returns an adapter for specified UBI.
void adapterRemoved(AdapterPtr adapter)
Indicates that adapter was removed.
DevicePtr deviceForAddress(const QString &address) const
Returns a device for specified address.
AdapterPtr usableAdapter() const
Returns a usable adapter.
void bluetoothOperationalChanged(bool operational)
Indicates that Bluetooth operational state have changed.
QList< DevicePtr > devices() const
Returns a list of all devices.
PendingCall * requestDefaultAgent(Agent *agent)
Requests default agent.
Manager(QObject *parent=nullptr)
Creates a new Manager object.
bool isBluetoothBlocked() const
Returns whether Bluetooth is blocked.
void operationalChanged(bool operational)
Indicates that operational state have changed.
InitManagerJob * init()
Creates a new init job.
void usableAdapterChanged(AdapterPtr adapter)
Indicates that usable adapter have changed.
DevicePtr deviceForUbi(const QString &ubi) const
Returns a device for specified UBI.
AdapterPtr adapterForAddress(const QString &address) const
Returns an adapter for specified address.
static PendingCall * startService()
Attempts to start org.bluez service by D-Bus activation.
bool isBluetoothOperational() const
Returns whether Bluetooth is operational.
PendingCall * unregisterProfile(Profile *profile)
Unregisters profile.
void bluetoothBlockedChanged(bool blocked)
Indicates that Bluetooth blocked state have changed.
void deviceChanged(DevicePtr device)
Indicates that at least one of the device's properties have changed.
PendingCall * registerAgent(Agent *agent)
Registers agent.
bool isInitialized() const
Returns whether the manager is initialized.
void deviceRemoved(DevicePtr device)
Indicates that a device was removed.
void adapterAdded(AdapterPtr adapter)
Indicates that adapter was added.
void allAdaptersRemoved()
Indicates that all adapters were removed.
bool isOperational() const
Returns whether the manager is operational.
Pending method call.
Definition pendingcall.h:33
Bluetooth profile.
Definition profile.h:47