Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
CommandHandler Class Reference

Command handler class. More...

#include <CommandHandler.h>

Public Member Functions

 CommandHandler ()
 Instantiate a CommandHandler. More...
 
bool registerCommand (CommandDelegate reqDelegate)
 Add a new command to the command handler. More...
 
bool unregisterCommand (CommandDelegate reqDelegate)
 Remove a command from the command handler. More...
 
void registerSystemCommands ()
 Register default system commands. More...
 
CommandDelegate getCommandDelegate (String commandString)
 Get the command delegate for a command. More...
 
VerboseMode getVerboseMode ()
 Get the verbose mode. More...
 
void setVerboseMode (VerboseMode reqVerboseMode)
 Set the verbose mode. More...
 
String getCommandPrompt ()
 Get the command line prompt. More...
 
void setCommandPrompt (String reqPrompt)
 Set the command line prompt. More...
 
char getCommandEOL ()
 Get the end of line character. More...
 
void setCommandEOL (char reqEOL)
 Set the end of line character. More...
 
String getCommandWelcomeMessage ()
 Get the welcome message. More...
 
void setCommandWelcomeMessage (String reqWelcomeMessage)
 Set the welcome message. More...
 

Detailed Description

Command handler class.

Constructor & Destructor Documentation

CommandHandler::CommandHandler ( )

Instantiate a CommandHandler.

Member Function Documentation

CommandDelegate CommandHandler::getCommandDelegate ( String  commandString)

Get the command delegate for a command.

Parameters
commandStringCommand to query
Return values
CommandDelegateThe command delegate matchin the command
char CommandHandler::getCommandEOL ( )

Get the end of line character.

Return values
charThe EOL character
Note
Only supports one EOL, unlike Windows
String CommandHandler::getCommandPrompt ( )

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>
String CommandHandler::getCommandWelcomeMessage ( )

Get the welcome message.

Return values
StringThe welcome message that is shown when clients connect
Note
Only if verbose mode is enabled
VerboseMode CommandHandler::getVerboseMode ( )

Get the verbose mode.

Return values
VerboseModeVerbose mode
bool CommandHandler::registerCommand ( CommandDelegate  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.
void CommandHandler::registerSystemCommands ( )

Register default system commands.

Note
Adds the following system commmands to the command handler
  • status
  • echo
  • help
  • debugon
  • debugoff
  • command
void CommandHandler::setCommandEOL ( char  reqEOL)

Set the end of line character.

Parameters
reqEOLThe EOL character
Note
Only supports one EOL, unlike Windows
void CommandHandler::setCommandPrompt ( String  reqPrompt)

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>
void CommandHandler::setCommandWelcomeMessage ( String  reqWelcomeMessage)

Set the welcome message.

Parameters
reqWelcomeMessageThe welcome message that is shown when clients connect
Note
Only if verbose mode is enabled
void CommandHandler::setVerboseMode ( VerboseMode  reqVerboseMode)

Set the verbose mode.

Parameters
reqVerboseModeVerbose mode to set
bool CommandHandler::unregisterCommand ( CommandDelegate  reqDelegate)

Remove a command from the command handler.

reqDelegate Delegate to remove from command handler