QNearFieldTarget Class ReferenceThe QNearFieldTarget class provides an interface for communicating with a target device. More... #include <QNearFieldTarget> Inherits: QObject. Inherited by: QNearFieldTagType1, QNearFieldTagType2, QNearFieldTagType3, and QNearFieldTagType4. This class was introduced in Qt Mobility 1.2. Public Types
Public Functions
Signals
Protected Functions
Related Non-Members
Additional Inherited Members
Detailed DescriptionThe 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, 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. 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. Member Type Documentation
flags QNearFieldTarget::AccessMethods |
Constant | Value | Description |
---|---|---|
QNearFieldTarget::NdefAccess | 0 | The target supports reading and writing NDEF messages using readNdefMessages() and writeNdefMessages(). |
QNearFieldTarget::TagTypeSpecificAccess | 1 | The target supports sending tag type specific commands using sendCommand() and sendCommands(). |
QNearFieldTarget::LlcpAccess | 2 | 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 error codes that that a near field target reports.
Constant | Value | Description |
---|---|---|
QNearFieldTarget::NoError | 0 | No error has occurred. |
QNearFieldTarget::UnknownError | 1 | An unidentified error occurred. |
QNearFieldTarget::UnsupportedError | 2 | The requested operation is unsupported by this near field target. |
QNearFieldTarget::TargetOutOfRangeError | 3 | The target is no longer within range. |
QNearFieldTarget::NoResponseError | 4 | The target did not respond. |
QNearFieldTarget::ChecksumMismatchError | 5 | The checksum has detected a corrupted response. |
QNearFieldTarget::InvalidParametersError | 6 | Invalid parameters were passed to a tag type specific function. |
QNearFieldTarget::NdefReadError | 7 | Failed to read NDEF messages from the target. |
QNearFieldTarget::NdefWriteError | 8 | Failed to write NDEF messages to the target. |
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. |
QNearFieldTarget::NfcForumDevice | 7 | An NFC Forum device target. |
Constructs a new near field target with parent.
Destroys the near field target.
Returns the access methods support by this near field target.
This signal is emitted when the near field target moves out of proximity.
This signal is emitted when an error occurs while processing request id. The error parameter describes the error.
Handles the response received for the request id. Returns true if the response is handled; otherwise returns false.
Classes reimplementing this virtual function should call the base class implementation to ensure that requests initiated by those classes are handled correctly.
The default implementation stores the response such that it can be retrieved by requestResponse().
Returns true if at least one NDEF message is stored on the near field target; otherwise returns false.
Returns true if the target is processing commands; otherwise returns false.
This signal is emitted when a complete NDEF message has been read from the target.
See also readNdefMessages().
This signal is emitted when NDEF messages have been successfully written to the target.
See also writeNdefMessages().
Starts reading NDEF messages stored on the near field target. Returns a request id which can be used to track the completion status of the request. An invalid request id will be returned if the target does not support reading NDEF messages.
An ndefMessageRead() signal will be emitted for each NDEF message. The requestCompleted() signal will be emitted was all NDEF messages have been read. The error() signal is emitted if an error occurs.
Note: Symbian^3 and Harmattan only support read one NDEF message.
This signal is emitted when a request id completes.
See also sendCommand().
Returns the decoded response for request id. If the request is unknown or has not yet been completed an invalid QVariant is returned.
Sends command to the near field target. Returns a request id which can be used to track the completion status of the request. An invalid request id will be returned if the target does not support sending tag type specific commands.
The requestCompleted() signal will be emitted on successful completion of the request; otherwise the error() signal will be emitted.
Once the request completes successfully the response can be retrieved from the requestResponse() function. The response of this request will be a QByteArray.
See also requestCompleted() and waitForRequestCompleted().
Sends multiple commands to the near field target. Returns a request id which can be used to track the completion status of the request. An invalid request id will be returned if the target does not support sending tag type specific commands.
If all commands complete successfully the requestCompleted() signal will be emitted; otherwise the error() signal will be emitted. If a command fails succeeding commands from this call will not be processed.
Once the request completes the response for successfully completed requests can be retrieved from the requestResponse() function. The response of this request will be a QList<QByteArray>.
See also requestCompleted() and waitForRequestCompleted().
Sets the decoded response for request id to response. If emitRequestCompleted is true the requestCompleted() signal will be emitted for id; otherwise no signal will be emitted.
See also requestResponse().
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.
Waits up to msecs milliseconds for the request id to complete. Returns true if the request completes successfully and the requestCompeted() signal is emitted; otherwise returns false.
Writes the NDEF messages in messages to the target. Returns a request id which can be used to track the completion status of the request. An invalid request id will be returned if the target does not support reading NDEF messages.
The ndefMessagesWritten() signal will be emitted when the write operation completes successfully; otherwise the error() signal is emitted.
Note: Symbian^3 and Harmattan only support writing one NDEF message. Only the first NDEF message in the list will be written, others are silently dropped.
Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. | Qt qtmobility-1.2 | |
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD. | ||
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP ! |
Copyright © 2000-2012 - www.developpez.com