File indexing completed on 2024-12-01 12:29:48

0001 /*
0002  * BluezQt - Asynchronous Bluez wrapper library
0003  *
0004  * SPDX-FileCopyrightText: 2021 Ivan Podkurkov <podkiva2@gmail.com>
0005  *
0006  * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0007  */
0008 
0009 #include "gattserviceremote.h"
0010 #include "gattserviceremote_p.h"
0011 #include "device.h"
0012 #include "device_p.h"
0013 #include "pendingcall.h"
0014 #include "utils.h"
0015 
0016 namespace BluezQt
0017 {
0018 
0019 GattServiceRemote::GattServiceRemote(const QString &path, const QVariantMap &properties, DevicePtr adapter)
0020     : QObject()
0021     , d(new GattServiceRemotePrivate(path, properties, adapter))
0022 {
0023 }
0024 
0025 GattServiceRemote::~GattServiceRemote()
0026 {
0027 }
0028 
0029 GattServiceRemotePtr GattServiceRemote::toSharedPtr() const
0030 {
0031     return d->q.toStrongRef();
0032 }
0033 
0034 QString GattServiceRemote::ubi() const
0035 {
0036     return d->m_bluezGattService->path();
0037 }
0038 
0039 QString GattServiceRemote::uuid() const
0040 {
0041     return d->m_uuid;
0042 }
0043 
0044 bool GattServiceRemote::isPrimary() const
0045 {
0046     return d->m_primary;
0047 }
0048 
0049 DevicePtr GattServiceRemote::device() const
0050 {
0051     return d->m_device;
0052 }
0053 
0054 QList<QDBusObjectPath> GattServiceRemote::includes() const
0055 {
0056     return d->m_includes;
0057 }
0058 
0059 quint16 GattServiceRemote::handle() const
0060 {
0061     return d->m_handle;
0062 }
0063 
0064 PendingCall* GattServiceRemote::setHandle(quint16 handle)
0065 {
0066     return new PendingCall(d->setDBusProperty(QStringLiteral("Handle"), QVariant::fromValue(handle)), PendingCall::ReturnVoid, this);
0067 }
0068 
0069 QList<GattCharacteristicRemotePtr> GattServiceRemote::characteristics() const
0070 {
0071     return d->m_characteristics;
0072 }
0073 
0074 } // namespace BluezQt
0075 
0076 #include "moc_gattserviceremote.cpp"