BluezQt

declarativemanager.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 DECLARATIVEMANAGER_H
10#define DECLARATIVEMANAGER_H
11
12#include <QHash>
13#include <QQmlEngine>
14#include <QQmlListProperty>
15
16#include "manager.h"
17
18class DeclarativeDevice;
19class DeclarativeAdapter;
20
21class DeclarativeManager : public BluezQt::Manager
22{
24 QML_NAMED_ELEMENT(Manager)
25 QML_SINGLETON
26 Q_PROPERTY(DeclarativeAdapter *usableAdapter READ usableAdapter NOTIFY usableAdapterChanged)
27 Q_PROPERTY(QQmlListProperty<DeclarativeAdapter> adapters READ declarativeAdapters NOTIFY adaptersChanged)
28 Q_PROPERTY(QQmlListProperty<DeclarativeDevice> devices READ declarativeDevices NOTIFY devicesChanged)
29 Q_PROPERTY(QQmlListProperty<DeclarativeDevice> connectedDevices READ declarativeConnectedDevices NOTIFY connectedDevicesChanged)
30
31public:
32 explicit DeclarativeManager(QObject *parent = nullptr);
33
34 DeclarativeAdapter *usableAdapter() const;
35 QQmlListProperty<DeclarativeAdapter> declarativeAdapters();
36 QQmlListProperty<DeclarativeDevice> declarativeDevices();
37 QQmlListProperty<DeclarativeDevice> declarativeConnectedDevices();
38
39 DeclarativeAdapter *declarativeAdapterFromPtr(BluezQt::AdapterPtr ptr) const;
40 DeclarativeDevice *declarativeDeviceFromPtr(BluezQt::DevicePtr ptr) const;
41
44
45public Q_SLOTS:
46 DeclarativeAdapter *adapterForAddress(const QString &address) const;
47 DeclarativeAdapter *adapterForUbi(const QString &ubi) const;
48 DeclarativeDevice *deviceForAddress(const QString &address) const;
49 DeclarativeDevice *deviceForUbi(const QString &ubi) const;
50
52 void initFinished();
53 void initError(const QString &errorText);
54 void adapterAdded(DeclarativeAdapter *adapter);
55 void adapterRemoved(DeclarativeAdapter *adapter);
56 void adapterChanged(DeclarativeAdapter *adapter);
57 void deviceAdded(DeclarativeDevice *device);
58 void deviceRemoved(DeclarativeDevice *device);
59 void deviceChanged(DeclarativeDevice *device);
60 void usableAdapterChanged(DeclarativeAdapter *adapter);
61
62 void adaptersChanged(QQmlListProperty<DeclarativeAdapter> adapters);
63 void devicesChanged(QQmlListProperty<DeclarativeDevice> devices);
64 void connectedDevicesChanged(QQmlListProperty<DeclarativeDevice> devices);
65
66private Q_SLOTS:
67 void initJobResult(BluezQt::InitManagerJob *job);
68
69 void slotAdapterAdded(BluezQt::AdapterPtr adapter);
70 void slotAdapterRemoved(BluezQt::AdapterPtr adapter);
71 void slotDeviceAdded(BluezQt::DevicePtr device);
72 void slotDeviceRemoved(BluezQt::DevicePtr device);
73 void slotUsableAdapterChanged(BluezQt::AdapterPtr adapter);
74 void slotDeviceConnectedChanged();
75};
76
77#endif // DECLARATIVEMANAGER_H
Init manager job.
Bluetooth manager.
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.