MythTV  master
Protected Slots | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
MythPowerOSX Class Reference

#include <mythpowerosx.h>

Inheritance diagram for MythPowerOSX:
Inheritance graph
[legend]
Collaboration diagram for MythPowerOSX:
Collaboration graph
[legend]

Protected Slots

void Refresh (void) override final
 
- Protected Slots inherited from MythPower
void FeatureTimeout (void)
 
virtual void Refresh (void)
 

Protected Member Functions

 MythPowerOSX ()
 Power management for OSX. More...
 
 ~MythPowerOSX () override final
 
void Init (void) override
 
bool DoFeature (bool Delayed=false) override final
 
- Protected Member Functions inherited from MythPower
 MythPower ()
 
 ~MythPower () override=default
 
virtual void DidWakeUp (void)
 
virtual void FeatureHappening (Feature Spontaneous=FeatureNone)
 Signal to the rest of MythTV that the given feature will happen now. More...
 
virtual bool ScheduleFeature (enum Feature Type, uint Delay)
 
void SetRequestedDelay (uint Delay)
 
void PowerLevelChanged (int Level)
 
- Protected Member Functions inherited from ReferenceCounter
virtual ~ReferenceCounter (void)
 Called on destruction, will warn if object deleted with references in place. More...
 

Static Protected Member Functions

static void PowerCallBack (void *Reference, io_service_t Service, natural_t Type, void *Data)
 Receive notification of power status changes. More...
 
static void PowerSourceCallBack (void *Reference)
 Receive notification of changes to the power supply. More...
 
- Static Protected Member Functions inherited from MythPower
static QString FeatureToString (enum Feature Type)
 
static bool FeatureIsEquivalent (Feature First, Feature Second)
 

Protected Attributes

CFRunLoopSourceRef m_powerRef { nullptr }
 
io_connect_t m_rootPowerDomain { 0 }
 
io_object_t m_powerNotifier { MACH_PORT_NULL }
 
IONotificationPortRef m_powerNotifyPort { nullptr }
 
- Protected Attributes inherited from MythPower
Features m_features { FeatureNone }
 
Feature m_scheduledFeature { FeatureNone }
 
bool m_isSpontaneous { false }
 
uint m_maxRequestedDelay { 0 }
 
uint m_maxSupportedDelay { MAXIMUM_SHUTDOWN_WAIT }
 
QTimer m_featureTimer { }
 
QDateTime m_sleepTime { }
 
int m_powerLevel { Unset }
 
bool m_warnForLowBattery { false }
 
- Protected Attributes inherited from ReferenceCounter
bool m_logDebug
 This is used to suppress creating LoggingItem classes for LoggingItem reference count changes. More...
 
QAtomicInt m_referenceCount {1}
 

Friends

class MythPower
 

Additional Inherited Members

- Public Types inherited from MythPower
enum  PowerLevel {
  UPS = -2, ACPower = -1, BatteryEmpty = 0, BatteryLow = 10,
  BatteryFull = 100, UnknownPower = 101, Unset
}
 
enum  Feature {
  FeatureNone = 0x00, FeatureShutdown = 0x01, FeatureSuspend = 0x02, FeatureHibernate = 0x04,
  FeatureRestart = 0x08, FeatureHybridSleep = 0x10
}
 
- Public Slots inherited from MythPower
virtual void CancelFeature (void)
 This is untested as it is currently not clear whether it is useful. More...
 
- Signals inherited from MythPower
void ShuttingDown (void)
 
void Suspending (void)
 
void Hibernating (void)
 
void Restarting (void)
 
void HybridSleeping (void)
 
void WillShutDown (uint MilliSeconds=0)
 
void WillSuspend (uint MilliSeconds=0)
 
void WillHibernate (uint MilliSeconds=0)
 
void WillRestart (uint MilliSeconds=0)
 
void WillHybridSleep (uint MilliSeconds=0)
 
void WokeUp (qint64 SecondsAsleep)
 
void LowBattery (void)
 
- Public Member Functions inherited from MythPower
virtual bool RequestFeature (Feature Request, bool Delay=true)
 
