nfc_start_iso14443_4_emulation()
Start ISO 14443-4 emulation.
Synopsis:
#include <nfc/nfc.h>
NFC_API nfc_result_t nfc_start_iso14443_4_emulation(const nfc_iso14443_4_card_t *card)
Arguments:
- card
-
The structure containing the information that will be emulated
Library:
libnfcDescription:
The nfc_start_iso14443_4_emulation() function registers card emulation information within the NFC service. It also starts the emulation when the application is in the foreground. Only one ISO 14443-4 emulation is allowed at one time, and emulation is only active while this application is in the foreground. If an application is placed in the background, the NFC service automatically stops the appplication's iso14443-4 emulation.
Once the application is placed in the foreground again, the NFC service resumes emulation. If an application attempts to call the nfc_start_iso14443_4_emulation() function while it is already emulating ISO 14443-4, the second call will fail with NFC_RESULT_LIMITATION_EXCEEDED.
During emulation, the following events can occur:
- NFC_ISO14443_4_COMMAND_EVENT: This event indicates that a command was generated by the target reader. The application must first call the nfc_get_target() function to retrieve the event target, and then call the nfc_get_iso14443_4_emulation_command() function using the target retrieved to extract the command data from the triggered event.
- NFC_ISO14443_4_EVENT_CODE_EVENT: This event indicates that an ISO 14443-4 related event has occurred. This event is associated with an event code from the target reader. The nfc_get_notification_value() function must be used to extract the event code which will be of type iso14443_4_event_t.
Returns:
NFC_RESULT_SUCCESS, or one of the following:
- NFC_RESULT_INVALID_PARAMETER: A parameter is invalid.
- NFC_RESULT_SERVICE_CONNECTION_ERROR: The application is not connected to NFC service.
- NFC_RESULT_OUT_OF_MEMORY: The system memory available for the NFC system to complete this operation is insufficient.
- NFC_RESULT_LIMITATION_EXCEEDED: ISO 14443-4 emulation is already running.
- NFC_RESULT_OPERATION_REJECTED: NFC is not enabled, or application is not in foreground.
- NFC_RESULT_OPERATION_NOT_SUPPORTED: The Application Data buffer of the Type A card, or Higher Layer Response buffer of the Type B card is too large for the capabilities of the NFC Controller.