| 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_LINUX_P_H |
| 53 |
#define QBATTERYINFO_LINUX_P_H |
| 54 |
|
| 55 |
#include <lomiribatteryinfo.h> |
| 56 |
|
| 57 |
#include <QtCore/qmap.h> |
| 58 |
|
| 59 |
QT_BEGIN_NAMESPACE |
| 60 |
|
| 61 |
#if !defined(QT_NO_UDEV) |
| 62 |
class QUDevWrapper; |
| 63 |
#else |
| 64 |
class QTimer; |
| 65 |
#endif |
| 66 |
|
| 67 |
class LomiriBatteryInfoPrivate : public QObject |
| 68 |
{ |
| 69 |
Q_OBJECT |
| 70 |
|
| 71 |
public: |
| 72 |
LomiriBatteryInfoPrivate(LomiriBatteryInfo *parent); |
| 73 |
LomiriBatteryInfoPrivate(int batteryIndex, LomiriBatteryInfo *parent); |
| 74 |
~LomiriBatteryInfoPrivate(); |
| 75 |
|
| 76 |
int batteryCount(); |
| 77 |
int batteryIndex() const; |
| 78 |
bool isValid(); |
| 79 |
int level(int battery); |
| 80 |
int level(); |
| 81 |
int currentFlow(int battery); |
| 82 |
int currentFlow(); |
| 83 |
int cycleCount(int battery); |
| 84 |
int cycleCount(); |
| 85 |
int maximumCapacity(int battery); |
| 86 |
int maximumCapacity(); |
| 87 |
int remainingCapacity(int battery); |
| 88 |
int remainingCapacity(); |
| 89 |
int remainingChargingTime(int battery); |
| 90 |
int remainingChargingTime(); |
| 91 |
int voltage(int battery); |
| 92 |
int voltage(); |
| 93 |
LomiriBatteryInfo::ChargerType chargerType(); |
| 94 |
LomiriBatteryInfo::ChargingState chargingState(int battery); |
| 95 |
LomiriBatteryInfo::ChargingState chargingState(); |
| 96 |
LomiriBatteryInfo::LevelStatus levelStatus(int battery); |
| 97 |
LomiriBatteryInfo::LevelStatus levelStatus(); |
| 98 |
LomiriBatteryInfo::Health health(int battery); |
| 99 |
LomiriBatteryInfo::Health health(); |
| 100 |
float temperature(int battery); |
| 101 |
float temperature(); |
| 102 |
|
| 103 |
void setBatteryIndex(int batteryIndex); |
| 104 |
|
| 105 |
Q_SIGNALS: |
| 106 |
void batteryCountChanged(int count); |
| 107 |
void batteryIndexChanged(int batteryIndex); |
| 108 |
void validChanged(bool isValid); |
| 109 |
void chargerTypeChanged(LomiriBatteryInfo::ChargerType type); |
| 110 |
void chargingStateChanged(LomiriBatteryInfo::ChargingState state); |
| 111 |
void levelChanged(int level); |
| 112 |
void currentFlowChanged(int flow); |
| 113 |
void cycleCountChanged(int cycleCount); |
| 114 |
void remainingCapacityChanged(int capacity); |
| 115 |
void remainingChargingTimeChanged(int seconds); |
| 116 |
void voltageChanged(int voltage); |
| 117 |
void levelStatusChanged(LomiriBatteryInfo::LevelStatus levelStatus); |
| 118 |
void healthChanged(LomiriBatteryInfo::Health health); |
| 119 |
void temperatureChanged(float temperature); |
| 120 |
|
| 121 |
protected: |
| 122 |
void connectNotify(const QMetaMethod &signal); |
| 123 |
void disconnectNotify(const QMetaMethod &signal); |
| 124 |
|
| 125 |
private Q_SLOTS: |
| 126 |
#if !defined(QT_NO_UDEV) |
| 127 |
void onBatteryDataChanged(int battery, const QByteArray &attribute, const QByteArray &value); |
| 128 |
void onChargerTypeChanged(const QByteArray &value, bool enabled); |
| 129 |
#else |
| 130 |
void onTimeout(); |
| 131 |
#endif |
| 132 |
|
| 133 |
private: |
| 134 |
LomiriBatteryInfo * const q_ptr; |
| 135 |
Q_DECLARE_PUBLIC(LomiriBatteryInfo) |
| 136 |
|
| 137 |
bool watchIsValid; |
| 138 |
bool forceWatchBatteryCount; |
| 139 |
bool watchBatteryCount; |
| 140 |
bool watchChargerType; |
| 141 |
bool watchChargingState; |
| 142 |
bool watchCurrentFlow; |
| 143 |
bool watchRemainingCapacity; |
| 144 |
bool watchRemainingChargingTime; |
| 145 |
bool watchVoltage; |
| 146 |
bool watchLevelStatus; |
| 147 |
int batteryCounts; |
| 148 |
int index; |
| 149 |
QMap<int, int> currentFlows; |
| 150 |
QMap<int, int> voltages; |
| 151 |
QMap<int, int> remainingCapacities; |
| 152 |
QMap<int, int> remainingChargingTimes; |
| 153 |
QMap<int, int> maximumCapacities; |
| 154 |
QMap<int, LomiriBatteryInfo::ChargingState> chargingStates; |
| 155 |
LomiriBatteryInfo::ChargerType currentChargerType; |
| 156 |
QMap<int, LomiriBatteryInfo::LevelStatus> levelStatuss; |
| 157 |
#if !defined(QT_NO_UDEV) |
| 158 |
QUDevWrapper *uDevWrapper; |
| 159 |
#else |
| 160 |
QTimer *timer; |
| 161 |
#endif |
| 162 |
|
| 163 |
int getBatteryCount(); |
| 164 |
int getCurrentFlow(int battery); |
| 165 |
int getRemainingCapacity(int battery); |
| 166 |
int getRemainingChargingTime(int battery); |
| 167 |
int getVoltage(int battery); |
| 168 |
LomiriBatteryInfo::ChargerType getChargerType(); |
| 169 |
LomiriBatteryInfo::ChargingState getChargingState(int battery); |
| 170 |
LomiriBatteryInfo::LevelStatus getLevelStatus(int battery); |
| 171 |
}; |
| 172 |
|
| 173 |
QT_END_NAMESPACE |
| 174 |
|
| 175 |
#endif |