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

#include <libmythbase/platforms/mythpowerosx.h>

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

Protected Slots

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

Protected Member Functions

 MythPowerOSX ()
 Power management for OSX. More...
 
 ~MythPowerOSX () override
 
void Init (void) override
 
bool DoFeature (bool Delayed=false) override
 
- 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, std::chrono::seconds Delay)
 
void SetRequestedDelay (std::chrono::seconds 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 }
 
std::chrono::seconds m_maxRequestedDelay { 0s }
 
std::chrono::seconds 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 : std::int8_t {
  UPS = -2, ACPower = -1, BatteryEmpty = 0, BatteryLow = 10,
  BatteryFull = 100, UnknownPower = 101, Unset = 102
}
 
enum  Feature : std::uint8_t {
  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 (std::chrono::milliseconds MilliSeconds=0ms)
 
void WillSuspend (std::chrono::milliseconds MilliSeconds=0ms)
 
void WillHibernate (std::chrono::milliseconds MilliSeconds=0ms)
 
void WillRestart (std::chrono::milliseconds MilliSeconds=0ms)
 
void WillHybridSleep (std::chrono::milliseconds MilliSeconds=0ms)
 
void WokeUp (std::chrono::seconds 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, std::chrono::seconds MinimumDelay=0s)
 
- 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 QRecursiveMutex 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 24 of file mythpowerosx.cpp.

◆ ~MythPowerOSX()

MythPowerOSX::~MythPowerOSX ( )
overrideprotected

Definition at line 29 of file mythpowerosx.cpp.

Member Function Documentation

◆ Refresh

void MythPowerOSX::Refresh ( void  )
overrideprotectedslot

Definition at line 108 of file mythpowerosx.cpp.

Referenced by Init(), and PowerSourceCallBack().

◆ Init()

void MythPowerOSX::Init ( void  )
overrideprotectedvirtual

Reimplemented from MythPower.

Definition at line 49 of file mythpowerosx.cpp.

Referenced by MythPowerOSX().

◆ DoFeature()

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

Reimplemented from MythPower.

Definition at line 91 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 174 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 160 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: