javAPRS

Implementation of the APRS Protocols in Java

Steve Dimse KO4HD

k4hg@tapr.org
http://www.aprs.net/steve.html


This paper describes my implementation of the Automatic Position Reporting System (APRS) protocols in the computer language Java. APRS is one of the most innovative uses of ham radio in recent years. javAPRS extends the usefulness of APRS to the internet.

Java Basics

Java was designed by Sun Microsystems as a language to promote the use of distributed computing resources over the internet. Based on the C language, with an object programming philosophy drawn from Smalltalk and Lisp, platform independence, and built-in security, it is a language uniquely suited to network programming.

The principle drawback to the use of Java at present is slow execution speed. Unlike traditional programs, which are compiled into machine specific object code before distribution, Java is compiled down to byte code which is then interpreted on the local machine, often executing at 10-25% of the speed of native code. There is reason to be hopeful, however. Several companies are working on 'just-in-time' compilers, which convert byte code to native code on the local machine just prior to execution. Also, the horsepower of today's computers makes even the interpreted version run at an acceptable speed in most applications.

The leading use of Java at present is to write programs, called applets, which are run within a World Wide Web (WWW) browser, such as Netscape. javAPRS can work in this fashion, or as a stand alone program. Security restrictions limit some of the interesting possibilities for javAPRS as an applet, such as using separate servers for map and APRS data, or connecting to multiple other computers to plot data from multiple LANs.

javAPRS Design

In the basic design of javAPRS, I have tried to create a system which can be used now by people without programming knowledge to add APRS data to their web pages. In addition, using the object oriented programming (OOP) features of Java, the system is designed to be easily extended by other Java programmers. This sort of extension does not require access to source code of javAPRS. The interfaces used by other programs will be posted in my web pages as they are finalized. Source code will not be freely available, but I will consider requests for the source code on a specific basis. The remainder of this paper discusses the use of javAPRS in web page creation. Programmers interested in extending javAPRS should contact me directly for more info.

javAPRS Applet Parameters

The basic syntax to call an applet in hypertext markup language (HTML) is:

<APPLET codebase = "javAPRS/" CODE="javAPRS.class" WIDTH=400 HEIGHT =300>

This executes the applet "javAPRS.class" in the directory "javAPRS" (relative to the HTML file the call is found in). It allocates a space of the size indicated in the browser window. Other HTML commands, such as <CENTER> work just as they would for other graphic elements such as images. The lines after APPLET tag consist of a series of parameters which are passed to the applet to control its behavior. Each parameter has a default value, usually the most commonly chosen option, and if the default parameter is desired, it need not be declared.

Map Parameters

At this time, javAPRS understands two kinds of maps. One or the other map must be used, or the applet will not run. The map files are stored in a subfolder "/maps" relative to the "codebase" named in the applet call.

<PARAM name = "dosMap" value = "anymap.map"> <PARAM name = "gifMap" value = "anymap.map">

Maps can be automatically or manually scaled.

<PARAM name = "autoScale" value = "true"> (Default true)

This will cause the map to be scaled to fit the window the applet is presently running in. If autoscaling is not used, then the following three parameters may be used to set the magnification and offset of the map. For now, the only way to figure out the value of these parameters is trial and error.

<PARAM name = "scale" value = "2.0"> (Default 1.0)
<PARAM name = "offsetX" value = "100"> (Default 0)
<PARAM name = "offsetY" value = "100"> (Default 0)

Two options work only with dosMaps, namely:

<PARAM name = "showMapLabels" value = "true"> (default true)
<PARAM name = "showAllMapLabels" value = "true"> (default false)


which will show either all map labels or those designated at the present scale.


Data Parameters

Data to be displayed by javAPRS is one of three types, either NMEA (only RMC and GGA are recognized at present), TNC data (raw data from a TNC which is the MacAPRS log file format), and HST files produced by dosAPRS. Any or all of the three types of data may be displayed, but only one file of each type can be used.

