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

NFC card detection library. More...

Go to the source code of this file.

Data Structures

struct  NfcScannerEventData
 Event data passed to the user callback. More...
 
struct  NfcScannerEvent
 Event passed to the user callback. More...
 

Typedefs

typedef struct NfcScanner NfcScanner
 NfcScanner opaque type definition.
 
typedef void(* NfcScannerCallback) (NfcScannerEvent event, void *context)
 User callback function signature.
 

Enumerations

enum  NfcScannerEventType { NfcScannerEventTypeDetected }
 Event type passed to the user callback. More...
 

Functions

NfcScannernfc_scanner_alloc (Nfc *nfc)
 Allocate an NfcScanner instance.
 
void nfc_scanner_free (NfcScanner *instance)
 Delete an NfcScanner instance.
 
void nfc_scanner_start (NfcScanner *instance, NfcScannerCallback callback, void *context)
 Start an NfcScanner.
 
void nfc_scanner_stop (NfcScanner *instance)
 Stop an NfcScanner.
 

Detailed Description

NFC card detection library.

Once started, a NfcScanner instance will iterate over all available protocols and return a list of one or more detected protocol identifiers via a user-provided callback.

The NfcScanner behaviour is greedy, i.e. it will not stop scanning upon detection of a just one protocol and will try others as well until all possibilities are exhausted. This is to allow for multi-protocol card support.

If no supported cards are in the vicinity, the scanning process will continue until stopped explicitly.

Typedef Documentation

◆ NfcScannerCallback

typedef void(* NfcScannerCallback) (NfcScannerEvent event, void *context)

User callback function signature.

A function with such signature must be provided by the user upon calling nfc_scanner_start().

Parameters
[in]eventoccurred event, complete with type and data.
[in]contextpointer to the context data provided in nfc_scanner_start() call.

Enumeration Type Documentation

◆ NfcScannerEventType

Event type passed to the user callback.

Enumerator
NfcScannerEventTypeDetected 

One or more protocols have been detected.

Function Documentation

◆ nfc_scanner_alloc()

NfcScanner * nfc_scanner_alloc ( Nfc * nfc)

Allocate an NfcScanner instance.

Parameters
[in]nfcpointer to an Nfc instance.
Returns
pointer to the allocated NfcScanner instance.
See also
nfc.h

◆ nfc_scanner_free()

void nfc_scanner_free ( NfcScanner * instance)

Delete an NfcScanner instance.

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

◆ nfc_scanner_start()

void nfc_scanner_start ( NfcScanner * instance,
NfcScannerCallback callback,
void * context )

Start an NfcScanner.

Parameters
[in,out]instancepointer to the instance to be started.
[in]callbackpointer to the callback function (will be called upon a detection event).
[in]contextpointer to the caller-specific context (will be passed to the callback).

◆ nfc_scanner_stop()

void nfc_scanner_stop ( NfcScanner * instance)

Stop an NfcScanner.

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