File indexing completed on 2024-05-26 04:05:33
0001 /* 0002 SPDX-FileCopyrightText: 2009 Harald Fernengel <harry@kdevelop.org> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #ifndef SOLID_BACKENDS_IOKIT_BATTERY_H 0008 #define SOLID_BACKENDS_IOKIT_BATTERY_H 0009 0010 #include "iokitdeviceinterface.h" 0011 #include <solid/devices/ifaces/battery.h> 0012 0013 namespace Solid 0014 { 0015 namespace Backends 0016 { 0017 namespace IOKit 0018 { 0019 class IOKitDevice; 0020 0021 class Battery : public DeviceInterface, virtual public Solid::Ifaces::Battery 0022 { 0023 Q_OBJECT 0024 Q_INTERFACES(Solid::Ifaces::Battery) 0025 0026 public: 0027 Battery(IOKitDevice *device); 0028 virtual ~Battery(); 0029 0030 bool isPresent() const override; 0031 Solid::Battery::BatteryType type() const override; 0032 0033 int chargePercent() const override; 0034 int capacity() const override; 0035 0036 bool isRechargeable() const override; 0037 bool isPowerSupply() const override; 0038 0039 Solid::Battery::ChargeState chargeState() const override; 0040 0041 qlonglong timeToEmpty() const override; 0042 qlonglong timeToFull() const override; 0043 double voltage() const override; 0044 double temperature() const override; 0045 QString serial() const override; 0046 0047 // ### the ones below are TODO 0048 // clang-format off 0049 Solid::Battery::Technology technology() const override { return Solid::Battery::UnknownTechnology; } 0050 double energy() const override { return 0.0; } 0051 double energyFull() const override { return 0.0; } 0052 double energyFullDesign() const override { return 0.0; } 0053 double energyRate() const override { return 0.0; } 0054 0055 qlonglong remainingTime() const override { return -1; } 0056 // clang-format on 0057 0058 Q_SIGNALS: 0059 void energyChanged(double energy, const QString &udi) override; 0060 void energyFullChanged(double energyFull, const QString &udi) override; 0061 void energyFullDesignChanged(double energyFullDesign, const QString &udi) override; 0062 void energyRateChanged(double energyRate, const QString &udi) override; 0063 void chargePercentChanged(int value, const QString &udi) override; 0064 void capacityChanged(int value, const QString &udi) override; 0065 void chargeStateChanged(int newState, const QString &udi) override; 0066 void presentStateChanged(bool newState, const QString &udi) override; 0067 void powerSupplyStateChanged(bool newState, const QString &udi) override; 0068 void timeToEmptyChanged(qlonglong time, const QString &udi) override; 0069 void timeToFullChanged(qlonglong time, const QString &udi) override; 0070 void temperatureChanged(double temperature, const QString &udi) override; 0071 void voltageChanged(double voltage, const QString &udi) override; 0072 void remainingTimeChanged(qlonglong time, const QString &udi) override; 0073 }; 0074 } 0075 } 0076 } 0077 0078 #endif // SOLID_BACKENDS_IOKIT_BATTERY_H