The NFC Data Exchange Format, NDEF is used as a lightweight format for transferring data across an NFC link.
NFC NDEF has been designed to offer a simple yet effective format so that it can be used by both active and passive NFC devices. In this way it can be used for all NFC communication.
Being a lightweight format, NDEF does not add much to the overheard of the messages allowing low data rates to be maintained, thereby saving on power – a crucial requirement for NFC.
The NFC data exchange format is a binary message format that can be used to encapsulate one or more application-defined payloads which may be of a variety of types and sizes. These are combined into a single message construct. Each payload is described by a type, a length, and an optional identifier.
NFC NDEF basics
With many different high level applications needing to transfer data over the NFC radio interface, the concept of the NFC NDEF is to be able to send data of any format over the interface while still being able to retain the air interface data format.
An NDEF message is composed of one or more NDEF records. There can be multiple records in a NDEF message.
The limit for the number of records that can be encapsulated into an NFC NDEF message depends upon the application in use and the tag type used.
In order that the system knows where the messages begin and end, the first record in a message is marked with the MB or Message Begin flag set and the last record in the message is marked with the ME or Message End flag set. The minimum message length is one record. This is achieved by setting both the MB and the ME flag in the same record.
To ensure that the data capability is used efficiently, NFC NDEF records do not incorporate an index number – the index number within the message is implicitly assigned by the order in which the records occur.
It can be seen that the NDEF is exchanged in messages that comprise of a sequence of records.
Each record consists of two parts:
- Header: The header for the NDEF exchange includes indicator for a number of elements:
- Payload length: The payload length is always included in the NDEF header by a specific field. The payload length field is one octet for short records but for normal records it is four octets long. Short records are indicated by setting a flag bit known as the SR or short record flag to a value of 1. Zero is a valid payload length.
- Payload type: The payload type of a record indicates the kind of data being carried in the payload of that record. This may be used to guide the processing of the payload at the discretion of the user application. The format of the Payload Type field value is indicated using the TNF, Type Name Format field.
- Payload identification: An optional payload identifier allows the applications to identify the payload carried within an NDEF record.
- Payload: The payload can be of one of a variety of different types: URL, MIME media, or NFC-specific data type. For NFC-specific data types the payload contents must be defined in an NFC Record Type Definition file, RTD.
NFC NDEF provides a straightforward format for exchanging data over an NFC link. It has little overhead in terms of additional data requiring to be transferred and as such is ideal for the low power NFC environment.
Why Use NDEF Format?
Imagine you are at a conference and you want to exchange business cards with someone. You could exchange physical business cards, or you could exchange digital business cards by tapping your phones together.
If you exchanged physical business cards, you would need to take the time to input all of the information from the card into your phone (or vice versa). With NDEF, you can exchange the digital equivalent of business cards quickly and easily, without inputting any information.
NDEF is also used for other applications, such as storing URLs on NFC tags that can be read by NFC-enabled devices. When an NFC device reads an NDEF-formatted URL from an NFC tag, it can automatically launch the browser and navigate to that URL.
NDEF is a flexible format that can be used for many applications. It was designed to guarantee interoperability between different NFC devices, and it is the format that is most commonly used for NFC data exchange.
Features of an NDEF Format
NDEF format is simple & efficient. It is designed to work in the following ways:
- Encapsulate Arbitrary Documents & Entities. This format can be used to store any type of document or data, regardless of its size or complexity. It encapsulates different data formats, including images, XML documents, and XML fragments.
- Encapsulate Entities of Unknown Size. NDEF can represent entities of unknown or variable size, such as images. This is done by representing the entity as a chunked sequence of Records, where each Record contains a portion of the entity.
- Aggregate Multiple Documents. This format can be used to store multiple documents in a single NDEF Message. This is useful for representing collections of information, such as a business card and a vCard.
- Flexible Payload Representation. The payload of an NDEF Record can be represented in a variety of ways, including as a binary array, an ASCII string, or a UTF-8 string.
- Identification & Type Information. Each NDEF Record contains information that can be used to identify the type of data that is stored in the payload. This allows NFC devices to quickly and easily identify the type of data that is contained in an NDEF Record.
- Error Detection & Correction. The NDEF format includes a built-in error detection and correction mechanism that can be used to detect and correct errors that may occur when an NDEF Message is being read or written.
- Security Features. The NDEF format includes several security features that can be used to protect the data that is stored in an NDEF Message. These features include encryption, digital signatures, and access control list.
Benefits of Using NDEF Format
There are many benefits to using the NDEF format, including the following:
- Interoperability. This is the primary benefit of using the NDEF format. By using this format, you can be sure that your data will be compatible with any NFC device that supports the NDEF format. It eliminates the risk of incompatibility between devices, which can lead to lost data or corruption.
- Efficiency. The NDEF format is designed to be efficient in both space and time. It uses a minimum amount of storage space, and it can be read and written quickly.
- Flexibility. The NDEF format is very flexible, and it can be used for a wide range of applications. It can be used to store any type of document or data, regardless of its size or complexity.
- Security. The NDEF format includes several security features that can be used to protect the data that is stored in an NDEF Message. These features include high-grade encryption and digital signatures.
- Simplicity. The NDEF format is simple and easy to use. It does not require any special software or hardware. All you need is a device that supports the NDEF format.
NDEF format is the authorized format by the NFC Forum for interoperability. The format is standardized to ensure compatibility between devices and applications. As such, you can be confident that your data will be compatible with any NFC device or application that supports the NDEF format.