BluezQt

declarativemanager.h
1 /*
2  * BluezQt - Asynchronous Bluez wrapper library
3  *
4  * SPDX-FileCopyrightText: 2014-2015 David Rosca <[email protected]>
5  *
6  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7  */
8 
9 #ifndef DECLARATIVEMANAGER_H
10 #define DECLARATIVEMANAGER_H
11 
12 #include <QHash>
13 #include <QQmlListProperty>
14 
15 #include "manager.h"
16 
17 class DeclarativeDevice;
18 class DeclarativeAdapter;
19 
20 class DeclarativeManager : public BluezQt::Manager
21 {
22  Q_OBJECT
23  Q_PROPERTY(DeclarativeAdapter *usableAdapter READ usableAdapter NOTIFY usableAdapterChanged)
24  Q_PROPERTY(QQmlListProperty<DeclarativeAdapter> adapters READ declarativeAdapters NOTIFY adaptersChanged)
25  Q_PROPERTY(QQmlListProperty<DeclarativeDevice> devices READ declarativeDevices NOTIFY devicesChanged)
26 
27 public:
28  explicit DeclarativeManager(QObject *parent = nullptr);
29 
30  DeclarativeAdapter *usableAdapter() const;
31  QQmlListProperty<DeclarativeAdapter> declarativeAdapters();
32  QQmlListProperty<DeclarativeDevice> declarativeDevices();
33 
34  DeclarativeAdapter *declarativeAdapterFromPtr(BluezQt::AdapterPtr ptr) const;
35  DeclarativeDevice *declarativeDeviceFromPtr(BluezQt::DevicePtr ptr) const;
36 
39 
40 public Q_SLOTS:
41  DeclarativeAdapter *adapterForAddress(const QString &address) const;
42  DeclarativeAdapter *adapterForUbi(const QString &ubi) const;
43  DeclarativeDevice *deviceForAddress(const QString &address) const;
44  DeclarativeDevice *deviceForUbi(const QString &ubi) const;
45 
46 Q_SIGNALS:
47  void initFinished();
48  void initError(const QString &errorText);
49  void adapterAdded(DeclarativeAdapter *adapter);
50  void adapterRemoved(DeclarativeAdapter *adapter);
51  void adapterChanged(DeclarativeAdapter *adapter);
52  void deviceAdded(DeclarativeDevice *device);
53  void deviceRemoved(DeclarativeDevice *device);
54  void deviceChanged(DeclarativeDevice *device);
55  void usableAdapterChanged(DeclarativeAdapter *adapter);
56 
57  void adaptersChanged(QQmlListProperty<DeclarativeAdapter> adapters);
58  void devicesChanged(QQmlListProperty<DeclarativeDevice> devices);
59 
60 private Q_SLOTS:
61  void initJobResult(BluezQt::InitManagerJob *job);
62 
63  void slotAdapterAdded(BluezQt::AdapterPtr adapter);
64  void slotAdapterRemoved(BluezQt::AdapterPtr adapter);
65  void slotDeviceAdded(BluezQt::DevicePtr device);
66  void slotDeviceRemoved(BluezQt::DevicePtr device);
67  void slotUsableAdapterChanged(BluezQt::AdapterPtr adapter);
68 };
69 
70 #endif // DECLARATIVEMANAGER_H
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SLOTSQ_SLOTS
void deviceChanged(DevicePtr device)
Indicates that at least one of the device's properties have changed.
void adapterAdded(AdapterPtr adapter)
Indicates that adapter was added.
void deviceRemoved(DevicePtr device)
Indicates that a device was removed.
AdapterPtr adapterForAddress(const QString &address) const
Returns an adapter for specified address.
Definition: manager.cpp:96
DevicePtr deviceForAddress(const QString &address) const
Returns a device for specified address.
Definition: manager.cpp:111
void adapterRemoved(AdapterPtr adapter)
Indicates that adapter was removed.
void adapterChanged(AdapterPtr adapter)
Indicates that at least one of the adapter's properties have changed.
Q_SIGNALSQ_SIGNALS
DevicePtr deviceForUbi(const QString &ubi) const
Returns a device for specified UBI.
Definition: manager.cpp:132
AdapterPtr adapterForUbi(const QString &ubi) const
Returns an adapter for specified UBI.
Definition: manager.cpp:106
void usableAdapterChanged(AdapterPtr adapter)
Indicates that usable adapter have changed.
void deviceAdded(DevicePtr device)
Indicates that a new device was added (eg.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Sep 25 2022 04:19:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.