File indexing completed on 2024-09-15 03:35:57
0001 /* 0002 * SPDX-FileCopyrightText: 2021 Ivan Podkurkov <podkiva2@gmail.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #include "gattserviceinterface.h" 0008 #include "inputinterface.h" 0009 #include "objectmanager.h" 0010 0011 #include <QDBusArgument> 0012 #include <QDBusConnection> 0013 #include <QDBusMessage> 0014 0015 // GattServiceObject 0016 GattServiceObject::GattServiceObject(const QDBusObjectPath &path, QObject *parent) 0017 : QObject(parent) 0018 { 0019 QDBusConnection::sessionBus().registerObject(path.path(), this); 0020 } 0021 0022 // GattServiceInterface 0023 GattServiceInterface::GattServiceInterface(const QDBusObjectPath &path, const QVariantMap &properties, QObject *parent) 0024 : QDBusAbstractAdaptor(parent) 0025 { 0026 setPath(path); 0027 setObjectParent(parent); 0028 setProperties(properties); 0029 setName(QStringLiteral("org.bluez.GattService1")); 0030 } 0031 0032 QString GattServiceInterface::UUID() const 0033 { 0034 return Object::property(QStringLiteral("UUID")).toString(); 0035 } 0036 0037 bool GattServiceInterface::primary() const 0038 { 0039 return Object::property(QStringLiteral("Primary")).toBool(); 0040 } 0041 0042 QDBusObjectPath GattServiceInterface::device() const 0043 { 0044 return Object::property(QStringLiteral("Device")).value<QDBusObjectPath>(); 0045 } 0046 0047 QList<QDBusObjectPath> GattServiceInterface::includes() const 0048 { 0049 return Object::property(QStringLiteral("Includes")).value<QList<QDBusObjectPath>>(); 0050 } 0051 0052 quint16 GattServiceInterface::handle() const 0053 { 0054 return Object::property(QStringLiteral("Handle")).value<quint16>(); 0055 } 0056 0057 void GattServiceInterface::setHandle(const quint16 handle) 0058 { 0059 Object::changeProperty(QStringLiteral("Handle"), QVariant::fromValue(handle)); 0060 } 0061 0062 #include "moc_gattserviceinterface.cpp"