1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QLOWENERGYDESCRIPTORDATA_H
5#define QLOWENERGYDESCRIPTORDATA_H
6
7#include <QtBluetooth/qbluetooth.h>
8#include <QtBluetooth/qbluetoothuuid.h>
9#include <QtCore/qshareddata.h>
10
11QT_BEGIN_NAMESPACE
12
13class QByteArray;
14struct QLowEnergyDescriptorDataPrivate;
15
16class Q_BLUETOOTH_EXPORT QLowEnergyDescriptorData
17{
18public:
19 QLowEnergyDescriptorData();
20 QLowEnergyDescriptorData(const QBluetoothUuid &uuid,
21 const QByteArray &value);
22 QLowEnergyDescriptorData(const QLowEnergyDescriptorData &other);
23 ~QLowEnergyDescriptorData();
24
25 QLowEnergyDescriptorData &operator=(const QLowEnergyDescriptorData &other);
26 friend bool operator==(const QLowEnergyDescriptorData &a, const QLowEnergyDescriptorData &b)
27 {
28 return equals(a, b);
29 }
30
31 friend bool operator!=(const QLowEnergyDescriptorData &a, const QLowEnergyDescriptorData &b)
32 {
33 return !equals(a, b);
34 }
35
36 QByteArray value() const;
37 void setValue(const QByteArray &value);
38
39 QBluetoothUuid uuid() const;
40 void setUuid(const QBluetoothUuid &uuid);
41
42 bool isValid() const;
43
44 void setReadPermissions(bool readable,
45 QBluetooth::AttAccessConstraints constraints = QBluetooth::AttAccessConstraints());
46 bool isReadable() const;
47 QBluetooth::AttAccessConstraints readConstraints() const;
48
49 void setWritePermissions(bool writable,
50 QBluetooth::AttAccessConstraints constraints = QBluetooth::AttAccessConstraints());
51 bool isWritable() const;
52 QBluetooth::AttAccessConstraints writeConstraints() const;
53
54 void swap(QLowEnergyDescriptorData &other) noexcept { d.swap(other&: other.d); }
55
56private:
57 static bool equals(const QLowEnergyDescriptorData &a, const QLowEnergyDescriptorData &b);
58 QSharedDataPointer<QLowEnergyDescriptorDataPrivate> d;
59};
60
61Q_DECLARE_SHARED(QLowEnergyDescriptorData)
62
63QT_END_NAMESPACE
64
65#endif // Include guard.
66

source code of qtconnectivity/src/bluetooth/qlowenergydescriptordata.h