File indexing completed on 2024-09-15 03:35:57
0001 /* 0002 * SPDX-FileCopyrightText: 2019 Kai Uwe Broulik <kde@broulik.de> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "batteryinterface.h" 0008 0009 #include <QDBusConnection> 0010 0011 // BatteryObject 0012 BatteryObject::BatteryObject(const QDBusObjectPath &path, QObject *parent) 0013 : QObject(parent) 0014 { 0015 QDBusConnection::sessionBus().registerObject(path.path(), this); 0016 } 0017 0018 // BatteryInterface 0019 BatteryInterface::BatteryInterface(const QDBusObjectPath &path, const QVariantMap &properties, QObject *parent) 0020 : QDBusAbstractAdaptor(parent) 0021 { 0022 setPath(path); 0023 setObjectParent(parent); 0024 setProperties(properties); 0025 setName(QStringLiteral("org.bluez.Battery1")); 0026 } 0027 0028 uchar BatteryInterface::percentage() const 0029 { 0030 return Object::property(QStringLiteral("Percentage")).value<uchar>(); 0031 } 0032 0033 #include "moc_batteryinterface.cpp"