| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <[email protected]> |
| 3 |
* |
| 4 |
* SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL |
| 5 |
*/ |
| 6 |
|
| 7 |
#include "batteryinterface.h" |
| 8 |
|
| 9 |
#include <QDBusConnection> |
| 10 |
|
| 11 |
// BatteryObject |
| 12 |
BatteryObject::BatteryObject(const QDBusObjectPath &path, QObject *parent) |
| 13 |
: QObject(parent) |
| 14 |
{ |
| 15 |
QDBusConnection::sessionBus().registerObject(path.path(), this); |
| 16 |
} |
| 17 |
|
| 18 |
// BatteryInterface |
| 19 |
BatteryInterface::BatteryInterface(const QDBusObjectPath &path, const QVariantMap &properties, QObject *parent) |
| 20 |
: QDBusAbstractAdaptor(parent) |
| 21 |
{ |
| 22 |
setPath(path); |
| 23 |
setObjectParent(parent); |
| 24 |
setProperties(properties); |
| 25 |
setName(QStringLiteral("org.bluez.Battery1")); |
| 26 |
} |
| 27 |
|
| 28 |
uchar BatteryInterface::percentage() const |
| 29 |
{ |
| 30 |
return Object::property(QStringLiteral("Percentage")).value<uchar>(); |
| 31 |
} |
| 32 |
|
| 33 |
#include "moc_batteryinterface.cpp" |