Qt NFC

NFC API 在启用 NFC 的设备之间提供连接。

Currently, the API is supported on Android and iOS . This module also provides limited access to readers supporting PC/SC specification on Linux, macOS, and Windows.

NFC is a short-range (less than 20 centimeters) wireless technology with a maximum transfer rate of 424 Kbps. NFC is ideal for transferring small packets of data when two devices are placed together.

The NFC module provides APIs for interacting with NFC Forum Tags and NFC Forum Devices. It can detect targets and losses, register NDEF message handlers, read and write NDEF messages on NFC Forum Tags, and send tag-specific commands.

使用模块

使用 Qt 模块的 C++ API 要求直接 (或透过其它依赖) 链接到模块库。几个构建工具对此有专用支持,包括 CMake and qmake .

构建采用 CMake

使用 find_package() 命令定位所需模块组件在 Qt6 包:

find_package(Qt6 REQUIRED COMPONENTS Nfc)
target_link_libraries(mytarget PRIVATE Qt6::Nfc)
					

更多细节,见 构建采用 CMake 概述。

采用 qmake 构建

要配置采用 qmake 构建模块,添加模块作为值为 QT 变量在工程的 .pro 文件:

QT += nfc
					

文章和指南

范例

参考

模块演变

Changes to Qt NFC 列出了 Qt 的 Qt 6 系列在模块 API 和功能上所做出的重要改变。

许可

Qt NFC 在商业许可下是可用的来自 Qt 公司 。此外,它在自由软件许可下也是可用的。从 Qt 5.4 起,这些自由软件许可是 GNU LGPL (次一般公共许可) 第 3 版 ,或 GNU GPL (一般公共许可) 第 2 版 。见 Qt 许可 进一步了解细节。