Flipper Zero Firmware
Loading...
Searching...
No Matches
nfc_protocol.c File Reference

Main protocol hierarchy definitions. More...

#include "nfc_protocol.h"
#include <furi/furi.h>

Data Structures

struct  NfcProtocolTreeNode
 Tree node describing a protocol. More...
 

Functions

NfcProtocol nfc_protocol_get_parent (NfcProtocol protocol)
 Get the immediate parent of a specific protocol.
 
bool nfc_protocol_has_parent (NfcProtocol protocol, NfcProtocol parent_protocol)
 Determine if a specific protocol has a parent on an arbitrary level.
 

Detailed Description

Main protocol hierarchy definitions.

To reduce code duplication, all NFC protocols are described as a tree, whose structure is shown in the diagram below. The (Start) node is actually nonexistent and is there only for clarity.

All its child protocols are considered base protocols, which in turn serve as parents to other, usually vendor-specific ones.

**************************** Protocol tree structure ***************************
(Start)
|
+------------------------+-----------+---------+------------+
| | | | |
ISO14443-3A ISO14443-3B Felica ISO15693-3 ST25TB
| | |
+---------------+-------------+ ISO14443-4B SLIX
| | |
ISO14443-4A Mf Ultralight Mf Classic
|
Mf Desfire

When implementing a new protocol, its place in the tree must be determined first. If no appropriate base protocols exists, then it must be a base protocol itself.

This file is to be modified upon adding a new protocol (see below).

Function Documentation

◆ nfc_protocol_get_parent()

NfcProtocol nfc_protocol_get_parent ( NfcProtocol protocol)

Get the immediate parent of a specific protocol.

Parameters
[in]protocolidentifier of the protocol in question.
Returns
parent protocol identifier if it has one, or NfcProtocolInvalid otherwise.

◆ nfc_protocol_has_parent()

bool nfc_protocol_has_parent ( NfcProtocol protocol,
NfcProtocol parent_protocol )

Determine if a specific protocol has a parent on an arbitrary level.

Unlike nfc_protocol_get_parent(), this function will traverse the full protocol hierarchy and check each parent node for the matching protocol type.

Parameters
[in]protocolidentifier of the protocol in question.
[in]parent_protocolidentifier of the parent protocol in question.
Returns
true if the parent of given type exists, false otherwise.