← Back to the chapter · Next detail →

Technical detail · NFC Tag Programming

NDEF record boundaries and byte accounting

Read Figure 3 from the ordered message container into the short URI record. Message Begin (MB) marks the first record and Message End (ME) marks the last. Short Record (SR) selects a one-byte payload-length field for payloads below 256 bytes. ID Length present (IL) declares an optional ID field; Type Name Format (TNF) tells the reader how to interpret the type.

For a short URI record with no ID, count one byte for the header containing flags and TNF, one for type length, one for payload length, and one for the U type. The URI payload then begins with its one-byte prefix code. Thus 1+1+1+1=41+1+1+1=4 bytes precede the payload, and the prefix code is part of that payload. Size and verify all fields before committing the tag.

← Back to the chapter · Next detail →