Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

QPowerStatus Class Reference
[QtBaseModule]

The QPowerStatus class provides a simplified interface to the device's primary power sources. More...

    #include <QPowerStatus>

Inherits QObject.

Public Types

Public Functions

Signals

Additional Inherited Members


Detailed Description

The QPowerStatus class provides a simplified interface to the device's primary power sources.

Applications may use the QPowerStatus class to obtain a simplified view of the system's power status. A more complete view can be obtained by examining the supported QPowerSource providers.

Each device may contain two primary power sources - a primary wall power source and a primary battery power source. Both sources are optional, and a specific device may have one, both or neither.

The primary power source sources are selected from the list of available QPowerSource providers. The selection may be configured in the Trolltech/HardwareAccessories configuration file in the following way:

KeyDescription
PowerSources/PrimaryWallSourceName of the QPowerSource to use as the primary wall source.
PowerSources/PrimaryBatterySourceName of the QPowerSource to use as the primary battery source.

If the primary wall source is not configured, the PrimaryAC QPowerSource name is tried first, and, if not available, the first AC source is used. If the primary wall source is configured, but the specified provider does not exist, then no QPowerSource is used.

If the primary battery source is not configured, the DefaultBattery QPowerSource is tried first, and, if not available, the first battery source is used. If the primary battery source is configured, but the specified provider does not exist, then no QPowerSource is used.

The battery status level is determined by mapping a battery percentage to one the four defined levels. The configuration for the various battery status levels are also defined in the Trolltech/HardwareAccessories configuration file in the following way:

KeyDescription
PrimaryBattery/NormalStatusIf the battery charge is above this percentage level, it is considered Normal. The default is 30.
PrimaryBattery/LowStatusIf the battery charge is above this percentage level, but below the normal status level, it is considered Low. The default is 15.
PrimaryBattery/VeryLowStatusIf the battery charge is above this percentage level, but below the low status level, it is considered very Low. The default is 5.

If any one of these values is specified illegally (for example, the NormalStatus is lower than the LowStatus), the default values are used.

See also QPowerSource.


Member Type Documentation

enum QPowerStatus::BatteryStatus

Describes the status of the device's battery connection.

ConstantValueDescription
QPowerStatus::Normal0The battery level is within normal operational range.
QPowerStatus::Low1The battery is low.
QPowerStatus::VeryLow2The battery is very low.
QPowerStatus::Critical3The battery is at a critical level. The device should shut down to preserve data.
QPowerStatus::NoBattery4There is no battery in the device.

enum QPowerStatus::WallStatus

Describes the status of the device's wall connection.

ConstantValueDescription
QPowerStatus::Available0The device is connected to a wall power supply.
QPowerStatus::NotAvailable1The device is not connected to a wall power supply, but connection is supported.
QPowerStatus::NoWallSource2The device is not connected to a wall power supply, and no such connection is supported.


Member Function Documentation

QPowerStatus::QPowerStatus ( QObject * parent = 0 )

Construct a new QPowerStatus instance with the specified parent.

QPowerStatus::~QPowerStatus ()   [virtual]

Destroy the QPowerStatus instance.

bool QPowerStatus::batteryCharging () const

Returns true if the primary battery is charging, false if not. If there is no primary battery, false is returned.

void QPowerStatus::batteryChargingChanged ( bool charging )   [signal]

This signal is emitted when the batteries charging flag changes.

See also QPowerStatus::batteryCharging().

QPowerSource * QPowerStatus::batterySource () const

Returns a pointer to the QPowerSource instance representing the primary battery power source, or null if there is no primary battery power source.

BatteryStatus QPowerStatus::batteryStatus () const

Returns the status of the primary battery power source, or NoBattery if there is no primary battery source.

void QPowerStatus::batteryStatusChanged ( QPowerStatus::BatteryStatus status )   [signal]

This signal is emitted whenever the battery status changes.

See also QPowerStatus::batteryStatus().

QPowerSource * QPowerStatus::wallSource () const

Returns a pointer to the QPowerSource instance representing the primary wall power source, or null if there is no primary wall power source.

WallStatus QPowerStatus::wallStatus () const

Return the status of the primary wall power source, or NoWallSource if there is no primary wall power source.

void QPowerStatus::wallStatusChanged ( QPowerStatus::WallStatus status )   [signal]

This signal is emitted whenever the wall status changes.

See also QPowerStatus::wallStatus().


Copyright © 2009 Nokia Trademarks
Qt Extended 4.4.3