Solid
battery.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef SOLID_BATTERY_H
00021 #define SOLID_BATTERY_H
00022
00023 #include <solid/solid_export.h>
00024
00025 #include <solid/deviceinterface.h>
00026
00027 namespace Solid
00028 {
00029 class BatteryPrivate;
00030 class Device;
00031
00035 class SOLID_EXPORT Battery : public DeviceInterface
00036 {
00037 Q_OBJECT
00038 Q_ENUMS(BatteryType ChargeState)
00039 Q_PROPERTY(bool plugged READ isPlugged)
00040 Q_PROPERTY(BatteryType type READ type)
00041 Q_PROPERTY(int chargePercent READ chargePercent)
00042 Q_PROPERTY(bool rechargeable READ isRechargeable)
00043 Q_PROPERTY(ChargeState chargeState READ chargeState)
00044 Q_DECLARE_PRIVATE(Battery)
00045 friend class Device;
00046
00047 public:
00060 enum BatteryType { UnknownBattery, PdaBattery, UpsBattery,
00061 PrimaryBattery, MouseBattery, KeyboardBattery,
00062 KeyboardMouseBattery, CameraBattery };
00063
00072 enum ChargeState { NoCharge, Charging, Discharging };
00073
00074
00075 private:
00084 explicit Battery(QObject *backendObject);
00085
00086 public:
00090 virtual ~Battery();
00091
00092
00099 static Type deviceInterfaceType() { return DeviceInterface::Battery; }
00100
00106 bool isPlugged() const;
00107
00114 BatteryType type() const;
00115
00116
00117
00124 int chargePercent() const;
00125
00126
00127
00133 bool isRechargeable() const;
00134
00142 ChargeState chargeState() const;
00143
00144 Q_SIGNALS:
00152 void chargePercentChanged(int value, const QString &udi);
00153
00163 void chargeStateChanged(int newState, const QString &udi);
00164
00172 void plugStateChanged(bool newState, const QString &udi);
00173 };
00174 }
00175
00176 #endif