Shellminator V3.0.1
Simple Terminal
Loading...
Searching...
No Matches
ShellminatorCommanderInterface Class Reference

#include <Shellminator-Commander-Interface.hpp>

Inheritance diagram for ShellminatorCommanderInterface:
Collaboration diagram for ShellminatorCommanderInterface:

Public Member Functions

 ShellminatorCommanderInterface (Stream *stream_p)
 
void attachCommander (Commander *commander_p)
 
void printCommandParserHelp (Stream *channel_p, bool formatting_p) override
 Print command parser Help. More...
 
void checkCommandFraction () override
 Check the command with the command parser to get some useful information. More...
 
bool hasCommandParser () override
 
void executeWithCommandParser () override
 
void autoCompleteWithCommandParser () override
 
void attachAutoCompleteBuffer (char *buffer_p, int buffer_size_p)
 
- Public Member Functions inherited from Shellminator
 Shellminator (Stream *stream_p)
 Shell object constructor. More...
 
bool enableBuffering (uint8_t *buffer, int bufferSize)
 Enable buffering to gain speed. More...
 
void attachExecFunc (void(*execution_fn_p)(char *, Shellminator *))
 Register a function callback for command execution. More...
 
void attachNeofetchFunc (void(*neofetch_fn_p)(Shellminator *))
 Register a function callback for neofetch command. 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 logOut ()
 
void format (Stream *stream_p, int firstArg)
 Basic text formatting. More...
 
void format (Stream *stream_p, int firstArg, int secondArg)
 
void format (Stream *stream_p, int firstArg, int secondArg, int thirdArg)
 
void hideCursor ()
 Hide the cursor. More...
 
void showCursor ()
 Show the cursor. More...
 
bool getCursorPosition (int *x, int *y, uint32_t timeout=250)
 Get the position of the cursor. More...
 
void setCursorPosition (int x, int y)
 Set the position of the cursor. More...
 
bool getTerminalSize (int *width, int *height)
 
void drawLogo ()
 Draws the startup logo. More...
 
void printBanner ()
 This function prints the banner text. More...
 
void printHistory ()
 Print command history. More...
 
void printHelp ()
 Print help text. More...
 
void setBannerText (const char *banner_p)
 This function sets the banner text. More...
 
void setBannerPathText (const char *bannerPath_p)
 This function sets the banner path text. 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)(Shellminator *))
 Override up arrow key behaviour. More...
 
void overrideDownArrow (void(*func)(Shellminator *))
 Override down arrow key behaviour. More...
 
void overrideLeftArrow (void(*func)(Shellminator *))
 Override left arrow key behaviour. More...
 
void overrideRightArrow (void(*func)(Shellminator *))
 Override right arrow key behaviour. More...
 
void overrideAbortKey (void(*func)(Shellminator *))
 Override abort key behaviour. More...
 
void overridePageUpKey (void(*func)(Shellminator *))
 Override Page-Up key behaviour. More...
 
void overridePageDownKey (void(*func)(Shellminator *))
 Override Page-Down key behaviour. More...
 
void overrideHomeKey (void(*func)(Shellminator *))
 Override Home key behaviour. More...
 
void overrideEndKey (void(*func)(Shellminator *))
 Override End key behaviour. More...
 
void overrideLogoutKey (void(*func)(Shellminator *))
 Override Logout key behaviour. More...
 
void overrideSearchKey (void(*func)(Shellminator *))
 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 setPassword (uint8_t *hashData, int hashSize)
 Enable login password. More...
 
void setPasswordHashFunction (void(*hashFunc_p)(uint8_t *, int, uint8_t *, int))
 Replace the built-in CRC32 hash generator. More...
 
void beginScreen (ShellminatorScreen *screen_p, int updatePeriod=250)
 Register Screen object to draw. More...
 
void endScreen ()
 Abort Screen session. More...
 
void swapScreen (ShellminatorScreen *screen_p, int updatePeriod=250)
 
void swapScreenAndClear (ShellminatorScreen *screen_p, int updatePeriod=250)
 
void requestRedraw ()
 Redraw request from a Screen object. More...
 
int eventAvailable ()
 Get the number of events available for reading from the eventBuffer. More...
 
shellEvent_t readEvent ()
 Read an event. More...
 
void popEvent ()
 Remove the current element from the buffer. More...
 
void mouseBegin ()
 Enable mouse reports. More...
 
void mouseEnd ()
 Disable mouse reports. More...
 
