Class TermAPI

Index Home MAE > MAE Architecture > MAE Data Types > Class Index > Class TermAPI

Summary
Public Methods
static bool create(device, name, rows, width, termtype)
static bool redraw(device)
static bool putchar(device, c)
static bool puts(device, text)
static bool setpos(device, y, x)
static bool termchar(device, c, module)
static bool termchar(device, text, module)
static bool newtermtype(device, termtype, module)
static bool setTerminalType(device, termType)
static bool bold(device, mode)
static bool underline(device, mode)
static bool reverse(device, mode)
static bool blinking(device, mode)
static bool color(device, newcolor)
static bool clear(device, area)
static bool delline(device, y, amount)
static bool insline(device, y, amount)
static bool delchar(device, y, x, amount)
static bool inschar(device, y, x, c, amount)
static bool fill(device, y1, x1, y2, x2, c)
static bool move(device, y1, x1, y2, x2, yt, xt, c)
static bool cursor(device, direction, amount)
static bool send(request, params, channel)

#include <TermAPI.h >

Summary

This class is used by other apps to send messages to the term channel.

Use this interface instead of sending messages directly to ensure message keywords are spelled correctly, all parameters are specified, and error checked.

The receiving app defined this interface to ensure it receives the messages correctly.

Public Methods

static bool create(device, name, rows, width, termtype)

UserDevice& device

the user's terminal device

const string& name

the screen name

int rows

the number of lines on screen (default: 25)

Default value: 25

int width

the character width of screen (default: 80)

Default value: 80

const string& termtype

the terminal type to emulate (default: xterm), e.g. h19, vt100, ansi, c64

Default value: "xterm"


Create a screen on the user's device for screen output.

Return value: true if sent

static bool redraw(device)

UserDevice& device

the user's terminal device


Redraw the teriminal window.

Return value: true if sent

static bool putchar(device, c)

UserDevice& device

the user's terminal device

int c

the character to print


Send a single character to the terminal.

Return value: true if sent

static bool puts(device, text)

UserDevice& device

the user's terminal device

const string& text

a string of characters


Send a string of characters to the terminal.

Return value: true if sent

static bool setpos(device, y, x)

UserDevice& device

the user's terminal device

int y

the screen row, e.g. 1, 2, ... 25

int x

the screen column, e.g. 1, 2, ... 80


Move the cursor to the screen location specified by (x, y).  The next printable character will appear there.

Return value: true if sent

static bool termchar(device, c, module)

UserDevice& device

the user's terminal device (with the region set to the terminal name)

int c

the character to print

const string& module

the channel where the app is running


Send a single character back to the app running in the terminal.

Return value: true if sent

static bool termchar(device, text, module)

UserDevice& device

the user's terminal device (with the region set to the terminal name)

const string& text

a string of characters

const string& module

the channel where the app is running


Send a string of characters back to the app running in the terminal.

Return value: true if sent

static bool newtermtype(device, termtype, module)

UserDevice& device

the user's terminal device (with the region set to the terminal name)

const string& termtype

the new terminal type, e.g. xterm, h19, vt100, ansi, c64

const string& module

the channel where the app is running


Sometimes, a terminal can switch to a different terminal type mode. When that happens, termgw reports back to the controlling app with the new terminal type.

Return value: true if sent

static bool setTerminalType(device, termType)

UserDevice& device

the user's terminal device

const string& termType

the terminal type, e.g. xterm, h19, vt100, ansi, c64

Default value: "xterm"


Set the terminal type for emulation. Different terminal types use different character sequences to mean bold, color, etc. Set this value to the environment TERM variable or align it with the terminal output of the running app.  Note the currently supported terminal types:  xterm.

For xterm codes, see https://www.xfree86.org/current/ctlseqs.html.

Return value: true if sent

static bool bold(device, mode)

UserDevice& device

the user's terminal device

const string& mode

the new bold mode - on, off, or toggle

Default value: "toggle"


Change text mode to display in bold.

Return value: true if sent

static bool underline(device, mode)

UserDevice& device

the user's terminal device

const string& mode

the new underline mode - on, off, or toggle

Default value: "toggle"


Change text mode to display in underline.

Return value: true if sent

static bool reverse(device, mode)

UserDevice& device

the user's terminal device

const string& mode

the new reverse mode - on, off, or toggle

Default value: "toggle"


Change text mode to display in reverse.

Return value: true if sent

static bool blinking(device, mode)

UserDevice& device

the user's terminal device

const string& mode

the new blinking mode - on, off, or toggle

Default value: "toggle"


Change text mode to display in blinking.

Return value: true if sent

static bool color(device, newcolor)

UserDevice& device

the user's terminal device

const string& newcolor

valid colors are black, red, green, yellow, blue, magenta, cyan, white (default)

Default value: "default"


Change color of text being displayed.

Return value: true if sent

static bool clear(device, area)

UserDevice& device

the user's terminal device

const string& area

all, above, below, left, right


Clear an area of the terminal screen based upon the value of parameter area.

Return value: true if sent

static bool delline(device, y, amount)

UserDevice& device

the user's terminal device

int y

the screen row to delete, e.g. 1, 2, ... 25

int amount

Default value: 1


Delete a screen line. Screen scrolls up to fill deleted line.

Return value: true if sent

static bool insline(device, y, amount)

UserDevice& device

the user's terminal device

int y

the screen row to delete, e.g. 1, 2, ... 25

int amount

Default value: 1


Insert a line into the screen.  Screen scrolls down to fill deleted line.

Return value: true if sent

static bool delchar(device, y, x, amount)

UserDevice& device

the user's terminal device

int y

the screen row of character to delete, e.g. 1, 2, ... 25

int x

the screen column of character to delete, e.g. 1, 2, ... 80

int amount

Default value: 1


Delete a character from the screen.  Screen scrolls left to fill deleted character.

Return value: true if sent

static bool inschar(device, y, x, c, amount)

UserDevice& device

the user's terminal device

int y

the screen row of character to delete, e.g. 1, 2, ... 25

int x

the screen column of character to delete, e.g. 1, 2, ... 80

int c

the character to instert

Default value: ' '

int amount

Default value: 1


Insert a character into the screen.  Screen scrolls right to make room for inserted character.

Return value: true if sent

static bool fill(device, y1, x1, y2, x2, c)

UserDevice& device

the user's terminal device

int y1

the upper left screen row of box to be filled

int x1

the upper left screen column of box to be filled

int y2

the lower right screen row of box to be filled

int x2

the lower right screen column of box to be filled

int c

the fill character

Default value: ' '


Fill a region of the screen with the character provided.

Return value: true if sent

static bool move(device, y1, x1, y2, x2, yt, xt, c)

UserDevice& device

the user's terminal device

int y1

the upper left screen row of box to be filled

int x1

the upper left screen column of box to be filled

int y2

the lower right screen row of box to be filled

int x2

the lower right screen column of box to be filled

int yt

the new upper left corner of the box

int xt

the new upper left corner of the box

int c

the fill character of the old box; 0 means no fill


Move the characters from a box on the screen to a a new location, filling in the old box with the fill charactger provided.

Return value: true if sent

static bool cursor(device, direction, amount)

UserDevice& device

the user's terminal device

const string& direction

can be: up, down, left, right, home

int amount

number of lines/columns to move in that direction (ignored for home)

Default value: 1


Move the cursor a certain amount in the specified direction.

Return value: true if sent

static bool send(request, params, channel)

const string& request

the request keyword

const XMLData& params

the data (parameter payload)

Default value: XMLData("")

const string& channel

override where message is sent (default: term)

Default value: "term"


Send an API message to channel term.