Posted on December 18, 2015 at 17:09Hi,
The first FIRST_RECORD_OFFSET constant is used to point to the ndef data in the buffer array. The bytes before FIRST_RECORD_OFFSET are used to store the length of the NDEF message.
The exemple given with NDEF_AddAAR function can help you how to write a function to add records in NDEF message.
For the NDEF header, here is the details
MB = Message Begin
ME = Message End
CF = Chunk Flag (indicating that this is either the first record chunk or a middle record chunk of a chunked payload)
SR = Short Record (if set, that the PAYLOAD_LENGTH field is a single octet)
IL = ID_LENGTH field is present
TNF = Type Name Format
TNF Field Values:
Empty 0x00
NFC Forum well-known type [NFC RTD] 0x01
Media-type as defined in RFC 2046 [RFC 2046] 0x02
Absolute URI as defined in RFC 3986 [RFC 3986] 0x03
NFC Forum external type [NFC RTD] 0x04
Unknown 0x05
Unchanged 0x06
Reserved 0x07
CF is used only if you need to split your record in multiple records, you used the SR flag so it indicates you don't need to split it in chunks.
So in your example it gives:
/* MB ME CF SR IL TNF for first Record in the NDEF message */
1 0 0 1 0 0x02
Payload type name length
Payload length
Payload type name
Payload
/* MB ME CF SR IL TNF for Second Record in the NDEF message */
0 1 0 1 0 0x06
Payload type name length - None
Payload length (same as the payload length of first Record)
Payload type name - None
Payload starts here for Second Record.
Hope this helps you.
Have nice day.