37 FeatureShutdown = 0x01,
38 FeatureSuspend = 0x02,
39 FeatureHibernate = 0x04,
40 FeatureRestart = 0x08,
41 FeatureHybridSleep = 0x10
44 Q_DECLARE_FLAGS(Features, Feature)
46 static MythPower* AcquireRelease(
void* Reference,
bool Acquire, std::chrono::seconds MinimumDelay = 0s);
47 virtual bool RequestFeature (Feature
Request,
bool Delay =
true);
48 Features GetFeatures (
void);
49 bool IsFeatureSupported(Feature Supported);
50 int GetPowerLevel (
void)
const;
51 QStringList GetFeatureList (
void);
54 virtual void CancelFeature (
void);
57 void ShuttingDown (
void);
58 void Suspending (
void);
59 void Hibernating (
void);
60 void Restarting (
void);
61 void HybridSleeping (
void);
62 void WillShutDown (std::chrono::milliseconds MilliSeconds = 0ms);
63 void WillSuspend (std::chrono::milliseconds MilliSeconds = 0ms);
64 void WillHibernate (std::chrono::milliseconds MilliSeconds = 0ms);
65 void WillRestart (std::chrono::milliseconds MilliSeconds = 0ms);
66 void WillHybridSleep(std::chrono::milliseconds MilliSeconds = 0ms);
67 void WokeUp (std::chrono::seconds SecondsAsleep);
68 void LowBattery (
void);
71 void FeatureTimeout (
void);
80 virtual void Init (
void);
81 virtual bool DoFeature (
bool =
false) {
return false; }
82 virtual void DidWakeUp (
void);
83 virtual void FeatureHappening (Feature Spontaneous = FeatureNone);
84 virtual bool ScheduleFeature (
enum Feature Type, std::chrono::seconds Delay);
85 void SetRequestedDelay (std::chrono::seconds Delay);
86 void PowerLevelChanged (
int Level);
87 static QString FeatureToString (
enum Feature Type);
88 static bool FeatureIsEquivalent(Feature First, Feature Second);
90 Features m_features { FeatureNone };
91 Feature m_scheduledFeature { FeatureNone };
92 bool m_isSpontaneous {
false };
93 std::chrono::seconds m_maxRequestedDelay { 0s };
95 QTimer m_featureTimer { };
96 QDateTime m_sleepTime { };
97 int m_powerLevel { Unset };
98 bool m_warnForLowBattery {
false };
104 Q_DECLARE_OPERATORS_FOR_FLAGS(MythPower::Features)
106 #endif // MYTHPOWER_H