MeeGo 1.2 Harmattan Developer Documentation Develop for the Nokia N9

MeeGo::QmBattery Class Reference

QmBattery provides information on device battery status. More...

Inheritance diagram for MeeGo::QmBattery:
Inheritance graph
[legend]
Collaboration diagram for MeeGo::QmBattery:
Collaboration graph
[legend]

List of all members.

Public Types

enum   Level { LevelFull = 0, LevelLow, LevelCritical }
enum   BatteryState {
  StateEmpty = 0, StateLow, StateOK, StateFull,
  StateError
}
 

Battery charge level states.

More...
enum   ChargingState { StateNotCharging = 0, StateCharging, StateChargingFailed }
 

Battery charging states.

More...
enum   RemainingTimeMode { NormalMode, PowersaveMode }
 

The mode in which the remaining time is to be calculated.

More...
enum   ChargerType {
  Unknown = -1, None, Wall, USB_500mA,
  USB_100mA
}
 

The type of charger connected.

More...
enum   Period { RATE_250ms = 0, RATE_1000ms, RATE_5000ms }
 

Battery current measurement periods.

More...
enum   BatteryCondition { ConditionGood = 0, ConditionPoor, ConditionUnknown = 0xff }
 

The battery condition.

More...
typedef ChargingState  State

Signals

void  batteryStateChanged (MeeGo::QmBattery::BatteryState batteryState)
  Sent when battery state has changed.
void  batteryRemainingCapacityChanged (int percentage, int bars)
  Sent when the remaining capacity percentage or bar count changes.
void  chargingStateChanged (MeeGo::QmBattery::ChargingState chargingState)
  Sent when battery charging state has changed.
void  chargerEvent (MeeGo::QmBattery::ChargerType chargerType)
  Sent when a charger event has occurred (charger plugged / unplugged).
void  batteryCurrent (int current)
  Sent at desired interval when battery current measurement is enabled (see startCurrentMeasurement).
void  batteryEnergyLevelChanged (int percentage)
void  batteryStatusChanged (MeeGo::QmBattery::State)
void  batteryLevelChanged (MeeGo::QmBattery::Level level)

Public Member Functions

  QmBattery (QObject *parent=0)
virtual  ~QmBattery ()
int  getNominalCapacity () const
  Gets the battery nominal (maximum) capasity.
BatteryState  getBatteryState () const
  Gets the battery state.
int  getRemainingCapacitymAh () const
  Gets remaining battery capacity as mAh.
int  getRemainingCapacityPct () const
  Gets the remaining battery capacity as a percentage.
int  getRemainingCapacityBars () const
  Gets the remaining battery capacity as number of bars or 0 if battery state is low.
int  getMaxBars () const
  Get the maximum number of battery bars.
int  getVoltage () const
  Gets the battery voltage.
int  getBatteryCurrent () const
  Gets the amount of current flowing out from the battery.
int  getCumulativeBatteryCurrent () const
  Gets the cumulative amount of battery current flowing out from the battery (the coulomb counter).
ChargerType  getChargerType () const
  Gets the currently connected charger type (or none).
ChargingState  getChargingState () const
  Gets the charging state (e.g. on / off / failed).
int  getRemainingChargingTime () const
  Gets the remaining charging time.
bool  startCurrentMeasurement (Period rate)
  Starts the battery current measurement.
bool  stopCurrentMeasurement ()
  Stops the battery current measurement.
int  getAverageTalkCurrent (RemainingTimeMode mode) const
  Get the average current in talk mode.
int  getRemainingTalkTime (RemainingTimeMode mode) const
  Gets the remaining talk time or -1 if not known.
int  getAverageActiveCurrent (RemainingTimeMode mode) const
  Get the average current in active use.
int  getRemainingActiveTime (RemainingTimeMode mode) const
  Get the remaining active use time or -1 if not known.
int  getAverageIdleCurrent (RemainingTimeMode mode) const
  Get the average current in idle mode.
int  getRemainingIdleTime (RemainingTimeMode mode) const
  Gets the remaining idle time or -1 if not known.
BatteryCondition  getBatteryCondition () const
  Gets the battery condition.
int  getBatteryEnergyLevel () const
Level  getLevel () const
State  getState () const

Properties

State  state
ChargingState  state
Level  level
ChargerType  type

Friends

class  QmBatteryPrivate

Detailed Description

