NDEF file
The NDEF file stores the length and content of the NDEF message. Use this library to encode standardized data for the NFC Type 4 Tag. To generate an NDEF message, you can use the NDEF messages and NDEF records modules.
The following code sample demonstrates how to encode the NDEF file for NFC Type 4 Tag:
int ndef_file_default_message(uint8_t *buff, uint32_t *size)
{
int err;
uint32_t ndef_size = nfc_t4t_ndef_file_msg_size_get(*size);
/* Encode URI message into buffer. */
err = nfc_ndef_uri_msg_encode(NFC_URI_HTTP_WWW,
m_url,
sizeof(m_url),
nfc_t4t_ndef_file_msg_get(buff),
&ndef_size);
if (err) {
return err;
}
err = nfc_t4t_ndef_file_encode(buff, &ndef_size);
if (err) {
return err;
}
*size = ndef_size;
return 0;
}
API documentation
Header file:
include/nfc/t4t/ndef_file.h
Source file:
subsys/nfc/t4t/ndef_file.c