BluezQt

gattcharacteristicremote.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 "gattcharacteristicremote.h"
10 #include "gattcharacteristicremote_p.h"
11 #include "pendingcall.h"
12 #include "utils.h"
13 
14 namespace BluezQt
15 {
16 
17 GattCharacteristicRemote::GattCharacteristicRemote(const QString &path, const QVariantMap &properties, GattServiceRemotePtr service)
18  : QObject()
19  , d(new GattCharacteristicRemotePrivate(path, properties, service))
20 {
21 }
22 
24 {
25 }
26 
28 {
29  return d->q.toStrongRef();
30 }
31 
32 QString GattCharacteristicRemote::ubi() const
33 {
34  return d->m_bluezGattCharacteristic->path();
35 }
36 
37 QString GattCharacteristicRemote::uuid() const
38 {
39  return d->m_uuid;
40 }
41 
42 QByteArray GattCharacteristicRemote::value() const
43 {
44  return d->m_value;
45 }
46 
48 {
49  return d->m_writeAcquired;
50 }
51 
53 {
54  return d->m_notifyAcquired;
55 }
56 
58 {
59  return d->m_notifying;
60 }
61 
62 QStringList GattCharacteristicRemote::flags() const
63 {
64  return d->m_flags;
65 }
66 
67 GattServiceRemotePtr GattCharacteristicRemote::service() const
68 {
69  return d->m_service;
70 }
71 
72 QList<GattDescriptorRemotePtr> GattCharacteristicRemote::descriptors() const
73 {
74  return d->m_descriptors;
75 }
76 
77 quint16 GattCharacteristicRemote::handle() const
78 {
79  return d->m_handle;
80 }
81 
83 {
84  return new PendingCall(d->setDBusProperty(QStringLiteral("Handle"), QVariant::fromValue(handle)), PendingCall::ReturnVoid, this);
85 }
86 
87 quint16 GattCharacteristicRemote::MTU() const
88 {
89  return d->m_MTU;
90 }
91 
93 {
94  return new PendingCall(d->m_bluezGattCharacteristic->ReadValue(options), PendingCall::ReturnByteArray, this);
95 }
96 
97 PendingCall *GattCharacteristicRemote::writeValue(const QByteArray &value, const QVariantMap &options)
98 {
99  return new PendingCall(d->m_bluezGattCharacteristic->WriteValue(value,options), PendingCall::ReturnVoid, this);
100 }
101 
103 {
104  return new PendingCall(d->m_bluezGattCharacteristic->StartNotify(), PendingCall::ReturnVoid, this);
105 }
106 
108 {
109  return new PendingCall(d->m_bluezGattCharacteristic->StopNotify(), PendingCall::ReturnVoid, this);
110 }
111 
113 {
114  return new PendingCall(d->m_bluezGattCharacteristic->Confirm(), PendingCall::ReturnVoid, this);
115 }
116 
117 } // namespace BluezQt
QVariant fromValue(const T &value)
KGuiItem properties()
bool isWriteAcquired() const
Returns whether writeAcquired for the characteristic.
PendingCall * setHandle(quint16 handle)
Sets the characteristic handle.
PendingCall * stopNotify()
Stop notifying the value of the GATT characteristic.
~GattCharacteristicRemote() override
Destroys a GattCharacteristic object.
PendingCall * confirm()
Confirmation that value of the characteristic was received.
PendingCall * readValue(const QVariantMap &options)
Read the value of the GATT characteristic.
PendingCall * startNotify()
Start notifying the value of the GATT characteristic.
GattCharacteristicRemotePtr toSharedPtr() const
Returns a shared pointer from this.
bool isNotifying() const
Returns whether the characteristic is notifying.
bool isNotifyAcquired() const
Returns whether notifyAcquired for the characteristic.
PendingCall * writeValue(const QByteArray &value, const QVariantMap &options)
Write the value of the GATT characteristic.
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.