Command Processing
Introduction
Command handler provides a common command line interface (CLI). Command line must be text. Commands should be separated with a single character. CLI can be used with:
Serial
Network (Websockets, Telnet)
and all communication protocols that are exchanging text data.
Commands can be added to and removed from the command handler. Each command will trigger a defined Delegate.
A welcome message may be shown when a user connects and end-of-line (EOL) character may be defined. An automatic “help” display is available.
For more examples take a look at the CommandLine, TelnetServer and HttpServer Websockets samples.
Using
Add these lines to your application componenent.mk file:
COMPONENT_DEPENDS += CommandProcessing
Add these lines to your application:
#include <CommandProcessing/Utils.h>
Basic example:
#include <CommandProcessing/Utils.h> CommandProcessing::Handler commandHandler; void processShutdownCommand(String commandLine, ReadWriteStream& commandOutput) { // ... } void init() { commandHandler.registerSystemCommands(); commandHandler.registerCommand(CommandProcessing::Command("shutdown", "Shutdown Server Command", "Application", processShutdownCommand)); }
API Documentation
References
Used by
Arducam Sample
CommandLine Sample
TelnetServer Sample
HttpServer Websockets Sample
SoC support
esp32
esp32c2
esp32c3
esp32s2
esp32s3
esp8266
host
rp2040