unleashed-firmware/lib/nfc/nfc_scanner.h
Astra ecab4d53d2
[FL-870] Auto-generated firmware documentation take two (#2944)
* Add doxygen and doxygen-awesome css, cleanup docs files
* Ignore more libraries and remove leftover local variables
* Create an actual intro page
* .md files linting
* Add doxygen action
* Fix Doxygen path
* Fix doxyfile path
* Try to upload
* Change docs branch
* Add submudules checkout
* Disable doxygen on PR
* Mention the firmware docs in the readme
* More dev docs mentions in the readme
* Fix runner group, add tags
* Test dev in PR
* Disable running on PR
* Fix a typo in the doxyfile
* Try upload to S3
* Fix local path
* Fix S3 ACL
* Add delete flag, unifying dev and tags
* Update ignored directories
* More ignored directories
* Even more ignored directories
* Fix submodule
* Change S3 uploader
* Change S3 uploader version
* Fix aws sync flags
* Fix ACL
* Disable ACL
* Improve ignores, add WiFi devboard docs
* TEMP: generate dev docs
* TEMP: generate 0.89.0 docs
* Disabling PR trigger
* Enable submodules and test build
* Enable test build
* Disable test build
* Change docs directory structure
* Fix accidentally committed submodule
* Fix submodules
* Update links to the developer documentation
* Markdown linting
* Update workflow, enable test build
* Fix doxygen dir path
* Update Doxyfile-awesome.cfg
* Change paths
* Fix upload docs path
* Disable pull_request debug trigger
* Disable tags building
* Remove autolinks and namespaces
* Establish basic documentation structure
* Add missing changes
* Improve stylesheet, move some files
* Improve examples
* Improve the main page
* Improve application dev docs
* Improve system programming docs
* Improve development tools docs
* Improve other docs
* Improve application examples
* Fix formatting
* Fix PVS-studio warnings
* Improve visuals
* Fix doxygen syntax warnings
* Fix broken links
* Update doxygen action

Co-authored-by: DrunkBatya <drunkbatya.js@gmail.com>
Co-authored-by: あく <alleteam@gmail.com>
Co-authored-by: Georgii Surkov <georgii.surkov@outlook.com>
Co-authored-by: Georgii Surkov <37121527+gsurkov@users.noreply.github.com>
2024-03-06 15:25:21 +09:00

97 lines
2.8 KiB
C

/**
* @file nfc_scanner.h
* @brief 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.
*/
#pragma once
#include <nfc/nfc.h>
#include <nfc/protocols/nfc_protocol.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief NfcScanner opaque type definition.
*/
typedef struct NfcScanner NfcScanner;
/**
* @brief Event type passed to the user callback.
*/
typedef enum {
NfcScannerEventTypeDetected, /**< One or more protocols have been detected. */
} NfcScannerEventType;
/**
* @brief Event data passed to the user callback.
*/
typedef struct {
size_t protocol_num; /**< Number of detected protocols (one or more). */
NfcProtocol* protocols; /**< Pointer to the array of detected protocol identifiers. */
} NfcScannerEventData;
/**
* @brief Event passed to the user callback.
*/
typedef struct {
NfcScannerEventType type; /**< Type of event. Determines how the data must be handled. */
NfcScannerEventData data; /**< Event-specific data. Handled accordingly to the even type. */
} NfcScannerEvent;
/**
* @brief User callback function signature.
*
* A function with such signature must be provided by the user upon calling nfc_scanner_start().
*
* @param[in] event occurred event, complete with type and data.
* @param[in] context pointer to the context data provided in nfc_scanner_start() call.
*/
typedef void (*NfcScannerCallback)(NfcScannerEvent event, void* context);
/**
* @brief Allocate an NfcScanner instance.
*
* @param[in] nfc pointer to an Nfc instance.
* @returns pointer to the allocated NfcScanner instance.
*
* @see nfc.h
*/
NfcScanner* nfc_scanner_alloc(Nfc* nfc);
/**
* @brief Delete an NfcScanner instance.
*
* @param[in,out] instance pointer to the instance to be deleted.
*/
void nfc_scanner_free(NfcScanner* instance);
/**
* @brief Start an NfcScanner.
*
* @param[in,out] instance pointer to the instance to be started.
* @param[in] callback pointer to the callback function (will be called upon a detection event).
* @param[in] context pointer to the caller-specific context (will be passed to the callback).
*/
void nfc_scanner_start(NfcScanner* instance, NfcScannerCallback callback, void* context);
/**
* @brief Stop an NfcScanner.
*
* @param[in,out] instance pointer to the instance to be stopped.
*/
void nfc_scanner_stop(NfcScanner* instance);
#ifdef __cplusplus
}
#endif