Abstract interface definitions for the NFC listener system. More...
Go to the source code of this file.
Data Structures | |
struct | NfcListenerBase |
Generic NFC listener interface. More... | |
Typedefs | |
typedef NfcGenericInstance *(* | NfcListenerAlloc) (NfcGenericInstance *base_listener, NfcDeviceData *data) |
Allocate a protocol-specific listener instance. | |
typedef void(* | NfcListenerFree) (NfcGenericInstance *instance) |
Delete a protocol-specific listener instance. | |
typedef void(* | NfcListenerSetCallback) (NfcGenericInstance *listener, NfcGenericCallback callback, void *context) |
Set the callback function to handle events emitted by the listener instance. | |
typedef NfcCommand(* | NfcListenerRun) (NfcGenericEvent event, void *context) |
Emulate a supported NFC card with given device data. | |
typedef const NfcDeviceData *(* | NfcListenerGetData) (const NfcGenericInstance *instance) |
Get the protocol-specific data that was that was provided for emulation. | |
Abstract interface definitions for the NFC listener system.
This file is an implementation detail. It must not be included in any public API-related headers.
typedef NfcGenericInstance *( * NfcListenerAlloc) (NfcGenericInstance *base_listener, NfcDeviceData *data) |
Allocate a protocol-specific listener instance.
For base listeners pass a pointer to an instance of type Nfc as the base_listener parameter, otherwise it must be a pointer to another listener instance (compare iso14443_3a/iso14443_3a_listener.c and iso14443_4a/iso14443_4a_listener.c).
The NFC device data passed as the data parameter is copied to the instance and may change during the emulation in response to reader commands.
To retrieve the modified data, NfcListenerGetData gets called by the NfcListener implementation when the user code calls nfc_listener_get_data().
[in] | base_listener | pointer to the parent listener instance. |
[in] | data | pointer to the protocol-specific data to use during emulation. |
typedef void(* NfcListenerFree) (NfcGenericInstance *instance) |
Delete a protocol-specific listener instance.
[in,out] | instance | pointer to the instance to be deleted. |
typedef const NfcDeviceData *(* NfcListenerGetData) (const NfcGenericInstance *instance) |
Get the protocol-specific data that was that was provided for emulation.
[in] | instance | pointer to the protocol-specific listener instance. |
typedef NfcCommand(* NfcListenerRun) (NfcGenericEvent event, void *context) |
Emulate a supported NFC card with given device data.
[in] | event | protocol-specific event passed by the parent listener instance. |
[in,out] | context | pointer to the protocol-specific listener instance. |
typedef void(* NfcListenerSetCallback) (NfcGenericInstance *listener, NfcGenericCallback callback, void *context) |
Set the callback function to handle events emitted by the listener instance.
[in,out] | listener | |
[in] | callback | pointer to the user-defined callback function which will receive events. |
[in] | context | pointer to the user-specific context (will be passed to the callback). |