Firmware for Arduino | PLEN Project Company Inc.
PLEN2::Protocol Class Reference

Analysis class of the PLEN2's protocol. More...

#include <Protocol.h>

Classes

class  Buffer
 Buffer struct. More...
 

Public Member Functions

 Protocol ()
 Constructor. More...
 
virtual ~Protocol ()
 Destructor. More...
 
void readByte (char byte)
 Read a character, and store it in the ring buffer. More...
 
bool accept ()
 Accept buffered string considering internal state. More...
 
void transitState ()
 Transit internal state. More...
 
virtual void beforeHook ()
 User-defined hook that runs before transitState() More...
 
virtual void afterHook ()
 User-defined hook that runs after transitState() More...
 

Protected Types

enum  State {
  READY, HEADER_INCOMING = 0, COMMAND_INCOMING, ARGUMENTS_INCOMING,
  STATE_EOE
}
 List of the internal states. More...
 

Protected Member Functions

void m_abort ()
 Abort analysis. More...
 

Protected Attributes

Buffer m_buffer
 
State m_state
 
uint8_t m_store_length
 
bool m_installing
 
Utility::AbstractParserm_parser [STATE_EOE]
 

Detailed Description

Analysis class of the PLEN2's protocol.

The class only analyses the command line given, so you should override the event handler(s) by inheriting the class yourself.

Please see the virtual methods to get more details.

Member Enumeration Documentation

enum PLEN2::Protocol::State
protected

List of the internal states.

Enumerator
READY 

Ready.

HEADER_INCOMING 

Will receive string that might be HEADER. (Alias of state READY.)

COMMAND_INCOMING 

Will receive string that might be COMMAND.

ARGUMENTS_INCOMING 

Will receive string that might be ARGUMENTS.

STATE_EOE 

Summation of the states.

Constructor & Destructor Documentation

PLEN2::Protocol::Protocol ( )

Constructor.

virtual PLEN2::Protocol::~Protocol ( )
inlinevirtual

Destructor.

Member Function Documentation

bool PLEN2::Protocol::accept ( )

Accept buffered string considering internal state.

Returns
Result
virtual void PLEN2::Protocol::afterHook ( )
virtual

User-defined hook that runs after transitState()

virtual void PLEN2::Protocol::beforeHook ( )
virtual

User-defined hook that runs before transitState()

void PLEN2::Protocol::m_abort ( )
protected

Abort analysis.

void PLEN2::Protocol::readByte ( char  byte)

Read a character, and store it in the ring buffer.

Parameters
[in]byteA character.
void PLEN2::Protocol::transitState ( )

Transit internal state.

Member Data Documentation

Buffer PLEN2::Protocol::m_buffer
protected
bool PLEN2::Protocol::m_installing
protected
Utility::AbstractParser* PLEN2::Protocol::m_parser[STATE_EOE]
protected
State PLEN2::Protocol::m_state
protected
uint8_t PLEN2::Protocol::m_store_length
protected

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