| 1 | /* |
| 2 | * BluezQt - Asynchronous BlueZ wrapper library |
| 3 | * |
| 4 | * SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <kde@broulik.de> |
| 5 | * |
| 6 | * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 7 | */ |
| 8 | |
| 9 | #ifndef BLUEZQT_BATTERY_H |
| 10 | #define BLUEZQT_BATTERY_H |
| 11 | |
| 12 | #include <QObject> |
| 13 | |
| 14 | #include "bluezqt_export.h" |
| 15 | #include "types.h" |
| 16 | |
| 17 | #include <memory> |
| 18 | |
| 19 | namespace BluezQt |
| 20 | { |
| 21 | /*! |
| 22 | * \inmodule BluezQt |
| 23 | * \class BluezQt::Battery |
| 24 | * \inheaderfile BluezQt/Battery |
| 25 | * |
| 26 | * \brief Device battery. |
| 27 | * |
| 28 | * This class represents a battery interface. |
| 29 | */ |
| 30 | class BLUEZQT_EXPORT Battery : public QObject |
| 31 | { |
| 32 | Q_OBJECT |
| 33 | /*! |
| 34 | * \property BluezQt::Battery::percentage |
| 35 | */ |
| 36 | Q_PROPERTY(int percentage READ percentage NOTIFY percentageChanged) |
| 37 | |
| 38 | public: |
| 39 | ~Battery() override; |
| 40 | |
| 41 | /*! |
| 42 | * Returns a shared pointer from this. |
| 43 | */ |
| 44 | BatteryPtr toSharedPtr() const; |
| 45 | |
| 46 | /*! |
| 47 | * Returns the battery percentage. |
| 48 | */ |
| 49 | int percentage() const; |
| 50 | |
| 51 | Q_SIGNALS: |
| 52 | /*! |
| 53 | * Indicates that battery's \a percentage has changed. |
| 54 | */ |
| 55 | void percentageChanged(int percentage); |
| 56 | |
| 57 | private: |
| 58 | BLUEZQT_NO_EXPORT explicit Battery(const QString &path, const QVariantMap &properties); |
| 59 | |
| 60 | std::unique_ptr<class BatteryPrivate> const d; |
| 61 | |
| 62 | friend class BatteryPrivate; |
| 63 | friend class DevicePrivate; |
| 64 | }; |
| 65 | |
| 66 | } // namespace BluezQt |
| 67 | |
| 68 | #endif // BLUEZQT_BATTERY_H |
| 69 | |