Torc
0.1
|
A power monitoring class for OS X. More...
#include <torcpowerosx.h>
Public Member Functions | |
TorcPowerOSX () | |
virtual | ~TorcPowerOSX () |
bool | DoShutdown (void) override |
Shutdown the system. More... | |
bool | DoSuspend (void) override |
Suspend the system. More... | |
bool | DoHibernate (void) override |
Hibernate the system. More... | |
bool | DoRestart (void) override |
Restart the system. More... | |
void | Refresh (void) |
Update the current power supply status. More... | |
![]() | |
virtual | ~TorcPower () |
QString | GetUIName (void) override |
bool | event (QEvent *Event) override |
![]() | |
TorcHTTPService (QObject *Parent, const QString &Signature, const QString &Name, const QMetaObject &MetaObject, const QString &Blacklist=QStringLiteral("")) | |
virtual | ~TorcHTTPService () |
void | ProcessHTTPRequest (const QString &PeerAddress, int PeerPort, const QString &LocalAddress, int LocalPort, TorcHTTPRequest &Request) override |
QVariantMap | ProcessRequest (const QString &Method, const QVariant &Parameters, QObject *Connection, bool Authenticated) override |
QString | GetMethod (int Index) |
QVariant | GetProperty (int Index) |
Get the value of a given property. More... | |
QVariantMap | GetServiceDetails (void) |
Return a QVariantMap describing the services methods and properties. More... | |
virtual QString | GetPresentationURL (void) |
![]() | |
TorcHTTPHandler (const QString &Signature, const QString &Name) | |
virtual | ~TorcHTTPHandler () |
QString | Signature (void) const |
bool | GetRecursive (void) const |
QString | Name (void) const |
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 bool | MethodIsAuthorised (TorcHTTPRequest &Request, int Allowed) |
Check the current request is authorised and set the authentication header if not. More... | |
static void | HandleOptions (TorcHTTPRequest &Request, int Allowed) |
static void | HandleFile (TorcHTTPRequest &Request, const QString &Filename, int Cache) |
Additional Inherited Members | |
![]() | |
enum | PowerLevels { ACPower = -1, BatteryEmpty = 0, BatteryLow = 10, BatteryFull = 100, UnknownPower = 101 } |
![]() | |
void | SubscriberDeleted (QObject *Subscriber) |
bool | GetCanShutdown (void) |
bool | GetCanSuspend (void) |
bool | GetCanHibernate (void) |
bool | GetCanRestart (void) |
int | GetBatteryLevel (void) |
QVariantMap | GetPowerStatus (void) |
bool | Shutdown (void) |
bool | Suspend (void) |
bool | Hibernate (void) |
bool | Restart (void) |
void | ShuttingDown (void) |
void | Suspending (void) |
void | Hibernating (void) |
void | Restarting (void) |
void | WokeUp (void) |
void | LowBattery (void) |
![]() | |
void | CanShutdownChanged (bool CanShutdown) |
void | CanSuspendChanged (bool CanSuspend) |
void | CanHibernateChanged (bool CanHibernate) |
void | CanRestartChanged (bool CanRestart) |
void | BatteryLevelChanged (int BatteryLevel) |
![]() | |
static void | Create (void) |
static void | TearDown (void) |
![]() | |
void | CanShutdownActiveChanged (bool Active) |
void | CanSuspendActiveChanged (bool Active) |
void | CanHibernateActiveChanged (bool Active) |
void | CanRestartActiveChanged (bool Active) |
void | CanShutdownValueChanged (bool Value) |
void | CanSuspendValueChanged (bool Value) |
void | CanHibernateValueChanged (bool Value) |
void | CanRestartValueChanged (bool Value) |
![]() | |
TorcPower () | |
void | BatteryUpdated (int Level) |
void | Debug (void) |
![]() | |
void | HandleSubscriberDeleted (QObject *Subscriber) |
![]() | |
TorcSetting * | m_canShutdown |
TorcSetting * | m_canSuspend |
TorcSetting * | m_canHibernate |
TorcSetting * | m_canRestart |
int | m_batteryLevel |
![]() | |
QReadWriteLock | m_httpServiceLock |
![]() | |
QString | m_signature |
bool | m_recursive |
QString | m_name |
![]() | |
bool | canShutdown |
bool | canSuspend |
bool | canHibernate |
bool | canRestart |
int | batteryLevel |
A power monitoring class for OS X.
TorcPowerOSX uses the IOKit framework to monitor the system's power status.
Definition at line 12 of file torcpowerosx.h.
TorcPowerOSX::TorcPowerOSX | ( | ) |
Definition at line 44 of file torcpowerosx.cpp.
|
virtual |
Definition at line 99 of file torcpowerosx.cpp.
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
overridevirtual |
|
staticprotected |
Receive notification of power status changes.
The OS will call this function when the power state is about to change. We can then make the appropriate internal calls to handle any necessary state changes.
In the case of system requests to ask whether power changes can proceed, we always allow.
Definition at line 243 of file torcpowerosx.cpp.
|
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 288 of file torcpowerosx.cpp.
void TorcPowerOSX::Refresh | ( | void | ) |
Update the current power supply status.
A change to the current status is notified from PowerSourceCallback, which calls this method to check for the actual change.
Definition at line 185 of file torcpowerosx.cpp.