Flipper Zero Firmware
Loading...
Searching...
No Matches
nfc_listener_base.h File Reference

Abstract interface definitions for the NFC listener system. More...

#include "nfc_generic_event.h"
#include "nfc_device_base.h"

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.
 

Detailed Description

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.

See also
nfc_listener.h

Typedef Documentation

◆ NfcListenerAlloc

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).

See also
nfc_protocol.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().

Parameters
[in]base_listenerpointer to the parent listener instance.
[in]datapointer to the protocol-specific data to use during emulation.
Returns
pointer to the allocated listener instance.

◆ NfcListenerFree

typedef void(* NfcListenerFree) (NfcGenericInstance *instance)

Delete a protocol-specific listener instance.

Parameters
[in,out]instancepointer to the instance to be deleted.

◆ NfcListenerGetData

typedef const NfcDeviceData *(* NfcListenerGetData) (const NfcGenericInstance *instance)

Get the protocol-specific data that was that was provided for emulation.

Parameters
[in]instancepointer to the protocol-specific listener instance.
Returns
pointer to the NFC device data.

◆ NfcListenerRun

typedef NfcCommand(* NfcListenerRun) (NfcGenericEvent event, void *context)

Emulate a supported NFC card with given device data.

Parameters
[in]eventprotocol-specific event passed by the parent listener instance.
[in,out]contextpointer to the protocol-specific listener instance.
Returns
command to be executed by the parent listener instance.

◆ NfcListenerSetCallback

typedef void(* NfcListenerSetCallback) (NfcGenericInstance *listener, NfcGenericCallback callback, void *context)

Set the callback function to handle events emitted by the listener instance.

See also
nfc_generic_event.h
Parameters
[in,out]listener
[in]callbackpointer to the user-defined callback function which will receive events.
[in]contextpointer to the user-specific context (will be passed to the callback).