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 QLOWENERGYSERVICEDATA_H
5#define QLOWENERGYSERVICEDATA_H
6
7#include <QtBluetooth/qtbluetoothglobal.h>
8#include <QtCore/qshareddata.h>
9
10QT_BEGIN_NAMESPACE
11
12class QBluetoothUuid;
13class QLowEnergyCharacteristicData;
14class QLowEnergyService;
15struct QLowEnergyServiceDataPrivate;
16
17class Q_BLUETOOTH_EXPORT QLowEnergyServiceData
18{
19public:
20 QLowEnergyServiceData();
21 QLowEnergyServiceData(const QLowEnergyServiceData &other);
22 ~QLowEnergyServiceData();
23
24 QLowEnergyServiceData &operator=(const QLowEnergyServiceData &other);
25 friend bool operator==(const QLowEnergyServiceData &a, const QLowEnergyServiceData &b)
26 {
27 return equals(a, b);
28 }
29 friend bool operator!=(const QLowEnergyServiceData &a, const QLowEnergyServiceData &b)
30 {
31 return !equals(a, b);
32 }
33
34 enum ServiceType { ServiceTypePrimary = 0x2800, ServiceTypeSecondary = 0x2801 };
35 ServiceType type() const;
36 void setType(ServiceType type);
37
38 QBluetoothUuid uuid() const;
39 void setUuid(const QBluetoothUuid &uuid);
40
41 QList<QLowEnergyService *> includedServices() const;
42 void setIncludedServices(const QList<QLowEnergyService *> &services);
43 void addIncludedService(QLowEnergyService *service);
44
45 QList<QLowEnergyCharacteristicData> characteristics() const;
46 void setCharacteristics(const QList<QLowEnergyCharacteristicData> &characteristics);
47 void addCharacteristic(const QLowEnergyCharacteristicData &characteristic);
48
49 bool isValid() const;
50
51 void swap(QLowEnergyServiceData &other) noexcept { d.swap(other&: other.d); }
52
53private:
54 static bool equals(const QLowEnergyServiceData &a, const QLowEnergyServiceData &b);
55 QSharedDataPointer<QLowEnergyServiceDataPrivate> d;
56};
57
58Q_DECLARE_SHARED(QLowEnergyServiceData)
59
60QT_END_NAMESPACE
61
62#endif // Include guard.
63

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