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 | |
| NfcScanner * | nfc_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. | |
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 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().
| [in] | event | occurred event, complete with type and data. |
| [in] | context | pointer to the context data provided in nfc_scanner_start() call. |
| enum NfcScannerEventType |
| NfcScanner * nfc_scanner_alloc | ( | Nfc * | nfc | ) |
Allocate an NfcScanner instance.
| [in] | nfc | pointer to an Nfc instance. |
| void nfc_scanner_free | ( | NfcScanner * | instance | ) |
Delete an NfcScanner instance.
| [in,out] | instance | pointer to the instance to be deleted. |
| void nfc_scanner_start | ( | NfcScanner * | instance, |
| NfcScannerCallback | callback, | ||
| void * | context ) |
Start an NfcScanner.
| [in,out] | instance | pointer to the instance to be started. |
| [in] | callback | pointer to the callback function (will be called upon a detection event). |
| [in] | context | pointer to the caller-specific context (will be passed to the callback). |
| void nfc_scanner_stop | ( | NfcScanner * | instance | ) |
Stop an NfcScanner.
| [in,out] | instance | pointer to the instance to be stopped. |