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 | |
10 | QT_BEGIN_NAMESPACE |
11 | |
12 | class QBluetoothUuid; |
13 | class QLowEnergyCharacteristicData; |
14 | class QLowEnergyService; |
15 | struct QLowEnergyServiceDataPrivate; |
16 | |
17 | class Q_BLUETOOTH_EXPORT QLowEnergyServiceData |
18 | { |
19 | public: |
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 | |
53 | private: |
54 | static bool equals(const QLowEnergyServiceData &a, const QLowEnergyServiceData &b); |
55 | QSharedDataPointer<QLowEnergyServiceDataPrivate> d; |
56 | }; |
57 | |
58 | Q_DECLARE_SHARED(QLowEnergyServiceData) |
59 | |
60 | QT_END_NAMESPACE |
61 | |
62 | #endif // Include guard. |
63 |