AsciiMassage
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AsciiMassageParser Class Reference

Main AsciiMassageParser class. More...

#include <AsciiMassageParser.h>

Inheritance diagram for AsciiMassageParser:
MassageParser

Public Types

typedef void(* callbackFunction) (void)
 

Public Member Functions

 AsciiMassageParser ()
 Constructor.
 
virtual int8_t nextByte (bool *error=0)
 Reads next byte.
 
virtual int16_t nextInt (bool *error=0)
 Reads next int.
 
virtual int32_t nextLong (bool *error=0)
 Reads next long.
 
virtual float nextFloat (bool *error=0)
 Reads next float.
 
virtual int nextString (char *receivedString, int bufferLength)
 Reads next string.
 
virtual void flush ()
 Flushes current message in buffer (if any).
 
virtual bool parse (int data, callbackFunction callback=0)
 
virtual bool parseStream (Stream *stream, callbackFunction callback=0)
 
virtual bool fullMatch (const char *address)
 Return true if current message matches "address".
 
virtual bool dispatch (const char *address, callbackFunction callback)
 

Protected Member Functions

virtual bool _decode (int serialByte)
 
bool _store (uint8_t value)
 

Protected Attributes

bool _needToFlush
 
size_t _messageSize
 
uint8_t _buffer [MASSAGE_PARSER_BUFFERSIZE]
 

Detailed Description

Main AsciiMassageParser class.

Member Function Documentation

◆ _decode()

bool AsciiMassageParser::_decode ( int  serialByte)
protectedvirtual

Decode sa single value read from the serial stream. Returns true if a massage is terminated.

Implements MassageParser.

◆ dispatch()

virtual bool MassageParser::dispatch ( const char *  address,
callbackFunction  callback 
)
inlinevirtualinherited

If current message matches "address", calls function "callback" and returns true; (otherwise returns false).

◆ parse()

virtual bool MassageParser::parse ( int  data,
callbackFunction  callback = 0 
)
inlinevirtualinherited

Reads one char, flushing previous message if needed. Returns true if new message has been parsed. Optional callback function will be called if new message has arrived.

◆ parseStream()

virtual bool MassageParser::parseStream ( Stream *  stream,
callbackFunction  callback = 0 
)
inlinevirtualinherited

Reads all elements of a stream, flushing previous message if needed. Returns true if new message has been parsed. Optional callback function will be called if new message has arrived.


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