EVE 1.0
NFC NDEF manipulation
Collaboration diagram for NFC NDEF manipulation:

Data Structures

struct  nfc_ndef_changed_cb_table_t
 Table element of interrupt handlers called on NDEF write attempt for supported NFC message types. More...
 
struct  ndef_record_t
 Structure describes one parsed NDEF record. See standard NFC Data Exchange Format specification. More...
 

Macros

#define NDEF_MB   (1 << 7)
 NDEF message first byte: Message begin flag.
 
#define NDEF_ME   (1 << 6)
 NDEF message first byte: Message end flag.
 
#define NDEF_CF   (1 << 5)
 NDEF message first byte: Message chunk flag.
 
#define NDEF_SR   (1 << 4)
 NDEF message first byte: Short record flag: payload length is 1 byte (otherwise 4 bytes)
 
#define NDEF_IL   (1 << 3)
 NDEF message first byte: ID length flag: ID is present if this flag is set.
 
#define NDEF_TNF_EMPTY   0x00
 NDEF message first byte: Empty Type.
 
#define NDEF_TNF_WELLKNOWN   0x01
 NDEF message first byte: Well-known Type.
 
#define NDEF_TNF_MEDIA   0x02
 NDEF message first byte: Media Type.
 
#define NDEF_TNF_URI   0x03
 NDEF message first byte: Absolute URI Type.
 
#define NDEF_TNF_EXT   0x04
 NDEF message first byte: External Type.
 
#define NDEF_TNF_UNKNOWN   0x05
 NDEF message first byte: Unknown Type.
 
#define NDEF_TNF_UNCHANGED   0x06
 NDEF message first byte: Unchanged Type.
 
#define NDEF_TNF_RESERVED   0x07
 NDEF message first byte: Reserved Type.
 

Typedefs

typedef bool nfc_ndef_changed_cb_t(const void *Nfc_p, uint8_t *Type, uint32_t TypeLen, uint8_t *Data, uint32_t DataLen)
 The callback is called on NDEF write attempt in card emulation mode. More...
 

Functions

bool NfcNdefResetBuffer (uint8_t *NdefFile, uint16_t NdefFileSize)
 Nullify NDEF messege output buffer. More...
 
bool NfcNdefGetDataLength (uint8_t *NdefFile, uint16_t NdefFileSize, uint16_t *DataLength)
 Get current NDEF messege length. More...
 
bool NfcNdefAddDataLength (uint8_t *NdefFile, uint16_t NdefFileSize, uint16_t DataLength)
 Increase current NDEF messege length. The function must be used when adding a record to the NDEF message with external tool or manually (not NfcNdefAddRecord()). More...
 
bool NfcNdefAddRecord (uint8_t *NdefFile, uint16_t NdefFileSize, struct ndef_record_t *NdefRec)
 Add a new record to the NDEF messege. More...
 
bool NfcNdefFinalize (uint8_t *NdefFile, uint16_t NdefFileSize)
 Close the NDEF messege. The function must be used after NDEF message altering either with NfcNdefAddRecord() or NfcNdefAddDataLength() before supplying to NFC library to ensure all the record headers are valid. More...
 
void NfcNdefGetFirstRecord (uint8_t *NdefFile, uint8_t **NewRecord)
 Get the pointer to the first record inside an NDEF message. More...
 
void NfcNdefGetRecord (uint8_t *NdefFile, uint8_t *PrevRecord, uint8_t **NewRecord)
 Get the pointer to the next record inside an NDEF message. More...
 
void NfcNdefRecordParse (uint8_t *Record, struct ndef_record_t *NdefRec)
 Parse raw NDEF record into the structure. More...
 

Detailed Description

Utility functions to manipulate with NFC NDEF.

Typedef Documentation

typedef bool nfc_ndef_changed_cb_t(const void *Nfc_p, uint8_t *Type, uint32_t TypeLen, uint8_t *Data, uint32_t DataLen)

The callback is called on NDEF write attempt in card emulation mode.

Parameters
NfcNFC driver descriptor
OffsetRequested NDEF offset to write to
DataData to write
DataLenData Length
Returns
bool true on success, false on error

Definition at line 50 of file nfc-ndef.h.

Function Documentation

bool NfcNdefResetBuffer ( uint8_t *  NdefFile,
uint16_t  NdefFileSize 
)

Nullify NDEF messege output buffer.

Parameters
NdefFilePointer to the NDEF message buffer.
NdefFileSizeNDEF message buffer size.
Returns
bool true on success, false on error
bool NfcNdefGetDataLength ( uint8_t *  NdefFile,
uint16_t  NdefFileSize,
uint16_t *  DataLength 
)

Get current NDEF messege length.

Parameters
[in]NdefFilePointer to the NDEF message buffer.
[in]NdefFileSizeNDEF message buffer size.
[out]DataLengthNDEF message length.
Returns
bool true on success, false on error
bool NfcNdefAddDataLength ( uint8_t *  NdefFile,
uint16_t  NdefFileSize,
uint16_t  DataLength 
)

Increase current NDEF messege length. The function must be used when adding a record to the NDEF message with external tool or manually (not NfcNdefAddRecord()).

Parameters
NdefFilePointer to the NDEF message buffer.
NdefFileSizeNDEF message buffer size.
DataLengthAdditional length added to the NDEF message.
Returns
bool true on success, false on error
bool NfcNdefAddRecord ( uint8_t *  NdefFile,
uint16_t  NdefFileSize,
struct ndef_record_t NdefRec 
)

Add a new record to the NDEF messege.

Parameters
NdefFilePointer to the NDEF message buffer.
NdefFileSizeNDEF message buffer size.
NdefRecPointer to a structure holding the NDEF record to add.
Returns
bool true on success, false on error
bool NfcNdefFinalize ( uint8_t *  NdefFile,
uint16_t  NdefFileSize 
)

Close the NDEF messege. The function must be used after NDEF message altering either with NfcNdefAddRecord() or NfcNdefAddDataLength() before supplying to NFC library to ensure all the record headers are valid.

Parameters
NdefFilePointer to the NDEF message buffer.
NdefFileSizeNDEF message buffer size.
Returns
bool true on success, false on error
void NfcNdefGetFirstRecord ( uint8_t *  NdefFile,
uint8_t **  NewRecord 
)

Get the pointer to the first record inside an NDEF message.

Parameters
NdefFile[in] Pointer to the NDEF message buffer.
NewRecord[out] Pointer to the first record pointer, NULL on error.
void NfcNdefGetRecord ( uint8_t *  NdefFile,
uint8_t *  PrevRecord,
uint8_t **  NewRecord 
)

Get the pointer to the next record inside an NDEF message.

Parameters
NdefFile[in] Pointer to the NDEF message buffer.
PrevRecord[in] The previus record pointer.
NewRecord[out] Pointer to the next record pointer, NULL on error.
void NfcNdefRecordParse ( uint8_t *  Record,
struct ndef_record_t NdefRec 
)

Parse raw NDEF record into the structure.

Parameters
Record[in] Pointer to the NDEF record buffer (Typically a pointer to NDEF message buffer content obtained with NfcNdefGetFirstRecord() / NfcNdefGetRecord().
NdefRec[out] Pointer to a descriptor of NDEF record to add, NULL on error.