28 #include "USBKeysExtra.h"
31 #define KEY_UNICODE 0x1000
34 #define KEY_WINSIZE 0x1001
51 Stream *
stream()
const {
return _stream; }
60 virtual size_t write(uint8_t c);
61 virtual size_t write(
const uint8_t *buffer,
size_t size);
73 int rows()
const {
return nrows; }
128 static size_t utf8Format(uint8_t *buffer,
long code);
142 int matchEscape(
int ch);
143 void telnetCommand(uint8_t type, uint8_t option);
void insertChar()
Inserts a blank character at the cursor position.
void cursorDown()
Moves the cursor down by one line.
void insertLine()
Inserts a line at the cursor position.
virtual ~Terminal()
Destroys this terminal object.
void deleteLine()
Deletes a line at the cursor position.
void cursorLeft()
Moves the cursor left by one character.
void reverse()
Reverse the foreground and background colors for inverted text.
Color
Terminal foreground or background colors.
long unicodeKey() const
Gets the Unicode version of the last key returned by readKey().
void scrollDown()
Scrolls the contents of the window down one line.
virtual void flush()
Flushes all data in the underlying stream.
virtual size_t write(uint8_t c)
Writes a single byte to the underlying stream.
void deleteChar()
Deletes the character at the cursor position.
void bold()
Enables bold text.
void clearToEOL()
Clears from the current cursor position to the end of the line.
void color(Color fg)
Selects a text foreground color with the default background color.
Operates the terminal in serial mode.
void begin(Stream &stream, Mode mode=Serial)
Begins terminal operations on an underlying stream.
void cursorUp()
Moves the cursor up by one line.
void backspace()
Backspaces over the last character.
void cursorRight()
Moves the cursor right by one character.
void cursorMove(int x, int y)
Moves the cursor to a specific location in the window.
Operates the terminal in telnet mode.
bool setWindowSize(int columns, int rows)
Sets the number of columns and rows in the window.
Terminal::Mode mode() const
Returns the mode this terminal is operating in, Serial or Telnet.
Extended stream interface for terminal operations.
size_t writeUnicode(long code)
Writes a Unicode code point to the output in UTF-8 encoding.
Mode
Mode to operate in, Serial or Telnet.
Terminal()
Constructs a terminal object.
Stream * stream() const
Returns a pointer to the underlying Stream, or NULL if the stream has not been set with begin() yet...
virtual int peek()
Peeks at the next byte from the underlying stream.
void underline()
Enables underlined text.
void clear()
Move the cursor to the top-left position and clear the screen.
void writeProgMem(const char *str)
Writes a static string that is stored in program memory.
virtual int read()
Reads the next byte from the underlying stream.
static size_t utf8Format(uint8_t *buffer, long code)
Formats a Unicode code point in a buffer in the UTF-8 encoding.
int rows() const
Gets the number of rows in the window; defaults to 24.
void scrollUp()
Scrolls the contents of the window up one line.
static size_t utf8Length(long code)
Determines the length of a Unicode code point in the UTF-8 encoding.
void end()
Ends terminal operations on an underlying stream.
int readKey()
Reads the next key that was typed on this terminal.
void normal()
Selects normal text with all attributes and colors off.
void blink()
Enables blinking text.
int columns() const
Gets the number of columns in the window; defaults to 80.
static bool isWideCharacter(long code)
Determine if a Unicode character is wide.
virtual int available()
Returns the number of bytes that are available for reading.