「App:Library:FabGL:Class:Terminal」の版間の差分
(ページの作成:「 ==class Terminal== An ANSI-VT100 compatible display terminal. {| class="wikitable" |#include <[http://www.fabglib.org/terminal_8h_source.html terminal.h]> |} Inherits S…」) |
|||
1行目: | 1行目: | ||
==class Terminal== | ==class Terminal== | ||
− | + | ANSI-VT100互換のディスプレイ端末。 | |
{| class="wikitable" | {| class="wikitable" | ||
|#include <[http://www.fabglib.org/terminal_8h_source.html terminal.h]> | |#include <[http://www.fabglib.org/terminal_8h_source.html terminal.h]> | ||
|} | |} | ||
− | + | ストリームを継承します。 | |
==Public Member Functions== | ==Public Member Functions== | ||
{| class="wikitable" | {| class="wikitable" | ||
− | | | + | |void activate (TerminalTransition transition=TerminalTransition::None) |
+ | |||
+ | <nowiki>:</nowiki>Activates this terminal for input and output. | ||
|- | |- | ||
− | | | + | |int available () |
+ | |||
+ | <nowiki>:</nowiki>Gets the number of codes available in the keyboard queue. | ||
|- | |- | ||
− | | | + | |int availableForWrite () |
+ | |||
+ | <nowiki>:</nowiki>Determines number of codes that the display input queue can still accept. | ||
|- | |- | ||
− | | | + | |bool begin (BaseDisplayController *displayController, int maxColumns=-1, int maxRows=-1, Keyboard *keyboard=nullptr) |
+ | |||
+ | <nowiki>:</nowiki>Initializes the terminal. | ||
|- | |- | ||
− | | | + | |Canvas * canvas () |
+ | |||
+ | <nowiki>:</nowiki>Gets associated canvas object. | ||
|- | |- | ||
− | | | + | |void clear (bool moveCursor=true) |
+ | |||
+ | <nowiki>:</nowiki>Clears the screen. | ||
|- | |- | ||
− | | | + | |void connectLocally () |
+ | |||
+ | <nowiki>:</nowiki>Permits using of terminal locally. | ||
|- | |- | ||
− | | | + | |void connectSerialPort (HardwareSerial &serialPort, bool autoXONXOFF=true) |
+ | |||
+ | <nowiki>:</nowiki>Connects a remote host using the specified serial port. | ||
|- | |- | ||
− | | | + | |void connectSerialPort (uint32_t baud, uint32_t config, int rxPin, int txPin, FlowControl flowControl, bool inverted=false, int rtsPin=-1, int ctsPin=-1) |
+ | |||
+ | <nowiki>:</nowiki>Connects a remote host using UART. | ||
|- | |- | ||
− | | | + | |bool CTSStatus () |
+ | |||
+ | <nowiki>:</nowiki>Reports current CTS signal status. | ||
|- | |- | ||
− | | | + | |void deactivate () |
+ | |||
+ | <nowiki>:</nowiki>Deactivates this terminal. | ||
|- | |- | ||
− | | | + | |void disableSerialPortRX (bool value) |
+ | |||
+ | <nowiki>:</nowiki>Disables/Enables serial port RX. | ||
|- | |- | ||
− | | | + | |void disconnectLocally () |
+ | |||
+ | <nowiki>:</nowiki>Avoids using of terminal locally. | ||
|- | |- | ||
− | | | + | |void enableCursor (bool value) |
+ | |||
+ | <nowiki>:</nowiki>Enables or disables cursor. | ||
|- | |- | ||
− | | | + | |void end () |
+ | |||
+ | <nowiki>:</nowiki>Finalizes the terminal. | ||
|- | |- | ||
− | | | + | |void flowControl (bool enableRX) |
+ | |||
+ | <nowiki>:</nowiki>Allows/disallows host to send data. | ||
|- | |- | ||
− | | | + | |bool flowControl () |
+ | |||
+ | <nowiki>:</nowiki>Checks whether host can receive data. | ||
|- | |- | ||
− | | | + | |void flush (bool waitVSync) |
+ | |||
+ | <nowiki>:</nowiki>Waits for all codes sent to the display has been processed. | ||
|- | |- | ||
− | | | + | |void flush () |
+ | |||
+ | <nowiki>:</nowiki>Waits for all codes sent to the display has been processed. | ||
|- | |- | ||
− | | | + | |int getColumns () |
+ | |||
+ | <nowiki>:</nowiki>Returns the number of columns. | ||
|- | |- | ||
− | | | + | |int getRows () |
+ | |||
+ | <nowiki>:</nowiki>Returns the number of lines. | ||
|- | |- | ||
− | | | + | |bool isActive () |
+ | |||
+ | <nowiki>:</nowiki>Determines if this terminal is active or not. | ||
|- | |- | ||
− | | | + | |Keyboard * keyboard () |
+ | |||
+ | <nowiki>:</nowiki>Gets associated keyboard object. | ||
|- | |- | ||
− | | | + | |void loadFont (FontInfo const *font) |
+ | |||
+ | <nowiki>:</nowiki>Sets the font to use. | ||
|- | |- | ||
− | | | + | |void localInsert (uint8_t c) |
+ | |||
+ | <nowiki>:</nowiki>Injects keys into the keyboard queue. | ||
|- | |- | ||
− | | | + | |void localWrite (uint8_t c) |
+ | |||
+ | <nowiki>:</nowiki>Injects keys into the keyboard queue. | ||
|- | |- | ||
− | | | + | |void localWrite (char const *str) |
+ | |||
+ | <nowiki>:</nowiki>Injects a string of keys into the keyboard queue. | ||
|- | |- | ||
− | | | + | |int peek () |
+ | |||
+ | <nowiki>:</nowiki>Reads a code from the keyboard without advancing to the next one. | ||
|- | |- | ||
− | | | + | |void pollSerialPort () |
+ | |||
+ | <nowiki>:</nowiki>Pools the serial port for incoming data. | ||
|- | |- | ||
− | | | + | |int read () |
+ | |||
+ | <nowiki>:</nowiki>Reads codes from keyboard. | ||
|- | |- | ||
− | | | + | |int read (int timeOutMS) |
+ | |||
+ | <nowiki>:</nowiki>Reads codes from keyboard specyfing timeout. | ||
|- | |- | ||
− | | | + | |bool RTSStatus () |
+ | |||
+ | <nowiki>:</nowiki>Reports current RTS signal status. | ||
|- | |- | ||
− | | | + | |void send (uint8_t c) |
+ | |||
+ | <nowiki>:</nowiki>Like localWrite() but sends also to serial port if connected. | ||
|- | |- | ||
− | | | + | |void send (char const *str) |
+ | |||
+ | <nowiki>:</nowiki>Like localWrite() but sends also to serial port if connected. | ||
|- | |- | ||
− | | | + | |void setBackgroundColor (Color color, bool setAsDefault=true) |
+ | |||
+ | <nowiki>:</nowiki>Sets the background color. | ||
|- | |- | ||
− | | | + | |void setColorForAttribute (CharStyle attribute, Color color, bool maintainStyle) |
+ | |||
+ | <nowiki>:</nowiki>Selects a color for the specified attribute. | ||
|- | |- | ||
− | | | + | |void setColorForAttribute (CharStyle attribute) |
+ | |||
+ | <nowiki>:</nowiki>Disables color for the specified attribute. | ||
|- | |- | ||
− | | | + | |void setForegroundColor (Color color, bool setAsDefault=true) |
+ | |||
+ | <nowiki>:</nowiki>Sets the foreground color. | ||
|- | |- | ||
− | | | + | |void setLogStream (Stream &stream) |
+ | |||
+ | <nowiki>:</nowiki>Sets the stream where to output debugging logs. | ||
|- | |- | ||
− | | | + | |void setRTSStatus (bool value) |
+ | |||
+ | <nowiki>:</nowiki>Sets RTS signal status. | ||
|- | |- | ||
− | | | + | |void setTerminalType (TermType value) |
+ | |||
+ | <nowiki>:</nowiki>Sets the terminal type to emulate. | ||
|- | |- | ||
− | | | + | |SoundGenerator * soundGenerator () |
+ | |||
+ | <nowiki>:</nowiki>Gets embedded sound generator. | ||
|- | |- | ||
− | | | + | |TermInfo const & terminalType () |
+ | |||
+ | <nowiki>:</nowiki>Determines current terminal type. | ||
|- | |- | ||
− | | | + | |void unRead (uint8_t c) |
+ | |||
+ | <nowiki>:</nowiki>Injects keys into the keyboard queue. | ||
|- | |- | ||
− | | | + | |bool waitFor (int value, int timeOutMS=-1) |
+ | |||
+ | <nowiki>:</nowiki>Wait for a specific code from keyboard, discarding all previous codes. | ||
|- | |- | ||
− | | | + | |size_t write (const uint8_t *buffer, size_t size) |
+ | |||
+ | <nowiki>:</nowiki>Sends specified number of codes to the display. | ||
|- | |- | ||
− | | | + | |size_t write (uint8_t c) |
+ | |||
+ | <nowiki>:</nowiki>Sends a single code to the display. | ||
|- | |- | ||
− | | | + | |bool XOFFStatus () |
− | + | ||
− | + | <nowiki>:</nowiki>Reports whether TX is active. | |
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
115行目: | 205行目: | ||
==Public Attributes== | ==Public Attributes== | ||
{| class="wikitable" | {| class="wikitable" | ||
− | | | + | |Delegate< char const * > onUserSequence |
+ | |||
+ | <nowiki>:</nowiki>Delegate called whenever a new user sequence has been received. | ||
|- | |- | ||
− | | | + | |Delegate< VirtualKey *, bool > onVirtualKey |
+ | |||
+ | <nowiki>:</nowiki>Delegate called whenever a new virtual key is received from keyboard. | ||
|- | |- | ||
− | | | + | |Delegate< VirtualKeyItem * > onVirtualKeyItem |
− | + | ||
− | + | <nowiki>:</nowiki>Delegate called whenever a new virtual key is received from keyboard, including shift states. | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
|} | |} | ||
2022年3月23日 (水) 11:38時点における版
class Terminal
ANSI-VT100互換のディスプレイ端末。
#include <terminal.h> |
ストリームを継承します。
Public Member Functions
void activate (TerminalTransition transition=TerminalTransition::None)
:Activates this terminal for input and output. |
int available ()
:Gets the number of codes available in the keyboard queue. |
int availableForWrite ()
:Determines number of codes that the display input queue can still accept. |
bool begin (BaseDisplayController *displayController, int maxColumns=-1, int maxRows=-1, Keyboard *keyboard=nullptr)
:Initializes the terminal. |
Canvas * canvas ()
:Gets associated canvas object. |
void clear (bool moveCursor=true)
:Clears the screen. |
void connectLocally ()
:Permits using of terminal locally. |
void connectSerialPort (HardwareSerial &serialPort, bool autoXONXOFF=true)
:Connects a remote host using the specified serial port. |
void connectSerialPort (uint32_t baud, uint32_t config, int rxPin, int txPin, FlowControl flowControl, bool inverted=false, int rtsPin=-1, int ctsPin=-1)
:Connects a remote host using UART. |
bool CTSStatus ()
:Reports current CTS signal status. |
void deactivate ()
:Deactivates this terminal. |
void disableSerialPortRX (bool value)
:Disables/Enables serial port RX. |
void disconnectLocally ()
:Avoids using of terminal locally. |
void enableCursor (bool value)
:Enables or disables cursor. |
void end ()
:Finalizes the terminal. |
void flowControl (bool enableRX)
:Allows/disallows host to send data. |
bool flowControl ()
:Checks whether host can receive data. |
void flush (bool waitVSync)
:Waits for all codes sent to the display has been processed. |
void flush ()
:Waits for all codes sent to the display has been processed. |
int getColumns ()
:Returns the number of columns. |
int getRows ()
:Returns the number of lines. |
bool isActive ()
:Determines if this terminal is active or not. |
Keyboard * keyboard ()
:Gets associated keyboard object. |
void loadFont (FontInfo const *font)
:Sets the font to use. |
void localInsert (uint8_t c)
:Injects keys into the keyboard queue. |
void localWrite (uint8_t c)
:Injects keys into the keyboard queue. |
void localWrite (char const *str)
:Injects a string of keys into the keyboard queue. |
int peek ()
:Reads a code from the keyboard without advancing to the next one. |
void pollSerialPort ()
:Pools the serial port for incoming data. |
int read ()
:Reads codes from keyboard. |
int read (int timeOutMS)
:Reads codes from keyboard specyfing timeout. |
bool RTSStatus ()
:Reports current RTS signal status. |
void send (uint8_t c)
:Like localWrite() but sends also to serial port if connected. |
void send (char const *str)
:Like localWrite() but sends also to serial port if connected. |
void setBackgroundColor (Color color, bool setAsDefault=true)
:Sets the background color. |
void setColorForAttribute (CharStyle attribute, Color color, bool maintainStyle)
:Selects a color for the specified attribute. |
void setColorForAttribute (CharStyle attribute)
:Disables color for the specified attribute. |
void setForegroundColor (Color color, bool setAsDefault=true)
:Sets the foreground color. |
void setLogStream (Stream &stream)
:Sets the stream where to output debugging logs. |
void setRTSStatus (bool value)
:Sets RTS signal status. |
void setTerminalType (TermType value)
:Sets the terminal type to emulate. |
SoundGenerator * soundGenerator ()
:Gets embedded sound generator. |
TermInfo const & terminalType ()
:Determines current terminal type. |
void unRead (uint8_t c)
:Injects keys into the keyboard queue. |
bool waitFor (int value, int timeOutMS=-1)
:Wait for a specific code from keyboard, discarding all previous codes. |
size_t write (const uint8_t *buffer, size_t size)
:Sends specified number of codes to the display. |
size_t write (uint8_t c)
:Sends a single code to the display. |
bool XOFFStatus ()
:Reports whether TX is active. |
Public Attributes
Delegate< char const * > onUserSequence
:Delegate called whenever a new user sequence has been received. |
Delegate< VirtualKey *, bool > onVirtualKey
:Delegate called whenever a new virtual key is received from keyboard. |
Delegate< VirtualKeyItem * > onVirtualKeyItem
:Delegate called whenever a new virtual key is received from keyboard, including shift states. |
Static Public Attributes
Detailed Description
Defines a cursor.
Example1:
Example2:
Examples:
- Others/KeyboardScanCodes/KeyboardScanCodes.ino, Others/KeyboardVirtualKeys/KeyboardVirtualKeys.ino, SSD1306_OLED/128x32/SimpleTerminalOut/SimpleTerminalOut.ino, SSD1306_OLED/128x64/NetworkTerminal/NetworkTerminal.ino, SSD1306_OLED/128x64/RTClock/RTClock.ino, SSD1306_OLED/128x64/SimpleTerminalOut/SimpleTerminalOut.ino, ST7789_TFT/240x240/SimpleTerminalOut/SimpleTerminalOut.ino, VGA/Altair8800/Altair8800.ino, VGA/AnsiTerminal/AnsiTerminal.ino, VGA/LoopbackTerminal/LoopbackTerminal.ino, VGA/MultitaskingCPM/MultitaskingCPM.ino, VGA/NetworkTerminal/NetworkTerminal.ino, VGA/SimpleTerminalOut/SimpleTerminalOut.ino, VGA/SimpleTextTerminalOut/SimpleTextTerminalOut.ino, and VGA/Songs/Songs.ino.
Definition at line 953 of file terminal.h.
The documentation for this struct was generated from the following file:
- terminal.h
- terminal.cpp