semf
semf::esh::Shell Class Reference

This class manages a semf's embedded shell (esh) operating on a single UART. The esh can be used for executing custom command and running them in a main-function-like environment. For using the esh create an instance of this class. Call the start function for staring the shell and call the loop function inside an endless loop to enable command execution. For adding command to the shell simply create at least one esh::Command object. More...

#include <shell.h>

Collaboration diagram for semf::esh::Shell:
Collaboration graph

Classes

struct  Config
 Configuarion parameters of the shell. More...
 

Public Member Functions

 Shell (UartHardware &uart, const Config &config)
 Constructor. More...
 
 Shell (const Shell &other)=delete
 
virtual ~Shell ()=default
 
void addCommand (Command &cmd)
 Adds a command to the shell. More...
 
void start ()
 Starts the reading process of the shell. The user should call this function once. More...
 
void loop ()
 Performs the command execution. More...
 
 SEMF_SIGNAL (error, Error)
 

Detailed Description

This class manages a semf's embedded shell (esh) operating on a single UART. The esh can be used for executing custom command and running them in a main-function-like environment. For using the esh create an instance of this class. Call the start function for staring the shell and call the loop function inside an endless loop to enable command execution. For adding command to the shell simply create at least one esh::Command object.

Definition at line 33 of file shell.h.

Constructor & Destructor Documentation

◆ Shell() [1/2]

semf::esh::Shell::Shell ( UartHardware uart,
const Config config 
)

Constructor.

Parameters
uartUART to use.
configesh's configuration.

Definition at line 17 of file shell.cpp.

◆ Shell() [2/2]

semf::esh::Shell::Shell ( const Shell other)
delete

◆ ~Shell()

virtual semf::esh::Shell::~Shell ( )
virtualdefault

Member Function Documentation

◆ addCommand()

void semf::esh::Shell::addCommand ( Command cmd)

Adds a command to the shell.

Parameters
cmdCommand to add to the shell.
Note
Since this is done by esh::Command the user shouldn't have to call this function.

Definition at line 34 of file shell.cpp.

Here is the caller graph for this function:

◆ loop()

void semf::esh::Shell::loop ( )

Performs the command execution.

Definition at line 46 of file shell.cpp.

Here is the call graph for this function:

◆ SEMF_SIGNAL()

semf::esh::Shell::SEMF_SIGNAL ( error  ,
Error   
)

Gets emitted on errors.

◆ start()

void semf::esh::Shell::start ( )

Starts the reading process of the shell. The user should call this function once.

Definition at line 39 of file shell.cpp.

Here is the call graph for this function: