Debian Codegraph @

src/gattdescriptorremote.cpp

raw
1 /*
2 * BluezQt - Asynchronous Bluez wrapper library
3 *
4 * SPDX-FileCopyrightText: 2021 Ivan Podkurkov <[email protected]>
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
14 namespace BluezQt {
15
16 GattDescriptorRemote::GattDescriptorRemote(const QString &path, const QVariantMap &properties, GattCharacteristicRemotePtr characteristic)
17 : QObject()
18 , d(new GattDescriptorRemotePrivate(path, properties, characteristic))
19 {
20 }
21
22 GattDescriptorRemote::~GattDescriptorRemote()
23 {
24 }
25
26 GattDescriptorRemotePtr GattDescriptorRemote::toSharedPtr() const
27 {
28 return d->q.toStrongRef();
29 }
30
31 QString GattDescriptorRemote::ubi() const
32 {
33 return d->m_bluezGattDescriptor->path();
34 }
35
36 QString GattDescriptorRemote::uuid() const
37 {
38 return d->m_uuid;
39 }
40
41 QByteArray GattDescriptorRemote::value() const
42 {
43 return d->m_value;
44 }
45
46 QStringList GattDescriptorRemote::flags() const
47 {
48 return d->m_flags;
49 }
50
51 quint16 GattDescriptorRemote::handle() const
52 {
53 return d->m_handle;
54 }
55
56 PendingCall* GattDescriptorRemote::setHandle(quint16 handle)
57 {
58 return new PendingCall(d->setDBusProperty(QStringLiteral("Handle"), QVariant::fromValue(handle)), PendingCall::ReturnVoid, this);
59 }
60
61 GattCharacteristicRemotePtr GattDescriptorRemote::characteristic() const
62 {
63 return d->m_characteristic;
64 }
65
66 PendingCall *GattDescriptorRemote::readValue(const QVariantMap &options)
67 {
68 return new PendingCall(d->m_bluezGattDescriptor->ReadValue(options), PendingCall::ReturnByteArray, this);
69 }
70
71 PendingCall *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"