BluezQt

gattdescriptor.cpp
1/*
2 * BluezQt - Asynchronous Bluez wrapper library
3 *
4 * SPDX-FileCopyrightText: 2022 Pontus Sjögren
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#include "gattdescriptor.h"
10#include "gattcharacteristic.h"
11#include "gattdescriptor_p.h"
12
13namespace BluezQt
14{
15
16GattDescriptor *GattDescriptor::createUserDescription(QString const &description, GattCharacteristic *characteristic)
17{
18 return new GattDescriptor(QLatin1String("2901"), {QLatin1String("read")}, description.toUtf8(), characteristic);
19}
20
21GattDescriptor::GattDescriptor(const QString &uuid, GattCharacteristic *parent)
22 : GattDescriptor(uuid, {}, {}, parent)
23{
24}
25
26GattDescriptor::GattDescriptor(const QString &uuid, const QStringList &flags, GattCharacteristic *parent)
27 : GattDescriptor(uuid, flags, {}, parent)
28{
29}
30
31GattDescriptor::GattDescriptor(const QString &uuid, const QStringList &flags, const QByteArray &initialValue, GattCharacteristic *parent)
32 : QObject(parent)
33 , d(new GattDescriptorPrivate(uuid, flags, initialValue, parent))
34{
35}
36
38
40{
41 return d->m_value;
42}
43
45{
46 d->m_value = value;
47}
48
50{
51 return d->m_uuid;
52}
53
55{
56 return d->m_characteristic->objectPath();
57}
58
60{
61 return d->m_flags;
62}
63
64QDBusObjectPath GattDescriptor::objectPath() const
65{
66 return d->m_objectPath;
67}
68
69}
70
71#include "moc_gattdescriptor.cpp"
Bluetooth GATT Descriptor.
QString uuid() const
Returns the UUID of the descriptor.
void writeValue(const QByteArray &value)
Writes the value of the descriptor.
QByteArray readValue()
Reads the current value of the descriptor.
static GattDescriptor * createUserDescription(const QString &description, GattCharacteristic *characteristic)
Convenience method to create a User Description for the given charactersitic.
~GattDescriptor() override
Destroys the GattDescriptor.
QDBusObjectPath characteristic() const
Return the DBus object path of the parent characteristic.
QStringList flags() const
Return the flags of the descriptor.
GattDescriptor(const QString &uuid, GattCharacteristic *parent)
Creates a GattDescriptor with the given UUID.
QByteArray toUtf8() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 16:59:47 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.