Solid

winbattery.h
1/*
2 SPDX-FileCopyrightText: 2013 Patrick von Reth <vonreth@kde.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef WINBATTERY_H
8#define WINBATTERY_H
9
10#include <solid/devices/ifaces/battery.h>
11
12#include "wininterface.h"
13
14namespace Solid
15{
16namespace Backends
17{
18namespace Win
19{
20class WinBattery : public WinInterface, virtual public Solid::Ifaces::Battery
21{
24
25public:
26 typedef QPair<QString, ulong> Battery;
27
28 WinBattery(WinDevice *device);
29
30 virtual Solid::Battery::BatteryType type() const;
31
32 virtual int chargePercent() const;
33
34 virtual int capacity() const;
35
36 int cycleCount() const override;
37
38 virtual bool isRechargeable() const;
39
40 virtual bool isPowerSupply() const;
41
42 virtual Solid::Battery::ChargeState chargeState() const;
43
44 Solid::Battery::Technology technology() const;
45
46 double energy() const;
47 double energyFull() const;
48 double energyFullDesign() const;
49 double energyRate() const;
50
51 double voltage() const;
52
53 virtual qlonglong timeToEmpty() const;
54
55 virtual qlonglong timeToFull() const;
56
57 virtual double temperature() const;
58
59 virtual QString serial() const;
60
61 // not yet implemented
62 // ------------
63 virtual bool isPresent() const;
64
65 virtual qlonglong remainingTime() const;
66
67 // ------------
68
69 static QSet<QString> getUdis();
70
71 static const Battery batteryInfoFromUdi(const QString &udi);
72
74 void chargePercentChanged(int value, const QString &udi);
75 void capacityChanged(int value, const QString &udi);
76 void cycleCountChanged(int value, const QString &udi);
77 void chargeStateChanged(int newState, const QString &udi);
78 void powerSupplyStateChanged(bool newState, const QString &udi);
79 void energyChanged(double energy, const QString &udi);
80 void energyFullChanged(double energyFull, const QString &udi);
81 void energyFullDesignChanged(double energyFullDesign, const QString &udi);
82 void energyRateChanged(double energyRate, const QString &udi);
83 void timeToEmptyChanged(qlonglong time, const QString &udi);
84 void temperatureChanged(double temperature, const QString &udi);
85 void voltageChanged(double voltage, const QString &udi);
86
87 // not yet implemented
88 // ------------
89 void presentStateChanged(bool newState, const QString &udi);
90 void timeToFullChanged(qlonglong time, const QString &udi);
91 void remainingTimeChanged(qlonglong time, const QString &udi);
92 // ------------
93
94private Q_SLOTS:
95 void powerChanged();
96
97private:
98 void initSerial(const Battery &b);
99 void updateTimeToEmpty(const Battery &b);
100 void updateBatteryTemp(const Battery &b);
101
102 static QMap<QString, Battery> m_udiToGDI;
104 int m_charge;
105 int m_capacity;
106 int m_cycleCount = -1;
107 bool m_rechargeable;
108 bool m_isPowerSupply;
110 Solid::Battery::Technology m_technology;
111 double m_energy;
112 double m_energyFull;
113 double m_energyFullDesign;
114 double m_energyRate;
115 double m_voltage;
116
117 QString m_serial;
118 ulong m_temperature;
119 ulong m_timeUntilEmpty;
120};
121}
122}
123}
124
125#endif // WINBATTERY_H
BatteryType
This enum type defines the type of the device holding the battery.
Technology
Technology used in the battery.
ChargeState
This enum type defines charge state of a battery.
This device interface is available on batteries.
Q_INTERFACES(...)
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:01:49 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.