File indexing completed on 2024-05-05 03:52:27

0001 /*
0002  * BluezQt - Asynchronous BlueZ wrapper library
0003  *
0004  * SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <kde@broulik.de>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #ifndef BLUEZQT_BATTERY_H
0010 #define BLUEZQT_BATTERY_H
0011 
0012 #include <QObject>
0013 
0014 #include "bluezqt_export.h"
0015 #include "types.h"
0016 
0017 #include <memory>
0018 
0019 namespace BluezQt
0020 {
0021 /**
0022  * @class BluezQt::Battery battery.h <BluezQt/Battery>
0023  *
0024  * %Device battery.
0025  *
0026  * This class represents a battery interface.
0027  */
0028 class BLUEZQT_EXPORT Battery : public QObject
0029 {
0030     Q_OBJECT
0031     Q_PROPERTY(int percentage READ percentage NOTIFY percentageChanged)
0032 
0033 public:
0034     /**
0035      * Destroys a Battery object.
0036      */
0037     ~Battery() override;
0038 
0039     /**
0040      * Returns a shared pointer from this.
0041      *
0042      * @return BatteryPtr
0043      */
0044     BatteryPtr toSharedPtr() const;
0045 
0046     /**
0047      * Returns the battery percentage.
0048      *
0049      * @return battery percentage
0050      */
0051     int percentage() const;
0052 
0053 Q_SIGNALS:
0054     /**
0055      * Indicates that battery's percentage has changed.
0056      */
0057     void percentageChanged(int percentage);
0058 
0059 private:
0060     BLUEZQT_NO_EXPORT explicit Battery(const QString &path, const QVariantMap &properties);
0061 
0062     std::unique_ptr<class BatteryPrivate> const d;
0063 
0064     friend class BatteryPrivate;
0065     friend class DevicePrivate;
0066 };
0067 
0068 } // namespace BluezQt
0069 
0070 #endif // BLUEZQT_BATTERY_H