<PARAM name = "NMEAfile" value = "nmea.data">
<PARAM name = "TNCfile" value ="ko4hd.data">
<PARAM name = "HSTfile" value = "marathon.data">


The way the data is displayed is affected by several parameters:

<PARAM name = "displayVectors" value = "true"> (default true)

This will draw vectors for course and speed info if present in a position report.

<PARAM name = "showCallsigns" value = "true"> (default true)

This prints a callsign next to each position report.

<PARAM name = "stationList" value = "true">

javAPRS can keep a station list for the stations that are 'heard' in the data stream. At the end of a file readin, the contents are dumped to the java console (select the option "Open Java Console" in Netscape. It will also speed up the redrawing once the data have been read, only the last position of each station will be plotted.

<PARAM name = "showNewStations" value = "false">

If stationList is true, then this option will show the name of each new station as it is heard. If the home station has been specified, the bearing and distance to the station will also be displayed.

There are a number of other, less important parameters that are available to fine tune the display to suit the user. Please refer to my web pages for more details.


javAPRS Sample Applications

The javAPRS classes that exist now allow a person without programming skills to create a World Wide Web page containing an APRS map, and display a file containing positions of various APRS stations, objects, and track plots. More complete instructions may be found on my web site. Here are three examples, with the HTML code used to call the applet, and the URLšs to reference them.

HST file replay

http://www.aprs.net/marathon.html
<APPLET codebase = "javAPRS/" CODE="javAPRS.class" WIDTH=500 HEIGHT =350>
<PARAM name = "dosMap" value = "washdc.map">
<PARAM name = "HSTfile" value = "marathon.hst">
<PARAM name = "sleep" value = "50">
<PARAM name = "stationlist" value = "false">
<PARAM name = "showStationNames" value = "false">
<PARAM name = "copyrightTop" value = "false">
<PARAM name = "scale" value = "1.6">
<PARAM name = "offsetx" value = "620">
<PARAM name = "offsety" value = "310"> </APPLET>


javAPRS screen capture



GIF files for maps

http://www.aprs.net/gifmap.html

<APPLET codebase = "javAPRS/" CODE="javAPRS.class" WIDTH=500 HEIGHT =350>
<PARAM name = "gifMap" value = "cudjoe.gif">
<PARAM name = "gifMapLeft" value = "81.558">
<PARAM name = "gifMapTop" value = "24.7">
<PARAM name = "gifMapPPDh" value = "3800">
<PARAM name = "gifMapPPDv" value = "3900">
<PARAM name = "sleep" value = "700">
<PARAM name = "LLfile" value = "boattrip.ll">
<PARAM name = "stationlist" value = "false">
<PARAM name = "copyrightTop" value = "false">
</APPLET>


javAPRS screen capture



Display of TNC data capture

http://www.aprs.net/trip.html

<APPLET codebase = "javAPRS/" CODE="javAPRS.class" WIDTH=500 HEIGHT =350>
<PARAM name = "dosMap" value = "usa.map">
<PARAM name = "TNCfile" value = "tnc.data">
<PARAM name = "drawvectors" value = "true">
<PARAM name = "homeID" value = "KO4HD-9">
</APPLET>


javAPRS screen capture



Future directions


The samples above are static data, and although there is some degree of animation while the data is plotted, they could be done just as easily with screen captures and GIF files. Soon I hope to have the system able to access real time data over the net. This is where javAPRS can fill a unique role. The possibility exists to incorporate internet connectivity directly into the standalone APRS programs currently in use, allowing web users to see the data obtained at various APRS stations across the country in real time. Also, it would be possible to write a server program, that could be connected to many different APRS sites and share their data, creating a nationwide APRS network, no longer limited to 300 baud and the vagarities of HF propagation. I plan to pursue these plans, and hope to have some results to share by the 1997 DCC, if not sooner.