dConstructing

Encoding a URI in an NFC NDEF payload

An NDEF message is made up of TLVs. The TLVs can contain the data that should be transmitted over NFC, but can also be a signal that the message is over. Here’s where the NDEF paylod fits in to the TLV.

  • T = Type
  • L = Length
  • V = Value – the NDEF payload

For this post we’ll encode a URI as the NDEF payload. To read about creating the rest of the NDEF record TLV, or terminal TLVs, read my post on Read in full

Encoding a URI in an NFC NDEF record TLV

A TLV is a segment of data included in an NFC message. This is what a TLV consists of:

  • T = Type – the type of record
  • L = Length – the length of the payload
  • V = Value – the data

There different kinds of TLVs, but when constructing a basic NDEF message we only need to be concerned with two, and NDEF record TLV and the terminal TLV.

NDEF Record TLV

This TLV is where you store the data you want to transmit via NFC. The next three sections describe what makes up the TLV...

Read in full

Encoding a URI in an NFC NDEF message

The whole point of Near Field Communication (NFC) is the NDEF message (or NFC Data Exchange Format message). That’s where the goods are stored. You can’t just type in any old text though. You have to use the right format, and you have to encode it in hexadecimal. It’s not the most fun thing in the world, but it is doable. I’ve written a series of blog posts to help you do it.

Encoding the Data

An NDEF message is made up of multiple chunks of data called TLVs...

Read in full