• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

qmbattery.h

Go to the documentation of this file.
00001 
00035 #ifndef QMBATTERY_H
00036 #define QMBATTERY_H
00037 
00038 
00039 #include <QtCore/qobject.h>
00040 #include "system_global.h"
00041 #include <QList>
00042 #include <QScopedPointer>
00043 
00044 QT_BEGIN_HEADER
00045 
00046 namespace MeeGo {
00047 
00048 class QmBatteryPrivate;
00049 
00057 class MEEGO_SYSTEM_EXPORT QmBattery : public QObject
00058 {
00059     Q_OBJECT
00060 
00064     Q_ENUMS(Level)
00065     Q_ENUMS(BatteryState)
00066     Q_ENUMS(RemainingTimeMode)
00070     Q_ENUMS(State)
00071     Q_ENUMS(ChargingState)
00072     Q_ENUMS(Period)
00073     Q_ENUMS(ChargerType)
00077     Q_PROPERTY(State state READ getState)
00078     Q_PROPERTY(ChargingState state READ getChargingState)
00082     Q_PROPERTY(Level level READ getLevel)
00083     Q_PROPERTY(ChargerType type READ getChargerType)
00084 
00085 public:
00086 
00091     enum Level
00092     {
00093         LevelFull = 0,
00094         LevelLow,
00095         LevelCritical
00096     };
00097 
00099     enum BatteryState
00100     {
00101         StateEmpty = 0,  
00102         StateLow,        
00103         StateOK,         
00104         StateFull,       
00105         StateError       
00106     };
00107 
00109     enum ChargingState
00110     {
00111         StateNotCharging = 0, 
00112         StateCharging,        
00113         StateChargingFailed   
00114     };
00115 
00119     typedef ChargingState State;
00120 
00122     enum RemainingTimeMode
00123     {
00124         NormalMode,       
00125         PowersaveMode     
00126     };
00127 
00129     enum ChargerType
00130     {
00131         Unknown = -1,        
00132         None,                
00133         Wall,                
00134         USB_500mA,           
00135         USB_100mA            
00136     };
00137 
00139     enum Period
00140     {
00141         RATE_250ms = 0,         
00142         RATE_1000ms,            
00143         RATE_5000ms             
00144     };
00145 
00147     enum BatteryCondition
00148     {
00149         ConditionGood = 0,      
00150         ConditionPoor,          
00151         ConditionUnknown = 0xff 
00152     };
00153 
00154     QmBattery(QObject *parent = 0);
00155     virtual ~QmBattery();
00156 
00162     int getNominalCapacity() const;
00163 
00169     BatteryState getBatteryState() const;
00170 
00176     int getRemainingCapacitymAh() const;
00177 
00183     int getRemainingCapacityPct() const;
00184 
00191     int getRemainingCapacityBars() const;
00192 
00198     int getMaxBars() const;
00199 
00205     int getVoltage() const;
00206 
00215     int getBatteryCurrent() const;
00216 
00230     int getCumulativeBatteryCurrent() const;
00231 
00237     ChargerType getChargerType() const;
00238 
00244     ChargingState getChargingState() const;
00245 
00251     int  getRemainingChargingTime() const;
00252 
00262     bool startCurrentMeasurement(Period rate);
00263 
00270     bool stopCurrentMeasurement();
00271 
00280     int getAverageTalkCurrent(RemainingTimeMode mode) const;
00281 
00290     int getRemainingTalkTime(RemainingTimeMode mode) const;
00291 
00300     int getAverageActiveCurrent(RemainingTimeMode mode) const;
00301 
00310     int getRemainingActiveTime(RemainingTimeMode mode) const;
00311 
00320     int getAverageIdleCurrent(RemainingTimeMode mode) const;
00321 
00330     int getRemainingIdleTime(RemainingTimeMode mode) const;
00331 
00337     BatteryCondition getBatteryCondition() const;
00338 
00342     int getBatteryEnergyLevel() const;
00343 
00347     Level getLevel() const;
00348 
00352     State getState() const;
00353 
00354 Q_SIGNALS:
00355 
00361     void batteryStateChanged(MeeGo::QmBattery::BatteryState batteryState);
00362 
00369     void batteryRemainingCapacityChanged(int percentage, int bars);
00370 
00376     void chargingStateChanged(MeeGo::QmBattery::ChargingState chargingState);
00377 
00383     void chargerEvent(MeeGo::QmBattery::ChargerType chargerType);
00384 
00391     void batteryCurrent(int current);
00392 
00396     void batteryEnergyLevelChanged(int percentage);
00397 
00401     void batteryStatusChanged(MeeGo::QmBattery::State);
00402 
00406     void batteryLevelChanged(MeeGo::QmBattery::Level level);
00407 
00408 private:
00409     Q_DISABLE_COPY(QmBattery)
00410     friend class QmBatteryPrivate;
00411     QScopedPointer<QmBatteryPrivate> pimpl_;
00412 };
00413 
00414 } // MeeGo namespace
00415 
00416 QT_END_HEADER
00417 
00418 #endif /*QMBATTERY_H*/
00419 
00420 // End of file

Generated on Mon Jul 4 2011 14:27:35 for QmSystem by  doxygen 1.7.1