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 bool isRechargeable() const override;
39
40 bool isPowerSupply() const override;
41
42 Solid::Battery::ChargeState chargeState() const override;
43
44 qlonglong timeToEmpty() const override;
45
46 qlonglong timeToFull() const override;
47
48 Solid::Battery::Technology technology() const override;
49
50 double energy() const override;
51
52 double energyFull() const override;
53
54 double energyFullDesign() const override;
55
56 double energyRate() const override;
57
58 double voltage() const override;
59
60 double temperature() const override;
61
62 QString serial() const override;
63
64 qlonglong remainingTime() const override;
65
67 void presentStateChanged(bool newState, const QString &udi) override;
68 void chargePercentChanged(int value, const QString &udi = QString()) override;
69 void capacityChanged(int value, const QString &udi) override;
70 void powerSupplyStateChanged(bool newState, const QString &udi) override;
71 void chargeStateChanged(int newState, const QString &udi = QString()) override;
72 void timeToEmptyChanged(qlonglong time, const QString &udi) override;
73 void timeToFullChanged(qlonglong time, const QString &udi) override;
74 void energyChanged(double energy, const QString &udi) override;
75 void energyFullChanged(double energyFull, const QString &udi) override;
76 void energyFullDesignChanged(double energyFullDesign, const QString &udi) override;
77 void energyRateChanged(double energyRate, const QString &udi) override;
78 void voltageChanged(double voltage, const QString &udi) override;
79 void temperatureChanged(double temperature, const QString &udi) override;
80 void remainingTimeChanged(qlonglong time, const QString &udi) override;
81
82private Q_SLOTS:
83 void slotChanged();
84
85private:
86 void updateCache();
87
88 bool m_isPresent;
89 int m_chargePercent;
90 int m_capacity;
91 bool m_isPowerSupply;
92 Solid::Battery::ChargeState m_chargeState;
93 qlonglong m_timeToEmpty;
94 qlonglong m_timeToFull;
95 double m_energy;
96 double m_energyFull;
97 double m_energyFullDesign;
98 double m_energyRate;
99 double m_voltage;
100 double m_temperature;
101};
102}
103}
104}
105
106#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.
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.