1/*
2 * BluezQt - Asynchronous Bluez wrapper library
3 *
4 * SPDX-FileCopyrightText: 2021 Ivan Podkurkov <podkiva2@gmail.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#include "gattdescriptorremote.h"
10#include "gattdescriptorremote_p.h"
11#include "pendingcall.h"
12#include "utils.h"
13
14namespace BluezQt {
15
16GattDescriptorRemote::GattDescriptorRemote(const QString &path, const QVariantMap &properties, GattCharacteristicRemotePtr characteristic)
17 : QObject()
18 , d(new GattDescriptorRemotePrivate(path, properties, characteristic))
19{
20}
21
22GattDescriptorRemote::~GattDescriptorRemote()
23{
24}
25
26GattDescriptorRemotePtr GattDescriptorRemote::toSharedPtr() const
27{
28 return d->q.toStrongRef();
29}
30
31QString GattDescriptorRemote::ubi() const
32{
33 return d->m_bluezGattDescriptor->path();
34}
35
36QString GattDescriptorRemote::uuid() const
37{
38 return d->m_uuid;
39}
40
41QByteArray GattDescriptorRemote::value() const
42{
43 return d->m_value;
44}
45
46QStringList GattDescriptorRemote::flags() const
47{
48 return d->m_flags;
49}
50
51quint16 GattDescriptorRemote::handle() const
52{
53 return d->m_handle;
54}
55
56PendingCall* GattDescriptorRemote::setHandle(quint16 handle)
57{
58 return new PendingCall(d->setDBusProperty(QStringLiteral("Handle"), QVariant::fromValue(handle)), PendingCall::ReturnVoid, this);
59}
60
61GattCharacteristicRemotePtr GattDescriptorRemote::characteristic() const
62{
63 return d->m_characteristic;
64}
65
66PendingCall *GattDescriptorRemote::readValue(const QVariantMap &options)
67{
68 return new PendingCall(d->m_bluezGattDescriptor->ReadValue(options), PendingCall::ReturnByteArray, this);
69}
70
71PendingCall *GattDescriptorRemote::writeValue(const QByteArray &value, const QVariantMap &options)
72{
73 return new PendingCall(d->m_bluezGattDescriptor->WriteValue(value,options), PendingCall::ReturnVoid, this);
74}
75
76} // namespace BluezQt
77
78#include "moc_gattdescriptorremote.cpp"
79

source code of bluez-qt/src/gattdescriptorremote.cpp