Shellminator  V1.1.1
Simple Terminal
Loading...
Searching...
No Matches
Shellminator Class Reference

Shellminator object. More...

#include <Shellminator.hpp>

Public Types

enum  {
  BLACK = 30 , RED = 31 , GREEN = 32 , YELLOW = 33 ,
  BLUE = 34 , MAGENTA = 35 , CYAN = 36 , WHITE = 37
}
 VT100 color codes. More...
 
enum  {
  REGULAR = 0 , BOLD = 1 , LOW_INTENSITY = 2 , ITALIC = 3 ,
  UNDERLINE = 4 , BLINKING = 5 , REVERSE = 6 , BACKGROUND = 7 ,
  INVISIBLE = 8
}
 VT100 font sytles. More...
 

Public Member Functions

 Shellminator (HardwareSerial *serialPort_p)
 Shellminator Constructor. More...
 
 Shellminator (HardwareSerial *serialPort_p, void(*execution_fn_p)(char *))
 Shellminator Constructor. More...
 
 Shellminator (Serial_ *serialPort_p)
 Shellminator Constructor. More...
 
 Shellminator (Serial_ *serialPort_p, void(*execution_fn_p)(char *))
 Shellminator Constructor. More...
 
 Shellminator (WiFiClient *resp)
 Shellminator Constructor. More...
 
 Shellminator (WiFiClient *resp, void(*execution_fn_p)(char *))
 Shellminator Constructor. More...
 
void addExecFunc (void(*execution_fn_p)(char *))
 Execution function adder function. More...
 
void begin (char *banner_p)
 Shellminator initialization function. More...
 
void begin (const char *banner_p)
 Shellminator initialization function. More...
 
void sendBackspace ()
 Sends a backspace. More...
 
void clear ()
 Clear screen. More...
 
void update ()
 Update function. More...
 
void setTerminalCharacterColor (uint8_t style, uint8_t color)
 Bring some color into your code. More...
 
void drawLogo ()
 Draws the startup logo. More...
 
void setBannerText (char *banner_p)
 This function sets the banner text. More...
 
void attachLogo (char *logo_p)
 This function attaches a logo to the terminal. More...
 
void attachLogo (const char *logo_p)
 This function attaches a logo to the terminal. More...
 
void overrideUpArrow (void(*func)(void))
 Override up arrow key behaviour. More...
 
void overrideDownArrow (void(*func)(void))
 Override down arrow key behaviour. More...
 
void overrideLeftArrow (void(*func)(void))
 Override left arrow key behaviour. More...
 
void overrideRightArrow (void(*func)(void))
 Override right arrow key behaviour. More...
 
void overrideAbortKey (void(*func)(void))
 Override abort key behaviour. More...
 
void freeUpArrow ()
 Reset up arrow key functionality to default. More...
 
void freeDownArrow ()
 Reset down arrow key functionality to default. More...
 
void freeLeftArrow ()
 Reset left arrow key functionality to default. More...
 
void freeRightArrow ()
 Reset right arrow key functionality to default. More...
 
void freeAbortKey ()
 Reset abort key functionality to default. More...
 

Static Public Member Functions

static void setTerminalCharacterColor (HardwareSerial *serialPort, uint8_t style, uint8_t color)
 Bring some color into your code. More...
 

Public Attributes

bool enableFormatting = true
 This flag enables or disables character formatting. More...
 

Static Public Attributes

static const char * version = SHELLMINATOR_VERSION
 String that holds the version information. More...
 

Detailed Description

Shellminator object.

It can be used to interface with a VT100 compatible terminal like PuTTY, Terra Term or minicom. The module requires an Arduino-like Serial object.

Definition at line 121 of file Shellminator.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

VT100 color codes.

This enum holds all of the VT100 compatible color codes.

Enumerator
BLACK 
RED 
GREEN 
YELLOW 
BLUE 
MAGENTA 
CYAN 
WHITE 

Definition at line 128 of file Shellminator.hpp.

◆ anonymous enum

anonymous enum

VT100 font sytles.

This enum holds all of the VT100 compatible font styles.

Enumerator
REGULAR 
BOLD 
LOW_INTENSITY 
ITALIC 
UNDERLINE 
BLINKING 
REVERSE 
BACKGROUND 
INVISIBLE 

Definition at line 142 of file Shellminator.hpp.

Constructor & Destructor Documentation

◆ Shellminator() [1/6]

Shellminator::Shellminator ( HardwareSerial *  serialPort_p)

Shellminator Constructor.

Constructor for a Shellminator object.

Parameters
serialPort_ppointer to an Arduino-like Serial object.

Definition at line 45 of file Shellminator.cpp.

Here is the call graph for this function:

◆ Shellminator() [2/6]

Shellminator::Shellminator ( HardwareSerial *  serialPort_p,
void(*)(char *)  execution_fn_p 
)

