[GreenKeys] boa_ttyd teletype server
Henry Minsky
[email protected]
Thu, 28 Nov 2002 20:33:21 -0500
The teletype server I wrote is called boa_ttyd, it's based on boa
(http://www.boa.org),
a lightweight ANSI C web server. I modified the top level select() loop to
also read and write from the serial port, along with adding a special
magic CGI URL which you can POST to in order to print messages on the
teletype.
The link to a tar file of the source code is available from the page
http://www.ai.mit.edu/people/hqm/japan/teletype/
The URL of the current version is
http://www.ai.mit.edu/people/hqm/japan/teletype/model28-0.1.tgz
Unfortunately there is no documentation yet
though, except for the basic boa server docs.
The software is only designed to drive a half-duplex machine right now, i.e.,
it dosn't echo characters back out the serial port. It uses boa to
listen to the network, and uses a hook into the cgi-bin mechanism
to write to the teletype when a special URL is accessed
(/cgi-bin/teletype.cgi).
If you HTTP POST a form to that URL with the query arg "msg=...."
it wil print out the message text on the teletype, using Tom Jennings'
ascii to baudot library.
There's a sample file called "boa.conf" which has stuff at the end
of it which is particular to the teletype.
The config params I added are
TTYBaudRate 75
X10MotorCode C2
TTYSerialPort /dev/ttyS0
The code has a driver for the X10 Firecracker module, which goes inline
with the serial port and lets you control the motor to the teletype.
The only baud rates supported are 75 and 50.
There are some definitions for web services, each with a URL basically.
These are invoked from the command line monitor from the teletype.
You hit "BREAK" to get a command prompt, and then hit a one letter
command to fetch some predefined URLS. You can also send email
and do some other stuff, though that code hasn't been debugged yet,
In the boa.conf file, these URL definitions are defined for the
commands to get weather, news, headlines, lookup a recipe, or
print a calendar for the day. I have defined scripts for these URLs
on another server in my house, and each one returns text to be
printed directly on the teletype.
# Each of these specifies a URL of a service. Performing
# an HTTP GET to this URL should return the text you want printed on the
# teletype
# http://nifft:8088/tty/recipes
RecipeServer nifft
RecipePath /tty/recipes
RecipePort 8088
# http://nifft:8088/tty/headlines
HeadlineServer nifft
HeadlinePath /tty/headlines
HeadlinePort 8088
# http://nifft:8088/tty/weather
WxServer nifft
WxPath /tty/weather
WxPort 8088
# http://nifft:8088/tty/news
NewsServer nifft
NewsPath /tty/news
NewsPort 8088
# http://nifft:8088/tty/calendar
CalendarServer nifft
CalendarPath /tty/calendar
CalendarPort 8088
# http://nifft:8088/tty/other
OtherServer nifft
OtherPath /tty/other
OtherPort 8088