Retrieve the associated target found after a successful NFC detection.
Synopsis:
#include <nfc/nfc.h>
NFC_API nfc_result_t nfc_get_target(nfc_event_t *event, nfc_target_t **target)
Arguments:
- event
-
The NFC event to get the message from.
- target
-
The returned target handle. The target handle is owned by the application and therefore must be cleaned up by the application using the nfc_destroy_target() function.
Library:
libnfc (For the qcc command, use the -l nfc option to link against this library)
Description:
This function gets the associated target after a successful NFC detection. The target returned is dependent on the event type retrieved from the nfc_get_event_type() function. The target is returned for each of the following event codes:
- NFC_SNEP_CONNECTION_EVENT: returns the target found after a successful LLCP connection has been detected; the application is now able to send and NDEF message via SNEP to another device.
- NFC_TAG_READWRITE_EVENT: returns the target found after a successful tag read.
- NFC_HANDOVER_COMPLETE_EVENT: returns the target found after a successful handover.
- NFC_HANDOVER_DETECTED_EVENT: returns the target found after remote device supporting handover is detected.
- NFC_LLCP_CONNECTION_EVENT: returns the target found after a successful LLCP connection is established.
- NFC_ISO14443_4_COMMAND_EVENT: returns the target found after a remote device sends a command during Host Card Emulation (HCE).
- NFC_LLCP_READ_COMPLETE_EVENT: returns the target found after a successful LLCP read; this event indicates that the reading of LLCP data is completed. This event is in response to a previous request from the application to the NFC service to read LLCP data from another device.
- NFC_LLCP_WRITE_COMPLETE_EVENT: returns the target found after a successful LLCP write; this event indicates that the writing of LLCP data is completed. This event is in response to a previous request from the application to the NFC service to write LLCP data to another device.