Shellminator Constructor.

Constructor for a Shellminator object with an execution function.

Parameters
serialPort_ppointer to an Arduino-like Serial object.
execution_fn_pfunction pointer to the execution function. It has to be a void return type, with one argument, and that argument is a char*type.

Definition at line 67 of file Shellminator.cpp.

Here is the call graph for this function:

◆ Shellminator() [3/6]

Shellminator::Shellminator ( Serial_ *  serialPort_p)

Shellminator Constructor.

Constructor for a Shellminator object.

Parameters
serialPort_ppointer to an Arduino-like Serial object.

Definition at line 91 of file Shellminator.cpp.

Here is the call graph for this function:

◆ Shellminator() [4/6]

Shellminator::Shellminator ( Serial_ *  serialPort_p,
void(*)(char *)  execution_fn_p 
)

Shellminator Constructor.

Constructor for a Shellminator object with an execution function.

Parameters
serialPort_ppointer to an Arduino-like Serial object.
execution_fn_pfunction pointer to the execution function. It has to be a void return type, with one argument, and that argument is a char*type.

Definition at line 113 of file Shellminator.cpp.

Here is the call graph for this function:

◆ Shellminator() [5/6]

Shellminator::Shellminator ( WiFiClient *  resp)

Shellminator Constructor.

Constructor for a Shellminator object.

Parameters
resppointer to a WiFiClient object.

Definition at line 137 of file Shellminator.cpp.

Here is the call graph for this function:

◆ Shellminator() [6/6]

Shellminator::Shellminator ( WiFiClient *  resp,
void(*)(char *)  execution_fn_p 
)

Shellminator Constructor.

Constructor for a Shellminator object with an execution function.

Parameters
resppointer to a WiFiClient object.
execution_fn_pfunction pointer to the execution function. It has to be a void return type, with one argument, and that argument is a char*type.

Definition at line 159 of file Shellminator.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ addExecFunc()

void Shellminator::addExecFunc ( void(*)(char *)  execution_fn_p)

Execution function adder function.

This function allows you to add or replace the execution function after the constructor.

Parameters
execution_fn_pfunction pointer to the execution function. It has to be a void return type, with one argument, and that argument is a char*type.

Definition at line 195 of file Shellminator.cpp.

◆ attachLogo() [1/2]

void Shellminator::attachLogo ( char *  logo_p)

This function attaches a logo to the terminal.

The logo is just a character array. To create costum startup logo: https://patorjk.com/software/taag/#p=display&f=Slant&t=Arduino To make it to a c-string: https://tomeko.net/online_tools/cpp_text_escape.php?lang=en Add '\r' to all line end.

Parameters
logo_pPointer to the logo's address.

Definition at line 183 of file Shellminator.cpp.

◆ attachLogo() [2/2]

void Shellminator::attachLogo ( const char *  logo_p)

This function attaches a logo to the terminal.

The logo is just a character array. To create costum startup logo: https://patorjk.com/software/taag/#p=display&f=Slant&t=Arduino To make it to a c-string: https://tomeko.net/online_tools/cpp_text_escape.php?lang=en Add '\r' to all line end.

Parameters
logo_pPointer to the logo's address.

Definition at line 189 of file Shellminator.cpp.

◆ begin() [1/2]

void Shellminator::begin ( char *  banner_p)

Shellminator initialization function.

This function initializes the object and prints the startup logo.

Note
The length of this string has to be less, or equal than SHELLMINATOR_BANNER_LEN. Leftover characters are truncated!
Warning
You have to call this function before all other member functions!
Parameters
banner_pthis is equivalent to a user name in linux like terminals. It is just a visual thing.

Definition at line 231 of file Shellminator.cpp.

Here is the call graph for this function:

◆ begin() [2/2]

void Shellminator::begin ( const char *  banner_p)

Shellminator initialization function.

This function initializes the object and prints the startup logo.

Note
The length of this string has to be less, or equal than SHELLMINATOR_BANNER_LEN. Leftover characters are truncated!
Warning
You have to call this function before all other member functions!
Parameters
banner_pthis is equivalent to a user name in linux like terminals. It is just a visual thing.

Definition at line 250 of file Shellminator.cpp.

Here is the call graph for this function:

◆ clear()

void Shellminator::clear ( )

Clear screen.

This function clears the terminal screen.

Definition at line 202 of file Shellminator.cpp.

◆ drawLogo()

void Shellminator::drawLogo ( )

Draws the startup logo.

Draws the startup logo in the terminal

Definition at line 1137 of file Shellminator.cpp.

Here is the caller graph for this function:

◆ freeAbortKey()

void Shellminator::freeAbortKey ( )

Reset abort key functionality to default.

This function resets the abort key functionality to default. If you want to detach the override function for the key, you have to call this function.

