Solid

upowerbattery.h
1/*
2 SPDX-FileCopyrightText: 2009 Pino Toscano <pino@kde.org>
3 SPDX-FileCopyrightText: 2010, 2012 Lukas Tinkl <ltinkl@redhat.com>
4 SPDX-FileCopyrightText: 2014 Kai Uwe Broulik <kde@privat.broulik.de>
5
6 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7*/
8
9#ifndef SOLID_BACKENDS_UPOWER_BATTERY_H
10#define SOLID_BACKENDS_UPOWER_BATTERY_H
11
12#include "upowerdeviceinterface.h"
13#include <solid/devices/ifaces/battery.h>
14
15namespace Solid
16{
17namespace Backends
18{
19namespace UPower
20{
21class Battery : public DeviceInterface, virtual public Solid::Ifaces::Battery
22{
25
26public:
27 Battery(UPowerDevice *device);
28 ~Battery() override;
29
30 bool isPresent() const override;
31
32 Solid::Battery::BatteryType type() const override;
33
34 int chargePercent() const override;
35
36 int capacity() const override;
37
38 int cycleCount() const override;
39
40 bool isRechargeable() const override;
41
42 bool isPowerSupply() const override;
43
44 Solid::Battery::ChargeState chargeState() const override;
45
46 qlonglong timeToEmpty() const override;
47
48 qlonglong timeToFull() const override;
49
50 Solid::Battery::Technology technology() const override;
51
52 double energy() const override;
53
54 double energyFull() const override;
55
56 double energyFullDesign() const override;
57
58 double energyRate() const override;
59
60 double voltage() const override;
61
62 double temperature() const override;
63
64 QString serial() const override;
65
66 qlonglong remainingTime() const override;
67
69 void presentStateChanged(bool newState, const QString &udi) override;
70 void chargePercentChanged(int value, const QString &udi = QString()) override;
71 void capacityChanged(int value, const QString &udi) override;
72 void cycleCountChanged(int value, const QString &udi) override;
73 void powerSupplyStateChanged(bool newState, const QString &udi) override;
74 void chargeStateChanged(int newState, const QString &udi = QString()) override;
75 void timeToEmptyChanged(qlonglong time, const QString &udi) override;
76 void timeToFullChanged(qlonglong time, const QString &udi) override;
77 void energyChanged(double energy, const QString &udi) override;
78 void energyFullChanged(double energyFull, const QString &udi) override;
79 void energyFullDesignChanged(double energyFullDesign, const QString &udi) override;
80 void energyRateChanged(double energyRate, const QString &udi) override;
81 void voltageChanged(double voltage, const QString &udi) override;
82 void temperatureChanged(double temperature, const QString &udi) override;
83 void remainingTimeChanged(qlonglong time, const QString &udi) override;
84
85private Q_SLOTS:
86 void slotChanged();
87
88private:
89 void updateCache();
90
91 bool m_isPresent;
92 int m_chargePercent;
93 int m_capacity;
94 int m_cycleCount = -1;
95 bool m_isPowerSupply;
96 Solid::Battery::ChargeState m_chargeState;
97 qlonglong m_timeToEmpty;
98 qlonglong m_timeToFull;
99 double m_energy;
100 double m_energyFull;
101 double m_energyFullDesign;
102 double m_energyRate;
103 double m_voltage;
104 double m_temperature;
105};
106}
107}
108}
109
110#endif // SOLID_BACKENDS_UPOWER_BATTERY_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 Sat Dec 21 2024 17:03:23 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.