void input (char *buffer, int bufferSize, const char *instruction, void(*callback)(char *, int, Shellminator *), bool secret=false)
 Input prompt. More...
 
void beep ()
 Select list. More...
 
void printLoginScreen ()
 
ShellminatorBufferedPrintergetBufferedPrinter ()
 Get the buffered printer object address. More...
 
void attachColorizer (DefaultColorizer *colorizer_p)
 
void autoDetectTerminal ()
 

Private Attributes

char * autoCompleteBuffer = NULL
 
int autoCompleteBufferSize = 0
 
Commander * commander = NULL
 Pointer to a Commander object. More...
 
ShellminatorCaller caller
 

Additional Inherited Members

- Public Types inherited from Shellminator
enum  textColor_t {
  BLACK = 30 , RED = 31 , GREEN = 32 , YELLOW = 33 ,
  BLUE = 34 , MAGENTA = 35 , CYAN = 36 , WHITE = 37
}
 VT100 color codes. More...
 
enum  backgroundColor_t {
  BG_BLACK = 40 , BG_RED = 41 , BG_GREEN = 42 , BG_YELLOW = 43 ,
  BG_BLUE = 44 , BG_MAGENTA = 45 , BG_CYAN = 46 , BG_WHITE = 47
}
 VT100 color codes. More...
 
enum  textStyle_t {
  REGULAR = 0 , BOLD = 1 , LOW_INTENSITY = 2 , ITALIC = 3 ,
  UNDERLINE = 4 , BLINKING = 5 , REVERSE = 6 , BACKGROUND = 7 ,
  INVISIBLE = 8
}
 VT100 font sytles. More...
 
enum  shellEventType_t {
  SHELL_EVENT_EMPTY , SHELL_EVENT_RESIZE , SHELL_EVENT_MOUSE , SHELL_EVENT_KEY ,
  SHELL_EVENT_CODED_KEY , SHELL_EVENT_SCREEN_SWAP
}
 Shell Event enumeration. More...
 
enum  eventCodes_t {
  EVENT_CODE_EMPTY , EVENT_CODE_RETURN , EVENT_CODE_MOUSE_LEFT_PRESSED , EVENT_CODE_MOUSE_LEFT_RELEASED ,
  EVENT_CODE_MOUSE_RIGHT_PRESSED , EVENT_CODE_MOUSE_RIGHT_RELEASED , EVENT_CODE_MOUSE_MIDDLE_PRESSED , EVENT_CODE_MOUSE_MIDDLE_RELEASED ,
  EVENT_CODE_MOUSE_WHEEL_UP , EVENT_CODE_MOUSE_WHEEL_DOWN , EVENT_CODE_UP_ARROW , EVENT_CODE_DOWN_ARROW ,
  EVENT_CODE_LEFT_ARROW , EVENT_CODE_RIGHT_ARROW , EVENT_CODE_HOME , EVENT_CODE_END
}
 Coded event enumeration. More...
 
- Static Public Member Functions inherited from Shellminator
static void setFormat (Stream *stream_p, int firstArg)
 Basic text formatting. More...
 
static void setFormat (Stream *stream_p, int firstArg, int secondArg)
 
static void setFormat (Stream *stream_p, int firstArg, int secondArg, int thirdArg)
 
static void hideCursor (Stream *stream_p)
 Hide the cursor. More...
 
static void showCursor (Stream *stream_p)
 Show the cursor. More...
 
static void setCursorPosition (Stream *channel_p, int x, int y)
 Set the position of the cursor. More...
 
static ShellminatorcastVoidToShellminator (void *ptr)
 This is a helper function for pointer casting. More...
 
static bool waitForKey (Stream *source, char key, uint32_t timeout=0)
 Wait for specific keypress. More...
 
static bool waitForKey (Stream *source, char *keys, uint32_t timeout=0)
 Wait for specific keypress. More...
 
- Public Attributes inherited from Shellminator
shellEvent_t eventBuffer [EVENT_BUFFER_SIZE]
 The events are stored in this buffer. More...
 
uint8_t eventBufferWritePtr
 Write position for the eventBuffers circular structure. More...
 
uint8_t eventBufferReadPtr
 Read position for the eventBuffers circular structure. More...
 
int terminalWidth = 30
 Stores the width of the terminal in characters. More...
 
int terminalHeight = 12
 Stores the height of the terminal in characters. More...
 
char mouseEventBuffer [SHELLMINATOR_MOUSE_PARSER_BUFFER_SIZE]
 This buffer is used to parse the mouse coordinates form the host terminals answer. More...
 
