File indexing completed on 2024-05-05 05:28:19

0001 /*
0002  * SPDX-FileCopyrightText: 2020 Dimitris Kardarakos <dimkard@posteo.net>
0003  *
0004  * SPDX-License-Identifier: GPL-3.0-or-later
0005  */
0006 
0007 #ifndef SOLIDWAKEUPBACKEND_H
0008 #define SOLIDWAKEUPBACKEND_H
0009 
0010 #include "wakeupbackend.h"
0011 
0012 class QDBusInterface;
0013 class QDBusServiceWatcher;
0014 
0015 class SolidWakeupBackend : public WakeupBackend
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit SolidWakeupBackend(QObject *parent = nullptr);
0020     virtual ~SolidWakeupBackend() = default;
0021 
0022     /**
0023      * @brief Schedule a wakeup at the time provided
0024      *
0025      * @param callbackInfo should provide:
0026      * dbus-service: the D-Bus service to call back after waking up
0027      * dbus-path: The path of the D-Bus service to call back after waking up
0028      * @param wakeupAt The exact time (in seconds) to schedule the wake-up
0029      * @return The scheduled wakeup returned by the power manager module
0030      */
0031     virtual QVariant scheduleWakeup(const QVariantMap &callbackInfo, const quint64 wakeupAt) override;
0032 
0033     /**
0034      * @brief Clear a scheduled wake-up
0035      *
0036      * @param scheduledWakeup The integer cookie of the scheduled wake up
0037      */
0038     virtual void clearWakeup(const QVariant &scheduledWakeup) override;
0039 
0040     /**
0041      * @return True if the interface and the service of the backend exist
0042      */
0043     virtual bool isValid() override;
0044 
0045     /**
0046      * @return True if the backend offers wakeup features
0047      */
0048     virtual bool isWakeupBackend() override;
0049 
0050 Q_SIGNALS:
0051     /**
0052      * @brief Emit when the backend has changed
0053      *
0054      */
0055     void backendChanged(const bool isActive);
0056 
0057 private:
0058     QDBusInterface *m_interface;
0059     QDBusServiceWatcher *m_watcher;
0060 };
0061 
0062 #endif // SOLIDWAKEUPBACKEND_H