Features GetFeatures (void)
 
bool IsFeatureSupported (Feature Supported)
 
int GetPowerLevel (void) const
 
QStringList GetFeatureList (void)
 
- Public Member Functions inherited from ReferenceCounter
 ReferenceCounter (const QString &debugName, bool logDebug=true)
 Creates reference counter with an initial value of 1. More...
 
virtual int IncrRef (void)
 Increments reference count. More...
 
virtual int DecrRef (void)
 Decrements reference count and deletes on 0. More...
 
- Static Public Member Functions inherited from MythPower
static MythPowerAcquireRelease (void *Reference, bool Acquire, uint MinimumDelay=0)
 
- Static Public Member Functions inherited from ReferenceCounter
static void PrintDebug (void)
 Print out any leaks if that level of debugging is enabled. More...
 
- Static Protected Attributes inherited from MythPower
static QMutex s_lock
 

Detailed Description

Definition at line 15 of file mythpowerosx.h.

Constructor & Destructor Documentation

◆ MythPowerOSX()

MythPowerOSX::MythPowerOSX ( )
protected

Power management for OSX.

Note
Qt only creates a CFRunLoop in the main thread so this object must be created and used in the main thread only - otherwise callbacks will not work.

Definition at line 19 of file mythpowerosx.cpp.

◆ ~MythPowerOSX()

MythPowerOSX::~MythPowerOSX ( )
finaloverrideprotected

Definition at line 24 of file mythpowerosx.cpp.

Member Function Documentation

◆ Refresh

void MythPowerOSX::Refresh ( void  )
finaloverrideprotectedslot

Definition at line 103 of file mythpowerosx.cpp.

Referenced by Init(), and PowerSourceCallBack().

◆ Init()

void MythPowerOSX::Init ( void  )
overrideprotectedvirtual

Reimplemented from MythPower.

Definition at line 44 of file mythpowerosx.cpp.

Referenced by MythPowerOSX().

◆ DoFeature()

bool MythPowerOSX::DoFeature ( bool  Delayed = false)
finaloverrideprotectedvirtual

Reimplemented from MythPower.

Definition at line 86 of file mythpowerosx.cpp.

◆ PowerCallBack()

void MythPowerOSX::PowerCallBack ( void *  Reference,
io_service_t  Service,
natural_t  Type,
void *  Data 
)
staticprotected

Receive notification of power status changes.

Note
Spontaneous shutdown and sleep events (e.g. user clicks on Shutdown from main menu bar) will cause signals to be sent to MythFrontend - which usually trigger the exit prompt.

Definition at line 169 of file mythpowerosx.cpp.

Referenced by Init().

◆ PowerSourceCallBack()

void MythPowerOSX::PowerSourceCallBack ( void *  Reference)
staticprotected

Receive notification of changes to the power supply.

Changes may be a change in the battery level or switches between mains power and battery.

Definition at line 155 of file mythpowerosx.cpp.

Referenced by Init().

Friends And Related Function Documentation

◆ MythPower

friend class MythPower
friend

Definition at line 19 of file mythpowerosx.h.

Member Data Documentation

◆ m_powerRef

CFRunLoopSourceRef MythPowerOSX::m_powerRef { nullptr }
protected

Definition at line 36 of file mythpowerosx.h.

Referenced by Init(), Refresh(), and ~MythPowerOSX().

◆ m_rootPowerDomain

io_connect_t MythPowerOSX::m_rootPowerDomain { 0 }
protected

Definition at line 37 of file mythpowerosx.h.

Referenced by Init(), and ~MythPowerOSX().

◆ m_powerNotifier

io_object_t MythPowerOSX::m_powerNotifier { MACH_PORT_NULL }
protected

Definition at line 38 of file mythpowerosx.h.

Referenced by Init(), and ~MythPowerOSX().

◆ m_powerNotifyPort

IONotificationPortRef MythPowerOSX::m_powerNotifyPort { nullptr }
protected

Definition at line 39 of file mythpowerosx.h.

Referenced by Init(), and ~MythPowerOSX().


The documentation for this class was generated from the following files: