termgw

Index Home MAE > MAE Architecture > MAE Daemons > termgw

Terminal Gateway Application

This daemon provides a gateway between an I/O stream (from IoGW or a MAE app) that uses terminal escape sequences and renders a virtual terminal in a user's browser.

This daemon manages various virtual terminals for users. It receives input for a terminal, processes escape sequences per the terminal type, and properly draws the display.  Virtual terminal display updates are transferred to a designated region on the page in the user's browser.

A this time these terminal types supported:

Additional types will be supported in future releases per customer demand.

An application creates a terminal in termgw.  TermGW manages the user display of that terminal.  See also maeterm.

MAE applications can subscribe to changes of specific terminals for further processing.

For TermGW to display escape sequences correctly, the terminal emulation must match the program's terminal type that generates the output.

Daemon Parameters

None.

Programming API to TermGW

Use the UserTerm class to setup a virtual terminal and then send data to it.  Behind the scenes, it uses the TermAPI class to interface with TermGW.

Database Tables

None.

Terminal Types

Type

Description

xterm

X Windows has popularized the terminal emulator called xterm, which is an evolution of DEC terminals. It supports color and a variety of screen manipulation escape sequences.  Eight (8) colors supported.

VT100

DEC VT100 was a very popular video terminal in its day.  Eight (8) colors supported.

H19

The Heath-19 or Zenith-19 video terminal.  No color support; display rendered as green on black.

ANSI

The ANSI standard for video terminal text display.

C64

This is actually xterm terminal emulation for escape sequences, but the character mapping for the Commodore-64. Upper case letters and graphics letters supported. The Upper and lower case font is also supported, using ESC SO to switch to it and ESC SI to switch back.


Messages Received and Processed (term)

The following messages may be received on the term channel.

Server API Messages (term)

MsgTag

Description

create

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

device - the user's terminal device

name - the screen name

rows - the number of lines on screen (default: 25)

width - the character width of screen (default: 80)

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

@return true if sent

redraw

Redraw the teriminal window.

device - the user's terminal device

@return true if sent

putchar

Send a single character to the terminal.

device - the user's terminal device

c - the character to print

@return true if sent

puts

Send a string of characters to the terminal.

device - the user's terminal device

text - a string of characters

@return true if sent

setxy

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

device - the user's terminal device

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

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

@return true if sent

termchar

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

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

c - the character to print

module - the channel where the app is running

@return true if sent

termstr

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

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

text - a string of characters

module - the channel where the app is running

@return true if sent

newtermtype

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.

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

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

module - the channel where the app is running

@return true if sent

settype

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.

device - the user's terminal device

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

@return true if sent

bold

Change text mode to display in bold.

device - the user's terminal device

mode - the new bold mode - on, off, or toggle

@return true if sent

underline

Change text mode to display in underline.

device - the user's terminal device

mode - the new underline mode - on, off, or toggle

@return true if sent

reverse

Change text mode to display in reverse.

device - the user's terminal device

mode - the new reverse mode - on, off, or toggle

@return true if sent

blinking

Change text mode to display in blinking.

device - the user's terminal device

mode - the new blinking mode - on, off, or toggle

@return true if sent

color

Change color of text being displayed.

device - the user's terminal device

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

@return true if sent

clear

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

device - the user's terminal device

area - all, above, below, left, right

@return true if sent

delline

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

device - the user's terminal device

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

@return true if sent

insline

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

device - the user's terminal device

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

@return true if sent

delchar

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

device - the user's terminal device

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

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

@return true if sent

inschar

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

device - the user's terminal device

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

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

c - the character to instert

@return true if sent

fillbox

Fill a region of the screen with the character provided.

device - the user's terminal device

y1 - the upper left screen row of box to be filled

x1 - the upper left screen column of box to be filled

y2 - the lower right screen row of box to be filled

x2 - the lower right screen column of box to be filled

c - the fill character

@return true if sent

movebox

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

device - the user's terminal device

y1 - the upper left screen row of box to be filled

x1 - the upper left screen column of box to be filled

y2 - the lower right screen row of box to be filled

x2 - the lower right screen column of box to be filled

yt - the new upper left corner of the box

xt - the new upper left corner of the box

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

@return true if sent

cursor

Move the cursor a certain amount in the specified direction.

device - the user's terminal device

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

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

@return true if sent


Client API Messages (term)

MsgTag

From

Description

termchar

termgw

Receive a single character for the app from the terminal.

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

c - the character for app

termstr

termgw

Send a string of characters for the app from the terminal.

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

text - a string of characters

newtermtype

termgw

The terminal is reporting that it now has a different terminal type.

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

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