Qt Mobility Reference Documentation

QSystemBatteryInfo Class Reference

The QSystemBatteryInfo class provides access to battery and power information from the system. More...

 #include <QSystemBatteryInfo>

Inherits QObject.

Public Types

enum BatteryStatus { BatteryStatus, BatteryEmpty, BatteryCritical, BatteryVeryLow, ..., BatteryFull }
enum ChargerType { UnknownCharger, NoCharger, WallCharger, USBCharger, ..., VariableCurrentCharger }
enum ChargingState { NotCharging, Charging, ChargingError }
enum EnergyUnit { UnitmAh, UnitmWh }

Properties

  • 1 property inherited from QObject

Public Functions

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 startCurrentMeasurement ( int rate )
int voltage () const
  • 29 public functions inherited from QObject

Signals

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 )
void voltageChanged ( int level )

Additional Inherited Members

  • 1 public slot inherited from QObject
  • 1 public variable inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

The QSystemBatteryInfo class provides access to battery and power information from the system.

Member Type Documentation

enum QSystemBatteryInfo::BatteryStatus

This enum describes the status of the main battery.

ConstantValueDescription
QSystemBatteryInfo::BatteryStatus?Battery level undetermined.
QSystemBatteryInfo::BatteryEmpty0Battery level reported as 0, system will shutdown.
QSystemBatteryInfo::BatteryCritical1Battery level is critical 3% or less.
QSystemBatteryInfo::BatteryVeryLow2Battery level is very low, 10% or less.
QSystemBatteryInfo::BatteryLow3Battery level is low 40% or less.
QSystemBatteryInfo::BatteryOk4Battery level is above 40%.
QSystemBatteryInfo::BatteryFull5Battery level is 100%.

enum QSystemBatteryInfo::ChargerType

This enum describes the type of charger used.

ConstantValueDescription
QSystemBatteryInfo::UnknownCharger-1Charger type unknown, or error.
QSystemBatteryInfo::NoCharger0No charger.
QSystemBatteryInfo::WallCharger1Using wall (mains) charger.
QSystemBatteryInfo::USBCharger2Using USB charger when the system cannot differentiate the current.
QSystemBatteryInfo::USB_500mACharger3Using USB charger at 500 mA.
QSystemBatteryInfo::USB_100mACharger4Using USB charger at 100 mA.
QSystemBatteryInfo::VariableCurrentCharger5Using variable current charger such as bicycle or solar.

enum QSystemBatteryInfo::ChargingState

This enum describes the charging state:

ConstantValueDescription
QSystemBatteryInfo::NotCharging0Battery is not charging.
QSystemBatteryInfo::Charging1Battery is charging.
QSystemBatteryInfo::ChargingError-1Error.

enum QSystemBatteryInfo::EnergyUnit

This enum describes the energy unit used by the system.

ConstantValueDescription
QSystemBatteryInfo::UnitmAh0Energy described in milli Amp hours (mAh)
QSystemBatteryInfo::UnitmWh1Energy described in milli watt hours (mWh)

Property Documentation

batteryStatus : const BatteryStatus

This property holds the battery status.

Returns the battery charge status.

Access functions:

QSystemBatteryInfo::BatteryStatus batteryStatus () const

Notifier signal:

void batteryStatusChanged ( QSystemBatteryInfo::BatteryStatus batteryStatus )

chargerType : const ChargerType

Access functions:

QSystemBatteryInfo::ChargerType chargerType () const

Notifier signal:

void chargerTypeChanged ( QSystemBatteryInfo::ChargerType chargerType )

chargingState : const ChargingState

Access functions:

QSystemBatteryInfo::ChargingState chargingState () const

Notifier signal:

void chargingStateChanged ( QSystemBatteryInfo::ChargingState chargingState )

currentFlow : const int

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 )

energyMeasurementUnit : const EnergyUnit

Access functions:

QSystemBatteryInfo::EnergyUnit energyMeasurementUnit () const

maxBars : const int

This property holds the maximum number of bars the system uses.

Returns the Maximum number of bars the system uses.

Access functions:

int maxBars () const

nominalCapacity : const int

This property holds the nominal battery capacity.

Returns the nominal (maximum) capacity of the battery, in milliampere-hours (mAh).

Access functions:

int nominalCapacity () const

Notifier signal:

void nominalCapacityChanged ( int level )

remainingCapacity : const int

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().

remainingCapacityBars : const int

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 )

remainingCapacityPercent : const int

This property holds the battery level in percent.

Returns the remaining battery level of the battery in percent.

Access functions:

int remainingCapacityPercent () const

Notifier signal:

void remainingCapacityPercentChanged ( int level )

remainingChargingTime : const int

This property holds the remaining time of charging.

Returns the remaining time of charging in seconds if charging, or -1 if not charging.

Access functions:

int remainingChargingTime () const

Notifier signal:

void remainingChargingTimeChanged ( int level )

voltage : const int

This property holds the battery voltage.

Returns the voltage of the battery, in millivolts (mV).

Access functions:

int voltage () const

Member Function Documentation

QSystemBatteryInfo::QSystemBatteryInfo ( QObject * parent = 0 )

Constructs a QSystemBatteryInfo object with the given parent.

QSystemBatteryInfo::~QSystemBatteryInfo ()

Destroys the QSystemBatteryInfo object.

void QSystemBatteryInfo::batteryStatusChanged ( QSystemBatteryInfo::BatteryStatus batteryStatus ) [signal]

void QSystemBatteryInfo::chargerTypeChanged ( QSystemBatteryInfo::ChargerType chargerType ) [signal]

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.

void QSystemBatteryInfo::chargingStateChanged ( QSystemBatteryInfo::ChargingState chargingState ) [signal]

This signal is emitted when charging state has changed. chargingState is the new chargingState.

void QSystemBatteryInfo::currentFlowChanged ( int level ) [signal]

This signal is emitted when the short term averge battery current has changed. Sent at desired interval when battery current measurement is enabled .

level is the new level.

See also QSystemBatteryInfo::startCurrentMeasurement.

void QSystemBatteryInfo::nominalCapacityChanged ( int level ) [signal]

This signal is emitted when nominal (maximum) battery level has changed. level is the new level.

void QSystemBatteryInfo::remainingCapacityBarsChanged ( int level ) [signal]

This signal is emitted when battery level has changed. level is the new level.

void QSystemBatteryInfo::remainingCapacityChanged ( int level ) [signal]

This signal is emitted when battery capacity has changed, reported in QSystemBatteryInfo::EnergyUnit. level is the new level.

void QSystemBatteryInfo::remainingCapacityPercentChanged ( int level ) [signal]

This signal is emitted when battery capacity in percent has changed. level is the new level.

void QSystemBatteryInfo::remainingChargingTimeChanged ( int level ) [signal]

This signal is emitted when remianing charge time has changed. level is the new level.

int QSystemBatteryInfo::startCurrentMeasurement ( int rate )

Starts battery current measurement with given rate. Return value is actual rate used by the system.

void QSystemBatteryInfo::voltageChanged ( int level ) [signal]

This signal is emitted when battery voltage level has changed, in millivolts (mV). level is the new level.

X

Thank you for giving your feedback.

Make sure it is related to this specific page. For more general bugs and requests, please use the Qt Bug Tracker.