The QSystemBatteryInfo class provides access to battery and power information from the system. More...
#include <QSystemBatteryInfo>
Inherits QObject.
This class was introduced in Qt Mobility 1.2.
enum | BatteryStatus { BatteryUnknown, BatteryEmpty, BatteryCritical, BatteryVeryLow, ..., BatteryFull } |
enum | ChargerType { UnknownCharger, NoCharger, WallCharger, USBCharger, ..., VariableCurrentCharger } |
enum | ChargingState { NotCharging, Charging, ChargingError } |
enum | EnergyUnit { UnitUnknown, UnitmAh, UnitmWh } |
|
|
QSystemBatteryInfo ( QObject * parent = 0 ) | |
~QSystemBatteryInfo () | |
QSystemBatteryInfo::BatteryStatus | batteryStatus () const |
QSystemBatteryInfo::ChargerType | chargerType () const |
QSystemBatteryInfo::ChargingState | chargingState () const |
int | currentFlow () const |
QSystemBatteryInfo::EnergyUnit | energyMeasurementUnit () const |
int | maxBars () const |
int | nominalCapacity () const |
int | remainingCapacity () const |
int | remainingCapacityBars () const |
int | remainingCapacityPercent () const |
int | remainingChargingTime () const |
int | voltage () const |
void | batteryStatusChanged ( QSystemBatteryInfo::BatteryStatus batteryStatus ) |
void | chargerTypeChanged ( QSystemBatteryInfo::ChargerType chargerType ) |
void | chargingStateChanged ( QSystemBatteryInfo::ChargingState chargingState ) |
void | currentFlowChanged ( int level ) |
void | nominalCapacityChanged ( int level ) |
void | remainingCapacityBarsChanged ( int level ) |
void | remainingCapacityChanged ( int level ) |
void | remainingCapacityPercentChanged ( int level ) |
void | remainingChargingTimeChanged ( int level ) |
The QSystemBatteryInfo class provides access to battery and power information from the system.
This enum describes the status of the main battery.
Constant | Value | Description |
---|---|---|
QSystemBatteryInfo::BatteryUnknown | -1 | Battery level undetermined. |
QSystemBatteryInfo::BatteryEmpty | 0 | Battery level reported as 0, system will shutdown. |
QSystemBatteryInfo::BatteryCritical | 1 | Battery level is critical 3% or less. |
QSystemBatteryInfo::BatteryVeryLow | 2 | Battery level is very low, 10% or less. |
QSystemBatteryInfo::BatteryLow | 3 | Battery level is low 40% or less. |
QSystemBatteryInfo::BatteryOk | 4 | Battery level is above 40%. |
QSystemBatteryInfo::BatteryFull | 5 | Battery level is 100%. |
This enum describes the type of charger used.
Constant | Value | Description |
---|---|---|
QSystemBatteryInfo::UnknownCharger | -1 | Charger type unknown, or error. |
QSystemBatteryInfo::NoCharger | 0 | No charger. |
QSystemBatteryInfo::WallCharger | 1 | Using wall (mains) charger. |
QSystemBatteryInfo::USBCharger | 2 | Using USB charger when the system cannot differentiate the current. |
QSystemBatteryInfo::USB_500mACharger | 3 | Using USB charger at 500 mA. |
QSystemBatteryInfo::USB_100mACharger | 4 | Using USB charger at 100 mA. |
QSystemBatteryInfo::VariableCurrentCharger | 5 | Using variable current charger such as bicycle or solar. |
This enum describes the charging state:
Constant | Value | Description |
---|---|---|
QSystemBatteryInfo::NotCharging | 0 | Battery is not charging. |
QSystemBatteryInfo::Charging | 1 | Battery is charging. |
QSystemBatteryInfo::ChargingError | -1 | Error. |
This enum describes the energy unit used by the system.
Constant | Value | Description |
---|---|---|
QSystemBatteryInfo::UnitUnknown | -1 | Energy unit unknown. |
QSystemBatteryInfo::UnitmAh | 0 | Energy described in milli Amp hours (mAh) |
QSystemBatteryInfo::UnitmWh | 1 | Energy described in milli watt hours (mWh) |
This property holds the battery status.
Returns the battery charge status.
Access functions:
QSystemBatteryInfo::BatteryStatus | batteryStatus () const |
Notifier signal:
void | batteryStatusChanged ( QSystemBatteryInfo::BatteryStatus batteryStatus ) |
This property holds the charger type. Returns the currently used charger type.
Access functions:
QSystemBatteryInfo::ChargerType | chargerType () const |
Notifier signal:
void | chargerTypeChanged ( QSystemBatteryInfo::ChargerType chargerType ) |
This property holds the charging state. Returns the charging state.
Access functions:
QSystemBatteryInfo::ChargingState | chargingState () const |
Notifier signal:
void | chargingStateChanged ( QSystemBatteryInfo::ChargingState chargingState ) |
This property holds the battery current flow.
Returns the amount of current flowing out from the battery (a short term averge), milliapmeres (mA). Positive current means discharging and negative current means charging.
Access functions:
int | currentFlow () const |
Notifier signal:
void | currentFlowChanged ( int level ) |
This property holds the energy unit used by the system. Returns the QSystemBatteryInfo::EnergyUnit that the system uses.
Access functions:
QSystemBatteryInfo::EnergyUnit | energyMeasurementUnit () const |
This property holds the maximum number of bars the system uses.
Returns the Maximum number of bars the system uses. In the case that the system has no default number of battery bars, 0 is returned.
Access functions:
int | maxBars () const |
This property holds the nominal battery capacity.
Returns the nominal (maximum) capacity of the battery, in QSystemBatteryInfo::EnergyUnit. If no battery is found, -1.
Access functions:
int | nominalCapacity () const |
Notifier signal:
void | nominalCapacityChanged ( int level ) |
This property holds the battery level in QSystemBatteryInfo::EnergyUnit.
Returns the remaining battery level of the battery in QSystemBatteryInfo::EnergyUnit.
Access functions:
int | remainingCapacity () const |
Notifier signal:
void | remainingCapacityChanged ( int level ) |
See also QSystemBatteryInfo::energyMeasurementUnit().
This property holds the remaining capacity in number of bars.
Returns the remaining capacity in number of bars. The bar count will not necessarily always reflect one to one on the remaining capacity percentage.
Access functions:
int | remainingCapacityBars () const |
Notifier signal:
void | remainingCapacityBarsChanged ( int level ) |
This property holds the battery level in percent.
Returns the remaining battery level of the battery in percent. If no battery is found, -1.
Access functions:
int | remainingCapacityPercent () const |
Notifier signal:
void | remainingCapacityPercentChanged ( int level ) |
This property holds the remaining time of charging.
Returns the remaining time of charging in seconds if charging, In the case of battery is full and not charging 0 will be returned. In the case where no battery is found or the platform does not provide this information, -1 will be returned.
Access functions:
int | remainingChargingTime () const |
Notifier signal:
void | remainingChargingTimeChanged ( int level ) |
This property holds the battery voltage.
Returns the voltage of the battery, in millivolts (mV). If no battery is found, -1.
Access functions:
int | voltage () const |
Constructs a QSystemBatteryInfo object with the given parent.
Destroys the QSystemBatteryInfo object.
This signal is emitted when battery status has changed. batteryStatus is the new battery status.
See also QSystemBatteryInfo::ChargingState.
This signal is emitted when the charger type has changed, such as when a phone gets plugged in to the wall, or usb. chargerType is the new charger type.
This signal is emitted when charging state has changed. chargingState is the new chargingState.
This signal is emitted when the short term averge battery current has changed, or on some systems at regular intervals.
On some systems where this can lead to a CPU intensive process, you should disconnect from this signal when you are finished.
level is the new level.
This signal is emitted when nominal (maximum) battery level has changed. level is the new level.
This signal is emitted when battery level has changed. level is the new level.
This signal is emitted when battery capacity has changed, reported in QSystemBatteryInfo::EnergyUnit. level is the new level.
This signal is emitted when battery capacity in percent has changed. level is the new level.
This signal is emitted when remianing charge time has changed. level is the new level.