Sming Framework API
Sming - Open Source framework for high efficiency WiFi SoC ESP8266 native development with C++ language.
CommandHandler.h
1 /*
2  * CommandHandler.h
3  *
4  * Created on: 2 jul. 2015
5  * Author: Herman
6  */
25 #ifndef SERVICES_COMMANDPROCESSING_COMMANDHANDLER_H_
26 #define SERVICES_COMMANDPROCESSING_COMMANDHANDLER_H_
27 
28 #include "../Wiring/WiringFrameworkIncludes.h"
29 #include "CommandDelegate.h"
30 #include "../Wiring/WHashMap.h"
31 #include "SystemClock.h"
32 #include <stdio.h>
33 #include "HardwareSerial.h"
34 
37 typedef enum {
40  } VerboseMode;
41 
44 {
45 public:
49  ~CommandHandler();
50 
57  bool registerCommand(CommandDelegate reqDelegate);
58 
62  bool unregisterCommand(CommandDelegate reqDelegate);
63 
74 
80 
85 
89  void setVerboseMode(VerboseMode reqVerboseMode);
90 
97 
103  void setCommandPrompt(String reqPrompt);
104 
109  char getCommandEOL();
110 
115  void setCommandEOL(char reqEOL);
116 
122 
127  void setCommandWelcomeMessage(String reqWelcomeMessage);
128 
129 // int deleteGroup(String reqGroup);
130 
131 private :
132  HashMap<String, CommandDelegate> *registeredCommands;
133  void procesHelpCommand(String commandLine, CommandOutput* commandOutput);
134  void procesStatusCommand(String commandLine, CommandOutput* commandOutput);
135  void procesEchoCommand(String commandLine, CommandOutput* commandOutput);
136  void procesDebugOnCommand(String commandLine, CommandOutput* commandOutput);
137  void procesDebugOffCommand(String commandLine, CommandOutput* commandOutput);
138  void processCommandOptions(String commandLine ,CommandOutput* commandOutput);
139 
140  VerboseMode verboseMode = VERBOSE;
141  String currentPrompt = "Sming>";
142  char currentEOL = '\r';
143  String currentWelcomeMessage = "Welcome to the Sming CommandProcessing\r\n";
144 };
145 
148 
150 #endif /* SERVICES_COMMANDPROCESSING_COMMANDHANDLER_H_ */
CommandHandler()
Instantiate a CommandHandler.
String getCommandPrompt()
Get the command line prompt.
void setVerboseMode(VerboseMode reqVerboseMode)
Set the verbose mode.
Silent mode.
Definition: CommandHandler.h:39
VerboseMode
Verbose mode.
Definition: CommandHandler.h:37
Verbose mode.
Definition: CommandHandler.h:38
void setCommandWelcomeMessage(String reqWelcomeMessage)
Set the welcome message.
Definition: WString.h:42
char getCommandEOL()
Get the end of line character.
void setCommandEOL(char reqEOL)
Set the end of line character.
bool registerCommand(CommandDelegate reqDelegate)
Add a new command to the command handler.
CommandDelegate getCommandDelegate(String commandString)
Get the command delegate for a command.
bool unregisterCommand(CommandDelegate reqDelegate)
Remove a command from the command handler.
Definition: CommandOutput.h:17
Command handler class.
Definition: CommandHandler.h:43
CommandHandler commandHandler
Global instance of CommandHandler.
Command delegate class.
Definition: CommandDelegate.h:29
void registerSystemCommands()
Register default system commands.
VerboseMode getVerboseMode()
Get the verbose mode.
void setCommandPrompt(String reqPrompt)
Set the command line prompt.
String getCommandWelcomeMessage()
Get the welcome message.