File indexing completed on 2024-05-12 16:57:41
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Dimitris Kardarakos <dimkard@posteo.net> 0003 * 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 */ 0006 0007 #ifndef WAKEUPMANAGER_H 0008 #define WAKEUPMANAGER_H 0009 0010 #include <QObject> 0011 #include <QDateTime> 0012 #include <QVariantMap> 0013 0014 class SolidWakeupBackend; 0015 class WakeupManager : public QObject 0016 { 0017 Q_OBJECT 0018 Q_CLASSINFO("D-Bus Interface", "org.kde.PowerManagement") 0019 0020 public: 0021 explicit WakeupManager(QObject *parent = nullptr); 0022 virtual ~WakeupManager() = default; 0023 0024 /** 0025 * @brief Schedule a wake-up at the time given 0026 */ 0027 void scheduleWakeup(const QDateTime wakeupAt); 0028 0029 /** 0030 * @return True if there is a backend that is up and running 0031 */ 0032 bool active() const; 0033 0034 /** 0035 * @return True if there is a backend that offers scheduling features 0036 */ 0037 bool hasWakeupFeatures(); 0038 0039 Q_SIGNALS: 0040 /** 0041 * @brief To be emited when the parent should take over and manage the wake-up 0042 * 0043 */ 0044 void wakeupAlarmClient(); 0045 0046 /** 0047 * @brief To be emited when wake-up manager status (active/not active) is changed 0048 * 0049 */ 0050 void activeChanged(const bool activeBackend); 0051 0052 public Q_SLOTS: 0053 0054 /** 0055 * @return Handles a wake-up 0056 */ 0057 void wakeupCallback(int cookie); 0058 0059 /** 0060 * @return Clear a scheduled wakeup 0061 */ 0062 void removeWakeup(int cookie); 0063 0064 /** 0065 * @return Clear last scheduled wakeup 0066 */ 0067 void removeWakeup(); 0068 0069 private Q_SLOTS: 0070 void setActive(const bool activeBackend); 0071 private: 0072 SolidWakeupBackend *m_wakeup_backend; 0073 int m_cookie; 0074 QVariantMap m_callback_info; 0075 int m_active; 0076 }; 0077 #endif //WAKEUPMANAGER_H