Solid

iokitbattery.h
1/*
2 SPDX-FileCopyrightText: 2009 Harald Fernengel <harry@kdevelop.org>
3
4 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5*/
6
7#ifndef SOLID_BACKENDS_IOKIT_BATTERY_H
8#define SOLID_BACKENDS_IOKIT_BATTERY_H
9
10#include "iokitdeviceinterface.h"
11#include <solid/devices/ifaces/battery.h>
12
13namespace Solid
14{
15namespace Backends
16{
17namespace IOKit
18{
19class IOKitDevice;
20
21class Battery : public DeviceInterface, virtual public Solid::Ifaces::Battery
22{
25
26public:
27 Battery(IOKitDevice *device);
28 virtual ~Battery();
29
30 bool isPresent() const override;
31 Solid::Battery::BatteryType type() const override;
32
33 int chargePercent() const override;
34 int capacity() const override;
35 int cycleCount() const override;
36
37 bool isRechargeable() const override;
38 bool isPowerSupply() const override;
39
40 Solid::Battery::ChargeState chargeState() const override;
41
42 qlonglong timeToEmpty() const override;
43 qlonglong timeToFull() const override;
44 double voltage() const override;
45 double temperature() const override;
46 QString serial() const override;
47
48 // ### the ones below are TODO
49 // clang-format off
50 Solid::Battery::Technology technology() const override { return Solid::Battery::UnknownTechnology; }
51 double energy() const override { return 0.0; }
52 double energyFull() const override { return 0.0; }
53 double energyFullDesign() const override { return 0.0; }
54 double energyRate() const override { return 0.0; }
55
56 qlonglong remainingTime() const override { return -1; }
57 // clang-format on
58
60 void energyChanged(double energy, const QString &udi) override;
61 void energyFullChanged(double energyFull, const QString &udi) override;
62 void energyFullDesignChanged(double energyFullDesign, const QString &udi) override;
63 void energyRateChanged(double energyRate, const QString &udi) override;
64 void chargePercentChanged(int value, const QString &udi) override;
65 void capacityChanged(int value, const QString &udi) override;
66 void cycleCountChanged(int value, const QString &udi) override;
67 void chargeStateChanged(int newState, const QString &udi) override;
68 void presentStateChanged(bool newState, const QString &udi) override;
69 void powerSupplyStateChanged(bool newState, const QString &udi) override;
70 void timeToEmptyChanged(qlonglong time, const QString &udi) override;
71 void timeToFullChanged(qlonglong time, const QString &udi) override;
72 void temperatureChanged(double temperature, const QString &udi) override;
73 void voltageChanged(double voltage, const QString &udi) override;
74 void remainingTimeChanged(qlonglong time, const QString &udi) override;
75};
76}
77}
78}
79
80#endif // SOLID_BACKENDS_IOKIT_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
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:01:48 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.