3.3.1 Capability Container
In order for an NFC device to read or write the data of the emulated tag it needs to fetch the Capability Container (CC) file. The CC contains information such as the file IDs of all the other files included within the application and the read/write privileges of each file. It also contains the maximum data size for each file to determine how many bytes of space are available for writing. To get that information, the reader/writer needs to access the NDEF or Proprietary File Control Type Length Value (TLV). The File Control TLV must be included for every file within the CC to be accessed by an NFC compliant device.
The format for the Capability Container is specified in the NFC Forum Type 4 Tag Operation Specification 3.0.
- CC Length – This 2 byte value is determined by the number of different files contained within the tag. The formula to calculate the CC Length is: [7 + (#Files * 8)].
- Mapping Version – This value tells the reader the mapping specification used by the tag. The firmware provided supports Version 2.0.
- MLe – These 2 bytes indicate the maximum number of bytes that can be read from the tag by a single Read Binary command. For the provided firmware, this value should be set to 0xFB to maximize the amount of data that can be read. That value accounts for the first three data bytes sent in a Read Binary command, including the optional CID.
- MLc – These 2 bytes indicate the maximum number of bytes that can be written to the tag by a single Update Binary command. For the provided firmware, this value should be set to 0xF9 to maximize the amount of data that can be written. That value accounts for the first six data bytes sent in an Update Binary command, including the optional CID.
- File Control TLV – The TLV blocks provide the reader with information about the tag data.
- Type Field (T) – This field contains the file type information of the TLV block. The following values may be used:
- 0x04 – NDEF File
- 0x05 – Proprietary File
- 0x06 – Extended NDEF file
- Length Field (L) – This field contains the length of the value field of the TLV block
- Value Field (V) – This field contains the file ID, the maximum file size, and the read/write access conditions of the file.
- File ID – Each file within the tag should have its own unique file ID number.
- Max File Size – This value is not the size of the data itself, but the size of the maximum possible data that can be stored within the file.
- Read Access (R) – Determines the read access properties of the file. This should be set to 0x00 to ensure the file has full read access. All other values are for limited read access.
- Write Access (W) – Determines the write access properties of the file. This value must be set so that the write privileges of the CC matches the write privileges specified by bReadOnly flag of the file. The value 0x00 allows for full write privileges. The value 0xFF disables all write privileges and makes the file read-only. All other values are for limited write access.
There must be a File Control TLV for each different file contained within the tag. Therefore, if there are three different files, there must be three TLVs that correspond to the settings of each file.