NDEF C Reference

Defines

URL_RECORDTYPE

NDEF record type for a URL.

URL_RECORDTYPE_LEN

Length of the NDEF record type in bytes.

SMPLINTKEY_LEN

Length of the sample interval key string in bytes.

SMPLINTB64_LEN

Length of the encoded sample interval string in bytes.

SERIALKEY_LEN

Length of the serial key string in bytes.

VERKEY_LEN

Length of the vfmt key string in bytes.

VFMTB64_LEN

Length of the encoded VFmt data in bytes.

STATKEY_LEN

Length of the status key string in bytes.

STATB64_LEN

Length of the encoded status string in bytes.

CBUFKEY_LEN

Length of the circular buffer key string in bytes.

NDEF_RECORD_HEADER_LEN

Length of the NDEF record header in bytes.

TL_LEN

Length of the Tag and Length fields of the NDEF message TLV in bytes.

TAG_NDEF_MESSSAGE

Tag indicating the TLV block contains an NDEF message.

WELLKNOWN_TNF

Record Type follows the Record Type Definition (RTD) format.

URI_ID_HTTP

URI Identifier Code for the HTTP protocol.

URI_ID_HTTPS

URI Identifier Code for the HTTPS protocol.

Functions

static void ndef_createurlrecord(int *eepindex, int msglenbytes, int httpsDisable)

Create a URL NDEF Record.

Parameters
  • eepindex – Position in the 64-byte array that buffers data to be written into EEPROM.

  • msglenbytes – NDEF Message Length in bytes.

void ndef_calclen(int *paddinglen, int *preamblenbytes, int *urllen)
int ndef_writepreamble(int buflenblks, char *statusb64)

Write the part of the URL before the circular buffer.

Parameters
  • buflenblks – Circular buffer length in 16-byte EEPROM blocks.

  • statusb64 – Pointer to a base64 encoded status structure.

Returns

1 if buflenblks is not even.

void ndef_writeblankurl(int buflenblks, char *statusb64, int *bufstartblk)

Write an NDEF message containing one URL record to EEPROM. The URL contains a circular buffer. This is populated with a placeholder text - all zeroes - initially.

Parameters
  • buflenblks – Circular buffer length in 16-byte EEPROM blocks.

  • statusb64 – Pointer to a base64 encoded status structure.

  • bufstartblk – The circular buffer start block is written to this pointer.

Variables

nv_t nv
static const char serialkey[] = "&s="

Seperator, key and equals before the serial string.

static const char cbufkey[] = "&q="

Seperator, key and equals before the circular buffer string.

static const char verkey[] = "&v="

Seperator, key and equals before the vfmt string.

static const char statkey[] = "&x="

Seperator, key and equals before the status string.

static const char smplintkey[] = "/?t="

Start of parameters followed by a key and equals for the sample interval string.

static const char zeropad[] = "MDAw"

4 characters that base64 decode to 0,0,0

union TNFFlags_t

Public Members

unsigned char all
unsigned char tnf

Type Name Format field.

unsigned char idpresent

ID present flag. 1 if the ID field is present.

unsigned char srecord

Short record flag. 1 if the payload length field is 1 byte long.

unsigned char chunkflag

Chunk flag. 1 if this is the first or middle record in a chunked message.

unsigned char msgend

Message end flag. 1 if this is the last record in the message.

unsigned char msgbegin

Message begin flag. 1 if this is the first record in the message.

struct TNFFlags_t::[anonymous] byte
union len_t

Public Members

unsigned long all
unsigned char bytes[4]