AceUtils
0.5.0
Useful Arduino utilties which are too small as separate libraries, but complex enough to be shared among multiple projects, and often have external dependencies to other libraries.
|
A convenience wrapper around a CommandDispatcher that hides complexity of creating, initializing and injecting the resources needed by the CommandDispatcher. More...
#include <CommandManager.h>
Public Member Functions | |
CommandManager (const CommandHandler *const *commands, uint8_t numCommands, Stream &serial, const char *prompt=nullptr) | |
Constructor. More... | |
int | runCoroutine () override |
Main body of coroutine, dispatches to the underlying mStreamLineReader and mDispatcher. | |
const CommandDispatcher * | getDispatcher () const |
Return the CommandDispatcher. More... | |
A convenience wrapper around a CommandDispatcher that hides complexity of creating, initializing and injecting the resources needed by the CommandDispatcher.
It is not strictly necessary to use this, but the setup is much easier using this class.
This is a subclass of Coroutine, just like CommandDispatcher. The runCoroutine() method simply delegates to the underlying CommandDispatcher, so this class can be used as a substitute for CommandDispatcher. The setupCoroutine() method should be called to initialize the name of the coroutine and insert it into the CoroutineScheduler.
Example usage:
BUF_SIZE | Size of the input line buffer. |
ARGV_SIZE | Size of the command line argv token list. |
Definition at line 82 of file CommandManager.h.
|
inline |
Constructor.
commands | Array of (CommandHandler*). |
numCommands | Number of commands in 'commands'. |
serial | The serial port used to read commands and send output, will normally be 'Serial', but can be set to something else. |
prompt | If not null, print a prompt and echo the command entered by the user. If null, don't print the prompt and don't echo the input from the user. |
Definition at line 96 of file CommandManager.h.
|
inline |