QNearFieldTarget#

The QNearFieldTarget class provides an interface for communicating with a target device. More

Inheritance diagram of PySide6.QtNfc.QNearFieldTarget

Synopsis#

Functions#

Signals#

Detailed Description#

QNearFieldTarget provides a generic interface for communicating with an NFC target device. Both NFC Forum devices and NFC Forum Tag targets are supported by this class. All target specific classes subclass this class.

The type() function can be used to get the type of the target device. The uid() function returns the unique identifier of the target. The AccessMethods flags returns from the accessMethods() function can be tested to determine which access methods are supported by the target.

If the target supports NdefAccess , hasNdefMessage() can be called to test if the target has a stored NDEF message, readNdefMessages() and writeNdefMessages() functions can be used to get and set the NDEF message.

If the target supports TagTypeSpecificAccess , sendCommand() can be used to send a single proprietary command to the target and retrieve the response.

class PySide6.QtNfc.QNearFieldTarget([parent=None])#
Parameters

parentPySide6.QtCore.QObject

Constructs a new near field target with parent.

PySide6.QtNfc.QNearFieldTarget.Type#

This enum describes the type of tag the target is detected as.

Constant

Description

QNearFieldTarget.ProprietaryTag

An unidentified proprietary target tag.

QNearFieldTarget.NfcTagType1

An NFC tag type 1 target.

QNearFieldTarget.NfcTagType2

An NFC tag type 2 target.

QNearFieldTarget.NfcTagType3

An NFC tag type 3 target.

QNearFieldTarget.NfcTagType4

An NFC tag type 4 target. This value is used if the cannot be further refined by or below.

QNearFieldTarget.NfcTagType4A

An NFC tag type 4 target based on ISO/IEC 14443-3A.

QNearFieldTarget.NfcTagType4B

An NFC tag type 4 target based on ISO/IEC 14443-3B.

QNearFieldTarget.MifareTag

A Mifare target.

PySide6.QtNfc.QNearFieldTarget.AccessMethod#

This enum describes the access methods a near field target supports.

Constant

Description

QNearFieldTarget.UnknownAccess

The target supports an unknown access type.

QNearFieldTarget.NdefAccess

The target supports reading and writing NDEF messages using readNdefMessages() and writeNdefMessages() .

QNearFieldTarget.TagTypeSpecificAccess

The target supports sending tag type specific commands using sendCommand() .

QNearFieldTarget.AnyAccess

The target supports any of the known access types.

PySide6.QtNfc.QNearFieldTarget.Error#

This enum describes the error codes that a near field target reports.

Constant

Description

QNearFieldTarget.NoError

No error has occurred.

QNearFieldTarget.UnknownError

An unidentified error occurred.

QNearFieldTarget.UnsupportedError

The requested operation is unsupported by this near field target.

QNearFieldTarget.TargetOutOfRangeError

The target is no longer within range.

QNearFieldTarget.NoResponseError

The target did not respond.

QNearFieldTarget.ChecksumMismatchError

The checksum has detected a corrupted response.

QNearFieldTarget.InvalidParametersError

Invalid parameters were passed to a tag type specific function.

QNearFieldTarget.ConnectionError

Failed to connect to the target.

QNearFieldTarget.NdefReadError

Failed to read NDEF messages from the target.

QNearFieldTarget.NdefWriteError

Failed to write NDEF messages to the target.

QNearFieldTarget.CommandError

Failed to send a command to the target.

QNearFieldTarget.TimeoutError

The request could not be completed within the time specified in waitForRequestCompleted() .

PySide6.QtNfc.QNearFieldTarget.accessMethods()#
Return type

AccessMethods

Returns the access methods support by this near field target.

PySide6.QtNfc.QNearFieldTarget.disconnect()#
Return type

bool

Closes the connection to the target to enable communication with the target from a different instance. The connection will also be closed, when the QNearFieldTarget is destroyed. A connection to the target device is (re)created to process a command or read/write a NDEF messages.

Returns true only if an existing connection was successfully closed; otherwise returns false.

PySide6.QtNfc.QNearFieldTarget.disconnected()#
PySide6.QtNfc.QNearFieldTarget.hasNdefMessage()#
Return type

bool

Returns true if at least one NDEF message is stored on the near field target; otherwise returns false.

PySide6.QtNfc.QNearFieldTarget.maxCommandLength()#
Return type

int

Returns the maximum number of bytes that can be sent with sendCommand . 0 will be returned if the target does not support sending tag type specific commands.

See also

sendCommand()

PySide6.QtNfc.QNearFieldTarget.ndefMessageRead(message)#
Parameters

messagePySide6.QtNfc.QNdefMessage

PySide6.QtNfc.QNearFieldTarget.type()#
Return type

Type

Returns the type of tag type of this near field target.

PySide6.QtNfc.QNearFieldTarget.uid()#
Return type

PySide6.QtCore.QByteArray

Returns the UID of the near field target.