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#ifndef QLOWENERGYCHARACTERISTICDATA_H
4#define QLOWENERGYCHARACTERISTICDATA_H
5
6#include <QtBluetooth/qlowenergycharacteristic.h>
7#include <QtCore/qshareddata.h>
8
9QT_BEGIN_NAMESPACE
10
11class QLowEnergyDescriptorData;
12struct QLowEnergyCharacteristicDataPrivate;
13class Q_BLUETOOTH_EXPORT QLowEnergyCharacteristicData
14{
15public:
16 QLowEnergyCharacteristicData();
17 QLowEnergyCharacteristicData(const QLowEnergyCharacteristicData &other);
18 ~QLowEnergyCharacteristicData();
19
20 QLowEnergyCharacteristicData &operator=(const QLowEnergyCharacteristicData &other);
21 friend bool operator==(const QLowEnergyCharacteristicData &a,
22 const QLowEnergyCharacteristicData &b)
23 {
24 return equals(a, b);
25 }
26 friend bool operator!=(const QLowEnergyCharacteristicData &a,
27 const QLowEnergyCharacteristicData &b)
28 {
29 return !equals(a, b);
30 }
31
32 QBluetoothUuid uuid() const;
33 void setUuid(const QBluetoothUuid &uuid);
34
35 QByteArray value() const;
36 void setValue(const QByteArray &value);
37
38 QLowEnergyCharacteristic::PropertyTypes properties() const;
39 void setProperties(QLowEnergyCharacteristic::PropertyTypes properties);
40
41 QList<QLowEnergyDescriptorData> descriptors() const;
42 void setDescriptors(const QList<QLowEnergyDescriptorData> &descriptors);
43 void addDescriptor(const QLowEnergyDescriptorData &descriptor);
44
45 void setReadConstraints(QBluetooth::AttAccessConstraints constraints);
46 QBluetooth::AttAccessConstraints readConstraints() const;
47
48 void setWriteConstraints(QBluetooth::AttAccessConstraints constraints);
49 QBluetooth::AttAccessConstraints writeConstraints() const;
50
51 void setValueLength(int minimum, int maximum);
52 int minimumValueLength() const;
53 int maximumValueLength() const;
54
55 bool isValid() const;
56
57 void swap(QLowEnergyCharacteristicData &other) noexcept { d.swap(other&: other.d); }
58
59private:
60 static bool equals(const QLowEnergyCharacteristicData &a,
61 const QLowEnergyCharacteristicData &b);
62 QSharedDataPointer<QLowEnergyCharacteristicDataPrivate> d;
63};
64
65Q_DECLARE_SHARED(QLowEnergyCharacteristicData)
66
67QT_END_NAMESPACE
68
69#endif // Include guard.
70

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