Changeset View
Changeset View
Standalone View
Standalone View
src/battery.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | * BluezQt - Asynchronous BlueZ wrapper library | ||||
3 | * | ||||
4 | * Copyright (C) 2019 Kai Uwe Broulik <kde@broulik.de> | ||||
5 | * | ||||
6 | * This library is free software; you can redistribute it and/or | ||||
7 | * modify it under the terms of the GNU Lesser General Public | ||||
8 | * License as published by the Free Software Foundation; either | ||||
9 | * version 2.1 of the License, or (at your option) version 3, or any | ||||
10 | * later version accepted by the membership of KDE e.V. (or its | ||||
11 | * successor approved by the membership of KDE e.V.), which shall | ||||
12 | * act as a proxy defined in Section 6 of version 3 of the license. | ||||
13 | * | ||||
14 | * This library is distributed in the hope that it will be useful, | ||||
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
17 | * Lesser General Public License for more details. | ||||
18 | * | ||||
19 | * You should have received a copy of the GNU Lesser General Public | ||||
20 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||||
21 | */ | ||||
22 | | ||||
23 | #ifndef BLUEZQT_BATTERY_H | ||||
24 | #define BLUEZQT_BATTERY_H | ||||
25 | | ||||
26 | #include <QObject> | ||||
27 | | ||||
28 | #include "types.h" | ||||
29 | #include "bluezqt_export.h" | ||||
30 | | ||||
31 | namespace BluezQt | ||||
32 | { | ||||
33 | | ||||
34 | /** | ||||
35 | * @class BluezQt::Battery battery.h <BluezQt/Battery> | ||||
36 | * | ||||
37 | * %Device battery. | ||||
38 | * | ||||
39 | * This class represents a battery interface. | ||||
40 | */ | ||||
41 | class BLUEZQT_EXPORT Battery : public QObject | ||||
42 | { | ||||
43 | Q_OBJECT | ||||
44 | Q_PROPERTY(int percentage READ percentage NOTIFY percentageChanged) | ||||
45 | | ||||
46 | public: | ||||
47 | /** | ||||
48 | * Destroys a Battery object. | ||||
49 | */ | ||||
50 | ~Battery(); | ||||
51 | | ||||
52 | /** | ||||
53 | * Returns a shared pointer from this. | ||||
54 | * | ||||
55 | * @return BatteryPtr | ||||
56 | */ | ||||
57 | BatteryPtr toSharedPtr() const; | ||||
58 | | ||||
59 | /** | ||||
60 | * Returns the battery percentage. | ||||
61 | * | ||||
62 | * @return battery percentage | ||||
63 | */ | ||||
64 | int percentage() const; | ||||
65 | | ||||
66 | Q_SIGNALS: | ||||
67 | /** | ||||
68 | * Indicates that battery's percentage has changed. | ||||
69 | */ | ||||
70 | void percentageChanged(int percentage); | ||||
71 | | ||||
72 | private: | ||||
73 | explicit Battery(const QString &path, const QVariantMap &properties); | ||||
74 | | ||||
75 | class BatteryPrivate *const d; | ||||
76 | | ||||
77 | friend class BatteryPrivate; | ||||
78 | friend class DevicePrivate; | ||||
79 | }; | ||||
80 | | ||||
81 | } // namespace BluezQt | ||||
82 | | ||||
83 | #endif // BLUEZQT_BATTERY_H |