Definition at line 1010 of file Shellminator.cpp.

◆ freeDownArrow()

void Shellminator::freeDownArrow ( )

Reset down arrow key functionality to default.

This function resets the down arrow functionality to default. If you want to detach the override function for the key, you have to call this function.

Definition at line 992 of file Shellminator.cpp.

◆ freeLeftArrow()

void Shellminator::freeLeftArrow ( )

Reset left arrow key functionality to default.

This function resets the left arrow functionality to default. If you want to detach the override function for the key, you have to call this function.

Definition at line 998 of file Shellminator.cpp.

◆ freeRightArrow()

void Shellminator::freeRightArrow ( )

Reset right arrow key functionality to default.

This function resets the right arrow functionality to default. If you want to detach the override function for the key, you have to call this function.

Definition at line 1004 of file Shellminator.cpp.

◆ freeUpArrow()

void Shellminator::freeUpArrow ( )

Reset up arrow key functionality to default.

This function resets the up arrow functionality to default. If you want to detach the override function for the key, you have to call this function.

Definition at line 986 of file Shellminator.cpp.

◆ overrideAbortKey()

void Shellminator::overrideAbortKey ( void(*)(void)  func)

Override abort key behaviour.

With this function you can attach a function that will be called every time when the abort key is pressed. The default abort key is usually a Ctrl + C combo.

Parameters
funcPointer to the function that will be called on keypress.

Definition at line 980 of file Shellminator.cpp.

◆ overrideDownArrow()

void Shellminator::overrideDownArrow ( void(*)(void)  func)

Override down arrow key behaviour.

With this function you can attach a function that will be called every time when the down arrow key is pressed.

Parameters
funcPointer to the function that will be called on keypress.

Definition at line 962 of file Shellminator.cpp.

◆ overrideLeftArrow()

void Shellminator::overrideLeftArrow ( void(*)(void)  func)

Override left arrow key behaviour.

With this function you can attach a function that will be called every time when the left arrow key is pressed.

Parameters
funcPointer to the function that will be called on keypress.

Definition at line 968 of file Shellminator.cpp.

◆ overrideRightArrow()

void Shellminator::overrideRightArrow ( void(*)(void)  func)

Override right arrow key behaviour.

With this function you can attach a function that will be called every time when the right arrow key is pressed.

Parameters
funcPointer to the function that will be called on keypress.

Definition at line 974 of file Shellminator.cpp.

◆ overrideUpArrow()

void Shellminator::overrideUpArrow ( void(*)(void)  func)

Override up arrow key behaviour.

With this function you can attach a function that will be called every time when the up arrow key is pressed.

Parameters
funcPointer to the function that will be called on keypress.

Definition at line 956 of file Shellminator.cpp.

◆ sendBackspace()

void Shellminator::sendBackspace ( )

Sends a backspace.

This function makes a backspace in the terminal application. Basically it deletes the last character in the terminal screen.

Definition at line 269 of file Shellminator.cpp.

◆ setBannerText()

void Shellminator::setBannerText ( char *  banner_p)

This function sets the banner text.

It can be used when you want to change the banner text runtime.

Parameters
banner_pString that contains the new banner text.

◆ setTerminalCharacterColor() [1/2]

void Shellminator::setTerminalCharacterColor ( HardwareSerial *  serialPort,
uint8_t  style,
uint8_t  color 
)
static

Bring some color into your code.

This function changes the color and style of the terminal application characters. This function can be used outside of a Shellminator object.

Warning
Please use the color and style enumeration table from this application as parameter.
Parameters
styleArduino Serial object to print the style code.
styleVT100 compatible font styles
colorVT100 compatible color code

Definition at line 1125 of file Shellminator.cpp.

◆ setTerminalCharacterColor() [2/2]

void Shellminator::setTerminalCharacterColor ( uint8_t  style,
uint8_t  color 
)

Bring some color into your code.

This function changes the color and style of the terminal application characters.

Warning
Please use the color and style enumeration table from this application as parameter.
Parameters
styleVT100 compatible font styles
colorVT100 compatible color code

Definition at line 1107 of file Shellminator.cpp.

Here is the caller graph for this function:

◆ update()

void Shellminator::update ( )

Update function.

This function handles all of the communication related stuff between the code and the terminal application.

Warning
This function has to be called periodically.
If the calling of this function is not frequent enough it cann cause buffer overflow in the Serial driver!

Definition at line 1016 of file Shellminator.cpp.

Member Data Documentation

◆ enableFormatting

bool Shellminator::enableFormatting = true

This flag enables or disables character formatting.

It can be usefull when VT100 format parser is not available on the host device.

Definition at line 368 of file Shellminator.hpp.

◆ version

const char * Shellminator::version = SHELLMINATOR_VERSION
static

String that holds the version information.

Definition at line 155 of file Shellminator.hpp.