Main protocol hierarchy definitions. More...
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. | |
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.
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).
NfcProtocol nfc_protocol_get_parent | ( | NfcProtocol | protocol | ) |
Get the immediate parent of a specific protocol.
[in] | protocol | identifier of the protocol in question. |
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.
[in] | protocol | identifier of the protocol in question. |
[in] | parent_protocol | identifier of the parent protocol in question. |