File indexing completed on 2024-12-01 12:29:46

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 namespace BluezQt
0018 {
0019 /**
0020  * @class BluezQt::Battery battery.h <BluezQt/Battery>
0021  *
0022  * %Device battery.
0023  *
0024  * This class represents a battery interface.
0025  */
0026 class BLUEZQT_EXPORT Battery : public QObject
0027 {
0028     Q_OBJECT
0029     Q_PROPERTY(int percentage READ percentage NOTIFY percentageChanged)
0030 
0031 public:
0032     /**
0033      * Destroys a Battery object.
0034      */
0035     ~Battery() override;
0036 
0037     /**
0038      * Returns a shared pointer from this.
0039      *
0040      * @return BatteryPtr
0041      */
0042     BatteryPtr toSharedPtr() const;
0043 
0044     /**
0045      * Returns the battery percentage.
0046      *
0047      * @return battery percentage
0048      */
0049     int percentage() const;
0050 
0051 Q_SIGNALS:
0052     /**
0053      * Indicates that battery's percentage has changed.
0054      */
0055     void percentageChanged(int percentage);
0056 
0057 private:
0058     BLUEZQT_NO_EXPORT explicit Battery(const QString &path, const QVariantMap &properties);
0059 
0060     class BatteryPrivate *const d;
0061 
0062     friend class BatteryPrivate;
0063     friend class DevicePrivate;
0064 };
0065 
0066 } // namespace BluezQt
0067 
0068 #endif // BLUEZQT_BATTERY_H