BluezQt 5.109.0
gattcharacteristicremote.h
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#ifndef BLUEZQT_GATTCHARACTERISTICREMOTE_H
10#define BLUEZQT_GATTCHARACTERISTICREMOTE_H
11
12#include "bluezqt_export.h"
13#include "gattdescriptorremote.h"
14#include "types.h"
15#include <QList>
16#include <QMap>
17#include <QObject>
18namespace BluezQt
19{
20
21class GattServiceRemote;
22class PendingCall;
23
31class BLUEZQT_EXPORT GattCharacteristicRemote : public QObject
32{
33 Q_OBJECT
34 Q_PROPERTY(QString ubi READ ubi CONSTANT)
35 Q_PROPERTY(QString uuid READ uuid NOTIFY uuidChanged)
36 Q_PROPERTY(QByteArray value READ value NOTIFY valueChanged)
37 Q_PROPERTY(bool writeAcquired READ isWriteAcquired NOTIFY writeAcquiredChanged)
38 Q_PROPERTY(bool notifyAcquired READ isNotifyAcquired NOTIFY notifyAcquiredChanged)
39 Q_PROPERTY(bool notifying READ isNotifying NOTIFY notifyingChanged)
40 Q_PROPERTY(QStringList flags READ flags NOTIFY flagsChanged)
41 Q_PROPERTY(quint16 handle READ handle NOTIFY handleChanged)
42 Q_PROPERTY(quint16 MTU READ MTU NOTIFY MTUChanged)
43 Q_PROPERTY(GattServiceRemotePtr service READ service CONSTANT)
44 Q_PROPERTY(QList<GattDescriptorRemotePtr> descriptors READ descriptors NOTIFY descriptorsChanged)
45
46
47public:
52
58 GattCharacteristicRemotePtr toSharedPtr() const;
59
67 QString ubi() const;
68
74 QString uuid() const;
75
81 QByteArray value() const;
82
88 bool isWriteAcquired() const;
89
95 bool isNotifyAcquired() const;
96
102 bool isNotifying() const;
103
109 QStringList flags() const;
110
116 quint16 handle() const;
117
124 PendingCall *setHandle(quint16 handle);
125
131 quint16 MTU() const;
132
138 GattServiceRemotePtr service() const;
139
146 QList<GattDescriptorRemotePtr> descriptors() const;
147
148public Q_SLOTS:
160 PendingCall *readValue(const QVariantMap &options);
161
172 PendingCall *writeValue(const QByteArray &value, const QVariantMap &options);
173
186
200
213
214Q_SIGNALS:
218 void characteristicChanged(GattCharacteristicRemotePtr characteristic);
219
223 void gattDescriptorAdded(GattDescriptorRemotePtr descriptor);
224
228 void descriptorsChanged(QList<GattDescriptorRemotePtr> descriptors);
229
233 void gattDescriptorRemoved(GattDescriptorRemotePtr descriptor);
234
238 void gattDescriptorChanged(GattDescriptorRemotePtr descriptor);
239
243 void uuidChanged(const QString &uuid);
244
248 void valueChanged(const QByteArray value);
249
253 void writeAcquiredChanged(bool writeAcquired);
254
258 void notifyAcquiredChanged(bool notifyAcquired);
259
263 void notifyingChanged(bool notifying);
264
268 void flagsChanged(QStringList flags);
269
273 void handleChanged(quint16 handle);
274
278 void MTUChanged(quint16 MTU);
279
280private:
281 BLUEZQT_NO_EXPORT explicit GattCharacteristicRemote(const QString &path, const QVariantMap &properties, GattServiceRemotePtr service);
282
283 const std::unique_ptr<class GattCharacteristicRemotePrivate> d;
284
285 friend class DevicePrivate;
286 friend class GattServiceRemotePrivate;
287 friend class GattCharacteristicRemotePrivate;
288 friend class ManagerPrivate;
289 friend class Adapter;
290};
291
292} // namespace BluezQt
293
294#endif // BLUEZQT_GATTCHARACTERISTICREMOTE_H
Bluetooth adapter.
Definition adapter.h:33
Bluetooth LE GATT characteristic.
Definition gattcharacteristicremote.h:32
void valueChanged(const QByteArray value)
Indicates that characteristic's value have changed.
QString ubi() const
Returns an UBI of the GATT characteristic.
quint16 MTU() const
Returns characteristic MTU.
bool isNotifyAcquired() const
Returns whether notifyAcquired for the characteristic.
PendingCall * confirm()
Confirmation that value of the characteristic was received.
GattServiceRemotePtr service() const
Returns a service that owns that characteristic.
QStringList flags() const
Returns flags the characteristic.
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.
void gattDescriptorAdded(GattDescriptorRemotePtr descriptor)
Indicates that a new descriptor was added (eg.
PendingCall * startNotify()
Start notifying the value of the GATT characteristic.
void characteristicChanged(GattCharacteristicRemotePtr characteristic)
Indicates that at least one of the characteristic's properties have changed.
void MTUChanged(quint16 MTU)
Indicates that characteristic's MTU have changed.
void notifyingChanged(bool notifying)
Indicates that characteristic's notifying state have changed.
GattCharacteristicRemotePtr toSharedPtr() const
Returns a shared pointer from this.
void writeAcquiredChanged(bool writeAcquired)
Indicates that characteristic's writeAcquired state have changed.
void handleChanged(quint16 handle)
Indicates that characteristic's handle have changed.
void uuidChanged(const QString &uuid)
Indicates that characteristic's uuid have changed.
PendingCall * readValue(const QVariantMap &options)
Read the value of the GATT characteristic.
QString uuid() const
Returns an uuid of the characteristic.
PendingCall * setHandle(quint16 handle)
Sets the characteristic handle.
bool isWriteAcquired() const
Returns whether writeAcquired for the characteristic.
void gattDescriptorChanged(GattDescriptorRemotePtr descriptor)
Indicates that at least one of the descriptor's properties have changed.
void notifyAcquiredChanged(bool notifyAcquired)
Indicates that characteristic's notifyAcquired state have changed.
void flagsChanged(QStringList flags)
Indicates that characteristic's flags have changed.
quint16 handle() const
Returns characteristic handle.
void gattDescriptorRemoved(GattDescriptorRemotePtr descriptor)
Indicates that a descriptor was removed.
void descriptorsChanged(QList< GattDescriptorRemotePtr > descriptors)
Indicates that characteristic descriptors list has changed.
QList< GattDescriptorRemotePtr > descriptors() const
Returns object paths representing the included services of this service.
bool isNotifying() const
Returns whether the characteristic is notifying.
QByteArray value() const
Returns an value of the characteristic.
Pending method call.
Definition pendingcall.h:33