QmBattery provides information on device battery status.

Scope:
Nokia Meego

Member Typedef Documentation


Member Enumeration Documentation

The battery condition.

Enumerator:
ConditionGood 

Battery condition is good.

ConditionPoor 

Battery might need to be replaced.

ConditionUnknown 

Battery condition is not known.

Battery charge level states.

Enumerator:
StateEmpty 

Battery empty (system being shut down).

StateLow 

Battery low (warnings issued to the user).

StateOK 

Battery OK.

StateFull 

Battery full.

StateError 

Battery state not known.

The type of charger connected.

Enumerator:
Unknown 

Unknown charger.

None 

No charger connected.

Wall 

Wall charger.

USB_500mA 

USB with 500mA output.

USB_100mA 

USB with 100mA output.

Battery charging states.

Enumerator:
StateNotCharging 

Not charging.

StateCharging 

Charging.

StateChargingFailed 

Charging error, e.g. unsupported charger.

Deprecated:
Deprecated, use BatteryState.
Enumerator:
LevelFull 
LevelLow 
LevelCritical 

Battery current measurement periods.

Enumerator:
RATE_250ms 

Measure every 250ms.

RATE_1000ms 

Measure every 1000ms.

RATE_5000ms 

Measure every 5000ms.

The mode in which the remaining time is to be calculated.

Enumerator:
NormalMode 

In normal mode.

PowersaveMode 

In powersave mode.


Constructor & Destructor Documentation

MeeGo::QmBattery::QmBattery ( QObject parent = 0  ) 
virtual MeeGo::QmBattery::~QmBattery (  )  [virtual]

Member Function Documentation

void MeeGo::QmBattery::batteryCurrent ( int  current  )  [signal]

Sent at desired interval when battery current measurement is enabled (see startCurrentMeasurement).

Parameters:
current  Current in mA
void MeeGo::QmBattery::batteryEnergyLevelChanged ( int  percentage  )  [signal]
void MeeGo::QmBattery::batteryLevelChanged ( MeeGo::QmBattery::Level  level  )  [signal]
void MeeGo::QmBattery::batteryRemainingCapacityChanged ( int  percentage,
int  bars  
) [signal]

Sent when the remaining capacity percentage or bar count changes.

Parameters:
percentage  The new remaining capacity a percentage
bars  The new remaining capacity as number of bars
void MeeGo::QmBattery::batteryStateChanged ( MeeGo::QmBattery::BatteryState  batteryState  )  [signal]

Sent when battery state has changed.

Parameters:
batteryState  New battery state
void MeeGo::QmBattery::batteryStatusChanged ( MeeGo::QmBattery::State   )  [signal]
void MeeGo::QmBattery::chargerEvent ( MeeGo::QmBattery::ChargerType  chargerType  )  [signal]

Sent when a charger event has occurred (charger plugged / unplugged).

Parameters:
chargerType  The new connected charger type (or None)
void MeeGo::QmBattery::chargingStateChanged ( MeeGo::QmBattery::ChargingState  chargingState  )  [signal]

Sent when battery charging state has changed.

Parameters:
chargingState  The new charging state
int MeeGo::QmBattery::getAverageActiveCurrent ( RemainingTimeMode  mode  )  const

Get the average current in active use.

Parameters:
mode,:  (PowersaveMode/Normal ) mode for which the current time is reported.
Returns:
Average current (mA)
int MeeGo::QmBattery::getAverageIdleCurrent ( RemainingTimeMode  mode  )  const

Get the average current in idle mode.

Parameters:
mode,:  (PowersaveMode/Normal ) mode for which the current time is reported.
Returns:
Average current (mA)
int MeeGo::QmBattery::getAverageTalkCurrent ( RemainingTimeMode  mode  )  const

Get the average current in talk mode.

Parameters:
mode,:  (PowersaveMode/Normal ) mode for which the current time is reported.
Returns:
Average current (mA)
BatteryCondition MeeGo::QmBattery::getBatteryCondition (  )  const

Gets the battery condition.

Returns:
Battery condition as QmBattery::BatteryCondition
int MeeGo::QmBattery::getBatteryCurrent (  )  const

Gets the amount of current flowing out from the battery.

Get the amount of current flowing out from the battery (a short term averge). Positive current means discharging and negative current means charging.

