The QNearFieldTarget class provides an interface for communicating with a target device. More...
#include <QNearFieldTarget>
Inherits QObject.
Inherited by QNearFieldTagType1 and QNearFieldTagType2.
enum | AccessMethod { NdefAccess, ApduAccess, TagTypeSpecificAccess, LlcpAccess } |
flags | AccessMethods |
enum | Type { AnyTarget, ProprietaryTag, NfcTagType1, NfcTagType2, ..., MifareTag } |
QNearFieldTarget ( QObject * parent = 0 ) | |
virtual AccessMethods | accessMethods () const = 0 |
virtual bool | hasNdefMessage () |
virtual QList<QNdefMessage> | ndefMessages () |
virtual QByteArray | sendApduCommand ( const QByteArray & command ) |
virtual QList<QByteArray> | sendApduCommands ( const QList<QByteArray> & commands ) |
virtual QByteArray | sendCommand ( const QByteArray & command ) |
virtual QList<QByteArray> | sendCommands ( const QList<QByteArray> & commands ) |
virtual void | setNdefMessages ( const QList<QNdefMessage> & messages ) |
virtual Type | type () const = 0 |
virtual QByteArray | uid () const = 0 |
virtual QUrl | url () const |
void | disconnected () |
quint16 | qNfcChecksum ( const char * data, uint len ) |
The QNearFieldTarget class provides an interface for communicating with a target device.
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, ndefMessages() and setNdefMessages() functions can be used to get and set the NDEF message.
If the target supports ApduAccess, sendApduCommand() can be used to send a single APDU command to the target and retrieve the response. sendApduCommands() can be used to send multiple APDU commands to the target and retrieve all of the responses.
If the target supports TagTypeSpecificAccess, sendCommand() can be used to send a single proprietary command to the target and retrieve the response. sendCommands() can be used to send multiple proprietary commands to the target and retrieve all of the responses.
If the target supports LlcpAccess, the QLlcpSocket class can be used to connected to a service provided by the target.
This enum describes the access methods a near field target supports.
Constant | Value | Description |
---|---|---|
QNearFieldTarget::NdefAccess | 0 | The target supports NDEF records using ndefMessages() and setNdefMessages(). |
QNearFieldTarget::ApduAccess | 1 | The target supports APDU access using sendApduCommand() and sendApduCommands(). |
QNearFieldTarget::TagTypeSpecificAccess | 2 | The target supports sending tag type specific commands using sendCommand() and sendCommands(). |
QNearFieldTarget::LlcpAccess | 3 | The target supports peer-to-peer LLCP communication. |
The AccessMethods type is a typedef for QFlags<AccessMethod>. It stores an OR combination of AccessMethod values.
This enum describes the type of tag the target is detected as.
Constant | Value | Description |
---|---|---|
QNearFieldTarget::AnyTarget | 0 | This value is only used when registering handlers to indicate that any compatible target can be used. |
QNearFieldTarget::ProprietaryTag | 1 | An unidentified proprietary target tag. |
QNearFieldTarget::NfcTagType1 | 2 | An NFC tag type 1 target. |
QNearFieldTarget::NfcTagType2 | 3 | An NFC tag type 2 target. |
QNearFieldTarget::NfcTagType3 | 4 | An NFC tag type 3 target. |
QNearFieldTarget::NfcTagType4 | 5 | An NFC tag type 4 target. |
QNearFieldTarget::MifareTag | 6 | A Mifare target. |
Constructs a new near field target with parent.
Returns the access methods support by this near field target.
This signal is emitted when the near field target moves out of proximity.
Returns true if at least one NDEF message is stored on the near field target; otherwise returns false.
Returns a list of all NDEF messages stored on the near field target.
See also setNdefMessages().
Sends the APDU command to the near field target and returns the result.
Sends multiple APDU commands to the near field target and returns the results.
Sends command to the near field target and returns the result.
Sends multiple commands to the near field target and returns the result.
Sets the NDEF messages stored on the near field target to messages.
See also ndefMessages().
Returns the type of tag type of this near field target.
Returns the UID of the near field target.
Returns the URL of the near field target.