NFC / NDEF Library for Proximity APIs  4.1.0
Easily parse and create NDEF records with the Windows Proximity APIs / Near Field Communication NFC.
Public Member Functions | Static Public Member Functions | List of all members
NdefLibrary.Ndef.NdefMessage Class Reference

An NDEF message is composed of one or more NDEF records. More...

Inheritance diagram for NdefLibrary.Ndef.NdefMessage:

Public Member Functions

byte [] ToByteArray ()
 Convert all the NDEF records currently stored in the NDEF message to a byte array suitable for writing to a tag or sending to another device. More...
 

Static Public Member Functions

static NdefMessage FromByteArray (byte[] message)
 Returns the NDEF message parsed from the contents of message . More...
 

Detailed Description

An NDEF message is composed of one or more NDEF records.

This class is essentially just a list of records, and provides the necessary methods to convert all the records into a single byte array that can be written to a tag and has the correct flags set (e.g., message begin / end). NdefMessage can also parse a byte array into an NDEF message, separating and creating all the individual records out of the array.

From the NFC Forum specification document: NFC Forum Data Exchange Format is a lightweight binary message format designed to encapsulate one or more application-defined payloads into a single message construct.

An NDEF message contains one or more NDEF records, each carrying a payload of arbitrary type and up to (2^32)-1 octets in size. Records can be chained together to support larger payloads.

An NDEF record carries three parameters for describing its payload: the payload length, the payload type, and an optional payload identifier.

Member Function Documentation

◆ FromByteArray()

static NdefMessage NdefLibrary.Ndef.NdefMessage.FromByteArray ( byte []  message)
static

Returns the NDEF message parsed from the contents of message .

The message parameter is interpreted as the raw message format defined in the NFC Forum specifications.

Parameters
messageRaw byte array containing the NDEF message, which consists of 0 or more NDEF records.
Exceptions
NdefExceptionThrown if there is an error parsing the NDEF message out of the byte array.
Returns
If parsing was successful, the NDEF message containing 0 or more NDEF records.

◆ ToByteArray()

byte [] NdefLibrary.Ndef.NdefMessage.ToByteArray ( )

Convert all the NDEF records currently stored in the NDEF message to a byte array suitable for writing to a tag or sending to another device.

Returns
The NDEF record(s) converted to an NDEF message.

The documentation for this class was generated from the following file: