The NDEF detection procedure module provides functions to perform the NDEF detection procedure, which is used to retrieve the NDEF message from the data of a tag. For the API documentation of this module, refer to High-level NDEF Detection Procedure.
To execute a full NDEF detection procedure, you must run its subprocedures in the following order:
After a successful NDEF detection procedure, you can also write data to the NDEF file. To do it, you need to perform an NDEF update procedure.
Note that this module uses three other modules. APDU reader/writer is used to generate and decode APDU commands and responses which are sent or received by Adafruit NFC Shield library over NFC. Apart from that, the payload of APDU responses is analyzed by Capability Container file parser and stored within the structure that represents Type 4 Tag content.
The following code example shows how to perform an NDEF detection procedure for a Type 4 Tag:
After a successful NDEF detection procedure, you can also write data to the NDEF file using the following code:
Note that the NDEF detection procedure is equivalent to reading and parsing of the data of a tag. This activity for Type 4 Tag slightly differs from reading and parsing NFC Type 2 Tag data. In case of Type 2 Tag, the whole tag data can be first read and then parsed. For Type 4 Tag, reading and parsing is not clearly seperated - it occurs in turns. This is necessary because the metadata of a tag (the CC file retrieved at the beginning of NDEF detection procedure) is later used to finish this procedure.