CommandProcessing::Handler Class Reference

Verbose mode. More...

#include <Handler.h>

Public Member Functions

 Handler ()
 Instantiate a CommandHandler. More...
 
 Handler (ReadWriteStream *stream, bool owned=true)
 
 Handler (const Handler &rhs)=delete
 
 ~Handler ()
 
void setOutputStream (ReadWriteStream *stream, bool owned=true)
 sets the output stream More...
 
ReadWriteStreamgetOutputStream ()
 
size_t process (char charToWrite)
 
size_t process (const char *buffer, size_t size)
 Write chars to stream. More...
 
String processNow (const char *buffer, size_t size)
 
bool registerCommand (Command reqDelegate)
 Add a new command to the command handler. More...
 
bool unregisterCommand (Command reqDelegate)
 Remove a command from the command handler. More...
 
void registerSystemCommands ()
 Register default system commands. More...
 
Command getCommandDelegate (const String &commandString)
 Get the command delegate for a command. More...
 
bool isVerbose () const
 Get the verbose mode. More...
 
void setVerbose (bool mode)
 Set the verbose mode. More...
 
const StringgetCommandPrompt () const
 Get the command line prompt. More...
 
void setCommandPrompt (const String &reqPrompt)
 Set the command line prompt. More...
 
char getCommandEOL () const
 Get the end of line character. More...
 
void setCommandEOL (char reqEOL)
 Set the end of line character. More...
 
const StringgetCommandWelcomeMessage () const
 Get the welcome message. More...
 
void setCommandWelcomeMessage (const String &reqWelcomeMessage)
 Set the welcome message. More...
 

Detailed Description

Verbose mode.

Command handler class

Constructor & Destructor Documentation

◆ Handler() [1/3]

CommandProcessing::Handler::Handler ( )

Instantiate a CommandHandler.

◆ Handler() [2/3]

CommandProcessing::Handler::Handler ( ReadWriteStream stream,
bool  owned = true 
)
inline

◆ Handler() [3/3]

CommandProcessing::Handler::Handler ( const Handler rhs)
delete

◆ ~Handler()

CommandProcessing::Handler::~Handler ( )
inline

Member Function Documentation

◆ getCommandDelegate()

Command CommandProcessing::Handler::getCommandDelegate ( const String commandString)

Get the command delegate for a command.

Parameters
commandStringCommand to query
Return values
CommandDelegateThe command delegate matching the command

◆ getCommandEOL()

char CommandProcessing::Handler::getCommandEOL ( ) const
inline

Get the end of line character.

Return values
charThe EOL character
Note
Only supports one EOL, unlike Windows

◆ getCommandPrompt()

const String& CommandProcessing::Handler::getCommandPrompt ( ) const
inline

Get the command line prompt.

Return values
StringThe command line prompt
Note
This is what is shown on the command line before user input Default is Sming>

◆ getCommandWelcomeMessage()

const String& CommandProcessing::Handler::getCommandWelcomeMessage ( ) const
inline

Get the welcome message.

Return values
StringThe welcome message that is shown when clients connect
Note
Only if verbose mode is enabled

◆ getOutputStream()

ReadWriteStream& CommandProcessing::Handler::getOutputStream ( )
inline

◆ isVerbose()

bool CommandProcessing::Handler::isVerbose ( ) const
inline

Get the verbose mode.

Return values
VerboseModeVerbose mode

◆ process() [1/2]

size_t CommandProcessing::Handler::process ( char  charToWrite)

◆ process() [2/2]

size_t CommandProcessing::Handler::process ( const char *  buffer,
size_t  size 
)
inline

Write chars to stream.

Parameters
bufferPointer to buffer to write to the stream
sizeQuantity of chars to write
Return values
size_tQuantity of chars processed

◆ processNow()

String CommandProcessing::Handler::processNow ( const char *  buffer,
size_t  size 
)

◆ registerCommand()

bool CommandProcessing::Handler::registerCommand ( Command  reqDelegate)

Add a new command to the command handler.

Parameters
reqDelegateCommand delegate to register
Return values
boolTrue on success
Note
If command already exists, it will not be replaced and function will fail. Call unregisterCommand first if you want to replace a command.

◆ registerSystemCommands()

void CommandProcessing::Handler::registerSystemCommands ( )

Register default system commands.

Note
Adds the following system commands to the command handler
  • status
  • echo
  • help
  • debugon
  • debugoff
  • command

◆ setCommandEOL()

void CommandProcessing::Handler::setCommandEOL ( char  reqEOL)
inline

Set the end of line character.

Parameters
reqEOLThe EOL character
Note
Only supports one EOL, unlike Windows

◆ setCommandPrompt()

void CommandProcessing::Handler::setCommandPrompt ( const String reqPrompt)
inline

Set the command line prompt.

Parameters
reqPromptThe command line prompt
Note
This is what is shown on the command line before user input Default is Sming>

◆ setCommandWelcomeMessage()

void CommandProcessing::Handler::setCommandWelcomeMessage ( const String reqWelcomeMessage)
inline

Set the welcome message.

Parameters
reqWelcomeMessageThe welcome message that is shown when clients connect
Note
Only if verbose mode is enabled

◆ setOutputStream()

void CommandProcessing::Handler::setOutputStream ( ReadWriteStream stream,
bool  owned = true 
)
inline

sets the output stream

Parameters
streampointer to the output stream
ownedspecifies if the output stream should be deleted in this class(owned=true)

◆ setVerbose()

void CommandProcessing::Handler::setVerbose ( bool  mode)
inline

Set the verbose mode.

Parameters
reqVerboseModeVerbose mode to set

◆ unregisterCommand()

bool CommandProcessing::Handler::unregisterCommand ( Command  reqDelegate)

Remove a command from the command handler.

reqDelegate Delegate to remove from command handler


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