uint8_t mouseEventBufferCounter = 0
 This variable traks the next free characters location in the mouseEventBuffer. More...
 
bool enableFormatting = true
 This flag enables or disables character formatting. More...
 
bool mute = false
 If set, the buzzer will be silent. More...
 
Stream * channel = NULL
 Pointer to the communication class. More...
 
- Static Public Attributes inherited from Shellminator
static const char * version = SHELLMINATOR_VERSION
 String, that holds the version information. More...
 
- Protected Member Functions inherited from Shellminator
virtual void printCommandParserHelp (Stream *channel_p, bool formatting_p)
 Print command parser Help. More...
 
virtual void checkCommandFraction ()
 Check the command with the command parser to get some useful information. More...
 
virtual bool hasCommandParser ()
 
virtual void executeWithCommandParser ()
 
virtual void autoCompleteWithCommandParser ()
 
void redrawLine ()
 
- Protected Attributes inherited from Shellminator
char cmd_buff [SHELLMINATOR_BUFF_DIM][SHELLMINATOR_BUFF_LEN+1] = {{0}}
 Text buffer. More...
 
uint32_t cmd_buff_dim = 1
 This variable tracks the index of the previous command while you browsing the command history. More...
 
uint32_t cmd_buff_cntr = 0
 This variable tracks the end of the input message. More...
 
uint32_t cursor = 0
 This variable tracks the location of the next character. More...
 
bool commandFound = false
 This flag must be set true in checkCommandFraction function when the command parser contains the command. More...
 

Detailed Description

Definition at line 67 of file Shellminator-Commander-Interface.hpp.

Constructor & Destructor Documentation

◆ ShellminatorCommanderInterface()

ShellminatorCommanderInterface::ShellminatorCommanderInterface ( Stream *  stream_p)
inline

Definition at line 70 of file Shellminator-Commander-Interface.hpp.

Here is the call graph for this function:

Member Function Documentation

◆ attachAutoCompleteBuffer()

void ShellminatorCommanderInterface::attachAutoCompleteBuffer ( char *  buffer_p,
int  buffer_size_p 
)

Definition at line 94 of file Shellminator-Commander-Interface.cpp.

◆ attachCommander()

void ShellminatorCommanderInterface::attachCommander ( Commander *  commander_p)

Definition at line 78 of file Shellminator-Commander-Interface.cpp.

◆ autoCompleteWithCommandParser()

void ShellminatorCommanderInterface::autoCompleteWithCommandParser ( )
overridevirtual

Reimplemented from Shellminator.

Definition at line 100 of file Shellminator-Commander-Interface.cpp.

Here is the call graph for this function:

◆ checkCommandFraction()

void ShellminatorCommanderInterface::checkCommandFraction ( )
overridevirtual

Check the command with the command parser to get some useful information.

Reimplemented from Shellminator.

Definition at line 82 of file Shellminator-Commander-Interface.cpp.

◆ executeWithCommandParser()

void ShellminatorCommanderInterface::executeWithCommandParser ( )
overridevirtual

Reimplemented from Shellminator.

Definition at line 86 of file Shellminator-Commander-Interface.cpp.

◆ hasCommandParser()

bool ShellminatorCommanderInterface::hasCommandParser ( )
overridevirtual

Reimplemented from Shellminator.

Definition at line 148 of file Shellminator-Commander-Interface.cpp.

◆ printCommandParserHelp()

void ShellminatorCommanderInterface::printCommandParserHelp ( Stream *  channel_p,
bool  formatting_p 
)
overridevirtual

Print command parser Help.

Reimplemented from Shellminator.

Definition at line 72 of file Shellminator-Commander-Interface.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ autoCompleteBuffer

char* ShellminatorCommanderInterface::autoCompleteBuffer = NULL
private

Definition at line 88 of file Shellminator-Commander-Interface.hpp.

◆ autoCompleteBufferSize

int ShellminatorCommanderInterface::autoCompleteBufferSize = 0
private

Definition at line 89 of file Shellminator-Commander-Interface.hpp.

◆ caller

ShellminatorCaller ShellminatorCommanderInterface::caller
private

Definition at line 94 of file Shellminator-Commander-Interface.hpp.

◆ commander

Commander* ShellminatorCommanderInterface::commander = NULL
private

Pointer to a Commander object.

Definition at line 92 of file Shellminator-Commander-Interface.hpp.