Get the data from a Garmin GPS, using Java

This document is not about the way to read what the GPS is supposed to give you if you call it using its NMEA capabilities. It's precisely about what does not belong to the NMEA specification, like the coordinates of the way-points, the routes, the almanach, etc.

This depends on another protocol, based on the same communication port, but with other parameters, so that they can coexist.

As an example, we will here show how to read all the way-points from the Garmin device.
This wouldn't have been possible without the informations found on Peter Bennett's web site.

One first thing to remember is that, depending on the kind of data you want to read, you have to set the Garmin device accordingly. For example, if you want to read what we are talking about, you have to:

Then you have to connect the Garmin device on the PC where you'll call the program from. You can easily build a cable, from the Data Cable provided by Garmin under the reference 010-10086-00, wich also happen to be the cheapest.

We've written the program using the Java Programming Language.
To use the different ports, you need to use the Java Communication APIs, that can be downloaded from the sun web-site.
The following classes assume that those APIs will be used.

To start the program, use the following command line:

java -classpath PortTyper.jar;D:\commapi\comm.jar PortTyper COM1 
      
Where D:\commapi\comm.jar is the jar-file downloaded from Sun, and PortTyper.jar is downloaded from here.

PortTyper.jar is made out of four java classes:

The kind of output you can expect will be in XML, and contains data that look like this:
1 008 34.401154 -119.69124
2 015 37.805992 -122.91649
3 016 37.84703 -122.39604
4 019 37.856647 -122.36459
5 2TREAS 37.833336 -122.39502
6 4FATHB 37.811165 -122.54001
7 AAMMOG 36.93333 27.281664
8 AANGIS 37.111664 26.833334
9 AASPRI 37.328167 26.562
10 AKATSN 36.966663 27.049997
...


Oliv fecit, A.D. 2002