QmBattery provides information on device battery status. More...
#include <qmbattery.h>
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 |
QmBattery provides information on device battery status.
Definition at line 57 of file qmbattery.h.
typedef ChargingState MeeGo::QmBattery::State |
Definition at line 119 of file qmbattery.h.
The battery condition.
ConditionGood |
Battery condition is good. |
ConditionPoor |
Battery might need to be replaced. |
ConditionUnknown |
Battery condition is not known. |
Definition at line 147 of file qmbattery.h.
Battery charge level states.
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. |
Definition at line 99 of file qmbattery.h.
The type of charger connected.
Unknown |
Unknown charger. |
None |
No charger connected. |
Wall |
Wall charger. |
USB_500mA |
USB with 500mA output. |
USB_100mA |
USB with 100mA output. |
Definition at line 129 of file qmbattery.h.
Battery charging states.
StateNotCharging |
Not charging. |
StateCharging |
Charging. |
StateChargingFailed |
Charging error, e.g. unsupported charger. |
Definition at line 109 of file qmbattery.h.
Definition at line 91 of file qmbattery.h.
Battery current measurement periods.
RATE_250ms |
Measure every 250ms. |
RATE_1000ms |
Measure every 1000ms. |
RATE_5000ms |
Measure every 5000ms. |
Definition at line 139 of file qmbattery.h.
The mode in which the remaining time is to be calculated.
Definition at line 122 of file qmbattery.h.
MeeGo::QmBattery::QmBattery | ( | QObject * | parent = 0 |
) |
virtual MeeGo::QmBattery::~QmBattery | ( | ) | [virtual] |
void MeeGo::QmBattery::batteryCurrent | ( | int | current | ) | [signal] |
Sent at desired interval when battery current measurement is enabled (see startCurrentMeasurement).
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.
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.
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).
chargerType | The new connected charger type (or None) |
void MeeGo::QmBattery::chargingStateChanged | ( | MeeGo::QmBattery::ChargingState | chargingState | ) | [signal] |
Sent when battery charging state has changed.
chargingState | The new charging state |
int MeeGo::QmBattery::getAverageActiveCurrent | ( | RemainingTimeMode | mode | ) | const |
Get the average current in active use.
mode,: | (PowersaveMode/Normal ) mode for which the current time is reported. |
int MeeGo::QmBattery::getAverageIdleCurrent | ( | RemainingTimeMode | mode | ) | const |
Get the average current in idle mode.
mode,: | (PowersaveMode/Normal ) mode for which the current time is reported. |
int MeeGo::QmBattery::getAverageTalkCurrent | ( | RemainingTimeMode | mode | ) | const |
Get the average current in talk mode.
mode,: | (PowersaveMode/Normal ) mode for which the current time is reported. |
BatteryCondition MeeGo::QmBattery::getBatteryCondition | ( | ) | const |
Gets the battery condition.
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.
int MeeGo::QmBattery::getBatteryEnergyLevel | ( | ) | const |
BatteryState MeeGo::QmBattery::getBatteryState | ( | ) | const |
Gets the battery state.
ChargerType MeeGo::QmBattery::getChargerType | ( | ) | const |
Gets the currently connected charger type (or none).
ChargingState MeeGo::QmBattery::getChargingState | ( | ) | const |
Gets the charging state (e.g. on / off / failed).
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.
Level MeeGo::QmBattery::getLevel | ( | ) | const |
int MeeGo::QmBattery::getMaxBars | ( | ) | const |
Get the maximum number of battery bars.
int MeeGo::QmBattery::getNominalCapacity | ( | ) | const |
Gets the battery nominal (maximum) capasity.
int MeeGo::QmBattery::getRemainingActiveTime | ( | RemainingTimeMode | mode | ) | const |
Get the remaining active use time or -1 if not known.
mode,: | (PowersaveMode/Normal ) mode in which the remaining time is to be estimated. |
int MeeGo::QmBattery::getRemainingCapacityBars | ( | ) | const |
Gets the remaining battery capacity as number of bars or 0 if battery state is low.
int MeeGo::QmBattery::getRemainingCapacitymAh | ( | ) | const |
Gets remaining battery capacity as mAh.
int MeeGo::QmBattery::getRemainingCapacityPct | ( | ) | const |
Gets the remaining battery capacity as a percentage.
int MeeGo::QmBattery::getRemainingChargingTime | ( | ) | const |
Gets the remaining charging time.
int MeeGo::QmBattery::getRemainingIdleTime | ( | RemainingTimeMode | mode | ) | const |
Gets the remaining idle time or -1 if not known.
mode,: | (PowersaveMode/Normal ) mode in which the remaining time is to be estimated. |
int MeeGo::QmBattery::getRemainingTalkTime | ( | RemainingTimeMode | mode | ) | const |
Gets the remaining talk time or -1 if not known.
mode,: | (PowersaveMode/Normal ) mode in which the remaining time is to be estimated |
State MeeGo::QmBattery::getState | ( | ) | const |
int MeeGo::QmBattery::getVoltage | ( | ) | const |
Gets the battery voltage.
bool MeeGo::QmBattery::startCurrentMeasurement | ( | Period | rate | ) |
Starts the battery current measurement.
rate | The rate of sending the signal (batteryCurrent) Use enums (RATE_250ms, RATE_1000ms, RATE_5000ms) |
TRUE | success | |
FALSE | failure |
bool MeeGo::QmBattery::stopCurrentMeasurement | ( | ) |
Stops the battery current measurement.
TRUE | success | |
FALSE | failure |
friend class QmBatteryPrivate [friend] |
Definition at line 410 of file qmbattery.h.
Level MeeGo::QmBattery::level [read] |
Definition at line 82 of file qmbattery.h.
ChargingState MeeGo::QmBattery::state [read] |
Definition at line 78 of file qmbattery.h.
State MeeGo::QmBattery::state [read] |
Definition at line 77 of file qmbattery.h.
ChargerType MeeGo::QmBattery::type [read] |
Definition at line 83 of file qmbattery.h.