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 
13 namespace Solid
14 {
15 namespace Backends
16 {
17 namespace IOKit
18 {
19 class IOKitDevice;
20 
21 class Battery : public DeviceInterface, virtual public Solid::Ifaces::Battery
22 {
23     Q_OBJECT
24     Q_INTERFACES(Solid::Ifaces::Battery)
25 
26 public:
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 
36     bool isRechargeable() const override;
37     bool isPowerSupply() const override;
38 
39     Solid::Battery::ChargeState chargeState() const override;
40 
41     qlonglong timeToEmpty() const override;
42     qlonglong timeToFull() const override;
43     double voltage() const override;
44     double temperature() const override;
45     QString serial() const override;
46 
47     // ### the ones below are TODO
48     // clang-format off
technology()49     Solid::Battery::Technology technology() const override { return Solid::Battery::UnknownTechnology; }
energy()50     double energy() const override { return 0.0; }
energyFull()51     double energyFull() const override { return 0.0; }
energyFullDesign()52     double energyFullDesign() const override { return 0.0; }
energyRate()53     double energyRate() const override { return 0.0; }
54 
isRecalled()55     bool isRecalled() const override { return false; }
recallVendor()56     QString recallVendor() const override { return QString(); }
recallUrl()57     QString recallUrl() const override { return QString(); }
58 
remainingTime()59     qlonglong remainingTime() const override { return -1; }
60     // clang-format on
61 
62 Q_SIGNALS:
63     void energyChanged(double energy, const QString &udi) override;
64     void energyFullChanged(double energyFull, const QString &udi) override;
65     void energyFullDesignChanged(double energyFullDesign, const QString &udi) override;
66     void energyRateChanged(double energyRate, const QString &udi) override;
67     void chargePercentChanged(int value, const QString &udi) override;
68     void capacityChanged(int value, const QString &udi) override;
69     void chargeStateChanged(int newState, const QString &udi) override;
70     void presentStateChanged(bool newState, const QString &udi) override;
71     void powerSupplyStateChanged(bool newState, const QString &udi) override;
72     void timeToEmptyChanged(qlonglong time, const QString &udi) override;
73     void timeToFullChanged(qlonglong time, const QString &udi) override;
74     void temperatureChanged(double temperature, const QString &udi) override;
75     void voltageChanged(double voltage, const QString &udi) override;
76     void remainingTimeChanged(qlonglong time, const QString &udi) override;
77 };
78 }
79 }
80 }
81 
82 #endif // SOLID_BACKENDS_IOKIT_BATTERY_H
83