MythTV master
mythpowerdbus.h
Go to the documentation of this file.
1#ifndef MYTHPOWERDBUS_H
2#define MYTHPOWERDBUS_H
3
4// Qt
5#include <QDBusConnection>
6#include <QDBusInterface>
7#include <QDBusObjectPath>
8
9// MythTV
10#include "mythpower.h"
11
13{
14 Q_OBJECT
15
16 friend class MythPower;
17
18 public:
19 static bool IsAvailable(void);
20
21 public slots:
22 void CancelFeature(void) override;
23 void Changed (void);
24 void DeviceAdded (const QDBusObjectPath& Device);
25 void DeviceRemoved (const QDBusObjectPath& Device);
26 void DeviceChanged (const QDBusObjectPath& Device);
27 void DBusSuspending (bool Stopping);
28 void DBusShuttingDown (bool Stopping);
29
30 protected slots:
31 void ReleaseLock (void);
32
33 protected:
35 ~MythPowerDBus() override;
36
37 void Init (void) override;
38 bool DoFeature (bool Delayed = false) override;
39 void DidWakeUp (void) override;
40 bool ScheduleFeature (enum Feature Type, std::chrono::seconds Delay) override;
41
42 private:
43 bool UpdateStatus (void);
44 int RetrieveBatteryLevel(const QString &Path);
45 void UpdateBattery (void);
46 void UpdateProperties (void);
47 void AcquireLock (Features Types);
48
49 bool m_onBattery { false };
50 QMap<QString,int> m_batteries;
51 QDBusConnection m_bus { QDBusConnection::systemBus() };
52 QDBusInterface *m_upowerInterface { nullptr };
53 QDBusInterface *m_logindInterface { nullptr };
54 int m_lockHandle { -1 };
56};
57
58#endif // MYTHPOWERDBUS_H
A device containing images (ie. USB stick, CD, storage group etc)
QDBusConnection m_bus
Definition: mythpowerdbus.h:51
void CancelFeature(void) override
This is untested.
void UpdateProperties(void)
QDBusInterface * m_upowerInterface
Definition: mythpowerdbus.h:52
void DidWakeUp(void) override
void DBusShuttingDown(bool Stopping)
void DeviceChanged(const QDBusObjectPath &Device)
Update power device state.
void AcquireLock(Features Types)
Acquire an inhibition lock for logind power events.
bool UpdateStatus(void)
void DBusSuspending(bool Stopping)
QTimer m_delayTimer
Definition: mythpowerdbus.h:55
void UpdateBattery(void)
bool ScheduleFeature(enum Feature Type, std::chrono::seconds Delay) override
Schedule a MythTV initiated power feature.
void DeviceAdded(const QDBusObjectPath &Device)
void ReleaseLock(void)
Release our inhibition lock.
static bool IsAvailable(void)
Static check for DBus interfaces that support some form of power management.
void DeviceRemoved(const QDBusObjectPath &Device)
int RetrieveBatteryLevel(const QString &Path)
void Changed(void)
bool DoFeature(bool Delayed=false) override
~MythPowerDBus() override
QMap< QString, int > m_batteries
Definition: mythpowerdbus.h:50
QDBusInterface * m_logindInterface
Definition: mythpowerdbus.h:53
void Init(void) override