6 #include <QRecursiveMutex>
38 FeatureShutdown = 0x01,
39 FeatureSuspend = 0x02,
40 FeatureHibernate = 0x04,
41 FeatureRestart = 0x08,
42 FeatureHybridSleep = 0x10
45 Q_DECLARE_FLAGS(Features, Feature)
47 static MythPower* AcquireRelease(
void* Reference,
bool Acquire, std::chrono::seconds MinimumDelay = 0s);
48 virtual bool RequestFeature (Feature
Request,
bool Delay =
true);
49 Features GetFeatures (
void);
50 bool IsFeatureSupported(Feature Supported);
51 int GetPowerLevel (
void)
const;
52 QStringList GetFeatureList (
void);
55 virtual void CancelFeature (
void);
58 void ShuttingDown (
void);
59 void Suspending (
void);
60 void Hibernating (
void);
61 void Restarting (
void);
62 void HybridSleeping (
void);
63 void WillShutDown (std::chrono::milliseconds MilliSeconds = 0ms);
64 void WillSuspend (std::chrono::milliseconds MilliSeconds = 0ms);
65 void WillHibernate (std::chrono::milliseconds MilliSeconds = 0ms);
66 void WillRestart (std::chrono::milliseconds MilliSeconds = 0ms);
67 void WillHybridSleep(std::chrono::milliseconds MilliSeconds = 0ms);
68 void WokeUp (std::chrono::seconds SecondsAsleep);
69 void LowBattery (
void);
72 void FeatureTimeout (
void);
81 virtual void Init (
void);
82 virtual bool DoFeature (
bool =
false) {
return false; }
83 virtual void DidWakeUp (
void);
84 virtual void FeatureHappening (Feature Spontaneous = FeatureNone);
85 virtual bool ScheduleFeature (
enum Feature Type, std::chrono::seconds Delay);
86 void SetRequestedDelay (std::chrono::seconds Delay);
87 void PowerLevelChanged (
int Level);
88 static QString FeatureToString (
enum Feature Type);
89 static bool FeatureIsEquivalent(Feature First, Feature Second);
91 Features m_features { FeatureNone };
92 Feature m_scheduledFeature { FeatureNone };
93 bool m_isSpontaneous {
false };
94 std::chrono::seconds m_maxRequestedDelay { 0s };
98 int m_powerLevel { Unset };
99 bool m_warnForLowBattery {
false };
105 Q_DECLARE_OPERATORS_FOR_FLAGS(MythPower::Features)
107 #endif // MYTHPOWER_H