File indexing completed on 2024-04-21 05:50:56

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 WakeupBackend;
0015 
0016 class WakeupManager : public QObject
0017 {
0018     Q_OBJECT
0019     Q_CLASSINFO("D-Bus Interface", "org.kde.PowerManagement")
0020 
0021 public:
0022     explicit WakeupManager(QObject *parent = nullptr);
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 offers wake-up features
0031      */
0032     bool active() const;
0033 
0034 Q_SIGNALS:
0035     /**
0036      * @brief To be emited when the parent should take over and manage the wake-up
0037      *
0038      */
0039     void wakeupAlarmClient();
0040 
0041 public Q_SLOTS:
0042     /**
0043      * @return Handles a wake-up
0044      */
0045     void wakeupCallback(const int cookie);
0046 
0047     /**
0048      * @return Clear a scheduled wakeup
0049      */
0050     void removeWakeup(const int cookie);
0051 
0052 private:
0053     WakeupBackend *m_wakeup_backend;
0054     int m_cookie;
0055     QVariantMap m_callback_info;
0056 };
0057 #endif //WAKEUPMANAGER_H