| 1 |
/* |
| 2 |
* SPDX-FileCopyrightText: 2021 Ivan Podkurkov <[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 "gattserviceinterface.h" |
| 8 |
#include "inputinterface.h" |
| 9 |
#include "objectmanager.h" |
| 10 |
|
| 11 |
#include <QDBusArgument> |
| 12 |
#include <QDBusConnection> |
| 13 |
#include <QDBusMessage> |
| 14 |
|
| 15 |
// GattServiceObject |
| 16 |
GattServiceObject::GattServiceObject(const QDBusObjectPath &path, QObject *parent) |
| 17 |
: QObject(parent) |
| 18 |
{ |
| 19 |
QDBusConnection::sessionBus().registerObject(path.path(), this); |
| 20 |
} |
| 21 |
|
| 22 |
// GattServiceInterface |
| 23 |
GattServiceInterface::GattServiceInterface(const QDBusObjectPath &path, const QVariantMap &properties, QObject *parent) |
| 24 |
: QDBusAbstractAdaptor(parent) |
| 25 |
{ |
| 26 |
setPath(path); |
| 27 |
setObjectParent(parent); |
| 28 |
setProperties(properties); |
| 29 |
setName(QStringLiteral("org.bluez.GattService1")); |
| 30 |
} |
| 31 |
|
| 32 |
QString GattServiceInterface::UUID() const |
| 33 |
{ |
| 34 |
return Object::property(QStringLiteral("UUID")).toString(); |
| 35 |
} |
| 36 |
|
| 37 |
bool GattServiceInterface::primary() const |
| 38 |
{ |
| 39 |
return Object::property(QStringLiteral("Primary")).toBool(); |
| 40 |
} |
| 41 |
|
| 42 |
QDBusObjectPath GattServiceInterface::device() const |
| 43 |
{ |
| 44 |
return Object::property(QStringLiteral("Device")).value<QDBusObjectPath>(); |
| 45 |
} |
| 46 |
|
| 47 |
QList<QDBusObjectPath> GattServiceInterface::includes() const |
| 48 |
{ |
| 49 |
return Object::property(QStringLiteral("Includes")).value<QList<QDBusObjectPath>>(); |
| 50 |
} |
| 51 |
|
| 52 |
quint16 GattServiceInterface::handle() const |
| 53 |
{ |
| 54 |
return Object::property(QStringLiteral("Handle")).value<quint16>(); |
| 55 |
} |
| 56 |
|
| 57 |
void GattServiceInterface::setHandle(const quint16 handle) |
| 58 |
{ |
| 59 |
Object::changeProperty(QStringLiteral("Handle"), QVariant::fromValue(handle)); |
| 60 |
} |
| 61 |
|
| 62 |
#include "moc_gattserviceinterface.cpp" |