Torc
0.1
|
A generic power status class. More...
#include <torcpower.h>
Public Types | |
enum | PowerLevels { ACPower = -1, BatteryEmpty = 0, BatteryLow = 10, BatteryFull = 100, UnknownPower = 101 } |
Public Slots | |
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) |
Signals | |
void | CanShutdownChanged (bool CanShutdown) |
void | CanSuspendChanged (bool CanSuspend) |
void | CanHibernateChanged (bool CanHibernate) |
void | CanRestartChanged (bool CanRestart) |
void | BatteryLevelChanged (int BatteryLevel) |
Public Member Functions | |
virtual | ~TorcPower () |
QString | GetUIName (void) override |
bool | event (QEvent *Event) override |
Public Member Functions inherited from TorcHTTPService | |
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) |
Public Member Functions inherited from TorcHTTPHandler | |
TorcHTTPHandler (const QString &Signature, const QString &Name) | |
virtual | ~TorcHTTPHandler () |
QString | Signature (void) const |
bool | GetRecursive (void) const |
QString | Name (void) const |
Static Public Member Functions | |
static void | Create (void) |
static void | TearDown (void) |
Protected Slots | |
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) |
Protected Member Functions | |
TorcPower () | |
void | BatteryUpdated (int Level) |
void | Debug (void) |
virtual bool | DoShutdown (void)=0 |
virtual bool | DoSuspend (void)=0 |
virtual bool | DoHibernate (void)=0 |
virtual bool | DoRestart (void)=0 |
Protected Member Functions inherited from TorcHTTPService | |
void | HandleSubscriberDeleted (QObject *Subscriber) |
Protected Attributes | |
TorcSetting * | m_canShutdown |
TorcSetting * | m_canSuspend |
TorcSetting * | m_canHibernate |
TorcSetting * | m_canRestart |
int | m_batteryLevel |
Protected Attributes inherited from TorcHTTPService | |
QReadWriteLock | m_httpServiceLock |
Protected Attributes inherited from TorcHTTPHandler | |
QString | m_signature |
bool | m_recursive |
QString | m_name |
Properties | |
bool | canShutdown |
bool | canSuspend |
bool | canHibernate |
bool | canRestart |
int | batteryLevel |
Additional Inherited Members | |
Static Protected Member Functions inherited from TorcHTTPHandler | |
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) |
A generic power status class.
TorcPower uses underlying platform implementations to monitor the system's power status and emits appropriate notifications (via TorcLocalContext) when the status changes. Additional implementations can be added by sub-classing PowerFactory and TorcPowerPriv.
The current power status (battery charge level or on mains power) can be queried directly via GetBatteryLevel and the system's ability to Suspend/Shutdown etc can be queried via CanSuspend, CanShutdown, CanHibernate and CanRestart.
A singleton power object is created by TorcPowerObject from within the administration thread
Definition at line 12 of file torcpower.h.
Enumerator | |
---|---|
ACPower | |
BatteryEmpty | |
BatteryLow | |
BatteryFull | |
UnknownPower |
Definition at line 27 of file torcpower.h.
|
virtual |
Definition at line 198 of file torcpower.cpp.
|
protected |
Definition at line 118 of file torcpower.cpp.
|
signal |
|
protected |
Definition at line 275 of file torcpower.cpp.
|
protectedslot |
Definition at line 450 of file torcpower.cpp.
|
signal |
|
protectedslot |
Definition at line 458 of file torcpower.cpp.
|
protectedslot |
Definition at line 466 of file torcpower.cpp.
|
signal |
|
protectedslot |
Definition at line 474 of file torcpower.cpp.
|
protectedslot |
Definition at line 418 of file torcpower.cpp.
|
signal |
|
protectedslot |
Definition at line 426 of file torcpower.cpp.
|
protectedslot |
Definition at line 434 of file torcpower.cpp.
|
signal |
|
protectedslot |
Definition at line 442 of file torcpower.cpp.
|
static |
|
protected |
Definition at line 251 of file torcpower.cpp.
|
protectedpure virtual |
Implemented in TorcPowerNull, TorcPowerUnixDBus, and TorcPowerOSX.
|
protectedpure virtual |
Implemented in TorcPowerNull, TorcPowerUnixDBus, and TorcPowerOSX.
|
protectedpure virtual |
Implemented in TorcPowerNull, TorcPowerUnixDBus, and TorcPowerOSX.
|
protectedpure virtual |
Implemented in TorcPowerNull, TorcPowerUnixDBus, and TorcPowerOSX.
|
override |
Definition at line 306 of file torcpower.cpp.
|
slot |
Definition at line 410 of file torcpower.cpp.
|
slot |
Definition at line 394 of file torcpower.cpp.
|
slot |
Definition at line 402 of file torcpower.cpp.
|
slot |
Definition at line 378 of file torcpower.cpp.
|
slot |
Definition at line 386 of file torcpower.cpp.
|
slot |
Definition at line 482 of file torcpower.cpp.
|
overridevirtual |
Reimplemented from TorcHTTPService.
Definition at line 270 of file torcpower.cpp.
|
slot |
Definition at line 351 of file torcpower.cpp.
|
slot |
Definition at line 505 of file torcpower.cpp.
|
slot |
Definition at line 523 of file torcpower.cpp.
|
slot |
Definition at line 362 of file torcpower.cpp.
|
slot |
Definition at line 511 of file torcpower.cpp.
|
slot |
Definition at line 329 of file torcpower.cpp.
|
slot |
Definition at line 493 of file torcpower.cpp.
|
slot |
Definition at line 373 of file torcpower.cpp.
|
slot |
Definition at line 340 of file torcpower.cpp.
|
slot |
Definition at line 499 of file torcpower.cpp.
|
static |
|
slot |
Definition at line 517 of file torcpower.cpp.
|
protected |
Definition at line 97 of file torcpower.h.
|
protected |
Definition at line 95 of file torcpower.h.
|
protected |
Definition at line 96 of file torcpower.h.
|
protected |
Definition at line 93 of file torcpower.h.
|
protected |
Definition at line 94 of file torcpower.h.
|
read |
Definition at line 24 of file torcpower.h.
|
read |
Definition at line 22 of file torcpower.h.
|
read |
Definition at line 23 of file torcpower.h.
|
read |
Definition at line 20 of file torcpower.h.
|
read |
Definition at line 21 of file torcpower.h.