Returns:
The battery current (mA)
int MeeGo::QmBattery::getBatteryEnergyLevel (  )  const
BatteryState MeeGo::QmBattery::getBatteryState (  )  const

Gets the battery state.

Returns:
The battery state as QmBattery::BatteryState
ChargerType MeeGo::QmBattery::getChargerType (  )  const

Gets the currently connected charger type (or none).

Returns:
Charger type as QmBattery::ChargerType
ChargingState MeeGo::QmBattery::getChargingState (  )  const

Gets the charging state (e.g. on / off / failed).

Returns:
The charging state as QmBattery::ChargingState
int MeeGo::QmBattery::getCumulativeBatteryCurrent (  )  const

Gets the cumulative amount of battery current flowing out from the battery (the coulomb counter).

The reference point of the cumulative battery current is undefined and only differences of the values returned by the same QmBattery instance are meningful. If the returned value is bigger than the previously returned value, the battery has discharged. If the returned value is smaller than previously returned value, the battery has been charged.

Returns:
Cumulative battery current (mAs)
Level MeeGo::QmBattery::getLevel (  )  const
Deprecated:
Deprecated, use getBatteryState()
int MeeGo::QmBattery::getMaxBars (  )  const

Get the maximum number of battery bars.

Returns:
The maximum value returned by getRemainingCapacityBars()
int MeeGo::QmBattery::getNominalCapacity (  )  const

Gets the battery nominal (maximum) capasity.

Returns:
The battery nominal (maximum) capasity (mAh)
int MeeGo::QmBattery::getRemainingActiveTime ( RemainingTimeMode  mode  )  const

Get the remaining active use time or -1 if not known.

Parameters:
mode,:  (PowersaveMode/Normal ) mode in which the remaining time is to be estimated.
Returns:
Active time in seconds
int MeeGo::QmBattery::getRemainingCapacityBars (  )  const

Gets the remaining battery capacity as number of bars or 0 if battery state is low.

Returns:
Battery level as number of bars [0 - getMaxbars()]
int MeeGo::QmBattery::getRemainingCapacitymAh (  )  const

Gets remaining battery capacity as mAh.

Returns:
Remaining battery capacity as mAh
int MeeGo::QmBattery::getRemainingCapacityPct (  )  const

Gets the remaining battery capacity as a percentage.

Returns:
Battery level in percents [0 - 100]
int MeeGo::QmBattery::getRemainingChargingTime (  )  const

Gets the remaining charging time.

Returns:
The charging time in seconds if charging or -1 if not charging
int MeeGo::QmBattery::getRemainingIdleTime ( RemainingTimeMode  mode  )  const

Gets the remaining idle time or -1 if not known.

Parameters:
mode,:  (PowersaveMode/Normal ) mode in which the remaining time is to be estimated.
Returns:
Idle time in seconds
int MeeGo::QmBattery::getRemainingTalkTime ( RemainingTimeMode  mode  )  const

Gets the remaining talk time or -1 if not known.

Parameters:
mode,:  (PowersaveMode/Normal ) mode in which the remaining time is to be estimated
Returns:
Talk time in seconds
State MeeGo::QmBattery::getState (  )  const
int MeeGo::QmBattery::getVoltage (  )  const

Gets the battery voltage.

Returns:
The battery voltage (mV)
bool MeeGo::QmBattery::startCurrentMeasurement ( Period  rate  ) 

Starts the battery current measurement.

Parameters:
rate  The rate of sending the signal (batteryCurrent) Use enums (RATE_250ms, RATE_1000ms, RATE_5000ms)
Return values:
TRUE  success
FALSE  failure
bool MeeGo::QmBattery::stopCurrentMeasurement (  ) 

Stops the battery current measurement.

Return values:
TRUE  success
FALSE  failure

Friends And Related Function Documentation

friend class QmBatteryPrivate [friend]

Property Documentation

Level MeeGo::QmBattery::level [read]
Deprecated:
Deprecated, use BatteryState.
ChargingState MeeGo::QmBattery::state [read]
State MeeGo::QmBattery::state [read]
Deprecated:
Deprecated, use BatteryState.
Deprecated:
Deprecated, use ChargingState.
Deprecated:
Deprecated, use ChargingState.
ChargerType MeeGo::QmBattery::type [read]

(C) 2009-2011 Nokia Corporation
LGPL Lesser General Public License
MeeGo 1.2 Harmattan API