Shellminator  V1.2.0
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 (WiFiServer *server_p)
 
 Shellminator (WiFiServer *server_p, void(*execution_fn_p)(char *))
 
void beginServer ()
 
void stopServer ()
 
void setClientTimeout (uint16_t clientTimeout_p)
 
 Shellminator (Stream *stream_p)
 
 Shellminator (Stream *stream_p, void(*execution_fn_p)(char *))
 
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 setTerminalCharacterColor (char *buff, uint8_t style, uint8_t color)
 Bring some color into your code. More...
 
void drawLogo ()
 Draws the startup logo. More...
 
void printBanner ()
 This function prints the banner text. More...
 
void printHistory ()
 
void printHelp ()
 
void setBannerText (char *banner_p)
 This function sets the banner text. More...
 
void setBannerText (const char *banner_p)
 This function sets the banner text. More...
 
void setBannerPathText (char *bannerPath_p)
 
void setBannerPathText (const char *bannerPath_p)
 
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 attachLogo (__FlashStringHelper *progmemLogo_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 overridePageUpKey (void(*func)(void))
 Override Page-Up key behaviour. More...
 
void overridePageDownKey (void(*func)(void))
 Override Page-Down key behaviour. More...
 
void overrideHomeKey (void(*func)(void))
 Override Home key behaviour. More...
 
void overrideEndKey (void(*func)(void))
 Override End key behaviour. More...
 
void overrideLogoutKey (void(*func)(void))
 Override Logout key behaviour. More...
 
void overrideSearchKey (void(*func)(void))
 Override Search 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...
 
void freePageUpKey ()
 Reset Page-Up key functionality to default. More...
 
void freePageDownKey ()
 Reset Page-Down key functionality to default. More...
 
void freeHomeKey ()
 Reset Home key functionality to default. More...
 
void freeEndKey ()
 Reset End key functionality to default. More...
 
void freeLogoutKey ()
 Reset Logout key functionality to default. More...
 
void freeSearchKey ()
 Reset Search key functionality to default. More...
 
void clientDisconnect ()
 Disconnect WiFiClient telnet client. More...
 
void beep ()
 Generate a beep sound on the terminal device. More...
 
void generateQRText (char *text)
 This function generates a QR-code from text. More...
 
void generateQRText (const char *text)
 This function generates a QR-code from text. More...
 
void generateQRText (char *text, enum qrcodegen_Ecc ecc)
 This function generates a QR-code from text. More...
 
void generateQRText (const char *text, enum qrcodegen_Ecc ecc)
 This function generates a QR-code from text. More...
 

Static Public Member Functions

static void setTerminalCharacterColor (Stream *stream_p, 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...
 
bool mute = false
 

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 110 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 117 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 131 of file Shellminator.hpp.

Constructor & Destructor Documentation

◆ Shellminator() [1/4]

Shellminator::Shellminator ( WiFiServer *  server_p)

Definition at line 64 of file Shellminator.cpp.

◆ Shellminator() [2/4]

Shellminator::Shellminator ( WiFiServer *  server_p,
void(*)(char *)  execution_fn_p 
)

Definition at line 84 of file Shellminator.cpp.

◆ Shellminator() [3/4]

Shellminator::Shellminator ( Stream *  stream_p)

Definition at line 258 of file Shellminator.cpp.

◆ Shellminator() [4/4]

Shellminator::Shellminator ( Stream *  stream_p,
void(*)(char *)  execution_fn_p 
)

Definition at line 278 of file Shellminator.cpp.

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 358 of file Shellminator.cpp.

◆ attachLogo() [1/3]

void Shellminator::attachLogo ( __FlashStringHelper *  progmemLogo_p)

This function attaches a logo to the terminal.

The logo is just a character array. To create custom 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 345 of file Shellminator.cpp.

◆ attachLogo() [2/3]

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 338 of file Shellminator.cpp.

◆ attachLogo() [3/3]

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 352 of file Shellminator.cpp.

◆ beep()

void Shellminator::beep ( )

Generate a beep sound on the terminal device.

Definition at line 2144 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 506 of file Shellminator.cpp.

Here is the call graph for this function:
Here is the caller 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 522 of file Shellminator.cpp.

Here is the call graph for this function:

◆ beginServer()

void Shellminator::beginServer ( )

Definition at line 103 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 365 of file Shellminator.cpp.

◆ clientDisconnect()

void Shellminator::clientDisconnect ( )

Disconnect WiFiClient telnet client.

Definition at line 1801 of file Shellminator.cpp.

◆ drawLogo()

void Shellminator::drawLogo ( )

Draws the startup logo.

Draws the startup logo in the terminal

Definition at line 2110 of file Shellminator.cpp.

Here is the call graph for this function:
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 1757 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 1739 of file Shellminator.cpp.

◆ freeEndKey()

void Shellminator::freeEndKey ( )

Reset End key functionality to default.

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

Definition at line 1781 of file Shellminator.cpp.

◆ freeHomeKey()

void Shellminator::freeHomeKey ( )

Reset Home key functionality to default.

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

Definition at line 1775 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 1745 of file Shellminator.cpp.

◆ freeLogoutKey()

void Shellminator::freeLogoutKey ( )

Reset Logout key functionality to default.

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

Definition at line 1787 of file Shellminator.cpp.

◆ freePageDownKey()

void Shellminator::freePageDownKey ( )

Reset Page-Down key functionality to default.

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

Definition at line 1769 of file Shellminator.cpp.

◆ freePageUpKey()

void Shellminator::freePageUpKey ( )

Reset Page-Up key functionality to default.

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

Definition at line 1763 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 1751 of file Shellminator.cpp.

◆ freeSearchKey()

void Shellminator::freeSearchKey ( )

Reset Search key functionality to default.

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

Definition at line 1793 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 1733 of file Shellminator.cpp.

◆ generateQRText() [1/4]

void Shellminator::generateQRText ( char *  text)

This function generates a QR-code from text.

With this function you can create QR-codes from text data( links as well ) and show the QR-code in the terminal. It can be handy with links or error codes.

Parameters
textThe text or link that you want to compress into a QR-code.
Note
The error correction is Medium by default.
Warning
To enable the QR-code support, please uncomment SHELLMINATOR_ENABLE_QR_SUPPORT definition at the configuration section.

Definition at line 2664 of file Shellminator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generateQRText() [2/4]

void Shellminator::generateQRText ( char *  text,
enum qrcodegen_Ecc  ecc 
)

This function generates a QR-code from text.

With this function you can create QR-codes from text data( links as well ) and show the QR-code in the terminal. It can be handy with links or error codes.

Parameters
textThe text or link that you want to compress into a QR-code.
eccError correction level.
Warning
To enable the QR-code support, please uncomment SHELLMINATOR_ENABLE_QR_SUPPORT definition at the configuration section.

Definition at line 2517 of file Shellminator.cpp.

Here is the call graph for this function:

◆ generateQRText() [3/4]

void Shellminator::generateQRText ( const char *  text)

This function generates a QR-code from text.

With this function you can create QR-codes from text data( links as well ) and show the QR-code in the terminal. It can be handy with links or error codes.

Parameters
textThe text or link that you want to compress into a QR-code.
Note
The error correction is Medium by default.
Warning
To enable the QR-code support, please uncomment SHELLMINATOR_ENABLE_QR_SUPPORT definition at the configuration section.

Definition at line 2658 of file Shellminator.cpp.

Here is the call graph for this function:

◆ generateQRText() [4/4]

void Shellminator::generateQRText ( const char *  text,
enum qrcodegen_Ecc  ecc 
)

This function generates a QR-code from text.

With this function you can create QR-codes from text data( links as well ) and show the QR-code in the terminal. It can be handy with links or error codes.

Parameters
textThe text or link that you want to compress into a QR-code.
eccError correction level.
Warning
To enable the QR-code support, please uncomment SHELLMINATOR_ENABLE_QR_SUPPORT definition at the configuration section.

Definition at line 2652 of file Shellminator.cpp.

Here is the call graph for this function:

◆ 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 1691 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 1673 of file Shellminator.cpp.

◆ overrideEndKey()

void Shellminator::overrideEndKey ( void(*)(void)  func)

Override End key behaviour.

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

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

Definition at line 1715 of file Shellminator.cpp.

◆ overrideHomeKey()

void Shellminator::overrideHomeKey ( void(*)(void)  func)

Override Home key behaviour.

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

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

Definition at line 1709 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 1679 of file Shellminator.cpp.

◆ overrideLogoutKey()

void Shellminator::overrideLogoutKey ( void(*)(void)  func)

Override Logout key behaviour.

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

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

Definition at line 1721 of file Shellminator.cpp.

◆ overridePageDownKey()

void Shellminator::overridePageDownKey ( void(*)(void)  func)

Override Page-Down key behaviour.

With this function you can attach a function that will be called every time when the Page-Down key is pressed.

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

Definition at line 1703 of file Shellminator.cpp.

◆ overridePageUpKey()

void Shellminator::overridePageUpKey ( void(*)(void)  func)

Override Page-Up key behaviour.

With this function you can attach a function that will be called every time when the Page-Up key is pressed.

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

Definition at line 1697 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 1685 of file Shellminator.cpp.

◆ overrideSearchKey()

void Shellminator::overrideSearchKey ( void(*)(void)  func)

Override Search key behaviour.

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

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

Definition at line 1727 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 1667 of file Shellminator.cpp.

◆ printBanner()

void Shellminator::printBanner ( )

This function prints the banner text.

Definition at line 375 of file Shellminator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printHelp()

void Shellminator::printHelp ( )

Definition at line 475 of file Shellminator.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ printHistory()

void Shellminator::printHistory ( )

Definition at line 402 of file Shellminator.cpp.

Here is the call graph for this function:

◆ 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 541 of file Shellminator.cpp.

◆ setBannerPathText() [1/2]

void Shellminator::setBannerPathText ( char *  bannerPath_p)

Definition at line 318 of file Shellminator.cpp.

◆ setBannerPathText() [2/2]

void Shellminator::setBannerPathText ( const char *  bannerPath_p)

Definition at line 328 of file Shellminator.cpp.

◆ setBannerText() [1/2]

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.

Definition at line 298 of file Shellminator.cpp.

◆ setBannerText() [2/2]

void Shellminator::setBannerText ( const 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.

Definition at line 308 of file Shellminator.cpp.

◆ setClientTimeout()

void Shellminator::setClientTimeout ( uint16_t  clientTimeout_p)

Definition at line 124 of file Shellminator.cpp.

◆ setTerminalCharacterColor() [1/3]

void Shellminator::setTerminalCharacterColor ( char *  buff,
uint8_t  style,
uint8_t  color 
)

Bring some color into your code.

This function changes the color and style of the terminal application characters. The output goes to a buffer;

Warning
Please use the color and style enumeration table from this application as parameter.
Parameters
buffThe result is generated to this buffer. It will be terminated with '\0' character.
styleVT100 compatible font styles
colorVT100 compatible color code

Definition at line 2080 of file Shellminator.cpp.

◆ setTerminalCharacterColor() [2/3]

void Shellminator::setTerminalCharacterColor ( Stream *  stream_p,
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 2098 of file Shellminator.cpp.

◆ setTerminalCharacterColor() [3/3]

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 2062 of file Shellminator.cpp.

Here is the caller graph for this function:

◆ stopServer()

void Shellminator::stopServer ( )

Definition at line 114 of file Shellminator.cpp.

◆ 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 1814 of file Shellminator.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ enableFormatting

bool Shellminator::enableFormatting = true

This flag enables or disables character formatting.

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

Definition at line 498 of file Shellminator.hpp.

◆ mute

bool Shellminator::mute = false

Definition at line 500 of file Shellminator.hpp.

◆ version

const char * Shellminator::version = SHELLMINATOR_VERSION
static

String that holds the version information.

Definition at line 144 of file Shellminator.hpp.