1// Copyright (C) 2022 Intel Corporation.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#define QT_BLUETOOTH_BUILD_REMOVED_API
5
6// Undefine Qt 128-bit int types
7#define QT_NO_INT128
8
9#include "qtbluetoothglobal.h"
10
11QT_USE_NAMESPACE
12
13#if QT_BLUETOOTH_REMOVED_SINCE(6, 6)
14
15#include "qbluetoothaddress.h" // inlined API
16
17#include "qbluetoothuuid.h"
18
19static_assert(std::is_aggregate_v<quint128>);
20static_assert(std::is_trivial_v<quint128>);
21
22// These legacy functions can't just call the new (quint128, Endian) overloads,
23// as the latter may see either QtCore's quint128 (__int128 built-in) _or_ our
24// fake version from qbluetoothuuid.h. This TU must _always_ see the fake ones
25// (as that is what we had in 6.5):
26#ifdef QT_SUPPORTS_INT128
27# error This TU requires QT_NO_INT128 to be defined.
28#endif
29
30QBluetoothUuid::QBluetoothUuid(quint128 uuid)
31 : QUuid(fromBytes(bytes: uuid.data))
32{}
33
34quint128 QBluetoothUuid::toUInt128() const
35{
36 quint128 uuid;
37 const auto bytes = toBytes();
38 memcpy(dest: uuid.data, src: bytes.data, n: sizeof(uuid.data));
39 return uuid;
40}
41
42// END quint128 functions
43
44QBluetoothUuid::QBluetoothUuid(const QString &uuid)
45 : QUuid(qToAnyStringViewIgnoringNull(s: uuid))
46{
47}
48
49#ifndef QT_NO_DEBUG_STREAM
50QDebug QBluetoothUuid::streamingOperator(QDebug debug, const QBluetoothUuid &uuid)
51{
52 debug << uuid.toString();
53 return debug;
54}
55#endif // QT_NO_DEBUG_STREAM
56
57#endif // QT_BLUETOOTH_REMOVED_SINCE(6, 6)
58

source code of qtconnectivity/src/bluetooth/removed_api.cpp