diff --git a/Sming/Components/CommandProcessing/README.rst b/Sming/Libraries/CommandProcessing/README.rst similarity index 100% rename from Sming/Components/CommandProcessing/README.rst rename to Sming/Libraries/CommandProcessing/README.rst diff --git a/Sming/Components/CommandProcessing/component.mk b/Sming/Libraries/CommandProcessing/component.mk similarity index 100% rename from Sming/Components/CommandProcessing/component.mk rename to Sming/Libraries/CommandProcessing/component.mk diff --git a/Sming/Components/CommandProcessing/samples/.cs b/Sming/Libraries/CommandProcessing/samples/.cs similarity index 100% rename from Sming/Components/CommandProcessing/samples/.cs rename to Sming/Libraries/CommandProcessing/samples/.cs diff --git a/Sming/Components/CommandProcessing/samples/Arducam/Makefile b/Sming/Libraries/CommandProcessing/samples/Arducam/Makefile similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/Makefile rename to Sming/Libraries/CommandProcessing/samples/Arducam/Makefile diff --git a/Sming/Components/CommandProcessing/samples/Arducam/README.rst b/Sming/Libraries/CommandProcessing/samples/Arducam/README.rst similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/README.rst rename to Sming/Libraries/CommandProcessing/samples/Arducam/README.rst diff --git a/Sming/Components/CommandProcessing/samples/Arducam/app/ArduCamCommand.cpp b/Sming/Libraries/CommandProcessing/samples/Arducam/app/ArduCamCommand.cpp similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/app/ArduCamCommand.cpp rename to Sming/Libraries/CommandProcessing/samples/Arducam/app/ArduCamCommand.cpp diff --git a/Sming/Components/CommandProcessing/samples/Arducam/app/application.cpp b/Sming/Libraries/CommandProcessing/samples/Arducam/app/application.cpp similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/app/application.cpp rename to Sming/Libraries/CommandProcessing/samples/Arducam/app/application.cpp diff --git a/Sming/Components/CommandProcessing/samples/Arducam/component.mk b/Sming/Libraries/CommandProcessing/samples/Arducam/component.mk similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/component.mk rename to Sming/Libraries/CommandProcessing/samples/Arducam/component.mk diff --git a/Sming/Components/CommandProcessing/samples/Arducam/include/ArduCamCommand.h b/Sming/Libraries/CommandProcessing/samples/Arducam/include/ArduCamCommand.h similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/include/ArduCamCommand.h rename to Sming/Libraries/CommandProcessing/samples/Arducam/include/ArduCamCommand.h diff --git a/Sming/Components/CommandProcessing/samples/Arducam/web/build/Sming.png b/Sming/Libraries/CommandProcessing/samples/Arducam/web/build/Sming.png similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/web/build/Sming.png rename to Sming/Libraries/CommandProcessing/samples/Arducam/web/build/Sming.png diff --git a/Sming/Components/CommandProcessing/samples/Arducam/web/build/grids-responsive-min.css b/Sming/Libraries/CommandProcessing/samples/Arducam/web/build/grids-responsive-min.css similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/web/build/grids-responsive-min.css rename to Sming/Libraries/CommandProcessing/samples/Arducam/web/build/grids-responsive-min.css diff --git a/Sming/Components/CommandProcessing/samples/Arducam/web/build/index.html b/Sming/Libraries/CommandProcessing/samples/Arducam/web/build/index.html similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/web/build/index.html rename to Sming/Libraries/CommandProcessing/samples/Arducam/web/build/index.html diff --git a/Sming/Components/CommandProcessing/samples/Arducam/web/build/layout.css b/Sming/Libraries/CommandProcessing/samples/Arducam/web/build/layout.css similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/web/build/layout.css rename to Sming/Libraries/CommandProcessing/samples/Arducam/web/build/layout.css diff --git a/Sming/Components/CommandProcessing/samples/Arducam/web/build/minified.js b/Sming/Libraries/CommandProcessing/samples/Arducam/web/build/minified.js similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/web/build/minified.js rename to Sming/Libraries/CommandProcessing/samples/Arducam/web/build/minified.js diff --git a/Sming/Components/CommandProcessing/samples/Arducam/web/build/pure-min.css b/Sming/Libraries/CommandProcessing/samples/Arducam/web/build/pure-min.css similarity index 100% rename from Sming/Components/CommandProcessing/samples/Arducam/web/build/pure-min.css rename to Sming/Libraries/CommandProcessing/samples/Arducam/web/build/pure-min.css diff --git a/Sming/Components/CommandProcessing/samples/CommandLine/Makefile b/Sming/Libraries/CommandProcessing/samples/CommandLine/Makefile similarity index 100% rename from Sming/Components/CommandProcessing/samples/CommandLine/Makefile rename to Sming/Libraries/CommandProcessing/samples/CommandLine/Makefile diff --git a/Sming/Components/CommandProcessing/samples/CommandLine/README.rst b/Sming/Libraries/CommandProcessing/samples/CommandLine/README.rst similarity index 100% rename from Sming/Components/CommandProcessing/samples/CommandLine/README.rst rename to Sming/Libraries/CommandProcessing/samples/CommandLine/README.rst diff --git a/Sming/Components/CommandProcessing/samples/CommandLine/app/application.cpp b/Sming/Libraries/CommandProcessing/samples/CommandLine/app/application.cpp similarity index 100% rename from Sming/Components/CommandProcessing/samples/CommandLine/app/application.cpp rename to Sming/Libraries/CommandProcessing/samples/CommandLine/app/application.cpp diff --git a/Sming/Components/CommandProcessing/samples/CommandLine/component.mk b/Sming/Libraries/CommandProcessing/samples/CommandLine/component.mk similarity index 100% rename from Sming/Components/CommandProcessing/samples/CommandLine/component.mk rename to Sming/Libraries/CommandProcessing/samples/CommandLine/component.mk diff --git a/Sming/Components/CommandProcessing/samples/CommandLine/files/index.html b/Sming/Libraries/CommandProcessing/samples/CommandLine/files/index.html similarity index 100% rename from Sming/Components/CommandProcessing/samples/CommandLine/files/index.html rename to Sming/Libraries/CommandProcessing/samples/CommandLine/files/index.html diff --git a/Sming/Components/CommandProcessing/samples/CommandLine/web/build/bootstrap.css.gz b/Sming/Libraries/CommandProcessing/samples/CommandLine/web/build/bootstrap.css.gz similarity index 100% rename from Sming/Components/CommandProcessing/samples/CommandLine/web/build/bootstrap.css.gz rename to Sming/Libraries/CommandProcessing/samples/CommandLine/web/build/bootstrap.css.gz diff --git a/Sming/Components/CommandProcessing/samples/CommandLine/web/build/index.html b/Sming/Libraries/CommandProcessing/samples/CommandLine/web/build/index.html similarity index 100% rename from Sming/Components/CommandProcessing/samples/CommandLine/web/build/index.html rename to Sming/Libraries/CommandProcessing/samples/CommandLine/web/build/index.html diff --git a/Sming/Components/CommandProcessing/samples/CommandLine/web/build/jquery.js.gz b/Sming/Libraries/CommandProcessing/samples/CommandLine/web/build/jquery.js.gz similarity index 100% rename from Sming/Components/CommandProcessing/samples/CommandLine/web/build/jquery.js.gz rename to Sming/Libraries/CommandProcessing/samples/CommandLine/web/build/jquery.js.gz diff --git a/Sming/Components/CommandProcessing/samples/CommandLine/web/dev/bootstrap.css b/Sming/Libraries/CommandProcessing/samples/CommandLine/web/dev/bootstrap.css similarity index 100% rename from Sming/Components/CommandProcessing/samples/CommandLine/web/dev/bootstrap.css rename to Sming/Libraries/CommandProcessing/samples/CommandLine/web/dev/bootstrap.css diff --git a/Sming/Components/CommandProcessing/samples/CommandLine/web/dev/index.html b/Sming/Libraries/CommandProcessing/samples/CommandLine/web/dev/index.html similarity index 100% rename from Sming/Components/CommandProcessing/samples/CommandLine/web/dev/index.html rename to Sming/Libraries/CommandProcessing/samples/CommandLine/web/dev/index.html diff --git a/Sming/Components/CommandProcessing/samples/CommandLine/web/dev/jquery.js b/Sming/Libraries/CommandProcessing/samples/CommandLine/web/dev/jquery.js similarity index 100% rename from Sming/Components/CommandProcessing/samples/CommandLine/web/dev/jquery.js rename to Sming/Libraries/CommandProcessing/samples/CommandLine/web/dev/jquery.js diff --git a/Sming/Components/CommandProcessing/samples/TelnetServer/Makefile b/Sming/Libraries/CommandProcessing/samples/TelnetServer/Makefile similarity index 100% rename from Sming/Components/CommandProcessing/samples/TelnetServer/Makefile rename to Sming/Libraries/CommandProcessing/samples/TelnetServer/Makefile diff --git a/Sming/Components/CommandProcessing/samples/TelnetServer/README.rst b/Sming/Libraries/CommandProcessing/samples/TelnetServer/README.rst similarity index 100% rename from Sming/Components/CommandProcessing/samples/TelnetServer/README.rst rename to Sming/Libraries/CommandProcessing/samples/TelnetServer/README.rst diff --git a/Sming/Components/CommandProcessing/samples/TelnetServer/app/application.cpp b/Sming/Libraries/CommandProcessing/samples/TelnetServer/app/application.cpp similarity index 100% rename from Sming/Components/CommandProcessing/samples/TelnetServer/app/application.cpp rename to Sming/Libraries/CommandProcessing/samples/TelnetServer/app/application.cpp diff --git a/Sming/Components/CommandProcessing/samples/TelnetServer/component.mk b/Sming/Libraries/CommandProcessing/samples/TelnetServer/component.mk similarity index 100% rename from Sming/Components/CommandProcessing/samples/TelnetServer/component.mk rename to Sming/Libraries/CommandProcessing/samples/TelnetServer/component.mk diff --git a/Sming/Components/CommandProcessing/src/.cs b/Sming/Libraries/CommandProcessing/src/.cs similarity index 100% rename from Sming/Components/CommandProcessing/src/.cs rename to Sming/Libraries/CommandProcessing/src/.cs diff --git a/Sming/Components/CommandProcessing/src/CommandProcessing/Command.h b/Sming/Libraries/CommandProcessing/src/CommandProcessing/Command.h similarity index 100% rename from Sming/Components/CommandProcessing/src/CommandProcessing/Command.h rename to Sming/Libraries/CommandProcessing/src/CommandProcessing/Command.h diff --git a/Sming/Components/CommandProcessing/src/CommandProcessing/Handler.cpp b/Sming/Libraries/CommandProcessing/src/CommandProcessing/Handler.cpp similarity index 90% rename from Sming/Components/CommandProcessing/src/CommandProcessing/Handler.cpp rename to Sming/Libraries/CommandProcessing/src/CommandProcessing/Handler.cpp index 540d7b3d49..03bec19a4e 100644 --- a/Sming/Components/CommandProcessing/src/CommandProcessing/Handler.cpp +++ b/Sming/Libraries/CommandProcessing/src/CommandProcessing/Handler.cpp @@ -96,11 +96,11 @@ void Handler::processCommandLine(const String& cmdString) void Handler::registerSystemCommands() { String system = F("system"); - registerCommand({F("status"), F("Displays System Information"), system, {&Handler::procesStatusCommand, this}}); - registerCommand({F("echo"), F("Displays command entered"), system, {&Handler::procesEchoCommand, this}}); - registerCommand({F("help"), F("Displays all available commands"), system, {&Handler::procesHelpCommand, this}}); - registerCommand({F("debugon"), F("Set Serial debug on"), system, {&Handler::procesDebugOnCommand, this}}); - registerCommand({F("debugoff"), F("Set Serial debug off"), system, {&Handler::procesDebugOffCommand, this}}); + registerCommand({F("status"), F("Displays System Information"), system, {&Handler::processStatusCommand, this}}); + registerCommand({F("echo"), F("Displays command entered"), system, {&Handler::processEchoCommand, this}}); + registerCommand({F("help"), F("Displays all available commands"), system, {&Handler::processHelpCommand, this}}); + registerCommand({F("debugon"), F("Set Serial debug on"), system, {&Handler::processDebugOnCommand, this}}); + registerCommand({F("debugoff"), F("Set Serial debug off"), system, {&Handler::processDebugOffCommand, this}}); registerCommand({F("command"), F("Use verbose/silent/prompt as command options"), system, @@ -143,7 +143,7 @@ bool Handler::unregisterCommand(Command reqDelegate) } } -void Handler::procesHelpCommand(String commandLine, ReadWriteStream& outputStream) +void Handler::processHelpCommand(String commandLine, ReadWriteStream& outputStream) { debug_d("HelpCommand entered"); outputStream.println(_F("Commands available are :")); @@ -152,7 +152,7 @@ void Handler::procesHelpCommand(String commandLine, ReadWriteStream& outputStrea } } -void Handler::procesStatusCommand(String commandLine, ReadWriteStream& outputStream) +void Handler::processStatusCommand(String commandLine, ReadWriteStream& outputStream) { debug_d("StatusCommand entered"); outputStream << _F("Sming Framework Version : " SMING_VERSION) << endl; @@ -161,19 +161,19 @@ void Handler::procesStatusCommand(String commandLine, ReadWriteStream& outputStr outputStream << _F("System Start Reason : ") << system_get_rst_info()->reason << endl; } -void Handler::procesEchoCommand(String commandLine, ReadWriteStream& outputStream) +void Handler::processEchoCommand(String commandLine, ReadWriteStream& outputStream) { debug_d("HelpCommand entered"); outputStream << _F("You entered : '") << commandLine << '\'' << endl; } -void Handler::procesDebugOnCommand(String commandLine, ReadWriteStream& outputStream) +void Handler::processDebugOnCommand(String commandLine, ReadWriteStream& outputStream) { // Serial.systemDebugOutput(true); // outputStream.println(_F("Debug set to : On")); } -void Handler::procesDebugOffCommand(String commandLine, ReadWriteStream& outputStream) +void Handler::processDebugOffCommand(String commandLine, ReadWriteStream& outputStream) { // Serial.systemDebugOutput(false); // outputStream.println(_F("Debug set to : Off")); diff --git a/Sming/Components/CommandProcessing/src/CommandProcessing/Handler.h b/Sming/Libraries/CommandProcessing/src/CommandProcessing/Handler.h similarity index 91% rename from Sming/Components/CommandProcessing/src/CommandProcessing/Handler.h rename to Sming/Libraries/CommandProcessing/src/CommandProcessing/Handler.h index 25a7f6569e..d75e2f6b55 100644 --- a/Sming/Components/CommandProcessing/src/CommandProcessing/Handler.h +++ b/Sming/Libraries/CommandProcessing/src/CommandProcessing/Handler.h @@ -58,7 +58,7 @@ class Handler */ void setOutputStream(ReadWriteStream* stream, bool owned = true) { - if(outputStream != nullptr && ownedStream) { + if(ownedStream) { delete outputStream; } @@ -125,7 +125,7 @@ class Handler /** @brief Get the command delegate for a command * @param commandString Command to query - * @retval CommandDelegate The command delegate matching the command + * @retval Command The command delegate matching the command */ Command getCommandDelegate(const String& commandString); @@ -217,11 +217,11 @@ class Handler bool ownedStream = true; LineBuffer commandBuf; - void procesHelpCommand(String commandLine, ReadWriteStream& outputStream); - void procesStatusCommand(String commandLine, ReadWriteStream& outputStream); - void procesEchoCommand(String commandLine, ReadWriteStream& outputStream); - void procesDebugOnCommand(String commandLine, ReadWriteStream& outputStream); - void procesDebugOffCommand(String commandLine, ReadWriteStream& outputStream); + void processHelpCommand(String commandLine, ReadWriteStream& outputStream); + void processStatusCommand(String commandLine, ReadWriteStream& outputStream); + void processEchoCommand(String commandLine, ReadWriteStream& outputStream); + void processDebugOnCommand(String commandLine, ReadWriteStream& outputStream); + void processDebugOffCommand(String commandLine, ReadWriteStream& outputStream); void processCommandOptions(String commandLine, ReadWriteStream& outputStream); void processCommandLine(const String& cmdString); diff --git a/Sming/Components/CommandProcessing/src/CommandProcessing/Utils.cpp b/Sming/Libraries/CommandProcessing/src/CommandProcessing/Utils.cpp similarity index 100% rename from Sming/Components/CommandProcessing/src/CommandProcessing/Utils.cpp rename to Sming/Libraries/CommandProcessing/src/CommandProcessing/Utils.cpp diff --git a/Sming/Components/CommandProcessing/src/CommandProcessing/Utils.h b/Sming/Libraries/CommandProcessing/src/CommandProcessing/Utils.h similarity index 100% rename from Sming/Components/CommandProcessing/src/CommandProcessing/Utils.h rename to Sming/Libraries/CommandProcessing/src/CommandProcessing/Utils.h diff --git a/docs/source/information/command-handler.rst b/docs/source/information/command-handler.rst deleted file mode 100644 index 134e491e89..0000000000 --- a/docs/source/information/command-handler.rst +++ /dev/null @@ -1,90 +0,0 @@ -*************** -Command Handler -*************** - -Summary -======= - -The Sming ``CommandHandler`` implementation adds the possibility to -handle system and application commands over a variety of input media. - -The CLI provides a framework in which basic system commands can be -extended and application specific commands created. - -Currently implemented are: - Serial - Telnet Server - Websocket Server - -Implementation -============== - -The implementation makes use of a global object ``CommandHandler``, -which at the start is just a skeleton without any command active. - -System commands can be activated using: - -``Serial.commandProcessing(true)`` - -``telnetServer.enableCommand(true)`` - -``websockerServer.commandProcessing(true, "command")`` - -The additional parameter for websocket is used to allow multiple -connections on one websocket server instance, both with or without -command processing. - -When the websocket open request has query parameter ``"command=true"`` -command processing is enabled. - -Usage -===== - -The usage of ``CommandProcessor`` is the same for all implementations, -except for specific requirements. ``CommandProcesor`` options -implemented are: - Verbose -> sets display of welcome message - Prompt --> set prompt string - EOL -> set end of line character - welcome -message -> set the welcome message - -System Commands -=============== - -The base ``CommandHandler`` has the following sysytem commands -implemented: - ``help``, Displays all available commands - ``status``, -Displays System Information - ``echo``, Displays command entered - -``debugon``, Set Serial debug on - ``debugoff``, Set Serial debug off - -``command``, Usage verbose/silent/prompt for command options - -Application options -=================== - -Applications (and Sming Core functionality) can add commands to the -``CommandProcesor`` using a construct like - -.. code-block:: c++ - - registerCommand(CommandDelegate( - "status", - "Displays System Information", - "system", - commandFunctionDelegate(&CommandHandler::procesStatusCommand, this) - )); - -The added command will then be available over every opened command -channel. - -Example usage -============= - -The capabilities of ``CommandHandler`` are shown in the example -``CommandProcessing_Debug``. - -The example will create an application which shows ``CommandProcessing`` -for Telnet, Websocket and Serial. - -- to test Telnet, open telnet client and connect on port 23 to the ESP - ip -- to test the Websocket, open a web browser with the ESP -- to test Serial use your “Serial program” and make sure “local echo” - is activated - -For all implementations type “help” to show the available Commands - -The possibilities of extending commands with the application are shown -in: - the class ``ExampleCommand`` - the functions -``startExampleApplicationCommand()`` and -``processApplicationCommands()`` diff --git a/docs/source/information/index.rst b/docs/source/information/index.rst index 0b360e0604..1ac38ab5ba 100644 --- a/docs/source/information/index.rst +++ b/docs/source/information/index.rst @@ -15,5 +15,4 @@ Information tasks debugging rboot-ota - command-handler tips-n-tricks