1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2016 BlackBerry Limited. All rights reserved.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4
5#ifndef QLOWENERGYDESCRIPTOR_H
6#define QLOWENERGYDESCRIPTOR_H
7
8#include <QtCore/QSharedPointer>
9#include <QtCore/QVariantMap>
10#include <QtBluetooth/qbluetooth.h>
11#include <QtBluetooth/QBluetoothUuid>
12
13QT_BEGIN_NAMESPACE
14
15struct QLowEnergyDescriptorPrivate;
16class QLowEnergyServicePrivate;
17
18class Q_BLUETOOTH_EXPORT QLowEnergyDescriptor
19{
20public:
21 QLowEnergyDescriptor();
22 QLowEnergyDescriptor(const QLowEnergyDescriptor &other);
23 ~QLowEnergyDescriptor();
24
25 QLowEnergyDescriptor &operator=(const QLowEnergyDescriptor &other);
26 friend bool operator==(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b)
27 {
28 return equals(a, b);
29 }
30 friend bool operator!=(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b)
31 {
32 return !equals(a, b);
33 }
34
35 bool isValid() const;
36
37 QByteArray value() const;
38
39 QBluetoothUuid uuid() const;
40 QString name() const;
41
42 QBluetoothUuid::DescriptorType type() const;
43
44private:
45 QLowEnergyHandle handle() const;
46 QLowEnergyHandle characteristicHandle() const;
47 QSharedPointer<QLowEnergyServicePrivate> d_ptr;
48
49 friend class QLowEnergyCharacteristic;
50 friend class QLowEnergyService;
51 friend class QLowEnergyControllerPrivate;
52 friend class QLowEnergyControllerPrivateAndroid;
53 friend class QLowEnergyControllerPrivateBluez;
54 friend class QLowEnergyControllerPrivateBluezDBus;
55 friend class QLowEnergyControllerPrivateCommon;
56 friend class QLowEnergyControllerPrivateDarwin;
57 friend class QLowEnergyControllerPrivateWinRT;
58 QLowEnergyDescriptorPrivate *data = nullptr;
59
60 QLowEnergyDescriptor(QSharedPointer<QLowEnergyServicePrivate> p,
61 QLowEnergyHandle charHandle,
62 QLowEnergyHandle descHandle);
63
64 static bool equals(const QLowEnergyDescriptor &a, const QLowEnergyDescriptor &b);
65};
66
67QT_END_NAMESPACE
68
69QT_DECL_METATYPE_EXTERN(QLowEnergyDescriptor, Q_BLUETOOTH_EXPORT)
70
71#endif // QLOWENERGYDESCRIPTOR_H
72

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