The QNearFieldManager class provides access to notifications for NFC events. More...
#include <QNearFieldManager>
Inherits QObject.
QNearFieldManager ( QObject * parent = 0 ) | |
~QNearFieldManager () | |
int | registerTargetDetectedHandler ( QObject * object, const char * method ) |
int | registerTargetDetectedHandler ( QObject * object, const char * method ) |
int | registerTargetDetectedHandler ( QNdefRecord::TypeNameFormat typeNameFormat, const QByteArray & type, QObject * object, const char * method ) |
int | registerTargetDetectedHandler ( const QNdefFilter & filter, QObject * object, const char * method ) |
void | startTargetDetection ( const QList<QNearFieldTarget::Type> & targetTypes ) |
void | startTargetDetection ( QNearFieldTarget::Type targetType = QNearFieldTarget::AnyTarget ) |
void | stopTargetDetection () |
bool | unregisterTargetDetectedHandler ( int handlerId ) |
void | targetDetected ( QNearFieldTarget * target ) |
void | targetLost ( QNearFieldTarget * target ) |
void | transactionDetected ( const QByteArray & applicationIdentifier ) |
The QNearFieldManager class provides access to notifications for NFC events.
NFC Forum devices support two modes of communications. The first mode, peer-to-peer communications, is used to communicate between two NFC Forum devices. The second mode, master/slave communications, is used to communicate between an NFC Forum device and an NFC Forum Tag or Contactess Card. The targetDetected() signal is emitted when a target device enters communications range. Communications can be initiated from the slot connected to this signal.
NFC Forum devices generally operate as the master in master/slave communications. Some devices are capable of operate as the slave, so called Card Emulation mode. In this mode the local NFC device emulates a NFC Forum Tag or Contactless Card and can be used to perform transactions. The transaction happens entirely within a secure element on the device and only a notification of the transaction is provided. The transactionDetected() signal is emitted whenever a transaction occurs.
NFC Forum Tags can contain one or more messages in a standardized format. These messages are encapsulated in the QNdefMessage class. Use the registerTargetDetectedHandler() functions to register message handlers with particular criteria. Handlers can be unregistered with the unregisterTargetDetectedHandler() function.
Constructs a new near field manager with parent.
Destroys the near field manager.
Registers object to receive notifications on method when a tag has been detected and has an NDEF message. The method on object should have the prototype 'void targetDetected(const QNdefMessage &message, QNearFieldTarget *target)'.
Returns an identifier, which can be used to unregister the handler, on success; otherwise returns -1.
Note: The target parameter of method may not be available on all platforms, in which case target will be 0.
Registers object to receive notifications on method when a tag has been detected and has an NDEF record that matchings typeNameFormat and type. The method on object should have the prototype 'void targetDetected(const QNdefMessage &message, QNearFieldTarget *target)'.
Returns an identifier, which can be used to unregister the handler, on success; otherwise returns -1.
Note: The target parameter of method may not be available on all platforms, in which case target will be 0.
Registers object to receive notifications on method when a tag has been detected and has an NDEF message that matches filter is detected. The method on object should have the prototype 'void targetDetected(const QNdefMessage &message, QNearFieldTarget *target)'.
Returns an identifier, which can be used to unregister the handler, on success; otherwise returns -1.
Note: The target parameter of method may not be available on all platforms, in which case target will be 0.
Starts detecting targets of type targetTypes. Causes the targetDetected() signal to be emitted when a target with a type in targetTypes is within proximity. If targetTypes is empty targets of all types will be detected.
See also stopTargetDetection().
This is an overloaded function.
Stops detecting targets. The targetDetected() signal will no longer be emitted until another call to startTargetDetection() is made.
This signal is emitted whenever a target is detected. The target parameter represents the detected target.
This signal will be emitted for all detected targets.
QNearFieldManager maintains ownership of target, however, it will not be destroyed until the QNearFieldManager destructor is called. Ownership may be transferred by calling setParent().
Do not delete target from the slot connected to this signal, instead call deleteLater().
Note: that if target is deleted before it moves out of proximity the targetLost() signal will not be emitted.
See also targetLost().
This signal is emitted whenever a target moves out of proximity. The target parameter represents the lost target.
Do not delete target from the slot connected to this signal, instead use deleteLater().
See also QNearFieldTarget::disconnected().
This signal is emitted when ever a transaction is performed with the application identified by applicationIdentifier.
The applicationIdentifier is a byte array of up to 16 bytes as defined by ISO 7816-4 and uniquely identifies the application and application vendor that was involved in the transaction.
Unregisters the target detect handler identified by handlerId.
Returns true on success; otherwise returns false.