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 | * @class BluezQt::Battery battery.h <BluezQt/Battery> |
23 | * |
24 | * %Device battery. |
25 | * |
26 | * This class represents a battery interface. |
27 | */ |
28 | class BLUEZQT_EXPORT Battery : public QObject |
29 | { |
30 | Q_OBJECT |
31 | Q_PROPERTY(int percentage READ percentage NOTIFY percentageChanged) |
32 | |
33 | public: |
34 | /** |
35 | * Destroys a Battery object. |
36 | */ |
37 | ~Battery() override; |
38 | |
39 | /** |
40 | * Returns a shared pointer from this. |
41 | * |
42 | * @return BatteryPtr |
43 | */ |
44 | BatteryPtr toSharedPtr() const; |
45 | |
46 | /** |
47 | * Returns the battery percentage. |
48 | * |
49 | * @return battery percentage |
50 | */ |
51 | int percentage() const; |
52 | |
53 | Q_SIGNALS: |
54 | /** |
55 | * Indicates that battery's percentage has changed. |
56 | */ |
57 | void percentageChanged(int percentage); |
58 | |
59 | private: |
60 | BLUEZQT_NO_EXPORT explicit Battery(const QString &path, const QVariantMap &properties); |
61 | |
62 | std::unique_ptr<class BatteryPrivate> const d; |
63 | |
64 | friend class BatteryPrivate; |
65 | friend class DevicePrivate; |
66 | }; |
67 | |
68 | } // namespace BluezQt |
69 | |
70 | #endif // BLUEZQT_BATTERY_H |
71 | |