Qt NFC

NFC API 在啓用 NFC 的設備之間提供連接。

目前,API 支持 Android , iOS and Linux 使用 Neard v0.14 or later. 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
					

文章和指南

日誌類彆

The QtNfc 模塊導齣下列 日誌類彆 :

日誌類彆 描述
qt.nfc.neard 啓用 Neard/Linux 實現的日誌

範例

參考

模塊演變

Qt NFC 的變化 列齣瞭 Qt 的 Qt 6 係列在模塊 API 和功能上所做齣的重要改變。

許可

Qt NFC 在商業許可下是可用的來自 Qt 公司 。此外,它在自由軟件許可下也是可用的。從 Qt 5.4 起,這些自由軟件許可是 GNU LGPL (次一般公共許可) 第 3 版 ,或 GNU GPL (一般公共許可) 第 2 版 。見 Qt 許可 進一步瞭解細節。