BluezQt

gattcharacteristicremote.cpp
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 "gattcharacteristicremote.h"
10#include "gattcharacteristicremote_p.h"
11#include "pendingcall.h"
12#include "utils.h"
13
14namespace BluezQt
15{
16
17GattCharacteristicRemote::GattCharacteristicRemote(const QString &path, const QVariantMap &properties, GattServiceRemotePtr service)
18 : QObject()
19 , d(new GattCharacteristicRemotePrivate(path, properties, service))
20{
21}
22
26
27GattCharacteristicRemotePtr GattCharacteristicRemote::toSharedPtr() const
28{
29 return d->q.toStrongRef();
30}
31
32QString GattCharacteristicRemote::ubi() const
33{
34 return d->m_bluezGattCharacteristic->path();
35}
36
37QString GattCharacteristicRemote::uuid() const
38{
39 return d->m_uuid;
40}
41
42QByteArray 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
62QStringList GattCharacteristicRemote::flags() const
63{
64 return d->m_flags;
65}
66
67GattServiceRemotePtr GattCharacteristicRemote::service() const
68{
69 return d->m_service;
70}
71
72QList<GattDescriptorRemotePtr> GattCharacteristicRemote::descriptors() const
73{
74 return d->m_descriptors;
75}
76
77quint16 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
87quint16 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
97PendingCall *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
118
119#include "moc_gattcharacteristicremote.cpp"
bool isNotifyAcquired() const
Returns whether notifyAcquired for the characteristic.
PendingCall * confirm()
Confirmation that value of the characteristic was received.
PendingCall * stopNotify()
Stop notifying the value of the GATT characteristic.
~GattCharacteristicRemote() override
Destroys a GattCharacteristic object.
PendingCall * writeValue(const QByteArray &value, const QVariantMap &options)
Write 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.
PendingCall * readValue(const QVariantMap &options)
Read the value of the GATT characteristic.
PendingCall * setHandle(quint16 handle)
Sets the characteristic handle.
bool isWriteAcquired() const
Returns whether writeAcquired for the characteristic.
bool isNotifying() const
Returns whether the characteristic is notifying.
Pending method call.
Definition pendingcall.h:35
QString path(const QString &relativePath)
KGuiItem properties()
QVariant fromValue(T &&value)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:56:00 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.