#include <cmd.h>
Public Member Functions | |
CConsole () | |
void | init () |
Initialisation. | |
void | refresh () |
void | clearLines () |
void | addLine (char *line, int type=TEXT_NORMAL) |
Adds new text line to log. Color of text and background depends on type. | |
void | printLog () |
Prints text in log on screen. | |
void | printInfo (CVec *positionAndOrientation) |
Prints information about limbs on screen. | |
void | setInput (char *userinput, int cursorposition=-1) |
Prints user input on screen and adjusts cursorposition. | |
int | readChar () |
Reads one character from user input. | |
int | executeCmd (int index, int type, byte &doWrite) |
Executes command at index in list. | |
int | executeCmds () |
Executes buffered commands in a specific order (configuration commands first). | |
void | createCmd (char **param, int param_count) |
Creates command from array of strings. | |
void | processWord (char *word) |
Processes one word (text containing one command and several parameters). | |
void | processLine (char *line, int len) |
Splits one line of user input in several words (commands and parameters). | |
void | process () |
User input loop. Processes one line of text at a time. | |
Private Attributes | |
char | buffer [LINESCOUNT][255] |
Text lines in log. | |
int | bufferType [LINESCOUNT] |
Type of text lines in log,. | |
char | inputBuffer [INPUTCOUNT][255] |
Input line history. | |
char | input [255] |
Current input line. | |
int | currentInput |
Index of current input line in history. | |
int | totalInput |
Number of input lines in history. | |
int | currentLine |
Index of last text line in log. | |
int | totalLines |
Number of text lines in log. | |
Cmd | list [CMD_LIST_LEN] |
Command and parameter buffer. | |
int | list_len |
Number of commands in buffer. |
Parses text input from console and runs commands.
CConsole::CConsole | ( | ) |
void CConsole::init | ( | ) |
Initialisation.
void CConsole::refresh | ( | ) |
void CConsole::clearLines | ( | ) |
void CConsole::addLine | ( | char * | line, | |
int | type = TEXT_NORMAL | |||
) |
Adds new text line to log. Color of text and background depends on type.
void CConsole::printLog | ( | ) |
Prints text in log on screen.
void CConsole::printInfo | ( | CVec * | positionAndOrientation | ) |
Prints information about limbs on screen.
positionAndOrientation | Two times number of limbs vectors storing Position and Orientation of every limb. |
void CConsole::setInput | ( | char * | userinput, | |
int | cursorposition = -1 | |||
) |
Prints user input on screen and adjusts cursorposition.
int CConsole::readChar | ( | ) |
Reads one character from user input.
int CConsole::executeCmd | ( | int | index, | |
int | type, | |||
byte & | doWrite | |||
) |
Executes command at index in list.
index | Index of command. | |
type | Type of command. | |
doWrite | If set to true starts write cycle after execution of all commands is complete. |
int CConsole::executeCmds | ( | ) |
Executes buffered commands in a specific order (configuration commands first).
void CConsole::createCmd | ( | char ** | param, | |
int | param_count | |||
) |
Creates command from array of strings.
void CConsole::processWord | ( | char * | word | ) |
Processes one word (text containing one command and several parameters).
Creates a command object and adds it to the list.
void CConsole::processLine | ( | char * | line, | |
int | len | |||
) |
Splits one line of user input in several words (commands and parameters).
void CConsole::process | ( | ) |
User input loop. Processes one line of text at a time.
char CConsole::buffer[LINESCOUNT][255] [private] |
Text lines in log.
int CConsole::bufferType[LINESCOUNT] [private] |
char CConsole::inputBuffer[INPUTCOUNT][255] [private] |
Input line history.
char CConsole::input[255] [private] |
Current input line.
int CConsole::currentInput [private] |
Index of current input line in history.
int CConsole::totalInput [private] |
Number of input lines in history.
int CConsole::currentLine [private] |
Index of last text line in log.
int CConsole::totalLines [private] |
Number of text lines in log.
Cmd CConsole::list[CMD_LIST_LEN] [private] |
Command and parameter buffer.
int CConsole::list_len [private] |
Number of commands in buffer.