Torc  0.1
torcpowerunixdbus.h
Go to the documentation of this file.
1 #ifndef TORCPOWERUNIXDBUS_H
2 #define TORCPOWERUNIXDBUS_H
3 
4 // Qt
5 #include <QtDBus>
6 
7 // Torc
8 #include "torcpower.h"
9 
10 class TorcPowerUnixDBus final : public TorcPower
11 {
12  Q_OBJECT
13 
14  public:
15  static bool Available (void);
16 
17  public:
19  virtual ~TorcPowerUnixDBus() = default;
20 
21  bool DoShutdown (void) override;
22  bool DoSuspend (void) override;
23  bool DoHibernate (void) override;
24  bool DoRestart (void) override;
25 
26  public slots:
27  void DeviceAdded (QDBusObjectPath Device);
28  void DeviceRemoved (QDBusObjectPath Device);
29  void DeviceChanged (QDBusObjectPath Device);
30  void DBusError (QDBusError Error);
31  void DBusCallback (void);
32  void Changed (void);
33 
34  private:
35  void UpdateBattery (void);
36  int GetBatteryLevel (const QString &Path);
37  void UpdateProperties (void);
38 
39  private:
40  bool m_onBattery;
41  QMap<QString,int> m_devices;
42  QDBusInterface m_upowerInterface;
43  QDBusInterface m_consoleInterface;
44 };
45 
46 #endif // TORCPOWERUNIXDBUS_H
bool DoHibernate(void) override
void DeviceAdded(QDBusObjectPath Device)
virtual ~TorcPowerUnixDBus()=default
void DeviceChanged(QDBusObjectPath Device)
void DeviceRemoved(QDBusObjectPath Device)
static bool Available(void)
A generic power status class.
Definition: torcpower.h:12
void DBusError(QDBusError Error)
bool DoSuspend(void) override
bool DoShutdown(void) override
int GetBatteryLevel(void)
Definition: torcpower.cpp:410
A power monitoring class for Unix based systems.
bool DoRestart(void) override