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 virtual bool isRechargeable() const;
37
38 virtual bool isPowerSupply() const;
39
40 virtual Solid::Battery::ChargeState chargeState() const;
41
42 Solid::Battery::Technology technology() const;
43
44 double energy() const;
45 double energyFull() const;
46 double energyFullDesign() const;
47 double energyRate() const;
48
49 double voltage() const;
50
51 virtual qlonglong timeToEmpty() const;
52
53 virtual qlonglong timeToFull() const;
54
55 virtual double temperature() const;
56
57 virtual QString serial() const;
58
59 // not yet implemented
60 // ------------
61 virtual bool isPresent() const;
62
63 virtual qlonglong remainingTime() const;
64
65 // ------------
66
67 static QSet<QString> getUdis();
68
69 static const Battery batteryInfoFromUdi(const QString &udi);
70
72 void chargePercentChanged(int value, const QString &udi);
73 void capacityChanged(int value, const QString &udi);
74 void chargeStateChanged(int newState, const QString &udi);
75 void powerSupplyStateChanged(bool newState, const QString &udi);
76 void energyChanged(double energy, const QString &udi);
77 void energyFullChanged(double energyFull, const QString &udi);
78 void energyFullDesignChanged(double energyFullDesign, const QString &udi);
79 void energyRateChanged(double energyRate, const QString &udi);
80 void timeToEmptyChanged(qlonglong time, const QString &udi);
81 void temperatureChanged(double temperature, const QString &udi);
82 void voltageChanged(double voltage, const QString &udi);
83
84 // not yet implemented
85 // ------------
86 void presentStateChanged(bool newState, const QString &udi);
87 void timeToFullChanged(qlonglong time, const QString &udi);
88 void remainingTimeChanged(qlonglong time, const QString &udi);
89 // ------------
90
91private Q_SLOTS:
92 void powerChanged();
93
94private:
95 void initSerial(const Battery &b);
96 void updateTimeToEmpty(const Battery &b);
97 void updateBatteryTemp(const Battery &b);
98
99 static QMap<QString, Battery> m_udiToGDI;
101 int m_charge;
102 int m_capacity;
103 bool m_rechargeable;
104 bool m_isPowerSupply;
106 Solid::Battery::Technology m_technology;
107 double m_energy;
108 double m_energyFull;
109 double m_energyFullDesign;
110 double m_energyRate;
111 double m_voltage;
112
113 QString m_serial;
114 ulong m_temperature;
115 ulong m_timeUntilEmpty;
116};
117}
118}
119}
120
121#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.
The single responsibility of this class is to create arguments valid for logind Inhibit call.
Definition fakebattery.h:16
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 Tue Mar 26 2024 11:17:12 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.