1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5 \page qtnfc-changes-qt6.html
6 \title Changes to Qt NFC
7 \ingroup changes-qt-5-to-6
8 \brief Migrate Qt NFC 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 Qt NFC, and provide guidance
20 \section1 New Features and Methods
22 \section2 Added \l QNdefRecord::clear()
24 Use this method to clear an NDEF record.
26 \section2 Added \l QNdefFilter::match()
28 Use this method to check if a \l QNdefMessage matches the given filter.
29 The method returns \c true in case of successful match and \c false
32 \section2 Extended \l QNearFieldTarget::Type
34 The enum was extended with two more types:
36 \li \l QNearFieldTarget::NfcTagType4A
37 \li \l QNearFieldTarget::NfcTagType4B
40 \section1 Changes in the Features and Methods
42 \section2 Renamed QNearFieldManager::isAvailable()
44 The \c QNearFieldManager::isAvailable() was renamed to
45 \l QNearFieldManager::isEnabled().
47 \section2 Added access method argument to \l QNearFieldManager::isSupported
49 The \c accessMethod argument allows to check if a specific feature is
50 supported. This is relevant because different platforms or versions of
51 operating systems can support different options.
53 \section2 Added access method argument to \l QNearFieldManager::startTargetDetection
55 The \c accessMethod argument allows to scan for NFC tags with the given
58 \section2 Changed \l QNdefNfcSmartPosterRecord::typeInfo from \l QByteArray to \l QString
60 According to NDEF Smart Poster specification, the type is a UTF-8 formatted
62 This affects the \l QNdefNfcSmartPosterRecord::typeInfo() and
63 \l QNdefNfcSmartPosterRecord::setTypeInfo() methods.
65 \section2 Updated return type of \l QNdefFilter::appendRecord
67 \l QNdefFilter::appendRecord now performs a basic validation of input
68 parameters and returns a boolean value indicating if the record is appended
71 \section1 Removed Features and Methods
73 \section2 Removed QNearFieldTarget::url
75 The method was never implemented in the existing subclasses of
78 \section2 Removed QNearFieldTarget::sendCommands
80 In Qt 5, the method was not very helpful because it didn't provide a way to
81 track the results of intermediate commands. Normally, an additional command
82 needs to be sent only when the previous command is successfully executed.
84 The correct approach would be to manually create a queue of commands,
85 use \l QNearFieldTarget::sendCommand to send a command and
86 \l QNearFieldTarget::requestCompleted or \l QNearFieldTarget::error to
87 handle the results of each command individually.
89 \section2 Removed QNearFieldTarget::keepConnection
91 The methods \c QNearFieldTarget::keepConnection() and
92 \c QNearFieldTarget::setKeepConnection() were removed. Keeping the
93 connection is the default behavior for now.
95 \section2 Removed QNearFieldTarget::isProcessingCommand
97 The method was never implemented and always returned \c false.
99 \section2 Made QNearFieldTarget::setResponseForRequest private API
101 The method should not be exposed as a public API. Use
102 \l QNearFieldTarget::ndefMessageRead or \l QNearFieldTarget::requestResponse
103 to read the data from an NFC tag.
105 \section2 Removed QNearFieldTarget::handleResponse
107 The method was removed as it just forwarded the call to
108 \c QNearFieldManager::setResponseForRequest, which became private API.
110 \section2 Made QNearFieldTarget::reportError private API
112 A \l QNearFieldTarget::error signal can be used instead.
114 \section2 Removed QNearFieldTarget::ndefMessagesWritten signal
116 The \l QNearFieldTarget::requestCompleted signal is used for both NDEF
117 messages and custom commands. The \c id parameter can be used to check which
118 request is actually completed.
120 \section2 Removed QNearFieldManager::(un)registerNdefMessageHandler
122 The methods \c QNearFieldTarget::registerNdefMessageHandler and
123 \c QNearFieldTarget::unregisterNdefMessageHandler were removed.
125 Use \l QNearFieldTarget::ndefMessageRead() and \l QNdefFilter::match() to
126 detect the NDEF messages and filter the required ones.
128 \note The application can still be automatically started once the NDEF Tag
129 is touched. The \l {annotatedurl}{Annotated URL} example shows how to
130 achieve it on Android.
132 \section2 Removed QNearFieldManager::TargetAccessModes
134 The \c TargetAccessModes enum was removed together with the getter and
135 setter methods (\c QNearFieldManager::setTargetAccessModes() and
136 \c {QNearFieldManager::targetAccessModes()}).
138 The feature is not supported on Android and iOS platforms.
140 \section2 Removed QNearFieldShareManager and QNearFieldShareTarget
142 File sharing via NFC is deprecated on Android in API 29. Other technologies
143 should be used instead.
145 \section2 Removed QML API
147 The support for QML API is discontinued.