1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5 \page qtbluetooth-changes-qt6.html
6 \title Changes to Qt Bluetooth
7 \ingroup changes-qt-5-to-6
8 \brief Migrate QtBluetooth to Qt 6.
10 Qt 6 is a result of the conscious effort to make the framework more
11 efficient and easy to use.
13 We try to maintain binary and source compatibility for all the public
14 APIs in each release. But some changes were inevitable in an effort to
15 make Qt a better framework.
17 In this topic we summarize those changes in QtBluetooth, and provide guidance
23 \li qbluetoothglobal.h was removed. qtbluetoothglobal.h is the official header with the same purpose.
25 \li Every usage of QVector has been replaced by QList.
27 \li Win32 backend has been removed. There will not be a working Bluetooth backend when Qt is built with mingw.
29 \li Since there is now only one Windows backend, the logging category qt.bluetooth.winrt was removed.
30 The corresponding log messages are now in qt.bluetooth.windows.
33 \section1 QBluetooth namespace
35 The enums QBluetooth::Security and QBluetooth::AttAccessConstraint have been changed
36 to a scoped enums for improved type safety.
38 \section1 QBluetoothDeviceDiscoveryAgent
40 QBluetoothDeviceDiscoveryAgent::inquiryType property and related setter/getter & enum were removed.
41 The API element was never implemented and/or supported.
43 \section1 QBluetoothDeviceInfo
46 \li manufacturerData() returns a QMultiHash rather than QHash. Since Qt 6
47 QMultiHash is no longer derived from QHash.
49 \li DataCompleteness was removed without replacement as the related API elements
50 no longer served a purpose
52 \li setServiceUuids(const QList<QBluetoothUuid>, DataCompleteness) was replaced by
53 setServiceUuids(const QList<QBluetoothUuid> &uuids)
55 \li DataCompleteness serviceUuidsCompleteness() const was removed without replacement.
57 \li QList<QBluetoothUuid> serviceUuids(DataCompleteness *completeness = nullptr) const was replaced by
58 QList<QBluetoothUuid> serviceUuids() const.
61 \section1 QBluetoothLocalDevice
63 The pairing agent related API was removed without replacement. This includes pairingConfirmation(bool),
64 pairingDisplayPinCode(..) & pairingDisplayConfirmation(..). Except for Android and BlueZ 4 there was
65 never an implementation for it. Bluez 4 support was removed in Qt 6 and Android's implementation
66 required unobtainable BLUETOOTH_PRIVILEGED for at least parts of the code.
68 \section1 QLowEnergyService
70 Renamed ServiceState enum values:
72 \li \l{QLowEnergyService::DiscoveryRequired}{DiscoveryRequired} becomes \l{QLowEnergyService::RemoteService}{RemoteService}
73 \li \l{QLowEnergyService::DiscoveringService}{DiscoveringService} becomes \l{QLowEnergyService::RemoteServiceDiscovering}{RemoteServiceDiscovering}
74 \li \l{QLowEnergyService::ServiceDiscovered}{ServiceDiscovered} becomes \l{QLowEnergyService::RemoteServiceDiscovered}{RemoteServiceDiscovered}
76 This change happens in anticipation that service discovery might become an optional
79 \section1 QBluetoothUuid
81 enums \l{QBluetoothUuid::ProtocolUuid}{ProtocolUuid},
82 \l{QBluetoothUuid::ServiceClassUuid}{ServiceClassUuid},
83 \l{QBluetoothUuid::CharacteristicType}{CharacteristicType}, and
84 \l{QBluetoothUuid::DescriptorType}{DescriptorType} are now scoped enums.
85 The usage of enum items has to be adapted in user code.
87 \section1 QLowEnergyController
90 \li Existing ctors and create*() functions with remote QBluetoothAddress parameters have been removed. QBluetoothAddress
91 is not sufficient to indicate remote devices on Apple systems. It requires UUIDs to "name" devices. This can only
92 be satisfied by QBluetoothDeviceInfo.
94 \li Remaining QLowEnergyController ctors have been made private. The createPeripheral() and createCentral() functions
95 should be used to obtain QLowEnergyController instances.
98 \section1 QLowEnergyCharacteristic
101 \li The new method clientCharacteristicConfiguration() has been introduced to conveniently obtain the
102 Client Characteristic Configuration Descriptor.
104 \l{QLowEnergyCharacteristic::CCCDDisable}{CCCDDisable},
105 \l{QLowEnergyCharacteristic::CCCDEnableNotification}{CCCDEnableNotification}, and
106 \l{QLowEnergyCharacteristic::CCCDEnableIndication}{CCCDEnableIndication} have been introduced
107 which hold the possible values for the Client Characteristic Configuration Descriptor.
108 \li The handle() method is no longer part of the public Bluetooth LE interfaces. It's purpose as identifier
109 for characteristics was replaced. The QLowEnergyCharacteristic instances itself serve as identifier.
112 \section1 QLowEnergyDescriptor
114 The handle() method is no longer part of the public Bluetooth LE interfaces. It's purpose as identifier
115 for descriptors was replaced. The QLowEnergyDescriptor instances itself serve as identifier.
117 \section1 QBluetoothTransferManager
119 QBluetoothTransferManager, QBluetoothTransferRequest, and QBluetoothTransferReply have been removed
122 \section1 QBluetoothSocket
124 QBluetoothSocket::SocketState and QBluetoothSocket::SocketError are now scoped enums. The usage of enum
125 items has to be adapted in user code.
127 \section1 QML Interface
129 The QML interface has been removed because socket programming via QML is not advisable.
130 QDeclarativeBluetoothService, QDeclarativeBluetoothSocket, and QDeclarativeBluetoothDiscoveryModel
131 (in QML: BluetoothService, BluetoothSocket, and BluetoothDiscoveryModel)
132 have been removed without replacement.
134 \section1 "error" signals
136 The "error" signals in QBluetoothDeviceDiscoveryAgent, QBluetoothLocalDevice, QBluetoothServer,
137 QBluetoothServiceDiscoveryAgent, QBluetoothSocket, QLowEnergyController, and QLowEnergyService
138 have been renamed to "errorOccurred" to remove ambiguities between the "error" signal and the