Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

MessageParser Class Reference

MessageParser Class Reference
[Nfc]

Event driven NDEF Message parser. More...

#include <MessageParser.h>

Data Structures

struct  Delegate
 Report parsing event to the application. More...

Public Types

enum  error_t {
  INVALID_MESSAGE_START, INSUFICIENT_DATA, INVALID_TYPE_NAME_FORMAT, INVALID_EMPTY_RECORD,
  INVALID_UNKNOWN_TYPE_LENGTH, INVALID_UNCHANGED_TYPE, CHUNK_RECORD_NOT_SUPPORTED, MISSING_MESSAGE_END,
  MISSING_TYPE_VALUE
}
 

Error that can be reported by the parsing operation.

More...

Public Member Functions

 MessageParser ()
 Construct a message parser.
void set_delegate (Delegate *delegate)
 Set the handler that processes parsing events.
void parse (const Span< const uint8_t > &data_buffer)
 Parse an NDEF Message.

Detailed Description

Event driven NDEF Message parser.

Definition at line 37 of file MessageParser.h.


Member Enumeration Documentation

enum error_t

Error that can be reported by the parsing operation.

Enumerator:
INVALID_MESSAGE_START 

The message doesn't start with a message start tag.

INSUFICIENT_DATA 

There is not enough data left to pursue parsing of the message.

INVALID_TYPE_NAME_FORMAT 

The type name of a record is invalid.

INVALID_EMPTY_RECORD 

An empty record is malformed.

INVALID_UNKNOWN_TYPE_LENGTH 

Record of unknown type embed a type length different than 0.

INVALID_UNCHANGED_TYPE 

Record of unchanged type contains a type.

CHUNK_RECORD_NOT_SUPPORTED 

Chunk record encountered.

MISSING_MESSAGE_END 

Message is not properly closed.

MISSING_TYPE_VALUE 

Type is missing in a record expecting a type (well known type, media type, absolute uri or external type).

Definition at line 42 of file MessageParser.h.


Constructor & Destructor Documentation

Construct a message parser.

Definition at line 110 of file MessageParser.cpp.


Member Function Documentation

void parse ( const Span< const uint8_t > &  data_buffer )

Parse an NDEF Message.

Records and errors are reported to the handler registered with set_event_handler.

Parameters:
data_bufferThe data buffer that contains the NDEF message.

Definition at line 119 of file MessageParser.cpp.

void set_delegate ( Delegate delegate )

Set the handler that processes parsing events.

Parameters:
delegateThe parsing event handler.

Definition at line 114 of file MessageParser.cpp.