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
23GattCharacteristicRemote::~GattCharacteristicRemote()
24{
25}
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
47bool GattCharacteristicRemote::isWriteAcquired() const
48{
49 return d->m_writeAcquired;
50}
51
52bool GattCharacteristicRemote::isNotifyAcquired() const
53{
54 return d->m_notifyAcquired;
55}
56
57bool GattCharacteristicRemote::isNotifying() const
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
82PendingCall* GattCharacteristicRemote::setHandle(quint16 handle)
83{
84 return new PendingCall(d->setDBusProperty(QStringLiteral("Handle"), value: QVariant::fromValue(value: handle)), PendingCall::ReturnVoid, this);
85}
86
87quint16 GattCharacteristicRemote::MTU() const
88{
89 return d->m_MTU;
90}
91
92PendingCall *GattCharacteristicRemote::readValue(const QVariantMap &options)
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
102PendingCall *GattCharacteristicRemote::startNotify()
103{
104 return new PendingCall(d->m_bluezGattCharacteristic->StartNotify(), PendingCall::ReturnVoid, this);
105}
106
107PendingCall *GattCharacteristicRemote::stopNotify()
108{
109 return new PendingCall(d->m_bluezGattCharacteristic->StopNotify(), PendingCall::ReturnVoid, this);
110}
111
112PendingCall *GattCharacteristicRemote::confirm()
113{
114 return new PendingCall(d->m_bluezGattCharacteristic->Confirm(), PendingCall::ReturnVoid, this);
115}
116
117} // namespace BluezQt
118
119#include "moc_gattcharacteristicremote.cpp"
120

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