BluezQt

gattdescriptorremote.cpp
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 
23 {
24 }
25 
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 
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
PendingCall * writeValue(const QByteArray &value, const QVariantMap &options)
Write the value of the GATT descriptor.
QVariant fromValue(const T &value)
KGuiItem properties()
PendingCall * setHandle(quint16 handle)
Sets the descriptor handle.
PendingCall * readValue(const QVariantMap &options)
Read the value of the GATT descriptor.
~GattDescriptorRemote() override
Destroys a GattDescriptor object.
GattDescriptorRemotePtr toSharedPtr() const
Returns a shared pointer from this.
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Sep 25 2022 04:19:10 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.