1/*
2 * BluezQt - Asynchronous Bluez wrapper library
3 *
4 * SPDX-FileCopyrightText: 2014 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_P_H
10#define BLUEZQT_MANAGER_P_H
11
12#include <QDBusContext>
13#include <QHash>
14#include <QObject>
15
16#include "bluezagentmanager1.h"
17#include "bluezprofilemanager1.h"
18#include "dbusobjectmanager.h"
19#include "rfkill.h"
20#include "types.h"
21
22namespace BluezQt
23{
24typedef org::freedesktop::DBus::ObjectManager DBusObjectManager;
25typedef org::bluez::AgentManager1 BluezAgentManager;
26typedef org::bluez::ProfileManager1 BluezProfileManager;
27
28class Manager;
29class Adapter;
30class Device;
31class AdapterPrivate;
32
33class ManagerPrivate : public QObject, protected QDBusContext
34{
35 Q_OBJECT
36
37public:
38 explicit ManagerPrivate(Manager *parent);
39
40 void init();
41 void nameHasOwnerFinished(QDBusPendingCallWatcher *watcher);
42 void load();
43 void getManagedObjectsFinished(QDBusPendingCallWatcher *watcher);
44 void clear();
45
46 AdapterPtr findUsableAdapter() const;
47
48 void serviceRegistered();
49 void serviceUnregistered();
50 void interfacesAdded(const QDBusObjectPath &objectPath, const QVariantMapMap &interfaces);
51 void interfacesRemoved(const QDBusObjectPath &objectPath, const QStringList &interfaces);
52 void adapterRemoved(const AdapterPtr &adapter);
53 void adapterPoweredChanged(bool powered);
54 void rfkillStateChanged(Rfkill::State state);
55
56 void addAdapter(const QString &adapterPath, const QVariantMap &properties);
57 void addDevice(const QString &devicePath, const QVariantMap &properties);
58 void removeAdapter(const QString &adapterPath);
59 void removeDevice(const QString &devicePath);
60
61 bool rfkillBlocked() const;
62 void setUsableAdapter(const AdapterPtr &adapter);
63
64 Manager *q;
65 Rfkill *m_rfkill;
66 DBusObjectManager *m_dbusObjectManager;
67 BluezAgentManager *m_bluezAgentManager;
68 BluezProfileManager *m_bluezProfileManager;
69
70 QHash<QString, AdapterPtr> m_adapters;
71 QHash<QString, DevicePtr> m_devices;
72 AdapterPtr m_usableAdapter;
73
74 bool m_initialized;
75 bool m_bluezRunning;
76 bool m_loaded;
77 bool m_adaptersLoaded;
78 bool m_bluetoothBlocked;
79
80Q_SIGNALS:
81 void initError(const QString &errorText);
82 void initFinished();
83
84private Q_SLOTS:
85 void propertiesChanged(const QString &interface, const QVariantMap &changed, const QStringList &invalidated);
86 void dummy();
87};
88
89} // namespace BluezQt
90
91#endif // BLUEZQT_MANAGER_P_H
92

source code of bluez-qt/src/manager_p.h