| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
#ifndef QBATTERYINFO_UPOWER_P_H |
| 53 |
#define QBATTERYINFO_UPOWER_P_H |
| 54 |
|
| 55 |
#include <qbatteryinfo.h> |
| 56 |
|
| 57 |
#include <QtCore/qmap.h> |
| 58 |
#include <QtCore/QVariantMap> |
| 59 |
#include <QtCore/QMap> |
| 60 |
#include <QtDBus/QDBusServiceWatcher> |
| 61 |
#include "qdevicekitservice_linux_p.h" |
| 62 |
|
| 63 |
QT_BEGIN_NAMESPACE |
| 64 |
|
| 65 |
class QBatteryInfoPrivate : public QObject |
| 66 |
{ |
| 67 |
Q_OBJECT |
| 68 |
|
| 69 |
public: |
| 70 |
QBatteryInfoPrivate(QBatteryInfo *parent); |
| 71 |
QBatteryInfoPrivate(int batteryIndex, QBatteryInfo *parent); |
| 72 |
~QBatteryInfoPrivate(); |
| 73 |
|
| 74 |
int batteryCount(); |
| 75 |
int batteryIndex() const; |
| 76 |
bool isValid(); |
| 77 |
int level(int battery); |
| 78 |
int level(); |
| 79 |
int currentFlow(int battery); |
| 80 |
int currentFlow(); |
| 81 |
int cycleCount(int battery); |
| 82 |
int cycleCount(); |
| 83 |
int maximumCapacity(int battery); |
| 84 |
int maximumCapacity(); |
| 85 |
int remainingCapacity(int battery); |
| 86 |
int remainingCapacity(); |
| 87 |
int remainingChargingTime(int battery); |
| 88 |
int remainingChargingTime(); |
| 89 |
int voltage(int battery); |
| 90 |
int voltage(); |
| 91 |
QBatteryInfo::ChargerType chargerType(); |
| 92 |
QBatteryInfo::ChargingState chargingState(int battery); |
| 93 |
QBatteryInfo::ChargingState chargingState(); |
| 94 |
QBatteryInfo::LevelStatus levelStatus(int battery); |
| 95 |
QBatteryInfo::LevelStatus levelStatus(); |
| 96 |
QBatteryInfo::Health health(int battery); |
| 97 |
QBatteryInfo::Health health(); |
| 98 |
float temperature(int battery); |
| 99 |
float temperature(); |
| 100 |
|
| 101 |
void setBatteryIndex(int batteryIndex); |
| 102 |
|
| 103 |
Q_SIGNALS: |
| 104 |
void batteryCountChanged(int count); |
| 105 |
int batteryIndexChanged(int batteryIndex); |
| 106 |
void validChanged(bool isValid); |
| 107 |
void chargerTypeChanged(QBatteryInfo::ChargerType type); |
| 108 |
void chargingStateChanged(QBatteryInfo::ChargingState state); |
| 109 |
void levelChanged(int level); |
| 110 |
void currentFlowChanged(int flow); |
| 111 |
void cycleCountChanged(int cycleCount); |
| 112 |
void remainingCapacityChanged(int capacity); |
| 113 |
void remainingChargingTimeChanged(int seconds); |
| 114 |
void voltageChanged(int voltage); |
| 115 |
void levelStatusChanged(QBatteryInfo::LevelStatus levelStatus); |
| 116 |
void healthChanged(QBatteryInfo::Health health); |
| 117 |
void temperatureChanged(float temperature); |
| 118 |
|
| 119 |
protected: |
| 120 |
QMap <int,QVariantMap> batteryMap; |
| 121 |
QBatteryInfo::ChargerType cType; |
| 122 |
QBatteryInfo::ChargingState cState; |
| 123 |
QList <QBatteryInfo::Health> healthList; |
| 124 |
private Q_SLOTS: |
| 125 |
void uPowerBatteryPropertyChanged(const QString & prop, const QVariant &v); |
| 126 |
void getBatteryStats(); |
| 127 |
void deviceAdded(const QString &path); |
| 128 |
void deviceRemoved(const QString &path); |
| 129 |
void connectToUpower(); |
| 130 |
void disconnectFromUpower(); |
| 131 |
|
| 132 |
private: |
| 133 |
QBatteryInfo * const q_ptr; |
| 134 |
Q_DECLARE_PUBLIC(QBatteryInfo) |
| 135 |
QDBusServiceWatcher *watcher; |
| 136 |
int index; |
| 137 |
|
| 138 |
void initialize(); |
| 139 |
QBatteryInfo::ChargingState getCurrentChargingState(int); |
| 140 |
QBatteryInfo::ChargerType getChargerType(const QString &path); |
| 141 |
}; |
| 142 |
|
| 143 |
QT_END_NAMESPACE |
| 144 |
|
| 145 |
#endif |