File indexing completed on 2024-04-14 15:32:03

0001 /*
0002  *   SPDX-FileCopyrightText: 2015 David Rosca <nowrep@gmail.com>
0003  *   SPDX-FileCopyrightText: 2021 Nate Graham <nate@kde.org>
0004  *
0005  *   SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef DEVICEMONITOR_H
0009 #define DEVICEMONITOR_H
0010 
0011 #include <QObject>
0012 
0013 #include <KSharedConfig>
0014 
0015 #include <BluezQt/Types>
0016 
0017 class KFilePlacesModel;
0018 
0019 class BlueDevilDaemon;
0020 
0021 class DeviceMonitor : public QObject
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     explicit DeviceMonitor(BlueDevilDaemon *daemon);
0027 
0028     void saveState();
0029 
0030 private Q_SLOTS:
0031     void bluetoothOperationalChanged(bool operational);
0032     void adapterAdded(BluezQt::AdapterPtr adapter);
0033     void deviceAdded(BluezQt::DevicePtr device);
0034 
0035     void deviceConnectedChanged(bool connected);
0036     void login1PrepareForSleep(bool active);
0037 
0038 private:
0039     void restoreState();
0040     void restoreAdapter(BluezQt::AdapterPtr adapter);
0041 
0042     void clearPlaces();
0043     void updateDevicePlace(BluezQt::DevicePtr device);
0044 
0045     KFilePlacesModel *places();
0046 
0047     BluezQt::Manager *m_manager;
0048     bool m_isParentValid;
0049     KFilePlacesModel *m_places = nullptr;
0050     KSharedConfig::Ptr m_config;
0051 };
0052 
0053 #endif // DEVICEMONITOR_H