gpstrans-0.41/0000755000175000017500000000000011037770611010303 500000000000000gpstrans-0.41/doc/0000755000175000017500000000000011037770611011050 500000000000000gpstrans-0.41/doc/gpstrans-old.html0000644000175000017500000000467310225356640014305 00000000000000 GPStrans - Transfer between Garmin GPS and UNIX Workstation

GPStrans - Transfer data between Garmin GPS and UNIX Workstations

What is GPStrans?

GPStrans is a program which allows to up- and download waypoints, route, almanac and trackroutes from you Garmin GPS. There is a ASCII-Version wish will allow to use the basic up-/download features of the program without having access to a graphic screen. The X11-Verion will soon allow to view the track-log and waypoints, also allow the edit data.


Software-Requirements

To successfully compile GPStrans you'll need 'gcc' or another ansi-C compatible Compiler. For the X11-Version you also need the xview-package distributed by Sun Microsystems as source-code. Be sure to use Version 3.2 or later because I take use of the new feature like filechooser.


Installation of GPStrans

GPStrans was developed using a Sun Workstation with SunOS 4.1.3. If you're using a SUN-Workstation you should only need to check the paths in the Makefile to point to the new xview-libraries.

I've successfully compiled GPStrans on a HP Workstation, but couldn't try the serial communication, because I don't have direct access to the workstation.


GPStrans Licensing Information

GPStrans is FreeWare. I'm releasing this source code to the public domain. You can redistribute it as often as you want as long as you let the original copyright notice in. If you like to do changes to GPStrans, please contact me before so that we can coordinate the work.

GPStrans is Copyright 1995 by Carsten tschach (tschach@zedat.fu-berlin.de). The datum translation-routines are based on the program MacGPS from John F. Waers (jfwaers@csn.net). You can copy it as long as you let the original copyright notice in.


How to get GPStrans

GPStrans is available via anonymous ftp from ftp.fu-berlin.de. The current version is 0.2beta - it's still a beta-test-version, so feel free to test it, but don't expect that it is error-free. If you discovered any errors, please email them to me at tschach@zedat.fu-berlin.de.


Source code:
gpstrans-0.3b.tar.gz


gpstrans-0.41/doc/gpstrans.10000644000175000017500000001414310427451722012717 00000000000000.TH "GPSTRANS" "1" "2006 May 7" "-" "GPS Utility" .SH "NAME" gpstrans \- communicate with Garmin GPS receiver .SH "SYNOPOSIS" .BR gpstrans " [ " .IR options " ] [ " "file " ] .SH "DESCRIPTION" .PP \fBgpstrans\fP allows the user with a Garmin GPS receiver to upload and download waypoints, routes, almanacs (satellite orbital elements) and trackroutes. If \fIfile\fP is not supplied, data will be read from stdin (\fB\-u\fP\fIx\fP switch) or written to stdout (\fB\-d\fP\fIx\fP switch). .SH "OPTIONS" .TP .BI \-p "port" set serial I/O device .TP .B \-s set datum, format, offset, and device interactively, and save them in \fI$HOME/.gpstrans\fP. .TP .B \-i identify connected GPS .TP .B \-o turn off GPS device .TP .B \-t get time from GPS .TP .B \-ts get time from GPS and set system time on host .TP .BI \-d x download data indicated by \fIx\fP: \fBr\fP=route, \fBt\fP=track, \fBw\fP=waypoint, \fBa\fP=almanac .TP .B \-m With \fB\-dt\fP, downloads track data in the format which can be displayed by Mayko mXmap(1). With \fB\-dr\fP or \fB\-ur\fP, downloads or uploads route data in a format compatible with Mayko mXmap. .TP .BI \-u x upload data indicated by \fIx\fP: \fBr\fP=route, \fBt\fP=track, \fBw\fP=waypoint, \fBa\fP=almanac .TP .B \-v print program version. .TP .BI \-\-verbose Increase verbosity. .TP .BI \-\-debug Add debug printouts. .TP .BI \-\-help Print help text. .SH "CONNECTION" For a DB\-25 connector, you may need to connect pin 4, 5 and 6, 8, 20 together. This sets handshake signals so that your workstation can use the serial port to communicate with the GPS. .nf .sp 1 ### ##### o o o # # # o # o o o o o o o o o o o # o o o o o .fi Connect the Garmin cable as follows: .nf .sp 2 3 7 o o o o o o o o o o o o o o o o o o o o o o o o o Pin 2 goes to DATA IN (White) Pin 3 goes to DATA OUT (Brown) Pin 7 goes to GROUND (Black) .fi If it doesn't work in this way, try exchanging pins 2 and 3 at the connector. The circular connector on a Garmin GPS II receiver can be wired to a DB\-9 connector as follows: .nf .sp _____ _____,\-\-\-\-\-, 3 / \\ 4 | | | | o o | | | |_____ | < <\- groove \-> |=====| |\-\-\-\-,| | o o | | | | || 2 \\ _____ / 1 |_____| | || `\-\-\-\-\-' || || views are looking || into connector || at each end of cable || || || 5 3 2 ________ || o o o o o | \\___________|| o o o o |_________,\-\-\-\-\-\-\-\-\-\-\-\-' DB\-9 pin 2 goes to circular connector pin 2 DB\-9 pin 3 goes to circular connector pin 4 DB\-9 pin 5 goes to circular connector pin 3 other pins are not connected (Note: the pin numbers for the circular connector are arbitrary, and may not match the `official' numbers.) .fi If your plug is more recent than the one above (ex: etrex) then you need DB\-9 or DB\-25 to be connected to your Garmin GPS like this: .BR _____,\-\-\-\-\-, POWER(+) | | | groove \-\-> |=====| |_____ DATA IN | | |\-\-\-\-,| DATA OUT | | | || GROUND(\-) |_____| | || `\-\-\-\-\-' || || || || || || || ________ || | \\___________|| |_________,\-\-\-\-\-\-\-\-\-\-\-\-' DB\-25 : 2 3 7 o o o o o o o o o o o o o o o o o o o o o o o o o Pin 2 goes to DATA IN (White) Pin 3 goes to DATA OUT (Brown) Pin 7 goes to GROUND (Black) DB\-9: 5 3 2 o o o o o o o o o pin 2 goes to DATA IN (White) pin 3 goes to DATA OUT (Brown) pin 5 goes to GROUND (Black) other pins are not connected For testing, you might try setting the GPS to NMEA\-Output and using a terminal emulator program like Kermit. The GPS will send a data record every 2 seconds. As long as you don't see any data on your computer, \fBgpstrans\fP won't work. After finishing the test, be sure to set your GPS receiver to GRMN/GRMN. .SH "ENVIRONMENT" .TP .B GPSDEV Serial I/O device (overrides contents of \fI$HOME/.gpstrans\fP, and is overridden by \fB\-p\fP switch). .SH "FILES" .TP .I $HOME/.gpstrans Has user preferences for datum, format, offset, and serial I/O device (see \fB\-s\fP switch, above). .SH "AUTHOR" GPStrans is Copyright 1995 by Carsten Tschach . The datum translation routines are based on the program MacGPS from John F. Waers . Mayko mXmap output format by Matthias Kattanek . German Grid by Andreas Lange . etrex support by Joao Seabra CT2GNL \- . Other Garmin formats added by Jim Van Zandt . .SH "SEE ALSO" .BR mxmap (1), .BR GPSMan gpstrans-0.41/src/0000755000175000017500000000000011037770611011072 500000000000000gpstrans-0.41/src/gps/0000755000175000017500000000000011037770611011663 500000000000000gpstrans-0.41/src/gps/Makefile0000644000175000017500000000141610231323522013233 00000000000000############################################################################## # # Makefile for GPStrans - subdirectory ./gps/ # ############################################################################## # # You don't need to change anything here. Do every change in ./Makefile # ############################################################################## CC = gcc INCLUDES=-I../include CFLAGS = -g -D__LINUX__ -DDEBUG OFILES = sendgpsinfo.o dms.o datum.o calendar.o gpsmessage.o garmincomm.o \ garminserial.o getgpsinfo.o latlong.o HFILES = ../include/defs.h ../include/Prefs.h ../include/Garmin.h ../include/protocols.h .c.o: $(HFILES) $(CC) -c $(CFLAGS) $(INCLUDES) $< all: $(OFILES) $(HFILES) clean: @rm -f core gpstrans *.o *.bak *~ #*# gpstrans-0.41/src/gps/calendar.c0000644000175000017500000001237010225356640013523 00000000000000/****************************************************************************/ /* */ /* ./gps/calendar.c - Procedures to convert time and datum */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include "Prefs.h" /* define constants */ #define START 2447892L /* Julian date for 00:00 12/31/89 */ /* prototype functions */ static long date2days (short mm, short dd, short yy); static void days2date (long julian, short *mm, short *dd, short *yy); /****************************************************************************/ /* dt is the date and time in the format "mm/dd/yyyy hh:mm:ss" and secs */ /* is the number of seconds since 12/31/1989 00:00:00, as defined by the */ /* #define START */ /****************************************************************************/ /****************************************************************************/ /* Convert seconds since 01/01/90 00:00:00 in date. */ /****************************************************************************/ char * secs2dt (long secs, short offset) { static char dt[30]; short mm, dd, yy, h, m, s; long days, rest; days = (long) ((secs + (long) (offset * 3600.0)) / (24L * 3600L)); rest = (secs + (long) (offset * 3600.0)) - (long) (days * 24L * 3600L); days2date (days, &mm, &dd, &yy); h = rest / 3600L; m = (rest - (long) h * 3600L) / 60L; s = (rest - (long) h * 3600L) - ((long) m * 60L); sprintf (dt, "%02d/%02d/%04d %02d:%02d:%02d", mm, dd, yy, h, m, s); return dt; } /****************************************************************************/ /* Convert dat in seconds since 01/01/90 00:00:00 */ /****************************************************************************/ long dt2secs (char *dt, int offset) { int mm, dd, yy, h, m, s; sscanf (dt, "%d/%d/%d %d:%d:%d", &mm, &dd, &yy, &h, &m, &s); return 24L * 3600L * date2days (mm, dd, yy) + 3600L * h + 60L * m + s - (long) (offset * 3600.0); } /****************************************************************************/ /* Convert date in days since 01/01/90 00:00:00 */ /****************************************************************************/ static long date2days (short mm, short dd, short yy) { long jul; short ja, jy, jm; if (yy < 0) ++yy; if (mm > 2) { jy = yy; jm = mm + 1; } else { jy = yy - 1; jm = mm + 13; } ja = 0.01 * jy; jul = (long) ((long) (365.25 * jy) + (long) (30.6001 * jm) + dd + 1720997 - ja + (long) (0.25 * ja)); return jul - START; } /****************************************************************************/ /* Convert days since 01/01/90 00:00:00 in date. */ /****************************************************************************/ static void days2date (long days, short *mm, short *dd, short *yy) { long ja, jalpha, jb, jc, jd, je; jalpha = (long) (((float) (days + START - 1867216) - 0.25) / 36524.25); ja = days + START + 1 + jalpha - (long) (0.25 * jalpha); jb = ja + 1524L; jc = 6680.0 + (long) (((double) (jb - 2439870) - 122.1) / 365.25); jd = (long) (365.25 * jc); je = (long) ((jb - jd) / 30.6001); *dd = jb - jd - (short) (30.6001 * je); *mm = je - 1; if (*mm > 12) *mm -= 12; *yy = jc - 4715; if (*mm > 2) --(*yy); if (*yy <= 0) --(*yy); } gpstrans-0.41/src/gps/datum.c0000644000175000017500000002143510225356640013066 00000000000000/****************************************************************************/ /* */ /* ./gps/datum.c - Definition of Datum and Ellipsoid */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" /****************************************************************************/ /* */ /* ellipsoid: index into the gEllipsoid[] array, in which */ /* */ /* a: ellipsoid semimajor axis */ /* invf: inverse of the ellipsoid flattening f */ /* dx, dy, dz: ellipsoid center with respect to WGS84 ellipsoid center */ /* */ /* x axis is the prime meridian */ /* y axis is 90 degrees east longitude */ /* z axis is the axis of rotation of the ellipsoid */ /* */ /* The following values for dx, dy and dz were extracted from the output of */ /* the GARMIN PCX5 program. The output also includes values for da and df, */ /* the difference between the reference ellipsoid and the WGS84 ellipsoid */ /* semi-major axis and flattening, respectively. These are replaced by the */ /* data contained in the structure array gEllipsoid[], which was obtained */ /* from the Defence Mapping Agency document number TR8350.2, "Department of */ /* Defense World Geodetic System 1984." */ /* */ /****************************************************************************/ /* Number of gDatum entries */ short nDatums = 102; struct DATUM const gDatum[] = { {"Adindan", 5, -162, -12, 206}, {"Afgooye", 15, -43, -163, 45}, {"Ain el Abd 1970", 14, -150, -251, -2}, {"Anna 1 Astro 1965", 2, -491, -22, 435}, {"Arc 1950", 5, -143, -90, -294}, {"Arc 1960", 5, -160, -8, -300}, {"Ascension Island `58", 14, -207, 107, 52}, {"Astro B4 Sorol Atoll", 14, 114, -116, -333}, {"Astro Beacon \"E\"", 14, 145, 75, -272}, {"Astro DOS 71/4", 14, -320, 550, -494}, {"Astronomic Stn `52", 14, 124, -234, -25}, {"Australian Geod `66", 2, -133, -48, 148}, {"Australian Geod `84", 2, -134, -48, 149}, {"Bellevue (IGN)", 14, -127, -769, 472}, {"Bermuda 1957", 4, -73, 213, 296}, {"Bogota Observatory", 14, 307, 304, -318}, {"Campo Inchauspe", 14, -148, 136, 90}, {"Canton Astro 1966", 14, 298, -304, -375}, {"Cape", 5, -136, -108, -292}, {"Cape Canaveral", 4, -2, 150, 181}, {"Carthage", 5, -263, 6, 431}, {"CH-1903", 3, 674, 15, 405}, {"Chatham 1971", 14, 175, -38, 113}, {"Chua Astro", 14, -134, 229, -29}, {"Corrego Alegre", 14, -206, 172, -6}, {"Djakarta (Batavia)", 3, -377, 681, -50}, {"DOS 1968", 14, 230, -199, -752}, {"Easter Island 1967", 14, 211, 147, 111}, {"European 1950", 14, -87, -98, -121}, {"European 1979", 14, -86, -98, -119}, {"Finland Hayford", 14, -78, -231, -97}, {"Gandajika Base", 14, -133, -321, 50}, {"Geodetic Datum `49", 14, 84, -22, 209}, {"Guam 1963", 4, -100, -248, 259}, {"GUX 1 Astro", 14, 252, -209, -751}, {"Hjorsey 1955", 14, -73, 46, -86}, {"Hong Kong 1963", 14, -156, -271, -189}, {"Indian Bangladesh", 6, 289, 734, 257}, {"Indian Thailand", 6, 214, 836, 303}, {"Ireland 1965", 1, 506, -122, 611}, {"ISTS 073 Astro `69", 14, 208, -435, -229}, {"Johnston Island", 14, 191, -77, -204}, {"Kandawala", 6, -97, 787, 86}, {"Kerguelen Island", 14, 145, -187, 103}, {"Kertau 1948", 7, -11, 851, 5}, {"L.C. 5 Astro", 4, 42, 124, 147}, {"Liberia 1964", 5, -90, 40, 88}, {"Luzon Mindanao", 4, -133, -79, -72}, {"Luzon Philippines", 4, -133, -77, -51}, {"Mahe 1971", 5, 41, -220, -134}, {"Marco Astro", 14, -289, -124, 60}, {"Massawa", 3, 639, 405, 60}, {"Merchich", 5, 31, 146, 47}, {"Midway Astro 1961", 14, 912, -58, 1227}, {"Minna", 5, -92, -93, 122}, {"NAD27 Alaska", 4, -5, 135, 172}, {"NAD27 Bahamas", 4, -4, 154, 178}, {"NAD27 Canada", 4, -10, 158, 187}, {"NAD27 Canal Zone", 4, 0, 125, 201}, {"NAD27 Caribbean", 4, -7, 152, 178}, {"NAD27 Central", 4, 0, 125, 194}, {"NAD27 CONUS", 4, -8, 160, 176}, {"NAD27 Cuba", 4, -9, 152, 178}, {"NAD27 Greenland", 4, 11, 114, 195}, {"NAD27 Mexico", 4, -12, 130, 190}, {"NAD27 San Salvador", 4, 1, 140, 165}, {"NAD83", 11, 0, 0, 0}, {"Nahrwn Masirah Ilnd", 5, -247, -148, 369}, {"Nahrwn Saudi Arbia", 5, -231, -196, 482}, {"Nahrwn United Arab", 5, -249, -156, 381}, {"Naparima BWI", 14, -2, 374, 172}, {"Observatorio 1966", 14, -425, -169, 81}, {"Old Egyptian", 12, -130, 110, -13}, {"Old Hawaiian", 4, 61, -285, -181}, {"Oman", 5, -346, -1, 224}, {"Ord Srvy Grt Britn", 0, 375, -111, 431}, {"Pico De Las Nieves", 14, -307, -92, 127}, {"Pitcairn Astro 1967", 14, 185, 165, 42}, {"Prov So Amrican `56", 14, -288, 175, -376}, {"Prov So Chilean `63", 14, 16, 196, 93}, {"Puerto Rico", 4, 11, 72, -101}, {"Qatar National", 14, -128, -283, 22}, {"Qornoq", 14, 164, 138, -189}, {"Reunion", 14, 94, -948, -1262}, {"Rome 1940", 14, -225, -65, 9}, {"RT 90", 3, 498, -36, 568}, {"Santo (DOS)", 14, 170, 42, 84}, {"Sao Braz", 14, -203, 141, 53}, {"Sapper Hill 1943", 14, -355, 16, 74}, {"Schwarzeck", 21, 616, 97, -251}, {"South American `69", 16, -57, 1, -41}, {"South Asia", 8, 7, -10, -26}, {"Southeast Base", 14, -499, -249, 314}, {"Southwest Base", 14, -104, 167, -38}, {"Timbalai 1948", 6, -689, 691, -46}, {"Tokyo", 3, -128, 481, 664}, {"Tristan Astro 1968", 14, -632, 438, -609}, {"Viti Levu 1916", 5, 51, 391, -36}, {"Wake-Eniwetok `60", 13, 101, 52, -39}, {"WGS 72", 19, 0, 0, 5}, {"WGS 84", 20, 0, 0, 0}, {"Zanderij", 14, -265, 120, -358}, {"Potsdam", 3, 606, 23, 413} }; struct ELLIPSOID const gEllipsoid[] = { {"Airy 1830", 6377563.396, 299.3249646}, {"Modified Airy", 6377340.189, 299.3249646}, {"Australian National", 6378160.0, 298.25}, {"Bessel 1841", 6377397.155, 299.1528128}, {"Clarke 1866", 6378206.4, 294.9786982}, {"Clarke 1880", 6378249.145, 293.465}, {"Everest (India 1830)", 6377276.345, 300.8017}, {"Everest (1948)", 6377304.063, 300.8017}, {"Modified Fischer 1960", 6378155.0, 298.3}, {"Everest (Pakistan)", 6377309.613, 300.8017}, {"Indonesian 1974", 6378160.0, 298.247}, {"GRS 80", 6378137.0, 298.257222101}, {"Helmert 1906", 6378200.0, 298.3}, {"Hough 1960", 6378270.0, 297.0}, {"International 1924", 6378388.0, 297.0}, {"Krassovsky 1940", 6378245.0, 298.3}, {"South American 1969", 6378160.0, 298.25}, {"Everest (Malaysia 1969)", 6377295.664, 300.8017}, {"Everest (Sabah Sarawak)", 6377298.556, 300.8017}, {"WGS 72", 6378135.0, 298.26}, {"WGS 84", 6378137.0, 298.257223563}, {"Bessel 1841 (Namibia)", 6377483.865, 299.1528128}, {"Everest (India 1956)", 6377301.243, 300.8017} }; gpstrans-0.41/src/gps/dms.c0000644000175000017500000001015610225356640012535 00000000000000/****************************************************************************/ /* */ /* ./gps/dms.c - Convert to various position formats */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" /****************************************************************************/ /* Convert degrees to dd mm'ss.s" (DMS-Format) */ /****************************************************************************/ char * toDMS (double a) { short neg = 0; double d, m, s; static char dms[20]; if (a < 0.0) { a = -a; neg = 1; } d = (double) ((int) a); a = (a - d) * 60.0; m = (double) ((int) a); s = (a - m) * 60.0; if (s > 59.5) { s = 0.0; m += 1.0; } if (m > 59.5) { m = 0.0; d += 1.0; } if (neg) d = -d; sprintf (dms, "%.0f°%02.0f'%04.1f\"", d, m, s); return dms; } /****************************************************************************/ /* Convert dd mm'ss.s" (DMS-Format) to degrees. */ /****************************************************************************/ double DMStoDegrees (char *dms) { int d, m; double s; sscanf (dms, "%d%d%lf", &d, &m, &s); s = (double) (abs (d)) + ((double) m + s / 60.0) / 60.0; if (d >= 0) return s; else return -s; } /****************************************************************************/ /* Convert degrees to dd mm.mmm' (DMM-Format) */ /****************************************************************************/ char * toDM (double a) { short neg = 0; double d, m; static char dm[13]; if (a < 0.0) { a = -a; neg = 1; } d = (double) ((int) a); m = (a - d) * 60.0; if (m > 59.5) { m = 0.0; d += 1.0; } if (neg) d = -d; sprintf (dm, "%.0f°%06.3f'", d, m); return dm; } /****************************************************************************/ /* Convert dd mm.mmm' (DMM-Format) to degree. */ /****************************************************************************/ double DMtoDegrees (char *dms) { int d; double m; sscanf (dms, "%d%lf", &d, &m); m = (double) (abs (d)) + m / 60.0; if (d >= 0) return m; else return -m; } gpstrans-0.41/src/gps/garmincomm.c0000644000175000017500000002025710236024453014102 00000000000000/****************************************************************************/ /* */ /* ./gps/garmincomm.c - Basic communication procedures between gps and */ /* unix host. */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* Copyright (c) 2001 by Joao Seabra - CT2GNL (seabra@ci.aac.uc.pt) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include "Prefs.h" #include "util.h" #include /* declare external variables */ extern int ttyfp; /* define global variables */ BYTE gGarminMessage[MAX_LENGTH]; int naks; /* define static variables */ static unsigned char checksum; /****************************************************************************/ /* Prepare package and send to GPS. */ /* */ /* A Garmin packet has six bytes of overhead. The caller includes two */ /* bytes of the packet header (ID and data byte count) in the message. */ /* This routine prepends the DLE and appends the trailer (checksum, DLE, */ /* and ETX). */ /****************************************************************************/ void sendGPSMessage (BYTE * message, short bytes) { short i; long n; BYTE gGarminMessage[MAX_LENGTH]; BYTE *p = gGarminMessage; checksum=0; *p++ = 0x10; /* Define start of message */ for (i = 0; i < bytes; i++) { *p++ = message[i]; checksum -= message[i]; if (message[i] == 0x10) *p++ = 0x10; } *p++ = checksum; if (checksum == 0x10) *p++ = 0x10; *p++ = 0x10; *p++ = 0x03; n = (long) (p - gGarminMessage); if (debugging>1) { printf (" Sending : "); for (i = 0; i < n; i++) printf ("%02X ", *(gGarminMessage + i)); printf ("\n"); if ((bytes != (message[1]+2)) || (bytes > 254)) Error("sendGPSMessage: invalid byte count\n"); } write (ttyfp, gGarminMessage, n); } /****************************************************************************/ /* Sent a "are-you-ready" message to GPS - return TRUE if GPS responds or */ /* FALSE if GPS did not respond (GPS off? / incorrect format?) */ /****************************************************************************/ int CheckGPS () { extern struct PREFS gPrefs; extern char gMessageStr[]; BYTE *p = gGarminMessage; BYTE last = 0; BYTE c; short err; int igot; short length = 0; long tttime = TickCount (); /* Open device, FALSE if unable to open device */ if ((err = serialOpen (GARMIN)) != noErr) { sprintf (gMessageStr, "The initialization of port %s has failed.", gPrefs.Device); Error (gMessageStr); serialClose (); return (1 == 0); } if (debugging) fprintf(stderr, "CheckGPS: sending test packet\n"); sendGPSMessage (test, 4); /* The "test" message has packet ID 0x1c=28, which is not listed in Garmin's ICD. Apparently it is an invalid ID, so the device will reply with an ACK but discard the packet. */ /* wait for response */ for (;;) { /* timeout exceeded */ if (TickCount () > (tttime + (long) TIMEOUT)) { serialClose (); return (1 == 0); } while (serialCharsAvail ()) { igot = read (ttyfp, &c, 1); if (c == 0x10 && last == 0x10) last = 0; else { assert(p < gGarminMessage + MAX_LENGTH); last = *p++ = c; ++length; } /* received valid response package */ if (*(p - 1) == 0x03 && *(p - 2) == 0x10) { if (debugging>1) { int i; printf (" Receiving: "); for (i = 0; i < length; i++) printf ("%02X ", *(gGarminMessage + i)); printf ("\n"); } serialClose (); return (1 == 1); } } } } /****************************************************************************/ /* Get response from GPS - returns number of bytes received, 0 if timeout */ /* period elapsed without completing a package. */ /****************************************************************************/ short getGPSMessage () { extern enum PROTOCOL mode; BYTE *p = gGarminMessage; BYTE last = 0; BYTE c; short length = 0; int igot; long tttime = TickCount (); checksum = -(0x10 + 0x03 + 0x10); /* with this starting value, the sum over the entire packet should be zero */ for (;;) { /* exit if timeout exceeded */ if (TickCount () > (tttime + (long) TIMEOUT)) { CloseBarGraph (); Error ("The GPS receiver is not responding."); mode = NONE; return 0; } while (serialCharsAvail ()) { if (length >= MAX_LENGTH - 1) { Error ("GPS receiver communication protocol error."); mode = NONE; return 0; } igot = read (ttyfp, &c, 1); if (c == 0x10 && last == 0x10) last = 0; else { assert(p < gGarminMessage + MAX_LENGTH); last = *p++ = c; checksum += c; ++length; } /* return when package complete */ if (*(p - 1) == 0x03 && *(p - 2) == 0x10) { if (debugging>1) { int i; printf (" Receiving: "); for (i = 0; i < length; i++) printf ("%02X ", *(gGarminMessage + i)); printf ("\n"); if (debugging && checksum) printf("getGPSMessage: ######## checksum=%d is nonzero #########\n", checksum); } return length; } } } } /* Read the ACK packet from the GPS. Sometimes we get an invalid packet "00 F5 10 03" instead, which we ignore. Return number of bytes in the valid ACK packet, or zero on failure. */ int getGPSack () { int n, trial; for (trial=0; trial<3; trial++) { n = getGPSMessage(); if ((n<8) || (gGarminMessage[0]!=0x10) || (gGarminMessage[2]!=n-6) || checksum || (gGarminMessage[n-2]!=0x10) || (gGarminMessage[n-1]!=0x03) ) { if (debugging) fprintf(stderr, "GPSack: discarding invalid packet\n"); continue; } if (gGarminMessage[1]==0x06) /* is the packet an ACK? */ return n; if (gGarminMessage[1]==21) /* is the packet a NAK? */ { naks++; return 0; } if (debugging) fprintf(stderr, "GPSack: discarding packet type 0x%02X=%d, " "neither ACK nor NAK\n", gGarminMessage[1], gGarminMessage[1]); } return 0; } gpstrans-0.41/src/gps/garminserial.c0000644000175000017500000001012310225356640014421 00000000000000/****************************************************************************/ /* */ /* ./gps/garminserial.c - Procedure to talk with serial device */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* Copyright (c) 2001 by Joao Seabra - CT2GNL (seabra@ci.aac.uc.pt) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Prefs.h" #include "Garmin.h" #include #include #include #include #ifdef SUNOS41 #include #endif /* define external variables */ extern struct PREFS gPrefs; /* define global variables */ int ttyfp; struct termio ttyset; /****************************************************************************/ /* Open serial device for requested protocol - only GARMIN supported now. */ /****************************************************************************/ int serialOpen (enum PROTOCOL p) { ttyfp = open (gPrefs.Device, O_RDWR); /* return when error opening device */ if (ttyfp < 0) return (-1); if (ioctl (ttyfp, TCGETA, &ttyset) < 0) return (-1); /* set baud rate for device */ switch (p) { case GARMIN: ttyset.c_cflag = CBAUD & B9600; ttyset.c_cflag |= CLOCAL; break; case NMEA: ttyset.c_cflag = CBAUD & B4800; break; default: return -1; } /* set character size and allow to read data */ #ifdef SUNOS41 ttyset.c_cflag |= (CSIZE & CS8) | CRTSCTS | CREAD; #else ttyset.c_cflag |= (CSIZE & CS8) | CREAD; #endif ttyset.c_iflag = ttyset.c_oflag = ttyset.c_lflag = (ushort) 0; ttyset.c_oflag = (ONLRET); /* return if unable to set communication parameters */ if (ioctl (ttyfp, TCSETAF, &ttyset) < 0) return (-1); return 0; } /****************************************************************************/ /* Get number of serial characters available. */ /****************************************************************************/ long serialCharsAvail () { int count; ioctl (ttyfp, FIONREAD, &count); return (long) count; } /****************************************************************************/ /* Close serial device. */ /****************************************************************************/ void serialClose () { close (ttyfp); } gpstrans-0.41/src/gps/getgpsinfo.c0000644000175000017500000014730111037513456014124 00000000000000/****************************************************************************/ /* */ /* ./gps/getgpsinfo.c - Receive data from GPS */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* Copyright (c) 1998 by Matthias Kattanek (mattes@ugraf.com) */ /* */ /* Copyright (c) 2001 by Joćo Seabra (seabra@ci.aac.uc.pt) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include "Prefs.h" #include "graph.h" #include "util.h" #include #include "protocols.h" #include #include #include /* define external variables */ extern BYTE gGarminMessage[MAX_LENGTH]; extern char *protocols; /* define global variables */ static short records; static FILE *FileRefNum; static char fileData[2*MAX_LINE]; static int AlmanacSat = 0; char GPSVersionStr[255]; /* function prototypes */ static int xmap_route_nr = 0; static long xmap_time = 0; static double xmap_lat = 0; static double xmap_lon = 0; static float xmap_speed = 0; static char *colorCodeToName (int code); static void doTrackHeader (); #ifdef OLDCODE static void doTrack_xmap (void); static void doTrack (void); #endif static void doWaypoint_xmap (void); static double distance (double lata, double lona, double latb, double lonb); static void parseGPS (void); static void doWaypoint (void); static void doRouteName (void); static void doAlmanac (void); static long number (BYTE * p); static char *string (short n, BYTE * p); static void FileWrite (char *data); static float tofloat (unsigned char *p); static short toshort (unsigned char *p); /****************************************************************************/ /* Write format information to output file. */ /****************************************************************************/ void saveFormat (char *fileData, short type) { extern struct PREFS gPrefs; extern struct DATUM const gDatum[]; char format[4]; time_t thistime; switch (gPrefs.format) { case DMS: strcpy (format, "DMS"); break; case DMM: strcpy (format, "DMM"); break; default: fprintf(stderr, "format code not recognized - using DDD instead\n"); gPrefs.format = DDD; case DDD: strcpy (format, "DDD"); break; case UTM: strcpy (format, "UTM"); break; case KKJ: strcpy (format, "KKJ"); break; case BNG: strcpy (format, "BNG"); break; case ITM: strcpy (format, "ITM"); break; case SEG: strcpy (format, "SEG"); break; case GKK: strcpy (format, "GKK"); break; /* Gauss Krueger Grid = German Grid */ } switch(file_format) { case MAYKO: case MAYKO2: time (&thistime); if (type == TRACK) sprintf (fileData, "xmaplog 1.0 %s", ctime (&thistime)); else if (type == ROUTE) sprintf (fileData, "xmaproute 1.0 %s", ctime (&thistime)); else sprintf (fileData, "unknown xmap format %s", ctime (&thistime)); break; case TSV: /****************************************************************************/ /* The following header is used to save information about the data */ /* in the TSV data files. If changed, the function getFileData() in */ /* SendGPSInfo.c must also be changed. */ /* */ /* Format: DDD UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* ||| |||||| ||| */ /* 0 1 2 3 4 5 6 */ /* 0123456789012345678901234567890123456789012345678901234567890123456789 */ /****************************************************************************/ sprintf (fileData, "Format: %s UTC Offset: %6.2f hrs Datum[%03d]: %s\n", format, gPrefs.offset, gPrefs.datum, gDatum[gPrefs.datum].name); switch (type) { case ROUTE: case WAYPOINT: if (strstr(protocols, "A100 D100")) strcat(fileData, "Type\t" "Name\t" "Comment \t"); else if (strstr(protocols, "A100 D101")) strcat(fileData, "Type\t" "Name\t" "Comment \t"); else if (strstr(protocols, "A100 D102")) strcat(fileData, "Type\t" "Name\t" "Comment \t"); else if (strstr(protocols, "A100 D103")) strcat(fileData, "Type\t" "Name\t" "Comment \t"); else if (strstr(protocols, "A100 D104")) strcat(fileData, "Type\t" "Name\t" "Comment \t"); else if (strstr(protocols, "A100 D105")) strcat(fileData, "Type\t" "Name\t" "Comment \t"); else if (strstr(protocols, "A100 D106")) strcat(fileData, "Type\t" "Name\t" "Comment \t"); else if (strstr(protocols, "A100 D107")) strcat(fileData, "Type\t" "Name\t" "Comment \t"); else if (strstr(protocols, "A100 D108")) strcat(fileData, "Type\t" "Name\t" "Comment \t" "Altitude\t"); else if (strstr(protocols, "A100 D109")) strcat(fileData, "Type\t" "Name\t" "Comment \t" "Date \t" "Altitude\t"); else if (strstr(protocols, "A100 D110")) strcat(fileData, "Type\t" "Name\t" "Comment \t" "Date \t" "Altitude\t"); break; case TRACK: if (strstr(protocols, "D300")) strcat(fileData, "Type\t" "Date \t"); else if (strstr(protocols, "D301")) strcat(fileData, "Type\t" "Date \t" "Altitude\t"); else if (strstr(protocols, "D302")) strcat(fileData, "Type\t" "Date \t" "Altitude\t"); } switch (gPrefs.format) { case DMS: case DMM: case DDD: strcat(fileData, "Latitude\tLongitude\t\n"); break; case UTM: strcat(fileData, "ZE\tZN\tEasting\tNorthing\t\n"); break; case BNG: case ITM: case KKJ: strcat(fileData, "Zone\tEasting\tNorthing\t\n"); break; /* case SUI: appears in sendgpsinfo.c comment but not implemented */ case SEG: case GKK: strcat(fileData, "Easting\tNorthing\t\n"); break; default: ; } break; } } /****************************************************************************/ /* Query GPS for its model and software version. Set string to point to a text string. Return nonzero status if error. */ /****************************************************************************/ int getGPSVersion (char **string) { extern struct PREFS gPrefs; extern char gMessageStr[]; char temp[255]; short err; int last = 0, i; BYTE *data=gGarminMessage+3; extern unsigned short product_ID, software_version; *string=gMessageStr; SetFrameBusy (1); /* First check if GPS responds to the "are-you-ready" package */ if (CheckGPS ()) { usleep (10000); /* a fast computer requires this - jrv */ if ((err = serialOpen (GARMIN)) != noErr) { sprintf (gMessageStr, "The port initialization of %s has failed.", gPrefs.Device); Error (gMessageStr); return 1; /* FAIL */ } if (debugging) fprintf(stderr, "getGPSVersion: sending product data request\n"); /* send request and receive version package */ sendGPSMessage (gid4, 2); /* protocol A000, Pid_Product_Rqst */ getGPSack (); /* presumably the GPS's ACK packet */ getGPSMessage (); /* get the GPS Pid_Product_Data */ sendGPSMessage (gid5, 4); /* send ACK packet for GPS response */ /* data returned has this format: typedef struct { uint16 product_ID; sint16 software_version; char product_description[]; // null-terminated string } Product_Data_Type; */ product_ID=toshort(data); software_version=toshort(data+2); /* extract model name and software version */ sprintf (GPSVersionStr, "Garmin %s", gGarminMessage + 7); GPSVersionStr[strlen (GPSVersionStr) - 1] = '\0'; for (i = 0; i <= strlen (GPSVersionStr); i++) { if (GPSVersionStr[i] == ' ') last = i; } sprintf (temp, " - V%s", &GPSVersionStr[last + 1]); GPSVersionStr[last] = '\0'; while ((i > 0) && (GPSVersionStr[strlen (GPSVersionStr) - 1] == ' ')) GPSVersionStr[strlen (GPSVersionStr) - 1] = '\0'; sprintf (GPSVersionStr, "%s%s", GPSVersionStr, temp); usleep (10000); /* wait 1/10 sec for device to send a protocol string */ if (serialCharsAvail()) { /* the device apparently implements the protocol capability protocol */ char *p; BYTE *s=data; BYTE tag; unsigned short udata; int n; getGPSMessage(); n=data[-1]; if (n<0) n=0; p=protocols=xmalloc(5*n/3+1); for ( ; n>0; n-=3) { tag=*s; udata=toshort(s+1); /* translate each protocol tag and data to the string used in the docs */ sprintf(p, " %c%03d", tag, udata); s+=3; p+=5; } *p=0; /* A100 - waypoint transfer A20x - route transfer A30x - track log transfer A400 - proximity waypoint transfer A500 - almanac transfer A600 - Date and time initialization A700 - Position initialization A800 - PVT protocol A906 - lap transfer For an etrex legend: P000 L001 A010 A100 D108 A201 D202 D108 D210 A301 D310 D301 A500 D501 A600 D600 A700 D700 A800 D800 A900 A902 A903 */ } else { /* Look up the protocols using the product ID and software version */ typedef struct { uint16 product_ID; /* product ID */ sint16 software_version; /* the earliest software version implementing this list of protocols */ char *protocol; /* list of protocols and their data types */ } protocol_t; /* These are protocol capabilities of "many" devices that do not implement the Protocol Capability Protocol, from Table 28 in the interface specification */ static protocol_t historic_protocols[] = { {7, 000, "L001 A010 A100 D100 A200 D200 D100 A500 D500 A600 D600 A700 D700"}, /* waypoints routes tracks prox wpt almanac */ {25, 000, "L001 A010 A100 D100 A200 D200 D100 A300 D300 A400 D400 A500 D500 A600 D600 A700 D700"}, {13, 000, "L001 A010 A100 D100 A200 D200 D100 A300 D300 A400 D400 A500 D500 A600 D600 A700 D700"}, {14, 000, "L001 A010 A100 D100 A200 D200 D100 A400 D400 A500 D500 A600 D600 A700 D700"}, {15, 000, "L001 A010 A100 D151 A200 D200 D151 A400 D151 A500 D500 A600 D600 A700 D700"}, {18, 000, "L001 A010 A100 D100 A200 D200 D100 A300 D300 A400 D400 A500 D500 A600 D600 A700 D700"}, {20, 000, "L002 A011 A100 D150 A200 D201 D150 A400 D450 A500 D550 A600 D600 A700 D700"}, {22, 000, "L001 A010 A100 D152 A200 D200 D152 A300 D300 A400 D152 A500 D500 A600 D600 A700 D700"}, {23, 000, "L001 A010 A100 D100 A200 D200 D100 A300 D300 A400 D400 A500 D500 A600 D600 A700 D700"}, {24, 000, "L001 A010 A100 D100 A200 D200 D100 A300 D300 A400 D400 A500 D500 A600 D600 A700 D700"}, {29, 000, "L001 A010 A100 D101 A200 D201 D101 A300 D300 A400 D101 A500 D500 A600 D600 A700 D700"}, {29, 400, "L001 A010 A100 D102 A200 D201 D102 A300 D300 A400 D102 A500 D500 A600 D600 A700 D700"}, {31, 000, "L001 A010 A100 D100 A200 D201 D100 A300 D300 A500 D500 A600 D600 A700 D700"}, {33, 000, "L002 A011 A100 D150 A200 D201 D150 A400 D450 A500 D550 A600 D600 A700 D700"}, {34, 000, "L002 A011 A100 D150 A200 D201 D150 A400 D450 A500 D550 A600 D600 A700 D700"}, {35, 000, "L001 A010 A100 D100 A200 D200 D100 A300 D300 A400 D400 A500 D500 A600 D600 A700 D700"}, {36, 000, "L001 A010 A100 D152 A200 D200 D152 A300 D300 A400 D152 A500 D500 A600 D600 A700 D700"}, {36, 300, "L001 A010 A100 D152 A200 D200 D152 A300 D300 A500 D500 A600 D600 A700 D700"}, {39, 000, "L001 A010 A100 D151 A200 D201 D151 A300 D300 A500 D500 A600 D600 A700 D700"}, {41, 000, "L001 A010 A100 D100 A200 D201 D100 A300 D300 A500 D500 A600 D600 A700 D700"}, {42, 000, "L001 A010 A100 D100 A200 D200 D100 A300 D300 A400 D400 A500 D500 A600 D600 A700 D700"}, {44, 000, "L001 A010 A100 D101 A200 D201 D101 A300 D300 A400 D101 A500 D500 A600 D600 A700 D700"}, {45, 000, "L001 A010 A100 D152 A200 D201 D152 A300 D300 A500 D500 A600 D600 A700 D700"}, {47, 000, "L001 A010 A100 D100 A200 D201 D100 A300 D300 A500 D500 A600 D600 A700 D700"}, {48, 000, "L001 A010 A100 D154 A200 D201 D154 A300 D300 A500 D501 A600 D600 A700 D700"}, {49, 000, "L001 A010 A100 D102 A200 D201 D102 A300 D300 A400 D102 A500 D501 A600 D600 A700 D700"}, {50, 000, "L001 A010 A100 D152 A200 D201 D152 A300 D300 A500 D501 A600 D600 A700 D700"}, {52, 000, "L002 A011 A100 D150 A200 D201 D150 A400 D450 A500 D550 A600 D600 A700 D700"}, {53, 000, "L001 A010 A100 D152 A200 D201 D152 A300 D300 A500 D501 A600 D600 A700 D700"}, {55, 000, "L001 A010 A100 D100 A200 D201 D100 A300 D300 A500 D500 A600 D600 A700 D700"}, {56, 000, "L001 A010 A100 D100 A200 D201 D100 A300 D300 A500 D500 A600 D600 A700 D700"}, {59, 000, "L001 A010 A100 D100 A200 D201 D100 A300 D300 A500 D500 A600 D600 A700 D700"}, {61, 000, "L001 A010 A100 D100 A200 D201 D100 A300 D300 A500 D500 A600 D600 A700 D700"}, {62, 000, "L001 A010 A100 D100 A200 D201 D100 A300 D300 A500 D500 A600 D600 A700 D700"}, {64, 000, "L002 A011 A100 D150 A200 D201 D150 A400 D450 A500 D551 A600 D600 A700 D700"}, {71, 000, "L001 A010 A100 D155 A200 D201 D155 A300 D300 A500 D501 A600 D600 A700 D700"}, {72, 000, "L001 A010 A100 D104 A200 D201 D104 A300 D300 A500 D501 A600 D600 A700 D700"}, {73, 000, "L001 A010 A100 D103 A200 D201 D103 A300 D300 A500 D501 A600 D600 A700 D700"}, {74, 000, "L001 A010 A100 D100 A200 D201 D100 A300 D300 A500 D500 A600 D600 A700 D700"}, {76, 000, "L001 A010 A100 D102 A200 D201 D102 A300 D300 A400 D102 A500 D501 A600 D600 A700 D700"}, {77, 000, "L001 A010 A100 D100 A200 D201 D100 A300 D300 A400 D400 A500 D501 A600 D600 A700 D700"}, {77, 301, "L001 A010 A100 D103 A200 D201 D103 A300 D300 A400 D403 A500 D501 A600 D600 A700 D700"}, {77, 350, "L001 A010 A100 D103 A200 D201 D103 A300 D300 A500 D501 A600 D600 A700 D700"}, {77, 361, "L001 A010 A100 D103 A200 D201 D103 A300 D300 A400 D403 A500 D501 A600 D600 A700 D700"}, {87, 000, "L001 A010 A100 D103 A200 D201 D103 A300 D300 A400 D403 A500 D501 A600 D600 A700 D700"}, {88, 000, "L001 A010 A100 D102 A200 D201 D102 A300 D300 A400 D102 A500 D501 A600 D600 A700 D700"}, {95, 000, "L001 A010 A100 D103 A200 D201 D103 A300 D300 A400 D403 A500 D501 A600 D600 A700 D700"}, {96, 000, "L001 A010 A100 D103 A200 D201 D103 A300 D300 A400 D403 A500 D501 A600 D600 A700 D700"}, {97, 000, "L001 A010 A100 D103 A200 D201 D103 A300 D300 A500 D501 A600 D600 A700 D700"}, {98, 000, "L002 A011 A100 D150 A200 D201 D150 A400 D450 A500 D551 A600 D600 A700 D700"}, {100, 000, "L001 A010 A100 D103 A200 D201 D103 A300 D300 A400 D403 A500 D501 A600 D600 A700 D700"}, {105, 000, "L001 A010 A100 D103 A200 D201 D103 A300 D300 A400 D403 A500 D501 A600 D600 A700 D700"}, {106, 000, "L001 A010 A100 D103 A200 D201 D103 A300 D300 A400 D403 A500 D501 A600 D600 A700 D700"}, {112, 000, "L001 A010 A100 D152 A200 D201 D152 A300 D300 A500 D501 A600 D600 A700 D700"}, /* 179 is the etrex Legend, which *usually* follows the protocol protocol, but is included here because it sometimes doesn't */ {179, 000, "L001 A010 A100 D108 A201 D202 D108 D210 A301 D310 D301 A500 D501 A600 D600 A700 D700 A800 D800 A900 A902 A903"}, {0} }; protocol_t *p=historic_protocols, *next; if (verbose) printf("checking historic protocols for product ID %d\n", product_ID); while(p->product_ID) { if (p->product_ID == product_ID) while(1) { next = p+1; if ((next->product_ID != product_ID) || (software_version < next->software_version)) goto found_protocol; p++; } p++; } printf ("Warning: device with product ID %d is unknown" " - assuming it's like a GPS II.\n", product_ID); p=historic_protocols+31; found_protocol: protocols = p->protocol; } usleep (60000); /* 5000 < needed < 6000 */ if (debugging) printf("product ID 0x%02x=%d, software version 0x%04x=%d, protocol string: \n%s\n", product_ID, product_ID, software_version, software_version, protocols); serialClose (); SetFrameBusy (0); } else { sprintf (GPSVersionStr, ""); SetFrameBusy (0); *string=GPSVersionStr; return 1; /* FAIL */ } *string=GPSVersionStr; return 0; /* normal return */ } /****************************************************************************/ /* Query GPS for current GPS time (in GMT/UTC). */ /****************************************************************************/ long getGPSTime (int var) { extern struct PREFS gPrefs; extern char gMessageStr[]; short err; struct tm *txx; time_t clock; /* Check if GPS responds to the "are-you-ready" package */ if (!CheckGPS ()) NotResponding (); /* open serial device */ if ((err = serialOpen (GARMIN)) != noErr) { sprintf (gMessageStr, "The port initialization of %s has failed.", gPrefs.Device); Error (gMessageStr); return (0); } if ((gPrefs.model == 'y')) { /* send command and receive package */ sendGPSMessage (tim1, 4); getGPSack (); getGPSMessage (); } else { /* send command and receive package */ sendGPSMessage (tim1, 4); getGPSack (); /* this is the ACK-package */ getGPSMessage (); /* This is of the unknown type 09: leap seconds ? */ getGPSack (); /* This is ACK again */ getGPSMessage (); /* Stuff */ } /* close serial device */ serialClose (); /* exit if not a valid time package */ if (*(gGarminMessage + 1) != 0x0e) return (-1); /* convert UTC time to localtime using the unix timezone */ time (&clock); txx = gmtime (&clock); txx->tm_sec = *(gGarminMessage + 10); txx->tm_min = *(gGarminMessage + 9); txx->tm_hour = *(gGarminMessage + 7); txx->tm_year = (toshort (gGarminMessage + 5) - 1900); txx->tm_mday = *(gGarminMessage + 4); txx->tm_mon = (*(gGarminMessage + 3)) - 1; clock = timegm (txx); return (clock); } /****************************************************************************/ /* Get multiple line packages from GPS (route, waypoint, track) */ /****************************************************************************/ void getGPSInfo (FILE * refNum, short type) { extern struct PREFS gPrefs; extern char gMessageStr[]; short total; short done = 0; BYTE *init, *req; short err; char *rType; int junk; char *junk_str; /* First check if GPS responds to the "are-you-ready" package */ if (!CheckGPS ()) NotResponding (); junk=getGPSVersion(&junk_str); /* load the "protocols" array */ /* open serial device */ if ((err = serialOpen (GARMIN)) != noErr) { sprintf (gMessageStr, "The port initialization of %s has failed.", gPrefs.Device); Error (gMessageStr); return; } FileRefNum = refNum; records = 0; /* Save output format if not Almanac-Data */ saveFormat (fileData, type); if (type != ALMANAC) FileWrite (fileData); /* process different requests */ switch (type) { default: case ALMANAC: init = alm1; req = alm2; rType = "almanac"; break; case ROUTE: init = rte1; req = rte2; rType = "routes"; break; case TRACK: init = trk1; req = trk2; rType = "track"; break; case WAYPOINT: init = wpt1; req = wpt2; rType = "waypoint"; break; } AlmanacSat = 0; /* open BarGraph window */ InitBarGraph (); /* send init package */ sendGPSMessage (init, 4); getGPSack(); /* exit if no package received from GPS */ if (getGPSMessage () == 0) { CloseBarGraph (); serialClose (); return; } total = toshort(gGarminMessage+3); /* get number of records to transfer */ if (verbose) { sprintf(gMessageStr, "GPS receiver will send %d packets.", total); Message (gMessageStr); } if (total < 1) total = 1; /* prevent divide by zero or negative length progress bar */ /* repeat until all packages received */ while (!done) { sendGPSMessage (req, 4); if (getGPSMessage () == 0) break; done = (gGarminMessage[1] == 0x0c); if (!done) { parseGPS (); SetBarGraph ((double) (records) / (double) total); } } /* close BarGraph and serial device */ CloseBarGraph (); serialClose (); if (verbose || debugging) { sprintf (gMessageStr, "%d %s packets were transferred from the GPS receiver.", records, rType); Message (gMessageStr); if (debugging && total && (records != total)) { sprintf(gMessageStr, " (%d were expected.)", total); Message (gMessageStr); } } } /****************************************************************************/ /* Parse messages received from GPS. */ /****************************************************************************/ static void parseGPS () { switch (gGarminMessage[1]) { case RTE_NAM: /* Route name record */ doRouteName (); break; case RTE_WPT: /* Route waypoint record */ if (file_format == MAYKO) doWaypoint_xmap (); else doWaypoint (); break; case ALM: /* Almanac record */ doAlmanac (); break; case Pid_Trk_Hdr: doTrackHeader (); break; case TRK: /* Track record */ if (file_format == MAYKO) // doTrack_xmap (); doWaypoint (); else // doTrack (); doWaypoint (); break; case WPT: /* Waypoint record */ doWaypoint (); break; default: if (debugging) printf("parseGPS: unexpected package, packet ID 0x%02X=%d\n", gGarminMessage[1], gGarminMessage[1]); return; } records++; } /****************************************************************************/ /* Process RouteName package (data type D200, D201, or D202) and write to output file\. */ /****************************************************************************/ static void doRouteName () { typedef struct { unsigned int nmbr; char *cmnt; } route_name_type; route_name_type rte; rte.cmnt=0; rte.nmbr=~1; if (strstr(protocols, "D200")) { char *d=(char *)(gGarminMessage+3); rte.nmbr=d[0]; /* no string field */ } else if (strstr(protocols, "D201")) { D201_Rte_Hdr_Type *d=(D201_Rte_Hdr_Type *)(gGarminMessage+3); rte.nmbr=d->nmbr; rte.cmnt=(char *)(&d->cmnt); } else if (strstr(protocols, "D202")) { D202_Rte_Hdr_Type *d=(D202_Rte_Hdr_Type *)(gGarminMessage+3); /* no route number */ rte.cmnt=(char *)(&d->rte_ident); } if (file_format == MAYKO) { if (rte.nmbr != ~1) xmap_route_nr = rte.nmbr; else xmap_route_nr = 0; /* punt */ } else { sprintf (fileData, "R\t"); FileWrite (fileData); if (rte.nmbr != ~1) { sprintf (fileData, "%d\t", rte.nmbr); FileWrite (fileData); } if (rte.cmnt) { sprintf (fileData, "%s\n", rte.cmnt); FileWrite (fileData); } } } static void doTrackHeader () { struct { unsigned char dspl; unsigned char color; char *ident; int index; struct { unsigned dspl:1; unsigned color:1; unsigned ident:1; unsigned index:1; } has; } hdr; hdr.has.dspl = hdr.has.color = hdr.has.ident = hdr.has.index = 0; if (strstr(protocols, "D310")) { D310_Trk_Hdr_Type *d=(D310_Trk_Hdr_Type *)(gGarminMessage+3); hdr.dspl = d->dspl; hdr.color = d->color; /* same as in D108 */ hdr.ident = (char *)(&d->trk_ident); hdr.has.dspl = hdr.has.color = hdr.has.ident = 1; } if (strstr(protocols, "D311")) { D311_Trk_Hdr_Type *d=(D311_Trk_Hdr_Type *)(gGarminMessage+3); hdr.index = toshort ((BYTE *)(&d->index)); hdr.has.index = 1; } if (strstr(protocols, "D312")) { D312_Trk_Hdr_Type *d=(D312_Trk_Hdr_Type *)(gGarminMessage+3); hdr.dspl = d->dspl; hdr.color = d->color; /* same as in D110 */ hdr.ident = (char *)(&d->trk_ident); hdr.has.dspl = hdr.has.color = hdr.has.ident = 1; } switch(file_format) { case MAYKO: case MAYKO2: break; case TSV: if (hdr.has.dspl) printf("H\t%s\t%s\t%.51s\n", hdr.dspl?"display":"hide", colorCodeToName(hdr.color), hdr.ident); else printf("H\t%d\n", hdr.index); break; } } /* return a pointer to a static string with the name of the color corresponding to CODE. */ static char * colorCodeToName (int code) { char *color_name[18]={ "black", "dark red", "dark green", "dark yellow", "dark blue", "dark magenta", "dark cyan", "light gray", "dark gray", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "transparent", "default" }; if (code == 0x1f || code == 255) return color_name[17]; if (code < 0 || code > 16) { if (debugging) printf("colorCodeToName: unexpected color code 0x%02X=%d, " "assuming black\n", code, code); code = 0; } return color_name[code]; } #ifdef OLDCODE /****************************************************************************/ /* Process Track package and write to output file\. */ /****************************************************************************/ static void doTrack () { extern struct PREFS gPrefs; double latitude, longitude, x, y; char zone[6]; if (*(gGarminMessage + 15) == '\x01') /* New track, create blank record */ if (records != 0) FileWrite ("\n"); /* convert bytes to latitude / longitude */ latitude = int2deg (number (gGarminMessage + 3)); longitude = int2deg (number (gGarminMessage + 7)); /* translate to selected datum */ translate (1, &latitude, &longitude, gPrefs.datum); /* Write track time to file */ sprintf (fileData, "T\t%s\t", secs2dt (number (gGarminMessage + 11), gPrefs.offset)); FileWrite (fileData); /* convert to selected position format */ switch (gPrefs.format) { case DMS: sprintf (fileData, "%s\t", toDMS (latitude)); FileWrite (fileData); sprintf (fileData, "%s\n", toDMS (longitude)); FileWrite (fileData); break; case DMM: sprintf (fileData, "%s\t", toDM (latitude)); FileWrite (fileData); sprintf (fileData, "%s\n", toDM (longitude)); FileWrite (fileData); break; case DDD: sprintf (fileData, "%03.7f\t%04.7f\n", latitude, longitude); FileWrite (fileData); break; case UTM: /* Convert to UTM grid */ DegToUTM (latitude, longitude, zone, &x, &y); sprintf (fileData, "%s\t%07.0f\t%07.0f\n", zone, x, y); FileWrite (fileData); break; case KKJ: /* Convert to KKJ grid */ DegToKKJ (latitude, longitude, zone, &x, &y); sprintf (fileData, "%s\t%07.0f\t%07.0f\n", zone, x, y); FileWrite (fileData); break; case BNG: /* Convert to British grid */ DegToBNG (latitude, longitude, zone, &x, &y); sprintf (fileData, "%s\t%05.0f\t%05.0f\n", zone, x, y); FileWrite (fileData); break; case ITM: /* Convert to Irish grid */ DegToITM (latitude, longitude, zone, &x, &y); sprintf (fileData, "%s\t%05.0f\t%05.0f\n", zone, x, y); FileWrite (fileData); break; case SEG: /* Convert to Swedish grid */ DegToSEG (latitude, longitude, &x, &y); sprintf (fileData, "%07.0f\t%07.0f\n", x, y); FileWrite (fileData); break; case GKK: DegToGKK (latitude, longitude, &x, &y); sprintf (fileData, "%07.0f\t%07.0f\n", x, y); FileWrite (fileData); break; default: break; } } /****************************************************************************/ /* convert Track package and write to Mayko xmap log */ /****************************************************************************/ static void doTrack_xmap () { extern struct PREFS gPrefs; double latitude, longitude; int altitude = 0; long t_diff = 0; double x_dist = 0; float x_speed = 0; if (*(gGarminMessage + 15) == '\x01') { /* New track, create blank record */ xmap_lat = 0; // reset xmap lat + lon xmap_lon = 0; xmap_time = 0; if (records != 0) FileWrite ("\n"); } /* convert bytes to latitude / longitude */ latitude = int2deg (number (gGarminMessage + 3)); longitude = int2deg (number (gGarminMessage + 7)); /* translate to selected datum */ translate (1, &latitude, &longitude, gPrefs.datum); /* * --- calculate speed */ if (xmap_lat) { x_dist = distance (latitude, longitude, xmap_lat, xmap_lon); t_diff = number (gGarminMessage + 11) - xmap_time; if (t_diff) x_speed = (float) ((x_dist / (double) t_diff) * 3600 / 1.852); else x_speed = xmap_speed; } /* * --- write mayko xmap format */ sprintf (fileData, "1 %03.7f %04.7f ", latitude, longitude); FileWrite (fileData); sprintf (fileData, "%.1f %d ", x_speed, altitude); FileWrite (fileData); sprintf (fileData, "%s", secs2dt (number (gGarminMessage + 11), gPrefs.offset)); FileWrite (fileData); if (xmap_lat) { if (file_format == MAYKO) { sprintf (fileData, " x%03.7f %04.7f", xmap_lat, xmap_lon); FileWrite (fileData); sprintf (fileData, " %06.7f", x_dist); FileWrite (fileData); sprintf (fileData, " -%d-", (int) t_diff); FileWrite (fileData); sprintf (fileData, " %.3f", x_speed); FileWrite (fileData); } } FileWrite ("\n"); xmap_lat = latitude; //save lat + lon for next round xmap_lon = longitude; xmap_time = number (gGarminMessage + 11); xmap_speed = x_speed; } #endif /* OLDCODE */ /****************************************************************************/ /* convert Track package and write to Mayko xmap log */ /****************************************************************************/ static void doWaypoint_xmap () { extern struct PREFS gPrefs; double latitude, longitude; printf ("route number %d\n", xmap_route_nr); if (xmap_route_nr) // save only "active" route 0 return; /* convert bytes to latitude / longitude */ latitude = int2deg (number (gGarminMessage + 9)); longitude = int2deg (number (gGarminMessage + 13)); /* translate to selected datum */ translate (1, &latitude, &longitude, gPrefs.datum); /* * --- write mayko xmap route format */ sprintf (fileData, "%s,", string (6, gGarminMessage + 3)); FileWrite (fileData); sprintf (fileData, "%03.6f,%04.6f,0,,\n", latitude, longitude); FileWrite (fileData); } /* return distance in km from (lata,lona) to (latb,lonb), where the latter are in degrees. Uses spherical earth approximation. */ double distance (double lata, double lona, double latb, double lonb) { #define DEG2RAD (3.14159265358979323846E0/180.0) double l0 = lona * DEG2RAD; double l1 = lonb * DEG2RAD; double b0 = lata * DEG2RAD; double b1 = latb * DEG2RAD; return (6371*2*asin(sqrt(cos(b1)*cos(b0)*sin(0.5*(l1 - l0))*sin(0.5*(l1 - l0)) + sin(0.5*(b1 - b0))*sin(0.5*(b1 - b0))))); } /****************************************************************************/ /* Process Waypoint packet (D1xx), Route packet (D2xx), or Track packet (D3xx) and write to output file. */ /****************************************************************************/ static void doWaypoint () { extern struct PREFS gPrefs; char zone[6], *s; double x,y; double x_dist=0, t_diff=0, x_speed=0; /* We extract these from the packet if available */ struct { double latitude, longitude; double altitude; double seconds; char name[16]; char *comment; char new_trk; struct { /* latitude and longitude are always present */ unsigned altitude:1; unsigned seconds:1; unsigned name:1; unsigned comment:1; } has; } pkt; char flag; char Pid; pkt.new_trk = pkt.has.altitude = pkt.has.seconds = pkt.has.name = pkt.has.comment = 0; Pid = gGarminMessage[1]; switch(Pid) { case Pid_Rte_Wpt_Data: case Pid_Wpt_Data: flag='W'; /* all the devices seem to use the same packet type for waypoints and routes, but something else for tracks */ if (strstr(protocols, "D100")) { D100_Wpt_Type *d=(D100_Wpt_Type *)(gGarminMessage+3); /* D100_Wpt_Type: struct { char ident[6]; // identifier position_type posn; // position uint32 unused; // should be set to zero char cmnt[40]; // comment } */ /* convert bytes to latitude/longitude */ pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); sprintf(pkt.name, "%-6.6s",(char *)(&d->ident)); pkt.comment=(char *)(&d->cmnt); pkt.has.name=pkt.has.comment=1; } else if (strstr(protocols, "D101")) { D101_Wpt_Type *d=(D101_Wpt_Type *)(gGarminMessage+3); /* convert bytes to latitude/longitude */ pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); sprintf(pkt.name, "%-6.6s",(char *)(&d->ident)); pkt.comment=(char *)(&d->cmnt); pkt.has.name=pkt.has.comment=1; } else if (strstr(protocols, "D102")) { D102_Wpt_Type *d=(D102_Wpt_Type *)(gGarminMessage+3); /* convert bytes to latitude/longitude */ pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); sprintf(pkt.name, "%-6.6s",(char *)(&d->ident)); pkt.comment=(char *)(&d->cmnt); pkt.has.name=pkt.has.comment=1; } else if (strstr(protocols, "D103")) { D103_Wpt_Type *d=(D103_Wpt_Type *)(gGarminMessage+3); /* convert bytes to latitude/longitude */ pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); sprintf(pkt.name, "%-6.6s",(char *)(&d->ident)); pkt.comment=(char *)(&d->cmnt); pkt.has.name=pkt.has.comment=1; } else if (strstr(protocols, "D104")) { D104_Wpt_Type *d=(D104_Wpt_Type *)(gGarminMessage+3); /* convert bytes to latitude/longitude */ pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); sprintf(pkt.name, "%-6.6s",(char *)(&d->ident)); pkt.comment=(char *)(&d->cmnt); pkt.has.name=pkt.has.comment=1; } else if (strstr(protocols, "D105")) { D105_Wpt_Type *d=(D105_Wpt_Type *)(gGarminMessage+3); /* convert bytes to latitude/longitude */ pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); sprintf(pkt.name, "%-15.15s",(char *)(&d->ident)); /* no comment */ pkt.has.name=1; } else if (strstr(protocols, "D106")) { D106_Wpt_Type *d=(D106_Wpt_Type *)(gGarminMessage+3); /* convert bytes to latitude/longitude */ pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); sprintf(pkt.name, "%-15.15s",(char *)(&d->ident)); /* no comment */ pkt.has.name=1; } else if (strstr(protocols, "D107")) { D107_Wpt_Type *d=(D107_Wpt_Type *)(gGarminMessage+3); /* convert bytes to latitude/longitude */ pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); sprintf(pkt.name, "%-6.6s",(char *)(&d->ident)); pkt.comment=(char *)(&d->cmnt); pkt.has.name=pkt.has.comment=1; } else if (strstr(protocols, "D108")) { D108_Wpt_Type *d=(D108_Wpt_Type *)(gGarminMessage+3); /* convert bytes to latitude/longitude */ pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); pkt.altitude = tofloat ((BYTE *)(&d->alt)); s=(char *)(char *)(&d->ident); sprintf(pkt.name, "%-15.15s",s); s+=strlen(s)+1; pkt.comment=s; pkt.has.altitude=pkt.has.name=pkt.has.comment=1; } else if (strstr(protocols, "D109")) { D109_Wpt_Type *d=(D109_Wpt_Type *)(gGarminMessage+3); /* convert bytes to latitude/longitude */ pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); pkt.altitude = tofloat ((BYTE *)(&d->alt)); s=(char *)(char *)(&d->ident); sprintf(pkt.name, "%-15.15s",s); s+=strlen(s)+1; pkt.comment=s; pkt.has.altitude=pkt.has.name=pkt.has.comment=1; } else if (strstr(protocols, "D110")) { D110_Wpt_Type *d=(D110_Wpt_Type *)(gGarminMessage+3); /* convert bytes to latitude/longitude */ pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); pkt.altitude = tofloat ((BYTE *)(&d->alt)); s=(char *)(&d->ident); sprintf(pkt.name, "%-15.15s",s); s+=strlen(s)+1; pkt.comment=s; pkt.seconds=number((BYTE *)(&d->time)); pkt.has.altitude=pkt.has.name=pkt.has.comment=pkt.has.seconds=1; } break; case Pid_Trk_Data: flag='T'; if (strstr(protocols, "D300")) { D300_Trk_Point_Type *d=(D300_Trk_Point_Type *)(gGarminMessage+3); pkt.seconds = number((BYTE *)(&d->time)); pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); pkt.new_trk = d->new_trk; pkt.has.seconds=1; } if (strstr(protocols, "D301")) { D301_Trk_Point_Type *d=(D301_Trk_Point_Type *)(gGarminMessage+3); pkt.seconds = number((BYTE *)(&d->time)); pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); pkt.altitude = tofloat ((BYTE *)(&d->alt)); pkt.new_trk = d->new_trk; pkt.has.seconds=pkt.has.altitude=1; } if (strstr(protocols, "D302")) { D302_Trk_Point_Type *d=(D302_Trk_Point_Type *)(gGarminMessage+3); pkt.seconds = number((BYTE *)(&d->time)); pkt.latitude = int2deg (number ((BYTE *)(&d->posn.lat))); pkt.longitude = int2deg (number ((BYTE *)(&d->posn.lon))); pkt.altitude = tofloat ((BYTE *)(&d->alt)); pkt.new_trk = d->new_trk; pkt.has.seconds=pkt.has.altitude=1; } break; } /* translate position selected datum */ translate (1, &pkt.latitude, &pkt.longitude, gPrefs.datum); switch(file_format) { case MAYKO: case MAYKO2: switch(Pid) { case Pid_Rte_Wpt_Data: sprintf (fileData, "%s,", pkt.name); FileWrite (fileData); sprintf (fileData, "%03.6f,%04.6f,0,,\n", pkt.latitude, pkt.longitude); FileWrite (fileData); break; case Pid_Trk_Data: if (pkt.new_trk) { /* New track, create blank record */ xmap_lat = 0; /* reset xmap lat + lon */ xmap_lon = 0; xmap_time = 0; if (records != 0) FileWrite ("\n"); } /* calculate speed */ if (xmap_lat) { x_dist = distance (pkt.latitude, pkt.longitude, xmap_lat, xmap_lon); t_diff = pkt.seconds - xmap_time; if (t_diff) x_speed = (float)((x_dist/(double)t_diff)*3600/1.852); else x_speed = xmap_speed; } /* write mayko xmap format */ sprintf (fileData, "1 %03.7f %04.7f ", pkt.latitude, pkt.longitude); FileWrite (fileData); sprintf (fileData, "%.1f %1.0f ", x_speed, pkt.altitude); FileWrite (fileData); sprintf (fileData, "%s", secs2dt (pkt.seconds, gPrefs.offset)); FileWrite (fileData); if (xmap_lat && (file_format == MAYKO2)) { sprintf (fileData, " x%03.7f %04.7f", xmap_lat, xmap_lon); FileWrite (fileData); sprintf (fileData, " %06.7f", x_dist); FileWrite (fileData); sprintf (fileData, " -%d-", (int) t_diff); FileWrite (fileData); sprintf (fileData, " %.3f", x_speed); FileWrite (fileData); } FileWrite ("\n"); xmap_lat = pkt.latitude; //save lat + lon for next round xmap_lon = pkt.longitude; xmap_time = number (gGarminMessage + 11); xmap_speed = x_speed; break; } break; case TSV: /* write record type flag */ sprintf (fileData, "%c\t", flag); FileWrite (fileData); /* write waypoint name */ if (pkt.has.name) { sprintf (fileData, "%s\t", pkt.name); FileWrite (fileData); } /* write comment - up to 40 characters */ if (pkt.has.comment) { sprintf (fileData, "%-40s\t", pkt.comment); FileWrite (fileData); } /* write date/time */ if (pkt.has.seconds) { sprintf (fileData, "%s\t", secs2dt (pkt.seconds, gPrefs.offset)); FileWrite (fileData); } /* write altitude */ if (pkt.has.altitude) /* does the packet accommodate altitude? */ { if (pkt.altitude < 1.e24) /* is the altitude valid? */ if (gPrefs.feet) sprintf (fileData, "%9.2f ft\t", pkt.altitude/.3048); else sprintf (fileData, "%9.2f m\t", pkt.altitude); else sprintf (fileData, "unknown \t"); FileWrite (fileData); } switch (gPrefs.format) { case DMS: sprintf (fileData, "%s\t", toDMS (pkt.latitude)); FileWrite (fileData); sprintf (fileData, "%s\n", toDMS (pkt.longitude)); FileWrite (fileData); break; case DMM: sprintf (fileData, "%s\t", toDM (pkt.latitude)); FileWrite (fileData); sprintf (fileData, "%s\n", toDM (pkt.longitude)); FileWrite (fileData); break; case DDD: sprintf (fileData, "%03.7f\t%04.7f\n", pkt.latitude, pkt.longitude); FileWrite (fileData); break; case UTM: /* convert to UTM grid */ DegToUTM (pkt.latitude, pkt.longitude, zone, &x, &y); sprintf (fileData, "%s\t%07.0f\t%07.0f\n", zone, x, y); FileWrite (fileData); break; case KKJ: /* convert to KKJ grid */ DegToKKJ (pkt.latitude, pkt.longitude, zone, &x, &y); sprintf (fileData, "%s\t%07.0f\t%07.0f\n", zone, x, y); FileWrite (fileData); break; case BNG: /* convert to British grid */ DegToBNG (pkt.latitude, pkt.longitude, zone, &x, &y); sprintf (fileData, "%s\t%05.0f\t%05.0f\n", zone, x, y); FileWrite (fileData); break; case ITM: /* convert to irish grid */ DegToITM (pkt.latitude, pkt.longitude, zone, &x, &y); sprintf (fileData, "%s\t%05.0f\t%05.0f\n", zone, x, y); FileWrite (fileData); break; case SEG: /* convert to Swedish grid */ DegToSEG (pkt.latitude, pkt.longitude, &x, &y); sprintf (fileData, "%07.0f\t%07.0f\n", x, y); FileWrite (fileData); break; case GKK: /* convert to German Grid */ DegToGKK (pkt.latitude, pkt.longitude, &x, &y); sprintf (fileData, "%07.0f\t%07.0f\n", x, y); FileWrite (fileData); break; default: break; } break; } } /****************************************************************************/ /* Process Almanac package (D500, D501, D550, or D551) and write to output file\. */ /****************************************************************************/ static void doAlmanac () { char temp[255]; typedef struct { int svid; short wn; double toa, af0, af1, e, sqrta, m0, w, omg0, odot, i; int hlth; } almanac_type; almanac_type pkt; pkt.svid = pkt.hlth = ~1; if (strstr(protocols, "D500")) { D500_Almanac_Type *d=(D500_Almanac_Type *)(gGarminMessage+3); /* no satellite ID */ pkt.wn = toshort ((BYTE *)(&d->wn )); pkt.toa = tofloat ((BYTE *)(&d->toa )); pkt.af0 = tofloat ((BYTE *)(&d->af0 )); pkt.af1 = tofloat ((BYTE *)(&d->af1 )); pkt.e = tofloat ((BYTE *)(&d->e )); pkt.sqrta = tofloat ((BYTE *)(&d->sqrta)); pkt.m0 = tofloat ((BYTE *)(&d->m0 )); pkt.w = tofloat ((BYTE *)(&d->w )); pkt.omg0 = tofloat ((BYTE *)(&d->omg0 )); pkt.odot = tofloat ((BYTE *)(&d->odot )); pkt.i = tofloat ((BYTE *)(&d->i )); /* no hlth */ } else if (strstr(protocols, "D501")) { D501_Almanac_Type *d=(D501_Almanac_Type *)(gGarminMessage+3); /* no satellite ID */ pkt.wn = toshort ((BYTE *)(&d->wn )); pkt.toa = tofloat ((BYTE *)(&d->toa )); pkt.af0 = tofloat ((BYTE *)(&d->af0 )); pkt.af1 = tofloat ((BYTE *)(&d->af1 )); pkt.e = tofloat ((BYTE *)(&d->e )); pkt.sqrta = tofloat ((BYTE *)(&d->sqrta)); pkt.m0 = tofloat ((BYTE *)(&d->m0 )); pkt.w = tofloat ((BYTE *)(&d->w )); pkt.omg0 = tofloat ((BYTE *)(&d->omg0 )); pkt.odot = tofloat ((BYTE *)(&d->odot )); pkt.i = tofloat ((BYTE *)(&d->i )); pkt.hlth = d->hlth; } else if (strstr(protocols, "D550")) { D550_Almanac_Type *d=(D550_Almanac_Type *)(gGarminMessage+3); pkt.svid = d->svid; pkt.wn = toshort ((BYTE *)(&d->wn )); pkt.toa = tofloat ((BYTE *)(&d->toa )); pkt.af0 = tofloat ((BYTE *)(&d->af0 )); pkt.af1 = tofloat ((BYTE *)(&d->af1 )); pkt.e = tofloat ((BYTE *)(&d->e )); pkt.sqrta = tofloat ((BYTE *)(&d->sqrta)); pkt.m0 = tofloat ((BYTE *)(&d->m0 )); pkt.w = tofloat ((BYTE *)(&d->w )); pkt.omg0 = tofloat ((BYTE *)(&d->omg0 )); pkt.odot = tofloat ((BYTE *)(&d->odot )); pkt.i = tofloat ((BYTE *)(&d->i )); /* no hlth */ } else if (strstr(protocols, "D551")) { D551_Almanac_Type *d=(D551_Almanac_Type *)(gGarminMessage+3); pkt.svid = d->svid; pkt.wn = toshort ((BYTE *)(&d->wn )); pkt.toa = tofloat ((BYTE *)(&d->toa )); pkt.af0 = tofloat ((BYTE *)(&d->af0 )); pkt.af1 = tofloat ((BYTE *)(&d->af1 )); pkt.e = tofloat ((BYTE *)(&d->e )); pkt.sqrta = tofloat ((BYTE *)(&d->sqrta)); pkt.m0 = tofloat ((BYTE *)(&d->m0 )); pkt.w = tofloat ((BYTE *)(&d->w )); pkt.omg0 = tofloat ((BYTE *)(&d->omg0 )); pkt.odot = tofloat ((BYTE *)(&d->odot )); pkt.i = tofloat ((BYTE *)(&d->i )); pkt.hlth = d->hlth; } if (pkt.svid == ~1) pkt.svid = ++AlmanacSat; /* next satellite */ /* don't handle if satellite not active "If the data for a particular satellite is missing or if the satellite is non-existent, then the week number for that satellite must be set to a negative number to indicate that the data is invalid." */ if (pkt.wn < 0) return; /* print almanac data in yuma-format */ sprintf (temp, "******** Week %d almanac for PRN-%02d ********\n", pkt.wn, pkt.svid); FileWrite (temp); sprintf (temp, "ID: %02d\n", pkt.svid); FileWrite (temp); sprintf (temp, "Health: %03d\n", pkt.hlth); FileWrite (temp); sprintf (temp, "Eccentricity: % 1.10E\n", pkt.e); FileWrite (temp); sprintf (temp, "Time of Applicability(x): %10.2f\n", pkt.toa); FileWrite (temp); sprintf (temp, "Orbital Inclination(rad): % 1.10f\n", pkt.i); FileWrite (temp); sprintf (temp, "Rate of Right Ascen(r/s): % 1.10E\n", pkt.odot); FileWrite (temp); sprintf (temp, "SQRT(A) (m^1/2): % 1.10f\n", pkt.sqrta); FileWrite (temp); sprintf (temp, "Right Ascen at TOA(rad): % 1.10E\n", pkt.omg0); FileWrite (temp); sprintf (temp, "Argument of Perigee(rad): % 1.10f\n", pkt.w); FileWrite (temp); sprintf (temp, "Mean Anom(rad): % 1.10E\n", pkt.m0); FileWrite (temp); sprintf (temp, "Af0(s): % 1.10E\n", pkt.af0); FileWrite (temp); sprintf (temp, "Af1(s/s): % 1.10E\n", pkt.af1); FileWrite (temp); sprintf (temp, "week: %d\n", pkt.wn); FileWrite (temp); sprintf (temp, "\n"); FileWrite (temp); } /****************************************************************************/ /* Convert bytes to string. */ /****************************************************************************/ static char * string (short n, BYTE * p) { static char s[50]; short i; for (i = 0; i < n; i++) s[i] = *p++; s[n] = '\0'; return s; } /****************************************************************************/ /* Convert bytes to long number. */ /****************************************************************************/ static long number (BYTE * p) { long n; /* LSB is first */ n = ((((((long) p[3] << 8) + p[2]) << 8) + p[1]) << 8) + p[0]; return n; } /****************************************************************************/ /* Convert bytes to float number. */ /****************************************************************************/ static float tofloat (BYTE * p) { float n; long *lp = (long *) &n; /* LSB is first */ *lp = ((((((long) p[3] << 8) + p[2]) << 8) + p[1]) << 8) + p[0]; return n; } /****************************************************************************/ /* Convert bytes to short number. */ /****************************************************************************/ static short toshort (BYTE * p) { short n; n = ((short) p[1] << 8) + p[0]; return n; } /****************************************************************************/ /* Write string to output file\. */ /****************************************************************************/ static void FileWrite (char *data) { fputs (data, FileRefNum); } gpstrans-0.41/src/gps/gpsmessage.c0000644000175000017500000000702610235233252014104 00000000000000/****************************************************************************/ /* */ /* ./gps/gpsmessage.c - Define GPS commands */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" /****************************************************************************/ /* Define Garmin-Protocol commands. */ /****************************************************************************/ BYTE m1[] = "\xfe\x01\x20"; /* Get the model and version number */ BYTE m2[] = "\x06\x02\xff\x00"; /* unknown */ BYTE p1[] = "\x06\x02\x1b\x00"; /* Get 1st packet */ BYTE p2[] = "\x06\x02\x0c\x00"; /* Get last packet */ BYTE alm1[] = "\x0a\x02\x01\x00"; /* Send almanac command */ BYTE alm2[] = "\x06\x02\x1f\x00"; /* Acknowlege almanac packet */ BYTE trk1[] = "\x0a\x02\x06\x00"; /* Get track command */ BYTE trk2[] = "\x06\x02\x22\x00"; /* Acknowlege track packet */ BYTE wpt1[] = "\x0A\x02\x07\x00"; /* Get waypoint command */ BYTE wpt2[] = "\x06\x02\x23\x00"; /* Acknowlege waypoint packet */ BYTE rte1[] = "\x0a\x02\x04\x00"; /* Get route command */ BYTE rte2[] = "\x06\x02\x1d\x00"; /* Acknowlege route packet */ BYTE test[] = "\x1c\x02\x00\x00"; /* Get response from Garmin */ BYTE gid4[] = "\xfe\x00"; /* Get Garmin model & Software rev */ BYTE gid5[] = "\x06\x02\xff\x00"; BYTE off1[] = "\x0a\x02\x08\x00"; /* Turn Garmin Off */ BYTE tim1[] = "\x0a\x02\x05\x00"; /* Get UTC Time */ BYTE almt[] = "\x0c\x02\x01\x00"; /* Almanac data base terminator */ BYTE rtet[] = "\x0c\x02\x04\x00"; /* Route data base terminator */ BYTE trkt[] = "\x0c\x02\x06\x00"; /* Track data base terminator */ BYTE wptt[] = "\x0c\x02\x07\x00"; /* Waypoint data base terminator */ gpstrans-0.41/src/gps/latlong.c0000644000175000017500000001511010225356640013405 00000000000000/****************************************************************************/ /* */ /* ./gps/latlong.c - Convert latitude and longitude */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include /* define constants */ static const double CONVERT = 11930464.7111111111111; /* 2^31 / 180 */ #ifndef PI static const double PI = 3.14159265358979323846; /* PI */ #endif static const double WGSa = 6378137.0; /* WGS84 semimajor axis */ static const double WGSinvf = 298.257223563; /* WGS84 1/f */ static const short WGS84ID = 100; /* ID of WGS84 datum */ /****************************************************************************/ /* Converts latitude and longitude in decimal degrees from WGS84 to another */ /* datum or from another datum to WGS84. The arguments to this function */ /* include a direction flag 'fromWGS84', pointers to double precision */ /* latitude and longitude, and an index to the gDatum[] array. */ /****************************************************************************/ void translate (short fromWGS84, double *latitude, double *longitude, short datumID) { extern struct DATUM const gDatum[]; extern struct ELLIPSOID const gEllipsoid[]; double dx = gDatum[datumID].dx; double dy = gDatum[datumID].dy; double dz = gDatum[datumID].dz; double phi = *latitude * PI / 180.0; double lambda = *longitude * PI / 180.0; double a0, b0, es0, f0; /* Reference ellipsoid of input data */ double a1, b1, es1, f1; /* Reference ellipsoid of output data */ double psi; /* geocentric latitude */ double x, y, z; /* 3D coordinates with respect to original datum */ double psi1; /* transformed geocentric latitude */ if (datumID == WGS84ID) /* do nothing if current datum is WGS84 */ return; if (fromWGS84) { /* convert from WGS84 to new datum */ a0 = WGSa; /* WGS84 semimajor axis */ f0 = 1.0 / WGSinvf; /* WGS84 flattening */ a1 = gEllipsoid[gDatum[datumID].ellipsoid].a; f1 = 1.0 / gEllipsoid[gDatum[datumID].ellipsoid].invf; } else { /* convert from datum to WGS84 */ a0 = gEllipsoid[gDatum[datumID].ellipsoid].a; /* semimajor axis */ f0 = 1.0 / gEllipsoid[gDatum[datumID].ellipsoid].invf; /* flattening */ a1 = WGSa; /* WGS84 semimajor axis */ f1 = 1 / WGSinvf; /* WGS84 flattening */ dx = -dx; dy = -dy; dz = -dz; } b0 = a0 * (1 - f0); /* semiminor axis for input datum */ es0 = 2 * f0 - f0 * f0; /* eccentricity^2 */ b1 = a1 * (1 - f1); /* semiminor axis for output datum */ es1 = 2 * f1 - f1 * f1; /* eccentricity^2 */ /* Convert geodedic latitude to geocentric latitude, psi */ if (*latitude == 0.0 || *latitude == 90.0 || *latitude == -90.0) psi = phi; else psi = atan ((1 - es0) * tan (phi)); /* Calc x and y axis coordinates with respect to original ellipsoid */ if (*longitude == 90.0 || *longitude == -90.0) { x = 0.0; y = fabs (a0 * b0 / sqrt (b0 * b0 + a0 * a0 * pow (tan (psi), 2.0))); } else { x = fabs ((a0 * b0) / sqrt ((1 + pow (tan (lambda), 2.0)) * (b0 * b0 + a0 * a0 * pow (tan (psi), 2.0)))); y = fabs (x * tan (lambda)); } if (*longitude < -90.0 || *longitude > 90.0) x = -x; if (*longitude < 0.0) y = -y; /* Calculate z axis coordinate with respect to the original ellipsoid */ if (*latitude == 90.0) z = b0; else if (*latitude == -90.0) z = -b0; else z = tan (psi) * sqrt ((a0 * a0 * b0 * b0) / (b0 * b0 + a0 * a0 * pow (tan (psi), 2.0))); /* Calculate the geocentric latitude with respect to the new ellipsoid */ psi1 = atan ((z - dz) / sqrt ((x - dx) * (x - dx) + (y - dy) * (y - dy))); /* Convert to geodetic latitude and save return value */ *latitude = atan (tan (psi1) / (1 - es1)) * 180.0 / PI; /* Calculate the longitude with respect to the new ellipsoid */ *longitude = atan ((y - dy) / (x - dx)) * 180.0 / PI; /* Correct the resultant for negative x values */ if (x - dx < 0.0) { if (y - dy > 0.0) *longitude = 180.0 + *longitude; else *longitude = -180.0 + *longitude; } } /****************************************************************************/ /* Converts Garmin integer format to double precision decimal degrees. */ /****************************************************************************/ double int2deg (long n) { double res; res = (double) (n / CONVERT); return (res); } /****************************************************************************/ /* Converts double precision decimal degrees to Garmin integer format. */ /****************************************************************************/ long deg2int (double x) { long res; res = (long) (x * CONVERT); return (res); } gpstrans-0.41/src/gps/sendgpsinfo.c0000644000175000017500000014114510427450423014272 00000000000000/****************************************************************************/ /* */ /* ./gps/sendgpsinfo.c - Send data to GPS */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* Copyright (c) 1998 by Matthias Kattanek (mattes@ugraf.com) */ /* 980802 sscanf modification %d -> %hd */ /* in sendGPSInfo() send one record too much */ /* */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include "Prefs.h" #include "protocols.h" #include #include #include /* define external variables */ extern BYTE gGarminMessage[MAX_LENGTH]; extern struct PREFS gPrefs; extern char *protocols; /* define global variables */ static char fileData[MAX_LINE]; static BYTE newTrack; static int track_count; static BYTE message[520]; /* allow for many 0x10 bytes which must be doubled */ struct PREFS gFilePrefs; /* additions for mXmap */ void mxmap_route (char *, int); char *mystrsep2 (char **stringp, char *delim); void strconvert (char *); /* prototype functions */ static short records (FILE *ifile, short type); static short doWaypoint (short type); static short doTrack (void); static short doRoute (void); static short doAlmanac (void); static short sendRecords (short); static void copyNumber (BYTE * p, long n); static void copyFloat (BYTE * p, double d); static char *field (char *a, short n); static void cpystr (BYTE * p, char *q, short n); static short getFileFormat (char *, char*); static void cleanupDMS (char *s); struct { int count; int type; int name; int comment; int date; int altitude; int position; /* first column of position data */ } column; /****************************************************************************/ /* Send "commit-suicide-command" to GPS. */ /****************************************************************************/ long sendGPSOff () { extern struct PREFS gPrefs; extern char gMessageStr[]; short err; /* First check if GPS responds to the "are-you-ready" package */ if (!CheckGPS ()) NotResponding (); /* open serial device */ if ((err = serialOpen (GARMIN)) != noErr) { sprintf (gMessageStr, "The port initialization of %s has failed.", gPrefs.Device); Error (gMessageStr); return 99; /* Currently Error never returns. Allow for another implementation? */ } /* send command - no respond is send from GPS */ sendGPSMessage (off1, 4); /* close serial device */ serialClose (); printf ("GPS turned off successfully\n"); return 0; } /****************************************************************************/ /* Send multiple line packages to GPS (route, waypoint, track) */ /****************************************************************************/ void sendGPSInfo (FILE *ifile, short type) { extern char gMessageStr[]; short recs, processed = 0; short err, result = 1; char *rType; BYTE *term; char secondLine[MAX_LINE]; int junk; char *junk_str; /* First check it GPS responds to the "are-you-ready" package */ if (!CheckGPS ()) NotResponding (); junk=getGPSVersion(&junk_str); /* load the "protocols" array */ /* open serial device */ if ((err = serialOpen (GARMIN)) != noErr) { sprintf (gMessageStr, "The port initialization of %s has failed.", gPrefs.Device); Error (gMessageStr); return; } recs = records (ifile, type); recs--; /* before vers0.34 sent one record too many*/ /* Continue only if GPS responds to the send-request package */ if (sendRecords (recs) == 0) { Error ("GPS did not respond to send-request packet.\n"); return; } /* return to beginning of file and read first lines */ rewind (ifile); GetLine (ifile, fileData, 1); GetLine (ifile, secondLine, 1); /* some files have two header lines */ rewind (ifile); /* reading header lines again is harmless */ if (!getFileFormat (fileData, secondLine)) { Error ("The file header format is incorrect."); return; } naks = 0; InitBarGraph (); /* process different requests */ switch (type) { default: case ALMANAC: rType = "almanac"; term = almt; while (GetLine (ifile, fileData, 0) && processed < recs && result) { if (fileData[0] == 'A') { result = doAlmanac (); SetBarGraph ((double) (++processed) / (double) recs); } } break; case ROUTE: rType = "routes"; term = rtet; if (file_format != MAYKO) { while (GetLine (ifile, fileData, 0) && processed < recs && result) { if (fileData[0] == 'R') { result = doRoute (); /* send route header */ ++processed; } if (fileData[0] == 'W') { result = doWaypoint (ROUTE); ++processed; } SetBarGraph ((double) (processed) / (double) recs); } break; } else { // manage Mayko mXmap format // case MXMAP_ROUTE: sprintf (fileData, "R\t0\tMAYKO MXMAP\n"); result = doRoute (); while (GetLine (ifile, fileData, 0) && result) { if (*fileData == '\0') break; mxmap_route (fileData, processed); // printf("mxmap-wp %s-\n", fileData ); // printf("%s-\n", fileData ); if (fileData[0] == 'W') { result = doWaypoint (ROUTE); ++processed; } *fileData = '\0'; SetBarGraph ((double) (processed) / (double) recs); } recs = processed; break; } case TRACK: rType = "track"; term = trkt; track_count = newTrack = 1; while (GetLine (ifile, fileData, 0) && processed < recs && result) { if (fileData[0] == 'T') { result = doTrack (); SetBarGraph ((double) (++processed) / (double) recs); } else { newTrack = 1; track_count++; } } break; case WAYPOINT: rType = "waypoint"; term = wptt; while (GetLine (ifile, fileData, 0) && (processed < recs) && result) { if (fileData[0] == 'W') { result = doWaypoint (WAYPOINT); SetBarGraph ((double) (++processed) / (double) recs); } } break; } /* close BarGraph window */ CloseBarGraph (); /* send terminator message to tell GPS - its over */ if (result) { sendGPSMessage (term, 4); /* get final response but ignore it */ getGPSMessage (); /* print number of packages transferred */ sprintf (gMessageStr, "%d %s packets were successfully transferred to the GPS receiver.", recs-naks, rType); Message (gMessageStr); if (naks) { sprintf (gMessageStr, "%d packets were rejected.\n", naks); Error (gMessageStr); } if (verbose && track_count) printf("%d tracks were transferred.\n", track_count); } /* close serial device */ serialClose (); } /* * Take mXmap route records and changes it back into the format * that gpstrans is using. Not the ideal solution, * actually pretty nasty hack, but works though. */ void mxmap_route (char *Datastring, int mrec) { static char *month[12] = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" }; int i; char *p, *r; char xname[80]; char xlat[10], xlon[10]; time_t t; struct tm *ts; time (&t); ts = localtime (&t); sprintf (xname, "MX%02d", mrec + 1); // set dummy name p = Datastring; r = mystrsep2 (&p, ",\n"); if (r != NULL) { strcpy (xname, r); strconvert (xname); // convert to upper, strip spaces } r = mystrsep2 (&p, ",\n"); strcpy (xlat, r); r = mystrsep2 (&p, ",\n"); strcpy (xlon, r); // this is how a gpstrans route record looks like //printf("W\t123456\t123456789012345678901234527-JUL-98 23:56\t12/31/1989 -8:00:00\t42.3753083\t-71.0194016\n"); sprintf (Datastring, "W\t%s\t", xname); // this seems not to be necessary to have doRoute() understand the record // i = strlen( Datastring ); // p = Datastring + i; // i = 32 - i; // while ( i-- ) // *p++ = '.'; i = strlen (Datastring); sprintf (Datastring + i, "%2d-%s-%02d %02d:%02d\t", ts->tm_mday, month[ts->tm_mon], ts->tm_year, ts->tm_hour, ts->tm_min); i = strlen (Datastring); sprintf (Datastring + i, "12/31/1989 -8:00:00\t%s\t%s\n", xlat, xlon); } char * mystrsep2 (char **stringp, char *delim) { char *begin, *end; begin = *stringp + strspn (*stringp, delim); end = *stringp + strcspn (*stringp, delim); if (end == *stringp) begin = NULL; if (*end != '\0') *end++ = '\0'; *stringp = end; return begin; } void strconvert (char *p) { char *dest; dest = p; while (*p) { if (!isspace (*p)) { if (islower (*p)) *dest = toupper (*p); else *dest = *p; dest++; } p++; } *dest = '\0'; } /****************************************************************************/ /* Waypoint file format: */ /* */ /* */ /* Format: DDD UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* W HOME 123 SNOWMASS 07/28/1994 20:12:54 40.1777471 -105.0892654 */ /* 0 1 2 3 4 5 */ /* TYPE NAME COMMENT DATE LATITUDE LONGITUDE */ /* */ /* */ /* Format: DMM UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* W HOME 123 SNOWMASS 07/28/1994 20:12:54 40 10.665' -105 05.356' */ /* 0 1 2 3 4 5 */ /* TYPE NAME COMMENT DATE LATITUDE LONGITUDE */ /* */ /* */ /* Format: DMS UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* W HOME 123 SNOWMASS 07/28/1994 20:12:54 40 10'39.9" -105 05'21.4" */ /* 0 1 2 3 4 5 */ /* TYPE NAME COMMENT DATE LATITUDE LONGITUDE */ /* */ /* */ /* Format: UTM UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* W HOME 123 SNOWMASS 07/28/1994 20:12:54 13 T 0492400 4447279 */ /* 0 1 2 3 4 5 6 7 */ /* TYPE NAME COMMENT DATE ZE ZN EASTING NORTHING */ /* */ /* */ /* Format: BNG UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* W EXAMPL BRITISH GRD 07/28/1994 20:12:54 SE 12345 67890 */ /* 0 1 2 3 4 5 6 */ /* TYPE NAME COMMENT DATE ZONE EASTING NORTHING */ /* */ /* */ /* Format: ITM UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* W EXAMPL IRISH GRID 07/28/1994 20:12:54 IN 12345 67890 */ /* 0 1 2 3 4 5 6 */ /* TYPE NAME COMMENT DATE ZONE EASTING NORTHING */ /* */ /* */ /* Format: FIN UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* W EXAMPL SWISS GRID 07/28/1994 20:12:54 27E 012345 067890 */ /* 0 1 2 3 4 5 6 */ /* TYPE NAME COMMENT DATE ZE EASTING NORTHING */ /* */ /* */ /* Format: SUI UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* W EXAMPL SWISS GRID 07/28/1994 20:12:54 012345 067890 */ /* 0 1 2 3 5 6 */ /* TYPE NAME COMMENT DATE EASTING NORTHING */ /* */ /* */ /* Format: SEG UTC Offset: 1.00 hrs Datum[085]: RT 90 */ /* W EXAMPL SWEDISH GRID 07/28/1994 20:12:54 012345 067890 */ /* 0 1 2 3 4 5 */ /* TYPE NAME COMMENT DATE EASTING NORTHING */ /* */ /* */ /* Format: GKK UTC Offset: 1.00 hrs Datum[102]: Potsdam */ /* W EXAMPL GERMAN GRID 07/28/1994 20:12:54 0123456 0678901 */ /* 0 1 2 3 4 5 */ /* TYPE NAME COMMENT DATE EASTING NORTHING */ /* */ /* */ /****************************************************************************/ /****************************************************************************/ /* Process Waypoint package - return 0 if GPS does not respond. */ /****************************************************************************/ static short doWaypoint (short type) { double x, y; short zone; char finzone[5]; /* Currently always 27E, i.e. not used */ char bgzone[5]; char nsZone; int pos; char *s; enum { LAT, LON }; enum { ZE, ZN, EASTING, NORTHING }; /* UTM Grid */ enum { BGZ, BGEAST, BGNORTH }; /* British, Irish Grid */ enum { SEAST, SNORTH }; /* Swiss Grid */ enum { SEGEAST, SEGNORTH }; /* Swedish Grid */ /* same format for German Grid */ struct { char type; char *comment, *name; long seconds; double latitude, longitude; double altitude; struct { /* latitude and longitude are always present */ unsigned altitude:1; unsigned seconds:1; unsigned name:1; unsigned comment:1; } has; } pkt; char empty[]=""; pkt.has.altitude = pkt.has.seconds = pkt.has.name = pkt.has.comment = 0; pkt.altitude = 1.01e24; pkt.seconds = ~0; pkt.comment = pkt.name = empty; if (column.type >= 0) pkt.type = *field(fileData, column.type); if (column.date >= 0) { char date[20]; strncpy (date, field (fileData, column.date), 19); date[19] = 0; pkt.seconds = dt2secs (date, gFilePrefs.offset); pkt.has.seconds = 1; } if ((column.altitude >= 0) && (!strstr(field(fileData, column.altitude), "unknown"))) { pkt.altitude = atof (field (fileData, column.altitude)); pkt.has.altitude = 1; } if (column.name >= 0) { pkt.name = field(fileData, column.name); pkt.has.name = 1; } if (column.comment >= 0) { pkt.comment = field(fileData, column.comment); pkt.has.comment = 1; } pos=column.position; /* handle various grids */ switch (gFilePrefs.format) { case DMS: cleanupDMS (fileData); pkt.latitude = DMStoDegrees (field (fileData, pos+LAT)); pkt.longitude = DMStoDegrees (field (fileData, pos+LON)); break; case DMM: cleanupDMS (fileData); pkt.latitude = DMtoDegrees (field (fileData, pos+LAT)); pkt.longitude = DMtoDegrees (field (fileData, pos+LON)); break; case DDD: sscanf (field (fileData, pos+LAT), "%lf %lf", &pkt.latitude, &pkt.longitude); break; case UTM: /* UTM Grid */ sscanf (field (fileData, pos+ZE), "%hd", &zone); sscanf (field (fileData, pos+ZN), "%c", &nsZone); sscanf (field (fileData, pos+EASTING), "%lf %lf", &x, &y); UTMtoDeg (zone, nsZone <= 'M', x, y, &pkt.latitude, &pkt.longitude); break; case KKJ: /* KKJ Grid */ sscanf (field (fileData, pos+ZE), "%s", finzone); sscanf (field (fileData, pos+EASTING), "%lf %lf", &x, &y); KKJtoDeg (2, 0, x, y, &pkt.latitude, &pkt.longitude); /* 2 is 27E, not used currently */ break; case BNG: /* British Grid */ sscanf (field (fileData, pos+BGZ), "%s", bgzone); sscanf (field (fileData, pos+BGEAST), "%lf %lf", &x, &y); BNGtoDeg (bgzone, x, y, &pkt.latitude, &pkt.longitude); break; case ITM: /* Irish Grid */ sscanf (field (fileData, pos+BGZ), "%s", bgzone); sscanf (field (fileData, pos+BGEAST), "%lf %lf", &x, &y); ITMtoDeg (bgzone, x, y, &pkt.latitude, &pkt.longitude); break; case SEG: /* Swedish Grid */ sscanf (field (fileData, pos+SEGEAST), "%lf %lf", &x, &y); SEGtoDeg (x, y, &pkt.latitude, &pkt.longitude); break; case GKK: /* German Grid */ sscanf (field (fileData, pos+SEGEAST), "%lf %lf", &x, &y); GKKtoDeg (x, y, &pkt.latitude, &pkt.longitude); break; default: break; } /* translate to selected datum */ translate (0, &pkt.latitude, &pkt.longitude, gFilePrefs.datum); if (column.name >= 0) { /* eliminate trailing tab and spaces (destructive, so must follow last use of "field" function */ if ((s = strstr(pkt.name, "\t"))) *s = 0; /* replace tab with null */ s = pkt.name; s += strlen(s); if (*s == '\n') *s = 0; /* replace newline with null */ for ( ; (--s > pkt.name) && (*s == ' '); ) *s = 0; /* eliminate trailing blanks */ } if (column.comment >= 0) { /* eliminate trailing tab and spaces (destructive, so must follow last use of "field" function */ if ((s = strstr(pkt.comment, "\t"))) *s = 0; /* replace tab with null */ s = pkt.comment; s += strlen(s); if (*s == '\n') *s = 0; /* replace newline with null */ for ( ; (--s > pkt.comment) && (*s == ' '); ) *s = 0; /* eliminate trailing blanks */ } if (debugging>1) { printf("pkt: name=\"%s\" comment=\"%s\"\n", pkt.name, pkt.comment); if(pkt.has.seconds) printf("%s", ctime(&pkt.seconds)); printf("latitude=%9.6f longitude=%9.6f altitude=%5.0f\n", pkt.latitude, pkt.longitude, pkt.altitude); } /* now create the appropriate kind of packet for this device */ /* create package header */ if (type == WAYPOINT) message[0] = Pid_Wpt_Data; else /* type == ROUTE */ message[0] = Pid_Rte_Wpt_Data; if (strstr(protocols, "D100")) { D100_Wpt_Type *d=(D100_Wpt_Type *)(message+2); /* number of message bytes to follow */ message[1] = sizeof(*d); /* copy position and time to GPS package */ copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); copyNumber ((BYTE *)&d->unused, pkt.seconds); cpystr ((unsigned char *)&d->ident, pkt.name, 6); cpystr ((unsigned char *)&d->cmnt, pkt.comment, 40); } else if (strstr(protocols, "D101")) { D101_Wpt_Type *d=(D101_Wpt_Type *)(message+2); /* number of message bytes to follow */ message[1] = sizeof(*d); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); copyNumber ((BYTE *)&d->unused, pkt.seconds); cpystr ((unsigned char *)&d->ident, pkt.name, 6); cpystr ((unsigned char *)&d->cmnt, pkt.comment, 40); } else if (strstr(protocols, "D102")) { D102_Wpt_Type *d=(D102_Wpt_Type *)(message+2); /* number of message bytes to follow */ message[1] = sizeof(*d); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); copyNumber ((BYTE *)&d->unused, pkt.seconds); cpystr ((unsigned char *)&d->ident, pkt.name, 6); cpystr ((unsigned char *)&d->cmnt, pkt.comment, 40); } else if (strstr(protocols, "D103")) { D103_Wpt_Type *d=(D103_Wpt_Type *)(message+2); /* number of message bytes to follow */ message[1] = sizeof(*d); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); copyNumber ((BYTE *)&d->unused, pkt.seconds); cpystr ((unsigned char *)&d->ident, pkt.name, 6); cpystr ((unsigned char *)&d->cmnt, pkt.comment, 40); } else if (strstr(protocols, "D104")) { D104_Wpt_Type *d=(D104_Wpt_Type *)(message+2); /* number of message bytes to follow */ message[1] = sizeof(*d); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); copyNumber ((BYTE *)&d->unused, pkt.seconds); cpystr ((unsigned char *)&d->ident, pkt.name, 6); cpystr ((unsigned char *)&d->cmnt, pkt.comment, 40); } else if (strstr(protocols, "D105")) { D105_Wpt_Type *d=(D105_Wpt_Type *)(message+2); /* number of message bytes to follow */ message[1] = sizeof(*d); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); /* no date field */ cpystr ((unsigned char *)&d->ident, pkt.name, 15); /* no comment field */ } else if (strstr(protocols, "D106")) { D106_Wpt_Type *d=(D106_Wpt_Type *)(message+2); /* number of message bytes to follow */ message[1] = sizeof(*d); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); /* no date field */ cpystr ((unsigned char *)&d->ident, pkt.name, 15); /* no comment field */ } else if (strstr(protocols, "D107")) { D107_Wpt_Type *d=(D107_Wpt_Type *)(message+2); /* number of message bytes to follow */ message[1] = sizeof(*d); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); copyNumber ((BYTE *)&d->unused, pkt.seconds); cpystr ((unsigned char *)&d->ident, pkt.name, 6); cpystr ((unsigned char *)&d->cmnt, pkt.comment, 40); } else if (strstr(protocols, "D108")) { D108_Wpt_Type *d=(D108_Wpt_Type *)(message+2); copyFloat ((BYTE *)&d->alt, pkt.altitude); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); /* no date field */ s = (char *)&d->ident; strcpy (s, pkt.name); s += strlen(s)+1; strcpy (s, pkt.comment); s += strlen(s)+1; message[1] = s- (char *)d; /* number of message bytes */ } else if (strstr(protocols, "D109")) { D109_Wpt_Type *d=(D109_Wpt_Type *)(message+2); copyFloat ((BYTE *)&d->alt, pkt.altitude); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); /* no date field */ s = (char *)&d->ident; strcpy (s, pkt.name); s += strlen(s)+1; strcpy (s, pkt.comment); s += strlen(s)+1; message[1] = s- (char *)d; /* number of message bytes */ } else if (strstr(protocols, "D110")) { D110_Wpt_Type *d=(D110_Wpt_Type *)(message+2); copyFloat ((BYTE *)&d->alt, pkt.altitude); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); copyNumber ((BYTE *)&d->time, pkt.seconds); s = (char *)&d->ident; strcpy (s, pkt.name); s += strlen(s)+1; strcpy (s, pkt.comment); s += strlen(s)+1; message[1] = s- (char *)d; /* number of message bytes */ } /* send package to GPS */ sendGPSMessage (message, message[1]+2); /* make sure GPS responds */ return getGPSack (); } static int colorNameToCode (char *name, char *protocol) { char *color_name[18]={ "black", "dark red", "dark green", "dark yellow", "dark blue", "dark magenta", "dark cyan", "light gray", "dark gray", "red", "green", "yellow", "blue", "magenta", "cyan", "white", "transparent", "default" }; int i; for (i=0; i<18; i++) if (strcasecmp(name, color_name[i]) == 0) break; if (i == 18) i = 0; /* unrecognized color name */ if (i == 17) { if ((strcasecmp(protocol,"D108")==0) || (strcasecmp(protocol,"D310")==0)) i = 255; else i = 0x1f; /* D109 */ } return i; } /****************************************************************************/ /* Track file format: */ /* */ /* */ /* T 08/29/1994 13:32:01 40.146967 -105.125464 13 T 489391 4443614 */ /* 0 1 2 3 4 5 6 7 */ /* TYPE DATE LAT LON ZONE ZN EASTING NORTHING */ /* */ /* */ /* Format: DDD UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* T 09/09/1994 20:03:49 40.1780207 -105.0901666 */ /* 0 1 2 3 */ /* TYPE DATE/TIME LATITUDE LONGITUDE */ /* */ /* */ /* Format: DMM UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* T 09/09/1994 20:03:49 40 10.681' -105 05.410' */ /* 0 1 2 3 */ /* TYPE DATE/TIME LATITUDE LONGITUDE */ /* */ /* */ /* Format: DMS UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* T 09/09/1994 20:03:49 40 10'40.9" -105 05'24.6" */ /* 0 1 2 3 */ /* TYPE DATE/TIME LATITUDE LONGITUDE */ /* */ /* */ /* Format: UTM UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* T 09/09/1994 20:03:49 13 T 0492323 4447310 */ /* 0 1 2 3 4 5 */ /* TYPE DATE/TIME ZE ZN EASTING NORTHING */ /* */ /* */ /* Format: BNG UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* T 09/09/1994 20:03:49 SE 12345 67890 */ /* 0 1 2 3 4 */ /* TYPE DATE/TIME ZONE EASTING NORTHING */ /* */ /* */ /* Format: ITM UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* T 09/09/1994 20:03:49 IN 12345 67890 */ /* 0 1 2 3 4 */ /* TYPE DATE/TIME ZONE EASTING NORTHING */ /* */ /* */ /* Format: SUI UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* T 09/09/1994 20:03:49 012345 067890 */ /* 0 1 3 4 */ /* TYPE DATE/TIME EASTING NORTHING */ /* */ /* Format: SEG UTC Offset: 1.00h Datum[085]: RT90 */ /* T 09/09/1994 20:03:49 012345 067890 */ /* 0 1 2 3 */ /* TYPE DATE/TIME EASTING NORTHING */ /* */ /* */ /* Format: GKK UTC Offset: 1.00 hrs Datum[102]: Potsdam */ /* T 07/28/1994 20:12:54 0123456 0678901 */ /* 0 1 2 3 */ /* TYPE DATE/TIME EASTING NORTHING */ /* */ /* */ /* Note: Even though the date/time is included in the protocol, the GPS 45 */ /* appears to ignore this field. The only track data that is time stamped */ /* is that actually generated by the GPS 45; actual track data uploaded */ /* from the GPS 45 has correct time stamps. */ /* */ /****************************************************************************/ /****************************************************************************/ /* Process Track package - return 0 if GPS does not respond. */ /****************************************************************************/ static short doTrack () { double latitude, longitude, x, y; long lat, lon; short zone; char nsZone, bgzone[3], finzone[5]; int pos; enum { LAT, LON }; enum { ZE, ZN, EASTING, NORTHING }; /* UTM Grid */ enum { BGZ, BGEAST, BGNORTH }; /* British, Irish Grid */ enum { SEAST, SNORTH }; /* Swiss Grid */ enum { SEGEAST, SEGNORTH }; /* Swedish Grid */ /* same format for German Grid */ struct { char type; char *comment, *name; long seconds; double latitude, longitude; double altitude; struct { /* latitude and longitude are always present */ unsigned altitude:1; unsigned seconds:1; unsigned name:1; unsigned comment:1; } has; } pkt; char empty[]=""; pkt.has.altitude = pkt.has.seconds = pkt.has.name = pkt.has.comment = 0; pkt.altitude = 1.01e24; pkt.seconds = ~0; pkt.comment = pkt.name = empty; if (column.date >= 0) { char date[20]; strncpy (date, field (fileData, column.date), 19); date[19] = 0; pkt.seconds = dt2secs (date, gFilePrefs.offset); pkt.has.seconds = 1; } if ((column.altitude >= 0) && (!strstr(field(fileData, column.altitude), "unknown"))) { pkt.altitude = atof (field (fileData, column.altitude)); pkt.has.altitude = 1; } pos=column.position; /* handle various grids */ switch (gFilePrefs.format) { case DMS: cleanupDMS (fileData); latitude = DMStoDegrees (field (fileData, pos+LAT)); longitude = DMStoDegrees (field (fileData, pos+LON)); break; case DMM: cleanupDMS (fileData); latitude = DMtoDegrees (field (fileData, pos+LAT)); longitude = DMtoDegrees (field (fileData, pos+LON)); break; case DDD: sscanf (field (fileData, pos+LAT), "%lf %lf", &latitude, &longitude); break; case UTM: /* UTM Grid */ sscanf (field (fileData, pos+ZE), "%hd", &zone); sscanf (field (fileData, pos+ZN), "%c", &nsZone); sscanf (field (fileData, pos+EASTING), "%lf %lf", &x, &y); UTMtoDeg (zone, nsZone <= 'M', x, y, &latitude, &longitude); break; case KKJ: /* KKJ Grid */ sscanf (field (fileData, pos+ZE), "%s", finzone); sscanf (field (fileData, pos+EASTING), "%lf %lf", &x, &y); KKJtoDeg (2, 0, x, y, &latitude, &longitude); /* 2 is 27E, not used currently */ break; case BNG: /* British Grid */ sscanf (field (fileData, pos+BGZ), "%s", bgzone); sscanf (field (fileData, pos+BGEAST), "%lf %lf", &x, &y); BNGtoDeg (bgzone, x, y, &latitude, &longitude); break; case ITM: /* Irish Grid */ sscanf (field (fileData, pos+BGZ), "%s", bgzone); sscanf (field (fileData, pos+BGEAST), "%lf %lf", &x, &y); ITMtoDeg (bgzone, x, y, &latitude, &longitude); break; case SEG: /* Swedish Grid */ sscanf (field (fileData, pos+SEGEAST), "%lf %lf", &x, &y); SEGtoDeg (x, y, &latitude, &longitude); break; case GKK: /* German Grid */ sscanf (field (fileData, pos+SEGEAST), "%lf %lf", &x, &y); GKKtoDeg (x, y, &latitude, &longitude); break; default: break; } /* translate to selected datum */ translate (0, &latitude, &longitude, gFilePrefs.datum); pkt.latitude = latitude; pkt.longitude = longitude; /* convert numbers to GPS bytes */ lat = deg2int (latitude); lon = deg2int (longitude); /* create package header */ message[0] = Pid_Trk_Data; #ifdef OLD /* number of message bytes to follow */ message[1] = 13; /* copy position and time to GPS package */ copyNumber (message + 2, lat); copyNumber (message + 6, lon); copyNumber (message + 10, dat); /* set "new track flag" */ #endif if (strstr(protocols, "D300")) { D300_Trk_Point_Type *d=(D300_Trk_Point_Type *)(message+2); copyNumber ((BYTE *)&d->time, pkt.seconds); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); d->new_trk = newTrack; message[1] = sizeof(*d); } if (strstr(protocols, "D301")) { D301_Trk_Point_Type *d=(D301_Trk_Point_Type *)(message+2); copyNumber ((BYTE *)&d->time, pkt.seconds); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); if (pkt.has.altitude) copyFloat ((BYTE *)&d->alt, pkt.altitude); d->new_trk = newTrack; message[1] = sizeof(*d); } if (strstr(protocols, "D302")) { D302_Trk_Point_Type *d=(D302_Trk_Point_Type *)(message+2); copyNumber ((BYTE *)&d->time, pkt.seconds); copyNumber ((BYTE *)&d->posn.lat, deg2int (pkt.latitude)); copyNumber ((BYTE *)&d->posn.lon, deg2int (pkt.longitude)); if (pkt.has.altitude) copyFloat ((BYTE *)&d->alt, pkt.altitude); d->new_trk = newTrack; message[1] = sizeof(*d); } newTrack = 0; /* send package to GPS */ sendGPSMessage (message, message[1]+2); /* make sure GPS responds */ return getGPSMessage (); } /****************************************************************************/ /* Route file format: */ /* */ /* */ /* R 1 BOGUS 1 */ /* 0 1 2 */ /* */ /****************************************************************************/ /****************************************************************************/ /* Process Route package - return 0 if GPS does not respond. */ /****************************************************************************/ static short doRoute () { short route; /* create package header */ message[0] = '\x1d'; /* number of message bytes to follow */ message[1] = 21; /* copy route data to GPS package */ sscanf (field (fileData, 1), "%hd", &route); // route = (short) strtol(field(fileData, 1), (char **)NULL, 10); message[2] = route; cpystr (message + 3, field (fileData, 2), 20); /* send package to GPS */ sendGPSMessage (message, 23); /* make sure GPS responds */ return getGPSMessage (); } /****************************************************************************/ /* Process Almanac package - uploading almanac data is no longer supported. */ /****************************************************************************/ #define ALM_BYTES 42 static short doAlmanac () { short i; unsigned short x; /* Print error message and return */ fprintf (stderr, "Error: Uploading of almanac data is no longer supported.\n"); return (0); /* create package header */ message[0] = '\x1f'; /* number of message bytes to follow */ message[1] = ALM_BYTES; /* copy almanac bytes to GPS package */ for (i = 0; i < ALM_BYTES; i++) { sscanf (fileData + 2 + 3 * i, "%02hX", &x); message[i + 2] = (BYTE) x; } /* send package to GPS */ sendGPSMessage (message, ALM_BYTES + 2); /* make sure GPS respond */ return getGPSMessage (); } /****************************************************************************/ /* Return number of records in input-file. */ /****************************************************************************/ static short records (FILE *ifile, short type) { short n = 0; /* Get line from input file */ GetLine (ifile, fileData, 1); /* Parse package type until end-of-file */ while (GetLine (ifile, fileData, 0)) { if (strncasecmp(fileData, "Type", 4)) { /* process different types */ switch (type) { case ALMANAC: if (fileData[0] == 'A') ++n; break; case ROUTE: if (fileData[0] == 'R' || fileData[0] == 'W') ++n; break; case TRACK: if (fileData[0] == 'T') ++n; break; case WAYPOINT: if (fileData[0] == 'W') ++n; break; default: /* ignore blank lines, comments, etc. */ break; } } } /* return number of records */ return n; } /****************************************************************************/ /* Send a message containing the number of records to follow. Returns a */ /* result code - zero if GPS did not respond. */ /****************************************************************************/ static short sendRecords (short recs) { short result; /* create package header */ message[0] = '\x1b'; /* number of message bytes to follow */ message[1] = '\x02'; /* convert number of records to GPS bytes */ message[2] = recs % 256; /* LSB of number of records */ message[3] = recs / 256; /* MSB */ /* send package to GPS */ sendGPSMessage (message, 4); /* make sure GPS responded */ result = getGPSMessage (); return result; } /****************************************************************************/ /* Convert long number to bytes. */ /****************************************************************************/ static void copyNumber (BYTE * p, long n) { *p++ = n & 0xff; /* LSB first */ n >>= 8; *p++ = n & 0xff; n >>= 8; *p++ = n & 0xff; n >>= 8; *p = n & 0xff; } /****************************************************************************/ /* Convert float number to bytes. */ /****************************************************************************/ static void copyFloat (BYTE * p, double d) { float f = (float)d; long *lp = (long *) &f; long n = *lp; *p++ = n & 0xff; /* LSB first */ n >>= 8; *p++ = n & 0xff; n >>= 8; *p++ = n & 0xff; n >>= 8; *p = n & 0xff; } /****************************************************************************/ /* returns a pointer to the nth field of a tab-delimited record which */ /* starts at address a. */ /****************************************************************************/ static char * field (char *str, short n) { short i = 0; char *a = str; while ((i++) < n) do { if (!*a) { char buf[160]; sprintf(buf, "Input line should have at least %d tabs:\n%80s\n", n-1, str); Error(buf); } } while (*(++a) != '\t'); return (a + 1); } /****************************************************************************/ /* Copy a string to GPS bytes. */ /****************************************************************************/ static void cpystr (BYTE * p, char *q, short n) { while ((*q != '\t') && (*q != '\n') && (*q != '\r') && (*q != 0)) { *p++ = *q++; --n; } while (n-- > 0) *p++ = ' '; } /****************************************************************************/ /* */ /* The following function retrieves the file format info from the first */ /* lines of the data file. This is highly dependent upon the following */ /* format for the first line in the file -- note that there are no */ /* embedded tabs. See the file "getGPSInfo.c" for further information. */ /* */ /* Format: DDD UTC Offset: -6.00 hrs Datum[061]: NAD27 CONUS */ /* ||| |||||| ||| */ /* 0 1 2 3 4 5 6 */ /* 0123456789012345678901234567890123456789012345678901234567890123456789 */ /* */ /****************************************************************************/ /* for Mayko track: xmaplog 1.0 Sat Apr 9 15:37:06 2005 1 24.9745041 121.5487808 0.0 0 12/11/1996 17:20:08 1 24.9745792 121.5483677 1.7 0 12/11/1996 17:20:58 for Mayko track type 2, "-m -m". Blank lines mark breaks in the track (GPS was off) xmaplog 1.0 Wed May 11 13:25:08 2005 1 24.9745041 121.5487808 0.0 0 12/11/1996 17:20:08 1 24.9745792 121.5483677 1.7 0 12/11/1996 17:20:58 x24.9745041 121.5487808 0.0424647 -50- 1.651 for Mayko route: xmaproute 1.0 Sun May 8 15:31:45 2005 for Mayko waypoints: unknown xmap format Sun May 8 15:30:53 2005 W 001 67.657959 meters 12/31/1989 -5:00:00 42.9273394 -71.4672483 */ /****************************************************************************/ /* Get data format from the first two lines of the input file. Return nonzero on success. */ /****************************************************************************/ static short getFileFormat (char *first, char *second) { extern short nDatums; char fmt[10]; if (strstr(first, "xmap")) { // manage Mayko mXmap format file_format = MAYKO; gFilePrefs.format = DDD; gFilePrefs.offset = 0; gFilePrefs.datum = 100; if (verbose) printf("Input file is in Mayko mXmap format.\n"); } else { sscanf (first, "%7s", fmt); if (strcmp (fmt, "Format:") != 0) return 0; /* Get position format */ sscanf (first + 8, "%3s", fmt); if (strcmp (fmt, "DMS") == 0) gFilePrefs.format = DMS; else if (strcmp (fmt, "DMM") == 0) gFilePrefs.format = DMM; else if (strcmp (fmt, "DDD") == 0) gFilePrefs.format = DDD; else if (strcmp (fmt, "UTM") == 0) gFilePrefs.format = UTM; else if (strcmp (fmt, "BNG") == 0) gFilePrefs.format = BNG; else if (strcmp (fmt, "ITM") == 0) gFilePrefs.format = ITM; else if (strcmp (fmt, "KKJ") == 0) gFilePrefs.format = KKJ; else if (strcmp (fmt, "SEG") == 0) gFilePrefs.format = SEG; else if (strcmp (fmt, "GKK") == 0) gFilePrefs.format = GKK; else return 0; /* Get time offset */ sscanf (first + 25, "%lf", &gFilePrefs.offset); if (gFilePrefs.offset < -24.0 || gFilePrefs.offset > 24.0) return 0; /* Get datum format */ sscanf (first + 43, "%3hd", &gFilePrefs.datum); /* nDatums - 1 was wrong, as Datums count from 0 to 102, that are 103 Datums, but nDatums was set to 102 */ if (gFilePrefs.datum < 0 || gFilePrefs.datum > nDatums) return 0; if (!*second) return 0; { int i; char *s; column.count=0; /* count the column labels. Labels are separated by tabs. A tab is optional after the last label. */ for (s=second; *s; s++) if ((*s == '\t') && s[1]) column.count++; s=second; for (i=0; i /****************************************************************************/ /* The k0 constant was empirically determined to give the best fit to the */ /* data from the GPS 45 and the PCX5 program. It should be 0.9996, but this */ /* number resulted in slight errors in the data. */ /****************************************************************************/ /* define constants */ static const char *zoneID0 = "STUQRNOPLMHJKFGCDEABXYZVW"; static const char *zoneID1 = "VWXYZQRSTULMNOPFGHJKABCDE"; static const double lat0 = 49.0; /* reference transverse mercator latitude */ static const double lon0 = -2.0; /* and longitude */ static const double k0 = 0.99960133; /****************************************************************************/ /* Convert degree to British Grid Format. */ /****************************************************************************/ void DegToBNG (double lat, double lon, char *zone, double *x, double *y) { short X0, Y0, X1, Y1; strcpy (zone, "--"); toTM (lat, lon, lat0, lon0, k0, x, y); /* add false easting and northing and round to nearest meter */ *x = floor (*x + 400000.0 + 0.5); *y = floor (*y - 100000.0 + 0.5); /* check for invalid range */ if (*x < 0.0 || *x > 1.0e6 || *y < 0.0 || *y > 2.5e6) { /* return with zone = "--" and set x and y to 0.0 */ *x = 0.0; *y = 0.0; return; } X0 = (long) *x / 500000; Y0 = (long) *y / 500000; X1 = ((long) *x / 100000) % 5; Y1 = ((long) *y / 100000) % 5; *x = (long) *x % 100000; *y = (long) *y % 100000; zone[0] = zoneID0[5 * Y0 + X0]; zone[1] = zoneID1[5 * Y1 + X1]; } /****************************************************************************/ /* Convert British Grid Format to degree. */ /****************************************************************************/ void BNGtoDeg (char *zone, double x, double y, double *lat, double *lon) { int m, n; /* Check for invalid zone */ if (strcmp (zone, "--") == 0 || x < 0.0 || x > 100000.0 || y < 0.0 || y > 100000.0) { *lat = 0.0; *lon = 0.0; return; } m = strchr (zoneID0, zone[0]) - zoneID0; n = strchr (zoneID1, zone[1]) - zoneID1; x += (m % 5) * 500000.0 + (n % 5) * 100000.0 - 400000.0; y += (m / 5) * 500000.0 + (n / 5) * 100000.0 + 100000.0; fromTM (x, y, lat0, lon0, k0, lat, lon); } gpstrans-0.41/src/grid/gkk.c0000644000175000017500000001146010225356640012661 00000000000000/****************************************************************************/ /* */ /* ./grid/gkk.c - Convert to and from GKK Grid Format */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* Copyright (c) 1996 by Janne Sinkkonen (janne@iki.fi) */ /* Copyright (c) 2000 by Andreas Lange (andreas.lange@rhein-main.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include /* NOTE: Gauss-Krueger refers to a grid system as well as to a projection method. Do not confuse both. germany/europe: Mittelmeridian 0° = Zone 0 : 0500000 -1.5 - 0 - 1.5 Mittelmeridian 3° = Zone 1 : 1500000 1.5 - 3 - 4.5 Mittelmeridian 6° = Zone 2 : 2500000 4.5 - 6 - 7.5 Mittelmeridian 9° = Zone 3 : 3500000 7.5 - 9 - 10.5 Mittelmeridian 12° = Zone 4 : 4500000 10.5 - 12 - 13.5 Mittelmeridian 15° = Zone 5 : 5500000 13.5 - 15 - 16.5 General Gauss-Krueger: 3° wide meridian zones 120 zones from 0° to 360° False Easting of 500000 m Normally not defined on southern hemisphere. */ /* define constants */ /* divider for false easting part */ #define DIVIDER 1000000.0 /* false easting without zone number prefix */ #define FEAST 500000.0 /* width of the meridian longitude zones */ #define MWIDTH 3.0 static const double lat0 = 0.0; /* reference transverse mercator latitude */ static double lon0 = 0.0; /* reference transverse mercator longitude */ static const double k0 = 1.0; /* scale factor at central meridian */ /****************************************************************************/ /* Convert degree to GKK Grid. */ /****************************************************************************/ void DegToGKK (double lat, double lon, double *x, double *y) { int zonenbr; /* not defined on southern hemisphere, only defined for middle european longitudes, that is zone 0 to 5. */ if (lat < 0.0 || lon < 0.0 || lon > 16.5) { *x = 0.0; *y = 0.0; return; } /* calculate zone */ zonenbr = floor ((lon / (double) MWIDTH) + (double) 0.5); /* set lon0 to reference meridian/longitude */ lon0 = (double) (zonenbr * MWIDTH); /* projection to tm */ toTM (lat, lon, lat0, lon0, k0, x, y); /* add false easting */ *x += (zonenbr * DIVIDER) + FEAST; } /****************************************************************************/ /* Convert GKK Grid to degree. */ /****************************************************************************/ void GKKtoDeg (double x, double y, double *lat, double *lon) { /* do some sanity checks */ if (x > 5999999.0 || x < 0.0 || y < 0.0 || y > 9999999.0) { *lat = 0; *lon = 0; return; } /* set lon0 to reference meridian/longitude */ lon0 = (floor (x / DIVIDER)) * MWIDTH; /* subtract false easting */ x -= (((floor (x / DIVIDER)) * DIVIDER) + FEAST); /* inverse projection from tm */ fromTM (x, y, lat0, lon0, k0, lat, lon); } gpstrans-0.41/src/grid/gridutils.c0000644000175000017500000000517610225356640014122 00000000000000/****************************************************************************/ /* */ /* ./grid/gridutils.c - Calculate datum variables */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include "Prefs.h" /****************************************************************************/ /* Calculate datum parameters. */ /****************************************************************************/ void datumParams (short datum, double *a, double *es) { extern struct DATUM const gDatum[]; extern struct ELLIPSOID const gEllipsoid[]; double f = 1.0 / gEllipsoid[gDatum[datum].ellipsoid].invf; /* flattening */ *es = 2 * f - f * f; /* eccentricity^2 */ *a = gEllipsoid[gDatum[datum].ellipsoid].a; /* semimajor axis */ } gpstrans-0.41/src/grid/itm.c0000644000175000017500000001024610225356640012677 00000000000000/****************************************************************************/ /* */ /* ./gps/dms.c - Convert to various position formats */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include /****************************************************************************/ /* The reference latitude and k0 factor were determined empirically to fit */ /* the GPS data. */ /****************************************************************************/ /* define constants */ static const char *zoneID = "VWXYZQRSTULMNOPFGHJKABCDE"; static const double lat0 = 53.4999886; /* reference transverse mercator */ static const double lon0 = -8.0; /* latitude and longitude */ static const double k0 = 1.000035; /****************************************************************************/ /* Convert degree to Irish Grid Format. */ /****************************************************************************/ void DegToITM (double lat, double lon, char *zone, double *x, double *y) { short X, Y; strcpy (zone, "--"); toTM (lat, lon, lat0, lon0, k0, x, y); /* add false easting and northing and round to nearest meter */ *x = floor (*x + 200000.0 + 0.5); *y = floor (*y + 250000.0 + 0.5); /* check for invalid range */ if (*x < 0.0 || *x > 500000.0 || *y < 0.0 || *y > 500000.0) { /* return with zone = "--" and set x and y to 0.0 */ *x = 0.0; *y = 0.0; return; } X = (long) *x / 100000; Y = (long) *y / 100000; *x = (long) *x % 100000; *y = (long) *y % 100000; zone[0] = 'I'; zone[1] = zoneID[5 * Y + X]; } /****************************************************************************/ /* Convert Irish Grid Format to degree. */ /****************************************************************************/ void ITMtoDeg (char *zone, double x, double y, double *lat, double *lon) { int n; /* Check for invalid zone */ if (strcmp (zone, "--") == 0 || x < 0.0 || x > 100000.0 || y < 0.0 || y > 100000.0) { *lat = 0.0; *lon = 0.0; return; } n = strchr (zoneID, zone[1]) - zoneID; x += (n % 5) * 100000.0 - 200000.0; y += (n / 5) * 100000.0 - 250000.0; fromTM (x, y, lat0, lon0, k0, lat, lon); } gpstrans-0.41/src/grid/kkj.c0000644000175000017500000000616410225356640012671 00000000000000/****************************************************************************/ /* */ /* ./grid/kkj.c - Convert to and from KKJ Grid Format */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* Copyright (c) 1996 by Janne Sinkkonen (janne@iki.fi) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include /* define constants */ static const double lat0 = 0.0; /* reference transverse mercator latitude */ static const double lon0 = 27.0; static const double k0 = 1.0; /****************************************************************************/ /* Convert degree to KKJ Grid. */ /****************************************************************************/ void DegToKKJ (double lat, double lon, char *zone, double *x, double *y) { sprintf (zone, "27E"); toTM (lat, lon, lat0, lon0, k0, x, y); /* false easting */ *x = *x + 500000.0; } /****************************************************************************/ /* Convert KKJ Grid to degree. */ /****************************************************************************/ void KKJtoDeg (short zone, short southernHemisphere, double x, double y, double *lat, double *lon) { x -= 500000.0; fromTM (x, y, lat0, lon0, k0, lat, lon); } gpstrans-0.41/src/grid/seg.c0000644000175000017500000000654210225356640012670 00000000000000/****************************************************************************/ /* */ /* ./grid/seg.c - Convert to Swedish Grid based on the datum RT90 */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* Copyright (c) 1999 by Anders Lennartsson (anders.lennartsson@sto.foa.se) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include /* define constants */ static const double lat0 = 0.0; /* reference transverse mercator latitude */ /* for SEG: the equator of Bessel's 1841 ellipsoid */ static const double lon0 = 15.808277777778; /* reference longitude */ /* for SEG: 2.5 gon east of Stockholm's old observatory */ static const double k0 = 1.0; /****************************************************************************/ /* Convert degree to Swedish Grid Format. */ /****************************************************************************/ void DegToSEG (double lat, double lon, double *x, double *y) { toTM (lat, lon, lat0, lon0, k0, x, y); /* add false easting and round to nearest meter */ *y = floor (*y + 0.5); *x = floor (*x + 1500000.5); /* realistic values */ /* 6100000m < x < 7700000m */ /* 1200000m < y < 1900000m */ } /****************************************************************************/ /* Convert Swedish Grid Format to degree. */ /****************************************************************************/ void SEGtoDeg (double x, double y, double *lat, double *lon) { x -= 1500000.0; fromTM (x, y, lat0, lon0, k0, lat, lon); } gpstrans-0.41/src/grid/tm.c0000644000175000017500000001414410225356640012527 00000000000000/****************************************************************************/ /* */ /* ./gps/tm.c - Convert to selected datum */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include "Prefs.h" #include /****************************************************************************/ /* Equations from "Map Projections -- A Working Manual", USGS Professional */ /* Paper 1395 */ /****************************************************************************/ /* prototype function */ static double M (double phi, double a, double es); /****************************************************************************/ /* Convert latitude and longitude to converted position. */ /****************************************************************************/ void toTM (double lat, double lon, double lat0, double lon0, double k0, double *x, double *y) { extern struct PREFS gPrefs; double m, et2, n, t, c, A, a, m0, es, lambda, phi, lambda0, phi0; datumParams (gPrefs.datum, &a, &es); lambda = lon * Degree; phi = lat * Degree; phi0 = lat0 * Degree; lambda0 = lon0 * Degree; m0 = M (phi0, a, es); m = M (phi, a, es); et2 = es / (1 - es); n = a / sqrt (1 - es * pow (sin (phi), 2.0)); t = pow (tan (phi), 2.0); c = et2 * pow (cos (phi), 2.0); A = (lambda - lambda0) * cos (phi); *x = k0 * n * (A + (1.0 - t + c) * A * A * A / 6.0 + (5.0 - 18.0 * t + t * t + 72.0 * c - 58.0 * et2) * pow (A, 5.0) / 120.0); *y = k0 * (m - m0 + n * tan (phi) * (A * A / 2.0 + (5.0 - t + 9.0 * c + 4 * c * c) * pow (A, 4.0) / 24.0 + (61.0 - 58.0 * t + t * t + 600.0 * c - 330.0 * et2) * pow (A, 6.0) / 720.0)); } /****************************************************************************/ /* Convert converted position to latitude and longitude. */ /****************************************************************************/ void fromTM (double x, double y, double lat0, double lon0, double k0, double *lat, double *lon) { extern struct PREFS gFilePrefs; double a, m0, es, et2, m, e1, mu, phi1, c1, t1, n1, r1, d, phi0, lambda0; phi0 = lat0 * Degree; lambda0 = lon0 * Degree; datumParams (gFilePrefs.datum, &a, &es); m0 = M (phi0, a, es); et2 = es / (1.0 - es); m = m0 + y / k0; e1 = (1.0 - sqrt (1.0 - es)) / (1.0 + sqrt (1.0 - es)); mu = m / (a * (1.0 - es / 4.0 - 3.0 * es * es / 64.0 - 5.0 * es * es * es / 256.0)); phi1 = mu + (3.0 * e1 / 2.0 - 27.0 * pow (e1, 3.0) / 32.0) * sin (2.0 * mu) + (21.0 * e1 * e1 / 16.0 - 55.0 * pow (e1, 4.0) / 32.0) * sin (4.0 * mu) + 151.0 * pow (e1, 3.0) / 96.0 * sin (6.0 * mu) + 1097.0 * pow (e1, 4.0) / 512.0 * sin (8.0 * mu); c1 = et2 * pow (cos (phi1), 2.0); t1 = pow (tan (phi1), 2.0); n1 = a / sqrt (1 - es * pow (sin (phi1), 2.0)); r1 = a * (1.0 - es) / pow (1.0 - es * pow (sin (phi1), 2.0), 1.5); d = x / (n1 * k0); *lat = (phi1 - n1 * tan (phi1) / r1 * (d * d / 2.0 - (5.0 + 3.0 * t1 + 10.0 * c1 - 4.0 * c1 * c1 - 9.0 * et2) * pow (d, 4.0) / 24.0 + (61.0 + 90.0 * t1 + 298.0 * c1 + 45.0 * t1 * t1 - 252.0 * et2 - 3.0 * c1 * c1) * pow (d, 6.0) / 720.0)) / Degree; *lon = (lambda0 + (d - (1.0 + 2.0 * t1 + c1) * pow (d, 3.0) / 6.0 + (5.0 - 2.0 * c1 + 28.0 * t1 - 3.0 * c1 * c1 + 8.0 * et2 + 24.0 * t1 * t1) * pow (d, 5.0) / 120.0) / cos (phi1)) / Degree; } /****************************************************************************/ /* Do some calculations - don't really know whats happen here. */ /****************************************************************************/ static double M (double phi, double a, double es) { double fix; if (phi == 0.0) return 0.0; else { fix = a * ( (1.0 - es / 4.0 - 3.0 * es * es / 64.0 - 5.0 * es * es * es / 256.0) * phi - (3.0 * es / 8.0 + 3.0 * es * es / 32.0 + 45.0 * es * es * es / 1024.0) * sin (2.0 * phi) + (15.0 * es * es / 256.0 + 45.0 * es * es * es / 1024.0) * sin (4.0 * phi) - (35.0 * es * es * es / 3072.0) * sin (6.0 * phi)); return fix; } } gpstrans-0.41/src/grid/ups.c0000644000175000017500000001105710225356640012716 00000000000000/****************************************************************************/ /* */ /* ./grid/ups.c - Convert to and from UPS Grid Format */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include "Prefs.h" #include /* prototype functions */ static void calcPhi (double *phi, double e, double t); /****************************************************************************/ /* Convert degree to UPS Grid. */ /****************************************************************************/ void toUPS (double lat, double lon, double *x, double *y) { extern struct PREFS gPrefs; double a, t, e, es, rho; const double k0 = 0.994; double lambda = lon * Degree; double phi = fabs (lat * Degree); datumParams (gPrefs.datum, &a, &es); e = sqrt (es); t = tan (Pi / 4.0 - phi / 2.0) / pow ((1.0 - e * sin (phi)) / (1.0 + e * sin (phi)), (e / 2.0)); rho = 2.0 * a * k0 * t / sqrt (pow (1.0 + e, 1.0 + e) * pow (1.0 - e, 1.0 - e)); *x = rho * sin (lambda); *y = rho * cos (lambda); if (lat > 0.0) *y = -(*y); /* Northern hemisphere */ *x += 2.0e6; /* Add in false easting and northing */ *y += 2.0e6; } /****************************************************************************/ /* Convert UPS Grid to degree. */ /****************************************************************************/ void fromUPS (short southernHemisphere, double x, double y, double *lat, double *lon) { extern struct PREFS gFilePrefs; double a, es, e, t, rho; const double k0 = 0.994; datumParams (gFilePrefs.datum, &a, &es); e = sqrt (es); /* Remove false easting and northing */ x -= 2.0e6; y -= 2.0e6; rho = sqrt (x * x + y * y); t = rho * sqrt (pow (1.0 + e, 1.0 + e) * pow (1.0 - e, 1.0 - e)) / (2.0 * a * k0); calcPhi (lat, e, t); *lat /= Degree; if (y != 0.0) t = atan (fabs (x / y)); else { t = Pi / 2.0; if (x < 0.0) t = -t; } if (!southernHemisphere) y = -y; if (y < 0.0) t = Pi - t; if (x < 0.0) t = -t; *lon = t / Degree; } /****************************************************************************/ /* Calculate Phi. */ /****************************************************************************/ static void calcPhi (double *phi, double e, double t) { double old = Pi / 2.0 - 2.0 * atan (t); short maxIterations = 20; while ((fabs ((*phi - old) / *phi) > 1.0e-8) && maxIterations--) { old = *phi; *phi = Pi / 2.0 - 2.0 * atan (t * pow ((1.0 - e * sin (*phi)) / ((1.0 + e * sin (*phi))), (e / 2.0))); } } gpstrans-0.41/src/grid/utm.c0000644000175000017500000000772510225356640012723 00000000000000/****************************************************************************/ /* */ /* ./grid/utm.c - Convert to and from UTM Grid Format */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* Parts are taken from John F. Waers (jfwaers@csn.net) program MacGPS. */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include /* define constants */ static const double lat0 = 0.0; /* reference transverse mercator latitude */ static const double k0 = 0.9996; /****************************************************************************/ /* Convert degree to UTM Grid. */ /****************************************************************************/ void DegToUTM (double lat, double lon, char *zone, double *x, double *y) { char nz; double lon0; if ((lat >= -80.0) && (lat <= 84.0)) { nz = 'C' + ((short) (lat + 80.0)) / 8; /* skip 'I' and 'O' */ if (nz > 'H') ++nz; if (nz > 'N') ++nz; lon0 = 6.0 * floor (lon / 6.0) + 3.0; sprintf (zone, "%02d\t%c", ((short) lon0 + 183) / 6, nz); toTM (lat, lon, lat0, lon0, k0, x, y); /* false easting */ *x = *x + 500000.0; /* false northing for southern hemisphere */ if (lat < 0.0) *y = 10000000.0 + *y; } else { strcpy (zone, "00\tx"); if (lat > 0.0) if (lon < 0.0) zone[3] = 'Y'; else zone[3] = 'Z'; else if (lon < 0.0) zone[3] = 'A'; else zone[3] = 'B'; toUPS (lat, lon, x, y); } } /****************************************************************************/ /* Convert UTM Grid to degree. */ /****************************************************************************/ void UTMtoDeg (short zone, short southernHemisphere, double x, double y, double *lat, double *lon) { double lon0; if (zone != 0) { lon0 = (double) ((-183 + 6 * zone)); /* remove false northing for southern hemisphere and false easting */ if (southernHemisphere) y = 1.0e7 - y; x -= 500000.0; fromTM (x, y, lat0, lon0, k0, lat, lon); } else fromUPS (southernHemisphere, x, y, lat, lon); *lat = fabs (*lat); if (southernHemisphere) *lat = -(*lat); } gpstrans-0.41/src/getline/0000755000175000017500000000000011037770611012521 500000000000000gpstrans-0.41/src/getline/CHANGES0000644000175000017500000000515610225356640013443 00000000000000Changes from last patch (v38i004 in comp.sources.misc) * added djgpp support on PCs * cleanup up __unix__ ifdefs * added __STDC__ prototypes in header file * change makefile to build an archive and testgl * added retry on interrupted read()s * fixed GO32 keymapping to handles arrow keys properly Changes from last release (v37i050 in comp.sources.misc) * Added support for AIX, XENIX, TurboC, gcc (EMX) under OS/2 * Added ^U (kill line) functionality * Added ESC-B/ESC-F backward/forward one word functionality * Made it possible to preload history with gl_histadd() before calling getline() Changes from last release (v28i056 in comp.sources.misc) * type-ahead saved in BSD mode (was OK in SYSV and POSIX) * fixed POSIX mode bug and enabled termios use if POSIX defined. * allow caller to supply a prompt width calculation function so that the caller can embed escape sequences into the prompt (see gl_strwidth in the man page). * added a getline.h header file for inclusion into the caller. * man page added, thanks to DaviD W. Sanderson (dws@cs.wisc.edu) Changes from previous release (v25i056 and patch v26i092) * The user no longer calls gl_init() and gl_cleanup(), getline() sets required terminal modes on entry and resets before returning. This was necessary to capture changes in terminal modes that the main program might be making. * Getline() now looks to see which characters are bound to signal generation, and when these characters are seen getline() resets terminal modes before passing on the signal. If the signal handler returns to getline(), the screen is automatically updated and editing can continue. * The toggle key for overwrite mode has been moved from ^G to ^O * All code is now classic rather than ANSI C, so any compiler should be able to handle it. * ^Y now yanks back previously kill'ed (^K) text starting at the current location. * ^R/^S begin reverse and forward incremental searches through the history list. * The programmer must add buffers onto the history list by calling gl_addhist(char *buffer). This function makes copies of the buffer and adds them to the history list if the buffer is not a blank line and if the buffer is different than the last item saved (so the program need not check for these conditions) * The main program can specify the screen width to use with a call to gl_setwidth(int width) * Getline now insists that both the input and output are connected to a terminal. If this is not the case, an error message is written and the program is terminated. The main program should check for this case and use buffered IO (stdio) for non-interactive sessions. gpstrans-0.41/src/getline/Makefile0000644000175000017500000000040610225356640014101 00000000000000CC = cc #CFLAGS = -Wall -DPOSIX CFLAGS = -DPOSIX LDFLAGS= testgl: libgetline.a testgl.o $(CC) $(LDFLAGS) $(CFLAGS) -o testgl testgl.o -L. -lgetline libgetline.a: getline.o ar cr libgetline.a getline.o -ranlib libgetline.a clean: rm -f *.o *.a testgl gpstrans-0.41/src/getline/README0000644000175000017500000002146510225356640013331 00000000000000*************************** Motivation ********************************** Many interactive programs read input line by line, but would like to provide line editing and history functionality to the end-user that runs the program. The input-edit package provides that functionality. As far as the programmer is concerned, the program only asks for the next line of input. However, until the user presses the RETURN key they can use emacs-style line editing commands and can traverse the history of lines previously typed. Other packages, such as GNU's readline, have greater capability but are also substantially larger. Input-edit is small, since it uses neither stdio nor any termcap features, and is also quite portable. It only uses \b to backspace and \007 to ring the bell on errors. Since it cannot edit multiple lines it scrolls long lines left and right on the same line. Input edit uses classic (not ANSI) C, and should run on any Unix system (BSD, SYSV or POSIX), PC's under DOS with MSC, TurboC or djgpp, PC's under OS/2 with gcc (EMX), or Vax/VMS. Porting the package to new systems basicaly requires code to read a character when it is typed without echoing it, everything else should be OK. I have run the package on: DECstation 5000, Ultrix 4.3 with cc 2.1 and gcc 2.3.3 Sun Sparc 2, SunOS 4.1.1, with cc SGI Iris, IRIX System V.3, with cc PC using DOS with MSC The description below is broken into two parts, the end-user (editing) interface and the programmer interface. Send bug reports, fixes and enhancements to: Chris Thewalt (thewalt@ce.berkeley.edu) 5/3/93 Thanks to the following people who have provided enhancements and fixes: Ron Ueberschaer, Christoph Keller, Scott Schwartz, Steven List, DaviD W. Sanderson, Goran Bostrom, Michael Gleason, Glenn Kasten, Edin Hodzic, Eric J Bivona, Kai Uwe Rommel, Danny Quah, Ulrich Betzler PS: I don't have, and don't want to add, a vi mode, sorry. ************************** End-User Interface *************************** Entering printable keys generally inserts new text into the buffer (unless in overwrite mode, see below). Other special keys can be used to modify the text in the buffer. In the description of the keys below, ^n means Control-n, or holding the CONTROL key down while pressing "n". Errors will ring the terminal bell. ^A/^E : Move cursor to beginning/end of the line. ^F/^B : Move cursor forward/backward one character. ESC-F : Move cursor forward one word. ESC-B : Move cursor backward one word. ^D : Delete the character under the cursor. ^H, DEL : Delete the character to the left of the cursor. ^K : Kill from the cursor to the end of line. ^L : Redraw current line. ^O : Toggle overwrite/insert mode. Initially in insert mode. Text added in overwrite mode (including yanks) overwrite existing text, while insert mode does not overwrite. ^P/^N : Move to previous/next item on history list. ^R/^S : Perform incremental reverse/forward search for string on the history list. Typing normal characters adds to the current search string and searches for a match. Typing ^R/^S marks the start of a new search, and moves on to the next match. Typing ^H or DEL deletes the last character from the search string, and searches from the starting location of the last search. Therefore, repeated DEL's appear to unwind to the match nearest the point at which the last ^R or ^S was typed. If DEL is repeated until the search string is empty the search location begins from the start of the history list. Typing ESC or any other editing character accepts the current match and loads it into the buffer, terminating the search. ^T : Toggle the characters under and to the left of the cursor. ^U : Deletes the entire line ^Y : Yank previously killed text back at current location. Note that this will overwrite or insert, depending on the current mode. TAB : By default adds spaces to buffer to get to next TAB stop (just after every 8th column), although this may be rebound by the programmer, as described below. NL, CR : returns current buffer to the program. DOS and ANSI terminal arrow key sequences are recognized, and act like: up : same as ^P down : same as ^N left : same as ^B right : same as ^F ************************** Programmer Interface *************************** The programmer accesses input-edit through these functions, and optionally through three additional function pointer hooks. The four functions are: char *getline(char *prompt) Prints the prompt and allows the user to edit the current line. A pointer to the line is returned when the user finishes by typing a newline or a return. Unlike GNU readline, the returned pointer points to a static buffer, so it should not be free'd, and the buffer contains the newline character. The user enters an end-of-file by typing ^D on an empty line, in which case the first character of the returned buffer is '\0'. Getline never returns a NULL pointer. The getline functions sets terminal modes needed to make it work, and resets them before returning to the caller. The getline function also looks for characters that would generate a signal, and resets the terminal modes before raising the signal condition. If the signal handler returns to getline, the screen is automatically redrawn and editing can continue. Getline now requires both the input and output stream be connected to the terminal (not redirected) so the main program should check to make sure this is true. If input or output have been redirected the main program should use buffered IO (stdio) rather than the slow 1 character read()s that getline uses. void gl_setwidth(int width) Set the width of the terminal to the specified width. The default width is 80 characters, so this function need only be called if the width of the terminal is not 80. Since horizontal scrolling is controlled by this parameter it is important to get it right. void gl_histadd(char *buf) The gl_histadd function checks to see if the buf is not empty or whitespace, and also checks to make sure it is different than the last saved buffer to avoid repeats on the history list. If the buf is a new non-blank string a copy is made and saved on the history list, so the caller can re-use the specified buf. void gl_strwidth(size_t (*func)()) The gl_strwidth function allows the caller to supply a pointer to a prompt width calculation function (strlen by default). This allows the caller to embed escape sequences in the prompt and then tell getline how many screen spaces the prompt will take up. The main loop in testgl.c, included in this directory, shows how the input-edit package can be used: extern char *getline(); extern void gl_histadd(); main() { char *p; do { p = getline("PROMPT>>>> "); gl_histadd(p); fputs(p, stdout); } while (*p != 0); } In order to allow the main program to have additional access to the buffer, to implement things such as completion or auto-indent modes, three function pointers can be bound to user functions to modify the buffer as described below. By default gl_in_hook and gl_out_hook are set to NULL, and gl_tab_hook is bound to a function that inserts spaces until the next logical tab stop is reached. The user can reassign any of these pointers to other functions. Each of the functions bound to these hooks receives the current buffer as the first argument, and must return the location of the leftmost change made in the buffer. If the buffer isn't modified the functions should return -1. When the hook function returns the screen is updated to reflect any changes made by the user function. int (*gl_in_hook)(char *buf) If gl_in_hook is non-NULL the function is called each time a new buffer is loaded. It is called when getline is entered, with an empty buffer, it is called each time a new buffer is loaded from the history with ^P or ^N, and it is called when an incremental search string is accepted (when the search is terminated). The buffer can be modified and will be redrawn upon return to getline(). int (*gl_out_hook)(char *buf) If gl_out_hook is non-NULL it is called when a line has been completed by the user entering a newline or return. The buffer handed to the hook does not yet have the newline appended. If the buffer is modified the screen is redrawn before getline returns the buffer to the caller. int (*gl_tab_hook)(char *buf, int prompt_width, int *cursor_loc) If gl_tab_hook is non-NULL, it is called whenever a tab is typed. In addition to receiving the buffer, the current prompt width is given (needed to do tabbing right) and a pointer to the cursor offset is given, where a 0 offset means the first character in the line. Not only does the cursor_loc tell the programmer where the TAB was received, but it can be reset so that the cursor will end up at the specified location after the screen is redrawn. gpstrans-0.41/src/getline/getline.30000644000175000017500000002261510225356640014162 00000000000000.\" Note that in silly ol' [nt]roff, even trailing white space is .\" significant. I went through and eliminated it. .\" I adopted a convention of using a bold 'getline' when referring to .\" the whole package, but an italic 'getline' when referring to the .\" specific function. .\" Note that in [nt]roff that "-" is a hyphen, while "\-" is a dash. .\" I adjusted some source text lines to keep them short (I keep line .\" numbers turned on in vi, so I only have 72 cols w/o wrapping). .\" It's too bad that getline() doesn't realloc() the buffer as .\" necessary. Then it could have an unlimited input line length. .\" Note that .RI et al are limited in how many args they can take. .\" I corrected gl_addhist to gl_histadd, which is what is actually .\" used! Perhaps it really should be gl_addhist, to preserve the .\" gl_ pattern in the other function names. .\" I tried to rephrase certain sections to avoid the passive voice. .\" I find the active voice much easier to understand, since I can tell .\" more easily what acts on what. .TH GETLINE 3 .SH NAME getline \- command-line editing library with history .SH SYNOPSIS .RI "char *getline(char *" prompt ); .PP .RI "void gl_histadd(char *" line ); .br .RI "void gl_setwidth(int " width ); .br .RI "void gl_strwidth(int " (*width_func)() ); .PP .RI "extern int (*gl_in_hook)(char *" buf ); .br .RI "extern int (*gl_out_hook)(char *" buf ); .br .RI "extern int (*gl_tab_hook)(char *" buf , .RI "int " prompt_width ", int *" cursor_loc ); .SH DESCRIPTION The .B getline package is a set of library routines that implement an editable command-line history. .PP .B "Programming Interface" .br .I getline returns a pointer to a line of text read from the user, prompting the user with the specified .IR prompt . The pointer refers to a static buffer allocated by the .B getline package. Clients may assume that the pointer .I getline returns is always the same, and is never NULL. The buffer .I getline returns to the caller contains the terminating newline character, except on end of file, in which case the first character in the buffer is 0 .RB ( NUL ). File descriptors 0 and 1 must be connected to the terminal (not redirected), so the caller should check for this condition (using .IR isatty (\|)) and call stdio routines if the session is not interactive. .PP .I gl_histadd adds the given .I line to the .B getline history list if the .I line is not empty and if it is different from the last line in the history list (so the caller need not check for these conditions). .I gl_histadd makes its own copies of all the lines it adds to the history list. This is so the caller can reuse the buffer it supplies to .IR gl_histadd . .PP .I gl_setwidth specifies the terminal .I width to use for horizontal scrolling. The default value is 80 columns, and it is important to properly specify the .I width or lines may wrap inadvertently. .PP .I gl_strwidth allows the application program to supply a prompt string width calculation function that returns the number of screen positions used by the argument string. By default strlen is used, but if the prompt contains escape sequences the user can bind a function that returns the actual number of screen postitions used by the argument string, not including the escape characters. .PP In addition to the function call interface, .B getline has three externally accessible function pointers that act as hooks if bound to user-defined functions. .B getline supplies each of the functions with a pointer to the current buffer as the first argument, and expects the return value to be the index of the first change the function made in the buffer (or \-1 if the function did not alter the buffer). After the functions return, .B getline updates the screen as necessary. .\"------- .\" DWS comment -- .\"------- Note that the functions may not alter the size of the buffer. Indeed, they do not even know how large the buffer is! .PP .I getline calls .I gl_in_hook (initially NULL) each time it loads a new buffer. More precisely, this is .TP \(bu at the first call to .I getline (with an empty buffer) .TP \(bu each time the user enters a new buffer from the history list (with .B ^P or .BR ^N ) .TP \(bu when the user accepts an incremental search string (when the user terminates the search). .PP .I getline calls .I gl_out_hook (initially NULL) when a line has been completed by the user entering a .B NEWLINE .RB (\| ^J \|) or .B RETURN .RB (\| ^M \|). The buffer .I gl_out_hook sees does not yet have the newline appended, and .I gl_out_hook should not add a newline. .PP .I getline calls .I gl_tab_hook whenever the user types a .BR TAB . In addition to the buffer, .I getline supplies the current .I prompt_width (presumably needed for tabbing calculations) and .IR cursor_loc , a pointer to the cursor location. .RI ( *cursor_loc \(eq 0 corresponds to the first character in the buffer) .I *cursor_loc tells .I gl_tab_hook where the .B TAB was typed. Note that when it redraws the screen, .I getline will honor any change .I gl_tab_hook may make to .IR *cursor_loc . .\"------- .\" DWS comment -- .\"------- Note also that .I prompt_width may not correspond to the actual width of .I prompt on the screen if .I prompt contains escape sequences. .I gl_tab_hook is initially bound to the .B getline internal static function .IR gl_tab , which acts like a normal .B TAB key by inserting spaces. .PP .B "User Interface" .br .\"------- .\" I adapted the prologue to this section from the ksh man page (dws). .\"------- To edit, the user moves the cursor to the point needing correction and then inserts or deletes characters or words as needed. All the editing commands are control characters, which typed by holding the CTRL key down while typing another character. Control characters are indicated below as the caret .RB (\| ^ \|) followed by another character, such as .BR ^A . .PP All edit commands operate from any place on the line, not just at the beginning. .PP These are the .I getline key bindings. .\"------- .\" Tt - max width of tag .\" Tw - max width of tag + spacing to the paragraph .\" Tp - special .TP, with the best indent for the editing command .\" descriptions. .\" The first version of Tp prints the tags left-justified. .\" The second version of Tp prints the tags as follows: .\" If one argument is given, it is printed right-justified. .\" If two arguments are given, the first is printed left-justified .\" and the second is printed right-justified. .\"------- .nr Tt \w'BACKSPACE' .nr Tw \w'BACKSPACE\0\0\0' .\" .de Tp .\" .TP \n(Twu .\" \fB\\$1\fR .\" .. .de Tp .TP \n(Twu .if \\n(.$=1 \h@\n(Ttu-\w'\fB\\$1\fR'u@\fB\\$1\fR .if \\n(.$=2 \fB\\$1\fR\h@\n(Ttu-\w'\fB\\$1\\$2\fR'u@\fB\\$2\fR .. .PP .\"------- .\" Set interparagraph spacing to zero so binding descriptions are .\" kept together. .\"------- .PD 0 .Tp "^A" Move cursor to beginning of line. .Tp "^B" Move cursor left (back) 1 column. .Tp ESC-B Move cursor back one word. .Tp "^D" Delete the character under the cursor. .Tp "^E" Move cursor to end of line. .Tp "^F" Move cursor right (forward) 1 column. .Tp ESC-F Move cursor forward one word. .Tp "^H" Delete the character left of the cursor.@ .Tp "^I" Jump to next tab stop (may be redefined by the program). .Tp "^J" Return the current line. .Tp "^K" Kill from cursor to the end of the line (see .BR "^Y" \|). .Tp "^L" Redisplay current line. .Tp "^M" Return the current line. .Tp "^N" Fetches next line from the history list. .Tp "^O" Toggle overwrite/insert mode, initially in insert mode. .Tp "^P" Fetches previous line from the history list. .Tp "^R" Begin a reverse incremental search through history list. Each printing character typed adds to the search substring (initially empty), and .B getline finds and displays the first matching location. Typing .B ^R again marks the current starting location and begins a new search for the current substring. Typing .B ^H or .B DEL deletes the last character from the search string, and .B getline restarts the search from the last starting location. Repeated .B ^H or .B DEL characters therefore appear to unwind the search to the match nearest the point where the user last typed .B ^R or .BR ^S . Typing .B ^H or .B DEL until the search string is empty causes .B getline to reset the start of the search to the beginning of the history list. Typing .B ESC or any other editing character accepts the current match and terminates the search. .Tp "^S" Begin a forward incremental search through the history list. The behavior is like that of .B ^R but in the opposite direction through the history list. .Tp "^T" Transpose current and previous character. .Tp "^U" Kill the entire line (see .BR "^Y" \|). .Tp "^Y" Yank previously killed text back at current location. .Tp BACKSPACE Delete the character left of the cursor. .Tp DEL Delete the character left of the cursor. .Tp RETURN Return the current line. .Tp TAB Jump to next tab stop (may be redefined by the program). .\"------- .\" Restore default interparagraph spacing. .\"------- .PD .PP .B getline recognizes DOS and ANSI arrow keys. They cause the following actions: .B up is the same as .BR ^P , .B down is the same as .BR ^N , .B left is the same as .BR ^P , and .B right is the same as .BR ^F . .SH AUTHORS .PP Program by Christopher R. Thewalt (thewalt\|@ce.berkeley.edu) .PP Original man page by DaviD W. Sanderson (dws\|@cs.wisc.edu) and Christopher R. Thewalt .SH COPYRIGHT \& .br .if n (C) .if t \s+8\v'+2p'\fB\(co\fR\v'-2p'\s0 \s+2Copyright 1992,1993 by Christopher R. Thewalt and DaviD W. Sanderson\s0 (but freely redistributable) gpstrans-0.41/src/getline/getline.c0000644000175000017500000007102210225356640014236 00000000000000#ifndef lint static char rcsid[] = "$Id: getline.c,v 3.11 1993/12/02 15:54:31 thewalt Exp thewalt $"; static char *copyright = "Copyright (C) 1991, 1992, 1993, Chris Thewalt"; #endif /* * Copyright (C) 1991, 1992, 1993 by Chris Thewalt (thewalt@ce.berkeley.edu) * * Permission to use, copy, modify, and distribute this software * for any purpose and without fee is hereby granted, provided * that the above copyright notices appear in all copies and that both the * copyright notice and this permission notice appear in supporting * documentation. This software is provided "as is" without express or * implied warranty. * * Thanks to the following people who have provided enhancements and fixes: * Ron Ueberschaer, Christoph Keller, Scott Schwartz, Steven List, * DaviD W. Sanderson, Goran Bostrom, Michael Gleason, Glenn Kasten, * Edin Hodzic, Eric J Bivona, Kai Uwe Rommel, Danny Quah, Ulrich Betzler */ #include "getline.h" static int gl_tab (); /* forward reference needed for gl_tab_hook */ /******************** imported interface *********************************/ #include #include #include #include #include extern int isatty (); extern void *malloc (); extern void free (); /********************* exported interface ********************************/ char *getline (); /* read a line of input */ void gl_setwidth (); /* specify width of screen */ void gl_histadd (); /* adds entries to hist */ void gl_strwidth (); /* to bind gl_strlen */ int (*gl_in_hook) () = 0; int (*gl_out_hook) () = 0; int (*gl_tab_hook) () = gl_tab; int echo = (1 == 1); /******************** internal interface *********************************/ #define BUF_SIZE 1024 static int gl_init_done = -1; /* terminal mode flag */ static int gl_termw = 80; /* actual terminal width */ static int gl_scroll = 27; /* width of EOL scrolling region */ static int gl_width = 0; /* net size available for input */ static int gl_extent = 0; /* how far to redraw, 0 means all */ static int gl_overwrite = 0; /* overwrite mode */ static int gl_pos, gl_cnt = 0; /* position and size of input */ static char gl_buf[BUF_SIZE]; /* input buffer */ static char gl_killbuf[BUF_SIZE] = ""; /* killed text */ static char *gl_prompt; /* to save the prompt string */ static char gl_intrc = 0; /* keyboard SIGINT char */ static char gl_quitc = 0; /* keyboard SIGQUIT char */ static char gl_suspc = 0; /* keyboard SIGTSTP char */ static char gl_dsuspc = 0; /* delayed SIGTSTP char */ static int gl_search_mode = 0; /* search mode flag */ static void gl_init (); /* prepare to edit a line */ static void gl_cleanup (); /* to undo gl_init */ static void gl_char_init (); /* get ready for no echo input */ static void gl_char_cleanup (); /* undo gl_char_init */ static size_t (*gl_strlen) () = (size_t (*)()) strlen; /* returns printable prompt width */ static void gl_addchar (); /* install specified char */ static void gl_del (); /* del, either left (-1) or cur (0) */ static void gl_error (); /* write error msg and die */ static void gl_fixup (); /* fixup state variables and screen */ static int gl_getc (); /* read one char from terminal */ static void gl_kill (); /* delete to EOL */ static void gl_newline (); /* handle \n or \r */ static void gl_putc (); /* write one char to terminal */ static void gl_puts (); /* write a line to terminal */ static void gl_redraw (); /* issue \n and redraw all */ static void gl_transpose (); /* transpose two chars */ static void gl_yank (); /* yank killed text */ static void gl_word (); /* move a word */ static void hist_init (); /* initializes hist pointers */ static char *hist_next (); /* return ptr to next item */ static char *hist_prev (); /* return ptr to prev item */ static char *hist_save (); /* makes copy of a string, without NL */ static void search_addchar (); /* increment search string */ static void search_term (); /* reset with current contents */ static void search_back (); /* look back for current string */ static void search_forw (); /* look forw for current string */ char *stop = "CRTL-C"; /************************ nonportable part *********************************/ extern int write (); extern void exit (); #ifdef unix #ifndef __unix__ #define __unix__ #endif /* not __unix__ */ #endif /* unix */ #ifdef _IBMR2 #ifndef __unix__ #define __unix__ #endif #endif #ifdef __GO32__ #include #undef MSDOS #undef __unix__ #endif #ifdef MSDOS #include #endif #ifdef __unix__ #ifndef __convexc__ extern int read (); extern int kill (); /* extern int ioctl(); */ #endif /* not __convexc__ */ #ifdef POSIX /* use POSIX interface */ #include struct termios new_termios, old_termios; #else /* not POSIX */ #include #ifdef M_XENIX /* does not really use bsd terminal interface */ #undef TIOCSETN #endif /* M_XENIX */ #ifdef TIOCSETN /* use BSD interface */ #include struct sgttyb new_tty, old_tty; struct tchars tch; struct ltchars ltch; #else /* use SYSV interface */ #include struct termio new_termio, old_termio; #endif /* TIOCSETN */ #endif /* POSIX */ #endif /* __unix__ */ #ifdef vms #include #include #include #include unixio static int setbuff[2]; /* buffer to set terminal attributes */ static short chan = -1; /* channel to terminal */ struct dsc$descriptor_s descrip; /* VMS descriptor */ #endif static void gl_char_init () /* turn off input echo */ { #ifdef __unix__ #ifdef POSIX tcgetattr (0, &old_termios); gl_intrc = old_termios.c_cc[VINTR]; gl_quitc = old_termios.c_cc[VQUIT]; #ifdef VSUSP gl_suspc = old_termios.c_cc[VSUSP]; #endif #ifdef VDSUSP gl_dsuspc = old_termios.c_cc[VDSUSP]; #endif new_termios = old_termios; new_termios.c_iflag &= ~(BRKINT | ISTRIP | IXON | IXOFF); new_termios.c_iflag |= (IGNBRK | IGNPAR); new_termios.c_lflag &= ~(ICANON | ISIG | IEXTEN | ECHO); new_termios.c_cc[VMIN] = 1; new_termios.c_cc[VTIME] = 0; tcsetattr (0, TCSANOW, &new_termios); #else /* not POSIX */ #ifdef TIOCSETN /* BSD */ ioctl (0, TIOCGETC, &tch); ioctl (0, TIOCGLTC, <ch); gl_intrc = tch.t_intrc; gl_quitc = tch.t_quitc; gl_suspc = ltch.t_suspc; gl_dsuspc = ltch.t_dsuspc; ioctl (0, TIOCGETP, &old_tty); new_tty = old_tty; new_tty.sg_flags |= RAW; new_tty.sg_flags &= ~ECHO; ioctl (0, TIOCSETN, &new_tty); #else /* SYSV */ ioctl (0, TCGETA, &old_termio); gl_intrc = old_termio.c_cc[VINTR]; gl_quitc = old_termio.c_cc[VQUIT]; new_termio = old_termio; new_termio.c_iflag &= ~(BRKINT | ISTRIP | IXON | IXOFF); new_termio.c_iflag |= (IGNBRK | IGNPAR); new_termio.c_lflag &= ~(ICANON | ISIG | ECHO); new_termio.c_cc[VMIN] = 1; new_termio.c_cc[VTIME] = 0; ioctl (0, TCSETA, &new_termio); #endif /* TIOCSETN */ #endif /* POSIX */ #endif /* __unix__ */ #ifdef vms descrip.dsc$w_length = strlen ("tt:"); descrip.dsc$b_dtype = DSC$K_DTYPE_T; descrip.dsc$b_class = DSC$K_CLASS_S; descrip.dsc$a_pointer = "tt:"; (void) sys$assign (&descrip, &chan, 0, 0); (void) sys$qiow (0, chan, IO$_SENSEMODE, 0, 0, 0, setbuff, 8, 0, 0, 0, 0); setbuff[1] |= TT$M_NOECHO; (void) sys$qiow (0, chan, IO$_SETMODE, 0, 0, 0, setbuff, 8, 0, 0, 0, 0); #endif /* vms */ } static void gl_char_cleanup () /* undo effects of gl_char_init */ { #ifdef __unix__ #ifdef POSIX tcsetattr (0, TCSANOW, &old_termios); #else /* not POSIX */ #ifdef TIOCSETN /* BSD */ ioctl (0, TIOCSETN, &old_tty); #else /* SYSV */ ioctl (0, TCSETA, &old_termio); #endif /* TIOCSETN */ #endif /* POSIX */ #endif /* __unix__ */ #ifdef vms setbuff[1] &= ~TT$M_NOECHO; (void) sys$qiow (0, chan, IO$_SETMODE, 0, 0, 0, setbuff, 8, 0, 0, 0, 0); sys$dassgn (chan); chan = -1; #endif } #if MSDOS || __EMX__ || __GO32__ int pc_keymap (c) int c; { switch (c) { case 72: c = 16; /* up -> ^P */ break; case 80: c = 14; /* down -> ^N */ break; case 75: c = 2; /* left -> ^B */ break; case 77: c = 6; /* right -> ^F */ break; default: c = 0; /* make it garbage */ } return c; } #endif /* MSDOS || __EMX__ || __GO32__ */ static int gl_getc () /* get a character without echoing it to screen */ { int c; #ifdef __unix__ char ch; #endif #ifdef __unix__ while ((c = read (0, &ch, 1)) == -1) { if (errno != EINTR) break; } if ((int) c == 3) { return (*stop); } c = (ch <= 0) ? -1 : ch; #endif /* __unix__ */ #ifdef MSDOS c = _bios_keybrd (_NKEYBRD_READ); #endif /* MSDOS */ #ifdef __GO32__ c = getkey (); if (c > 255) c = pc_keymap (c & 0377); #endif /* __GO32__ */ #ifdef __TURBOC__ while (!bioskey (1)) ; c = bioskey (0); #endif #if MSDOS || __TURBOC__ if ((c & 0377) == 224) { c = pc_keymap ((c >> 8) & 0377); } else { c &= 0377; } #endif /* MSDOS || __TURBOC__ */ #ifdef __EMX__ c = _read_kbd (0, 1, 0); if (c == 224 || c == 0) { c = pc_keymap (_read_kbd (0, 1, 0)); } else { c &= 0377; } #endif #ifdef vms if (chan < 0) { c = '\0'; } (void) sys$qiow (0, chan, IO$_TTYREADALL, 0, 0, 0, &c, 1, 0, 0, 0, 0); c &= 0177; /* get a char */ #endif return c; } static void gl_putc (c) int c; { char ch = c; write (1, &ch, 1); if (ch == '\n') { ch = '\r'; write (1, &ch, 1); /* RAW mode needs '\r', does not hurt */ } } /******************** fairly portable part *********************************/ static void gl_puts (buf) char *buf; { int len; if (buf) { len = strlen (buf); write (1, buf, len); } } static void gl_error (buf) char *buf; { int len = strlen (buf); gl_cleanup (); write (2, buf, len); printf ("In gl_error"); fflush (stdout); exit (1); } static void gl_init () /* set up variables and terminal */ { if (gl_init_done < 0) { /* -1 only on startup */ hist_init (); } if (isatty (0) == 0 || isatty (1) == 0) gl_error ("\n*** Error: getline(): not interactive, use stdio.\n"); gl_char_init (); gl_init_done = 1; } static void gl_cleanup () /* undo effects of gl_init, as necessary */ { if (gl_init_done > 0) gl_char_cleanup (); gl_init_done = 0; } void gl_setwidth (w) int w; { if (w > 20) { gl_termw = w; gl_scroll = w / 3; } else { gl_error ("\n*** Error: minimum screen width is 21\n"); } } char * getline (prompt) char *prompt; { int c, loc, tmp; #ifdef __unix__ int sig; #endif gl_init (); gl_prompt = (prompt) ? prompt : ""; gl_buf[0] = 0; if (gl_in_hook) gl_in_hook (gl_buf); gl_fixup (gl_prompt, -2, BUF_SIZE); while ((c = gl_getc ()) >= 0) { gl_extent = 0; /* reset to full extent */ if (isprint (c)) { if (gl_search_mode) search_addchar (c); else gl_addchar (c); } else { if (gl_search_mode) { if (c == '\033' || c == '\016' || c == '\020') { search_term (); c = 0; /* ignore the character */ } else if (c == '\010' || c == '\177') { search_addchar (-1); /* unwind search string */ c = 0; } else if (c != '\022' && c != '\023') { search_term (); /* terminate and handle char */ } } switch (c) { case '\n': case '\r': /* newline */ /* gl_newline(); oscar */ gl_cleanup (); return gl_buf; /*NOTREACHED*/ break; case '\001': gl_fixup (gl_prompt, -1, 0); /* ^A */ break; case '\002': gl_fixup (gl_prompt, -1, gl_pos - 1); /* ^B */ break; case '\004': /* ^D */ if (gl_cnt == 0) { gl_buf[0] = 0; gl_cleanup (); gl_putc ('\n'); return gl_buf; } else { gl_del (0); } break; case '\005': gl_fixup (gl_prompt, -1, gl_cnt); /* ^E */ break; case '\006': gl_fixup (gl_prompt, -1, gl_pos + 1); /* ^F */ break; case '\010': case '\177': gl_del (-1); /* ^H and DEL */ break; case '\t': /* TAB */ if (gl_tab_hook) { tmp = gl_pos; loc = gl_tab_hook (gl_buf, gl_strlen (gl_prompt), &tmp); if (loc >= 0 || tmp != gl_pos) gl_fixup (gl_prompt, loc, tmp); } break; case '\013': gl_kill (gl_pos); /* ^K */ break; case '\014': gl_redraw (); /* ^L */ break; case '\016': /* ^N */ strcpy (gl_buf, hist_next ()); if (gl_in_hook) gl_in_hook (gl_buf); gl_fixup (gl_prompt, 0, BUF_SIZE); break; case '\017': gl_overwrite = !gl_overwrite; /* ^O */ break; case '\020': /* ^P */ strcpy (gl_buf, hist_prev ()); if (gl_in_hook) gl_in_hook (gl_buf); gl_fixup (gl_prompt, 0, BUF_SIZE); break; case '\022': search_back (1); /* ^R */ break; case '\023': search_forw (1); /* ^S */ break; case '\024': gl_transpose (); /* ^T */ break; case '\025': gl_kill (0); /* ^U */ break; case '\031': gl_yank (); /* ^Y */ break; case '\033': /* ansi arrow keys */ c = gl_getc (); if (c == '[') { switch (c = gl_getc ()) { case 'A': /* up */ strcpy (gl_buf, hist_prev ()); if (gl_in_hook) gl_in_hook (gl_buf); gl_fixup (gl_prompt, 0, BUF_SIZE); break; case 'B': /* down */ strcpy (gl_buf, hist_next ()); if (gl_in_hook) gl_in_hook (gl_buf); gl_fixup (gl_prompt, 0, BUF_SIZE); break; case 'C': gl_fixup (gl_prompt, -1, gl_pos + 1); /* right */ break; case 'D': gl_fixup (gl_prompt, -1, gl_pos - 1); /* left */ break; default: gl_putc ('\007'); /* who knows */ break; } } else if (c == 'f' || c == 'F') { gl_word (1); } else if (c == 'b' || c == 'B') { gl_word (-1); } else gl_putc ('\007'); break; default: /* check for a terminal signal */ #ifdef __unix__ if (c > 0) { /* ignore 0 (reset above) */ sig = 0; #ifdef SIGINT if (c == gl_intrc) sig = SIGINT; #endif #ifdef SIGQUIT if (c == gl_quitc) sig = SIGQUIT; #endif #ifdef SIGTSTP if (c == gl_suspc || c == gl_dsuspc) sig = SIGTSTP; #endif if (sig != 0) { gl_cleanup (); kill (0, sig); gl_init (); gl_redraw (); c = 0; } } #endif /* __unix__ */ if (c > 0) gl_putc ('\007'); break; } } } gl_cleanup (); gl_buf[0] = 0; return gl_buf; } static void gl_addchar (c) int c; /* adds the character c to the input buffer at current location */ { int i; if (gl_cnt >= BUF_SIZE - 1) gl_error ("\n*** Error: getline(): input buffer overflow\n"); if (gl_overwrite == 0 || gl_pos == gl_cnt) { for (i = gl_cnt; i >= gl_pos; i--) gl_buf[i + 1] = gl_buf[i]; gl_buf[gl_pos] = c; gl_fixup (gl_prompt, gl_pos, gl_pos + 1); } else { gl_buf[gl_pos] = c; gl_extent = 1; gl_fixup (gl_prompt, gl_pos, gl_pos + 1); } } static void gl_yank () /* adds the kill buffer to the input buffer at current location */ { int i, len; len = strlen (gl_killbuf); if (len > 0) { if (gl_overwrite == 0) { if (gl_cnt + len >= BUF_SIZE - 1) gl_error ("\n*** Error: getline(): input buffer overflow\n"); for (i = gl_cnt; i >= gl_pos; i--) gl_buf[i + len] = gl_buf[i]; for (i = 0; i < len; i++) gl_buf[gl_pos + i] = gl_killbuf[i]; gl_fixup (gl_prompt, gl_pos, gl_pos + len); } else { if (gl_pos + len > gl_cnt) { if (gl_pos + len >= BUF_SIZE - 1) gl_error ("\n*** Error: getline(): input buffer overflow\n"); gl_buf[gl_pos + len] = 0; } for (i = 0; i < len; i++) gl_buf[gl_pos + i] = gl_killbuf[i]; gl_extent = len; gl_fixup (gl_prompt, gl_pos, gl_pos + len); } } else gl_putc ('\007'); } static void gl_transpose () /* switch character under cursor and to left of cursor */ { int c; if (gl_pos > 0 && gl_cnt > gl_pos) { c = gl_buf[gl_pos - 1]; gl_buf[gl_pos - 1] = gl_buf[gl_pos]; gl_buf[gl_pos] = c; gl_extent = 2; gl_fixup (gl_prompt, gl_pos - 1, gl_pos); } else gl_putc ('\007'); } static void gl_newline () /* * Cleans up entire line before returning to caller. A \n is appended. * If line longer than screen, we redraw starting at beginning */ { int change = gl_cnt; int len = gl_cnt; int loc = gl_width - 5; /* shifts line back to start position */ if (gl_cnt >= BUF_SIZE - 1) gl_error ("\n*** Error: getline(): input buffer overflow\n"); if (gl_out_hook) { change = gl_out_hook (gl_buf); len = strlen (gl_buf); } if (loc > len) loc = len; gl_fixup (gl_prompt, change, loc); /* must do this before appending \n */ /* gl_buf[len] = '\n'; gl_buf[len+1] = '\0'; */ gl_buf[len] = '\0'; gl_putc ('\n'); } static void gl_del (loc) int loc; /* * Delete a character. The loc variable can be: * -1 : delete character to left of cursor * 0 : delete character under cursor */ { int i; if ((loc == -1 && gl_pos > 0) || (loc == 0 && gl_pos < gl_cnt)) { for (i = gl_pos + loc; i < gl_cnt; i++) gl_buf[i] = gl_buf[i + 1]; gl_fixup (gl_prompt, gl_pos + loc, gl_pos + loc); } else gl_putc ('\007'); } static void gl_kill (pos) int pos; /* delete from pos to the end of line */ { if (pos < gl_cnt) { strcpy (gl_killbuf, gl_buf + pos); gl_buf[pos] = '\0'; gl_fixup (gl_prompt, pos, pos); } else gl_putc ('\007'); } static void gl_word (direction) int direction; /* move forward or backword one word */ { int pos = gl_pos; if (direction > 0) { /* forward */ while (!isspace (gl_buf[pos]) && pos < gl_cnt) pos++; while (isspace (gl_buf[pos]) && pos < gl_cnt) pos++; } else { /* backword */ if (pos > 0) pos--; while (isspace (gl_buf[pos]) && pos > 0) pos--; while (!isspace (gl_buf[pos]) && pos > 0) pos--; if (pos < gl_cnt && isspace (gl_buf[pos])) /* move onto word */ pos++; } gl_fixup (gl_prompt, -1, pos); } static void gl_redraw () /* emit a newline, reset and redraw prompt and current input line */ { if (gl_init_done > 0) { gl_putc ('\n'); gl_fixup (gl_prompt, -2, gl_pos); } } static void gl_fixup (prompt, change, cursor) char *prompt; int change, cursor; /* * This function is used both for redrawing when input changes or for * moving within the input line. The parameters are: * prompt: compared to last_prompt[] for changes; * change : the index of the start of changes in the input buffer, * with -1 indicating no changes, -2 indicating we're on * a new line, redraw everything. * cursor : the desired location of the cursor after the call. * A value of BUF_SIZE can be used to indicate the cursor should * move just past the end of the input line. */ { static int gl_shift; /* index of first on screen character */ static int off_right; /* true if more text right of screen */ static int off_left; /* true if more text left of screen */ static char last_prompt[80] = ""; int left = 0, right = -1; /* bounds for redraw */ int pad; /* how much to erase at end of line */ int backup; /* how far to backup before fixing */ int new_shift; /* value of shift based on cursor */ int extra; /* adjusts when shift (scroll) happens */ int i; int new_right = -1; /* alternate right bound, using gl_extent */ int l1, l2; if (change == -2) { /* reset */ gl_pos = gl_cnt = gl_shift = off_right = off_left = 0; gl_putc ('\r'); gl_puts (prompt); strcpy (last_prompt, prompt); change = 0; gl_width = gl_termw - gl_strlen (prompt); } else if (strcmp (prompt, last_prompt) != 0) { l1 = gl_strlen (last_prompt); l2 = gl_strlen (prompt); gl_cnt = gl_cnt + l1 - l2; strcpy (last_prompt, prompt); gl_putc ('\r'); gl_puts (prompt); gl_pos = gl_shift; gl_width = gl_termw - l2; change = 0; } pad = (off_right) ? gl_width - 1 : gl_cnt - gl_shift; /* old length */ backup = gl_pos - gl_shift; if (change >= 0) { gl_cnt = strlen (gl_buf); if (change > gl_cnt) change = gl_cnt; } if (cursor > gl_cnt) { if (cursor != BUF_SIZE) /* BUF_SIZE means end of line */ gl_putc ('\007'); cursor = gl_cnt; } if (cursor < 0) { gl_putc ('\007'); cursor = 0; } if (off_right || (off_left && cursor < gl_shift + gl_width - gl_scroll / 2)) extra = 2; /* shift the scrolling boundary */ else extra = 0; new_shift = cursor + extra + gl_scroll - gl_width; if (new_shift > 0) { new_shift /= gl_scroll; new_shift *= gl_scroll; } else new_shift = 0; if (new_shift != gl_shift) { /* scroll occurs */ gl_shift = new_shift; off_left = (gl_shift) ? 1 : 0; off_right = (gl_cnt > gl_shift + gl_width - 1) ? 1 : 0; left = gl_shift; new_right = right = (off_right) ? gl_shift + gl_width - 2 : gl_cnt; } else if (change >= 0) { /* no scroll, but text changed */ if (change < gl_shift + off_left) { left = gl_shift; } else { left = change; backup = gl_pos - change; } off_right = (gl_cnt > gl_shift + gl_width - 1) ? 1 : 0; right = (off_right) ? gl_shift + gl_width - 2 : gl_cnt; new_right = (gl_extent && (right > left + gl_extent)) ? left + gl_extent : right; } pad -= (off_right) ? gl_width - 1 : gl_cnt - gl_shift; pad = (pad < 0) ? 0 : pad; if (left <= right) { /* clean up screen */ for (i = 0; i < backup; i++) gl_putc ('\b'); if (left == gl_shift && off_left) { gl_putc ('$'); left++; } for (i = left; i < new_right; i++) if (echo) { gl_putc (gl_buf[i]); } else { gl_putc ('*'); } gl_pos = new_right; if (off_right && new_right == right) { gl_putc ('$'); gl_pos++; } else { for (i = 0; i < pad; i++) /* erase remains of prev line */ gl_putc (' '); gl_pos += pad; } } i = gl_pos - cursor; /* move to final cursor location */ if (i > 0) { while (i--) gl_putc ('\b'); } else { for (i = gl_pos; i < cursor; i++) if (echo) { gl_putc (gl_buf[i]); } else { gl_putc ('*'); } } gl_pos = cursor; } static int gl_tab (buf, offset, loc) char *buf; int offset; int *loc; /* default tab handler, acts like tabstops every 8 cols */ { int i, count, len; len = strlen (buf); count = 8 - (offset + *loc) % 8; for (i = len; i >= *loc; i--) buf[i + count] = buf[i]; for (i = 0; i < count; i++) buf[*loc + i] = ' '; i = *loc; *loc = i + count; return i; } /******************* strlen stuff **************************************/ void gl_strwidth (func) size_t (*func) (); { if (func != 0) { gl_strlen = func; } } /******************* History stuff **************************************/ #ifndef HIST_SIZE #define HIST_SIZE 100 #endif static int hist_pos = 0, hist_last = 0; static char *hist_buf[HIST_SIZE]; static void hist_init () { int i; hist_buf[0] = ""; for (i = 1; i < HIST_SIZE; i++) hist_buf[i] = (char *) 0; } void gl_histadd (buf) char *buf; { static char *prev = 0; char *p = buf; int len; /* in case we call gl_histadd() before we call getline() */ if (gl_init_done < 0) { /* -1 only on startup */ hist_init (); gl_init_done = 0; } while (*p == ' ' || *p == '\t' || *p == '\n') p++; if (*p) { len = strlen (buf); if (strchr (p, '\n')) /* previously line already has NL stripped */ len--; if (prev == 0 || strlen (prev) != len || strncmp (prev, buf, len) != 0) { hist_buf[hist_last] = hist_save (buf); prev = hist_buf[hist_last]; hist_last = (hist_last + 1) % HIST_SIZE; if (hist_buf[hist_last] && *hist_buf[hist_last]) { free (hist_buf[hist_last]); } hist_buf[hist_last] = ""; } } hist_pos = hist_last; } static char * hist_prev () /* loads previous hist entry into input buffer, sticks on first */ { char *p = 0; int next = (hist_pos - 1 + HIST_SIZE) % HIST_SIZE; if (hist_buf[hist_pos] != 0 && next != hist_last) { hist_pos = next; p = hist_buf[hist_pos]; } if (p == 0) { p = ""; gl_putc ('\007'); } return p; } static char * hist_next () /* loads next hist entry into input buffer, clears on last */ { char *p = 0; if (hist_pos != hist_last) { hist_pos = (hist_pos + 1) % HIST_SIZE; p = hist_buf[hist_pos]; } if (p == 0) { p = ""; gl_putc ('\007'); } return p; } static char * hist_save (p) char *p; /* makes a copy of the string */ { char *s = 0; int len = strlen (p); char *nl = strchr (p, '\n'); if (nl) { if ((s = malloc (len)) != 0) { strncpy (s, p, len - 1); s[len - 1] = 0; } } else { if ((s = malloc (len + 1)) != 0) { strcpy (s, p); } } if (s == 0) gl_error ("\n*** Error: hist_save() failed on malloc\n"); return s; } /******************* Search stuff **************************************/ static char search_prompt[101]; /* prompt includes search string */ static char search_string[100]; static int search_pos = 0; /* current location in search_string */ static int search_forw_flg = 0; /* search direction flag */ static int search_last = 0; /* last match found */ static void search_update (c) int c; { if (c == 0) { search_pos = 0; search_string[0] = 0; search_prompt[0] = '?'; search_prompt[1] = ' '; search_prompt[2] = 0; } else if (c > 0) { search_string[search_pos] = c; search_string[search_pos + 1] = 0; search_prompt[search_pos] = c; search_prompt[search_pos + 1] = '?'; search_prompt[search_pos + 2] = ' '; search_prompt[search_pos + 3] = 0; search_pos++; } else { if (search_pos > 0) { search_pos--; search_string[search_pos] = 0; search_prompt[search_pos] = '?'; search_prompt[search_pos + 1] = ' '; search_prompt[search_pos + 2] = 0; } else { gl_putc ('\007'); hist_pos = hist_last; } } } static void search_addchar (c) int c; { char *loc; search_update (c); if (c < 0) { if (search_pos > 0) { hist_pos = search_last; } else { gl_buf[0] = 0; hist_pos = hist_last; } strcpy (gl_buf, hist_buf[hist_pos]); } if ((loc = strstr (gl_buf, search_string)) != 0) { gl_fixup (search_prompt, 0, loc - gl_buf); } else if (search_pos > 0) { if (search_forw_flg) { search_forw (0); } else { search_back (0); } } else { gl_fixup (search_prompt, 0, 0); } } static void search_term () { gl_search_mode = 0; if (gl_buf[0] == 0) /* not found, reset hist list */ hist_pos = hist_last; if (gl_in_hook) gl_in_hook (gl_buf); gl_fixup (gl_prompt, 0, gl_pos); } static void search_back (new_search) int new_search; { int found = 0; char *p, *loc; search_forw_flg = 0; if (gl_search_mode == 0) { search_last = hist_pos = hist_last; search_update (0); gl_search_mode = 1; gl_buf[0] = 0; gl_fixup (search_prompt, 0, 0); } else if (search_pos > 0) { while (!found) { p = hist_prev (); if (*p == 0) { /* not found, done looking */ gl_buf[0] = 0; gl_fixup (search_prompt, 0, 0); found = 1; } else if ((loc = strstr (p, search_string)) != 0) { strcpy (gl_buf, p); gl_fixup (search_prompt, 0, loc - p); if (new_search) search_last = hist_pos; found = 1; } } } else { gl_putc ('\007'); } } static void search_forw (new_search) int new_search; { int found = 0; char *p, *loc; search_forw_flg = 1; if (gl_search_mode == 0) { search_last = hist_pos = hist_last; search_update (0); gl_search_mode = 1; gl_buf[0] = 0; gl_fixup (search_prompt, 0, 0); } else if (search_pos > 0) { while (!found) { p = hist_next (); if (*p == 0) { /* not found, done looking */ gl_buf[0] = 0; gl_fixup (search_prompt, 0, 0); found = 1; } else if ((loc = strstr (p, search_string)) != 0) { strcpy (gl_buf, p); gl_fixup (search_prompt, 0, loc - p); if (new_search) search_last = hist_pos; found = 1; } } } else { gl_putc ('\007'); } } char * getlinenoecho (prompt) char *prompt; { char *p; echo = (1 == 0); p = getline (prompt); echo = (1 == 1); return p; } gpstrans-0.41/src/getline/getline.h0000644000175000017500000000160010225356640014236 00000000000000#ifndef GETLINE_H #define GETLINE_H /* unix systems can #define POSIX to use termios, otherwise * the bsd or sysv interface will be used */ #if __STDC__ > 0 #include typedef size_t (*gl_strwidth_proc) (char *); char *getline (char *); /* read a line of input */ char *getlinenoecho (char *); /* read a line of input */ void gl_setwidth (int); /* specify width of screen */ void gl_histadd (char *); /* adds entries to hist */ void gl_strwidth (gl_strwidth_proc); /* to bind gl_strlen */ extern int (*gl_in_hook) (char *); extern int (*gl_out_hook) (char *); extern int (*gl_tab_hook) (char *, int, int *); #else /* not __STDC__ */ char *getline (); char *getlinenoecho (); void gl_setwidth (); void gl_histadd (); void gl_strwidth (); extern int (*gl_in_hook) (); extern int (*gl_out_hook) (); extern int (*gl_tab_hook) (); #endif /* __STDC__ */ #endif /* GETLINE_H */ gpstrans-0.41/src/getline/testgl.c0000644000175000017500000000040110225356640014102 00000000000000#include #include "getline.h" main() /* * just echo user input lines, letting user edit them and move through * history list */ { char *p; do { p = getline("PROMPT>>>> "); gl_histadd(p); fputs(p, stdout); } while (*p != 0); } gpstrans-0.41/src/include/0000755000175000017500000000000011037770611012515 500000000000000gpstrans-0.41/src/include/Garmin.h0000644000175000017500000001002010427451646014022 00000000000000static const double Pi = 3.14159265358979323846; /*static const double Degree = Pi/180.0; */ static const double Degree = 1.74532925199432957692e-2; typedef unsigned char BYTE; #define MAX_LENGTH 520 /* maximum length of Garmin binary message would be 255+overhead, except that it might contain lots of 0x10 bytes which must be doubled*/ #define MAX_LINE 256 /* data file maximum line length */ /*#define OUTDRIVER "\p.AOut" #define INDRIVER "\p.AIn" */ /* Garmin message type characters */ #define RTE_NAM 0x1d /* Route name record */ #define RTE_WPT 0x1e /* Route waypoint record */ #define ALM 0x1f /* Almanac record */ #define TRK 0x22 /* Track record */ #define WPT 0x23 /* Waypoint record */ #define GMNID 0x7e /* Request Garmin ID */ /* Transfer types */ #define ALMANAC 0 #define ROUTE 1 #define TRACK 2 #define WAYPOINT 3 enum PROTOCOL { NONE, GARMIN, NMEA }; /* prototypes */ /* int serialOpen(enum PROTOCOL); void serialClose(void); */ long serialCharsAvail (void); short getGPSMessage (void); void sendGPSMessage (BYTE * m, short length); int getGPSack (); extern int naks; /* transmitted packets rejected */ void getGPSInfo (FILE * refNum, short type); void sendGPSInfo (FILE * refNum, short type); void saveFormat (char *, short); int getGPSVersion (char **); double int2deg (long n); long deg2int (double x); char *secs2dt (long secs, short offset); long dt2secs (char *dt, int offset); void DegToUTM (double lat, double lon, char *zone, double *x, double *y); void UTMtoDeg (short zone, short southernHemisphere, double x, double y, double *lat, double *lon); void DegToKKJ (double lat, double lon, char *zone, double *x, double *y); void KKJtoDeg (short zone, short southernHemisphere, double x, double y, double *lat, double *lon); void toTM (double lat, double lon, double lat0, double lon0, double k0, double *x, double *y); void fromTM (double x, double y, double lat0, double lon0, double k0, double *lat, double *lon); void toUPS (double lat, double lon, double *x, double *y); void fromUPS (short southernHemisphere, double x, double y, double *lat, double *lon); void DegToBNG (double lat, double lon, char *zone, double *x, double *y); void BNGtoDeg (char *zone, double x, double y, double *lat, double *lon); void DegToSEG (double lat, double lon, double *x, double *y); void SEGtoDeg (double x, double y, double *lat, double *lon); void DegToITM (double lat, double lon, char *zone, double *x, double *y); void ITMtoDeg (char *zone, double x, double y, double *lat, double *lon); void GKKtoDeg (double x, double y, double *lat, double *lon); void DegToGKK (double lat, double lon, double *x, double *y); void datumParams (short datum, double *a, double *es); short GetLine (FILE * refNum, char *line, short init); void InitBarGraph (void); void SetBarGraph (double value); void CloseBarGraph (void); void Message (char *txt); int CheckGPS (void); void NotResponding (void); int serialOpen (enum PROTOCOL p); void serialClose (); void Error (char *txt); char *toDMS (double a); char *toDM (double a); double DMStoDegrees (char *s); double DMtoDegrees (char *s); void translate (short fromWGS84, double *latitude, double *longitude, short datumID); struct DATUM { char *name; short ellipsoid; short dx; short dy; short dz; }; struct ELLIPSOID { char *name; /* name of ellipsoid */ double a; /* semi-major axis, meters */ double invf; /* 1/f */ }; /* Messages declarations */ extern BYTE m1[], m2[]; extern BYTE p1[], p2[]; extern BYTE alm1[], alm2[]; extern BYTE trk1[], trk2[]; extern BYTE wpt1[], wpt2[]; extern BYTE rte1[], rte2[], rte3[]; extern BYTE almt[], rtet[], trkt[], wptt[]; extern BYTE gid2[], gid3[], gid4[], gid5[]; extern BYTE off1[], test[]; extern BYTE tim1[]; enum FILE_FORMAT { TSV=3333, /* tab separated value */ // CSV, /* comma separated value */ MAYKO, /* for basic Mayko xMap format */ MAYKO2 /* for Mayko xMap with rate data */ }; extern enum FILE_FORMAT file_format; extern int debugging; extern int verbose; gpstrans-0.41/src/include/Prefs.h0000644000175000017500000000251710225356640013672 00000000000000/* Note: The order of the seven items DMSITEM, DMMITEM, DDDITEM, UTMITEM, BNGITEM ITMITEM and SUIITEM must not be changed. The function doRadioButtons() in the file Prefs.c depends upon this order. */ #define OKITEM 1 /* OK button */ #define CANCELITEM 2 /* Cancel button */ #define LISTITEM 3 /* Datum list */ #define DESCITEM 4 /* Datum description static text item */ #define DMSITEM 5 /* D”MM'SS.S" format radio button */ #define DMMITEM 6 /* D”MM.MMM' format radio button */ #define DDDITEM 7 /* D.DDDDD format radio button */ #define UTMITEM 8 /* UTM format radio button */ #define BNGITEM 9 /* British Grid format radio button */ #define ITMITEM 10 /* Irish Grid format radio button */ #define SUIITEM 11 /* Swiss Grid format radio button */ #define CREATITEM 12 /* Text file creator edit text item */ #define OFFSETITEM 13 /* Local time - UTC offset edit text item */ #define DUMMYITEM 14 /* used so that one can set up the default item. */ /* Resource ID's */ #define DIALOGID 129 /* Maximum length of description field */ #define DESC_LEN 30 enum FORMAT { DMS, DMM, DDD, UTM, BNG, ITM, KKJ, SEG, GKK }; struct PREFS { short datum; enum FORMAT format; double offset; char Device[255]; char feet; /* nonzero if altitude in ft */ char model; }; void ChangePrefs (void); void InitPrefs (); void SetupProgram (); gpstrans-0.41/src/include/defs.h0000644000175000017500000000117711037513657013542 00000000000000#include #include #include #include #include #include #include #include #define ProgramName "GPStrans" #define ProgramVersion "0.41" #define ProgramYear "2005" #define MainMenuHeader "GPS Transfer" #define BarWindowHeader "Transfer in progress..." #define PrefsWindowHeader "Preferences" #define PrefFileName "~/.gpstrans" #define DefaultServerDevice "/dev/ttyS1" #define ServerBaud B4800 #define TIMEOUT 10 #define noErr 0 #define X_NULL (int) NULL gpstrans-0.41/src/include/gpsinfo.h0000644000175000017500000000010510427451641014250 00000000000000int getGPSVersion (char **); long sendGPSOff (); long getGPSTime (); gpstrans-0.41/src/include/gpstrans.gif0000644000175000017500000000210110225356640014757 00000000000000GIF87a˜Æš’’’,˜ÆžŒ©Ėķ£œ“Ś‹³Ž¼{ „āH~ę‰ZäŹ²é {ķL·ń3õ^nLńv‘YšČl¾QꇌVB§¢“YI·kp3rĒMo”F>c¹Ź“ū /ÉTyŽ¢ķY=Xč·Ē÷4„ˆ7‚˜tŲ“(ćØŲ(ŠöˆA95ÉSUw‰É¤¹ÉYęł) %1X©uŠj 3ŚźśZՐśRk Éėū ,\‘+1¢Ä‰+‚ڲŠ"„žw©Sb=pŪ4”7’dædĄRŗ[©ī‘Ė‘ō š‰3!Ą‡irś Ł%Ž›Ÿ–Ī)āćO£Ņ„L›:} •ĒØ@ˆ¦TjµžÄ€Yc×U„Āxa§ LU–ߣgimŽmĖÉķŚ™TėŚ½‹7ÆĮ‚`ŒōU2P/ƅ?óE*!\Æ7§-vŁXčcœvXīœürØU˜sV…Ö§³ĒϬ v@łĪ$Ó< e ;¶ģŁp<VF3FiY™P֝”·čŽ'vޚuL]Čušnøłķē „4ĒQ£hĒĮ̽ūr‡‹³L Ö³ö:AšCģ Üš[1oŗ}ėčĆålĖĒEa²ČN’¼&™õ&„ņŗßl·ōŽl“ŸL³6*“jFĖ>Öd3Åź’Œōaē uŹ:_pŃ1ó)iÓ<+–õ7„Ž˜“ŌÖRM4Š„į‹óŹóĶ'6BMö|ś$fĆŠr›-ģæ‹p{šĄĪõµ•J#ø7Ü}Ū7ā^Ӛ7į”x+Æām«$M¹ąWųs =Ļż“ƒW~7Üd~āę ¾Ż8㔯lÆQ;gpstrans-0.41/src/include/gpstrans.icon0000644000175000017500000003073710225356640015162 00000000000000/* Format_version=1, Width=160, Height=175, Depth=1, Valid_bits_per_item=16 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x007f,0xff00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0fff,0xfff8,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0001,0xffff,0xffff,0xc000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x001f,0xffff,0xfff9, 0xfc00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x007f, 0xffff,0xc001,0xff00,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x01c7,0xf8f8,0x0000,0x3f80,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0187,0x80f8,0x0000,0x07e0,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0780,0x8000,0x0000, 0x0ff8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1f80, 0x0000,0x0000,0x03ff,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x7e00,0x0000,0x0000,0x0380,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0100,0x0000,0x0000, 0x0180,0x0000,0x0000,0x0000,0x0000,0x0000,0x000f,0xff00, 0x0000,0x0000,0xffff,0xff00,0x0000,0x0000,0x0000,0x0000, 0x0003,0xfffe,0x0000,0x0001,0xffff,0xffc0,0x0000,0x0000, 0x0000,0x0000,0x0000,0xfffe,0x0000,0x0007,0xffff,0xffc0, 0x0000,0x0000,0x0000,0x0000,0x0000,0x3ffe,0x0000,0x003f, 0xffff,0xff00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0fff, 0x0000,0x00ff,0xffff,0xfe1c,0x0000,0x0000,0x0000,0x0000, 0x0000,0x03ff,0x0000,0x07ff,0xffff,0xfe1c,0x0000,0x0000, 0x0000,0x0000,0x0000,0x01ff,0x0000,0x1fff,0xffff,0xfe3e, 0x0000,0x0000,0x0000,0x0000,0x0000,0x01ff,0x8000,0x3fff, 0xffff,0xffbf,0x8000,0x0000,0x0000,0x0000,0x0000,0x00fe, 0x0000,0x0000,0x1fff,0xffbf,0xc000,0x0000,0x0000,0x0000, 0x0002,0x00fe,0x0000,0x0000,0x1f80,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0006,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x007f,0x01ff,0xe000,0x003f,0xff07,0xfff0, 0x0000,0x0000,0x0000,0x0000,0x00ff,0xcfff,0xe07f,0xffff, 0xff03,0xfff0,0x0000,0x0000,0x0000,0x0000,0x01e3,0xffff, 0xfe7f,0xffff,0xfe03,0xffe0,0x0000,0x0000,0x0000,0x0000, 0x0381,0xffff,0xffff,0xffff,0xfe03,0xffe0,0x0000,0x0000, 0x0000,0x0000,0x0780,0x7fff,0xffff,0xffff,0xfe03,0xffe0, 0x0000,0x0000,0x0000,0x0000,0x0f80,0x3fff,0xffff,0xffff, 0xfe03,0xfc00,0x0000,0x0000,0x0000,0x0000,0x0f80,0x1fff, 0xffff,0xffff,0xfe03,0xe000,0x0000,0x0000,0x0000,0x0000, 0x0f00,0x07ff,0xfff0,0x07ff,0xfe83,0xc000,0x0000,0x0000, 0x0000,0x0000,0x0f00,0x07c0,0x0000,0x07ff,0xfeff,0x8000, 0x0000,0x0000,0x0000,0x0000,0x0f00,0x01c0,0x0000,0x0000, 0x007f,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0180,0x0000,0x0000, 0x0780,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x1fff, 0xffe0,0x1fff,0xffc0,0x00e4,0x0000,0x0000,0x0000,0x0000, 0x0000,0x3fff,0xffff,0xffff,0xffe0,0x01e6,0x0000,0x0000, 0x0000,0x0000,0x0000,0xffff,0xffff,0xffff,0xfff0,0x07ff, 0x0000,0x0000,0x0000,0x0000,0x0001,0xffff,0xffff,0xffff, 0xfff0,0x0fff,0xf000,0x0000,0x0000,0x0000,0x0007,0xffff, 0xffff,0xffff,0xfff8,0x1fff,0xff80,0x0000,0x0000,0x0000, 0x007f,0xffff,0xffff,0xffff,0xffff,0xe003,0xff00,0x0000, 0x0000,0x0000,0x01ff,0xffff,0xffff,0xffff,0xffff,0x8000, 0xfe00,0x0000,0x0000,0x0000,0x03ff,0xffff,0xfffe,0x3fff, 0xfffc,0x0000,0x0c00,0x0000,0x0000,0x0000,0x07ff,0xf800, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x7fff,0xff80,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x7fff,0xffff,0xffff,0xffff,0xff00,0x0000, 0x0000,0x0000,0x0000,0x0000,0x7fff,0xffff,0xffff,0xffff, 0xfe00,0x0000,0x0000,0x0000,0x0000,0x0030,0x3fff,0xffff, 0xffff,0xffff,0xfe00,0x0000,0x0000,0x0000,0x0000,0x00f8, 0x3fff,0xffff,0xffff,0xffff,0xfe00,0x0000,0x0000,0x0000, 0x0000,0x01fc,0x1fff,0xffff,0xffff,0xffff,0xfc00,0x0000, 0x0000,0x0000,0x0000,0x03fe,0x1fff,0xffff,0xffff,0xffff, 0xf800,0x0000,0x0000,0x0000,0x0000,0x0fff,0x9fff,0xffff, 0xffff,0xffff,0xf000,0x0000,0x0000,0x0000,0x0000,0x1fff, 0xffff,0xffff,0xffff,0x7fff,0xf000,0x0000,0x0000,0x0000, 0x0000,0x1fff,0xffff,0xff80,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x018b,0xfebd,0xc000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x007e,0x03ff,0xffff,0xfff0,0x0000,0x0000, 0x1800,0x0000,0x0000,0x0000,0x007f,0x01ff,0xffff,0xffff, 0xffff,0xffff,0xfe00,0x0000,0x0000,0x0000,0x007f,0x81ff, 0xffff,0xffff,0xffff,0xffff,0xff80,0x0000,0x0000,0x0000, 0x007f,0x81ff,0xffff,0xffff,0xffff,0xffff,0xffe0,0x0000, 0x0000,0x0000,0x007f,0x801f,0xffff,0xffff,0xffff,0xffff, 0xfffc,0x0000,0x0000,0x0000,0x007f,0xe000,0x1fff,0xffff, 0xffff,0xffff,0xffff,0xffe0,0x0000,0x0000,0x007f,0xff80, 0x0000,0x7fff,0xffff,0xffff,0xffff,0xff80,0x0000,0x0000, 0x007f,0xfff0,0x0000,0x01ff,0xffe0,0x00ff,0xffff,0xffe0, 0x0000,0x0000,0x007f,0xfffc,0x0000,0x00ff,0xc000,0x0001, 0xffff,0xfffc,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0006,0x2000,0x0007, 0xffff,0xfffe,0x0000,0x0000,0x003f,0xffe0,0x0000,0x0003, 0xff80,0x00ff,0xffff,0xfffe,0x0000,0x0000,0x003f,0xffe0, 0x0000,0x0003,0xffff,0xffff,0xffff,0xfffe,0x0000,0x0000, 0x003f,0xffe0,0x0000,0x0000,0xffff,0xffff,0xffff,0xfffe, 0x0000,0x0000,0x003f,0xffc0,0x0000,0x0000,0x3fff,0xffff, 0xffff,0xfffe,0x0000,0x0000,0x003f,0xffc0,0x0000,0x0000, 0x0fff,0xffff,0xffff,0xfffe,0x0000,0x0000,0x003f,0xffc0, 0x0000,0x0000,0x01ff,0xffff,0xffff,0xfffe,0x0000,0x0000, 0x001f,0xffc0,0x0000,0x0000,0x007f,0xffff,0xffff,0xfffe, 0x0000,0x0400,0x001f,0xffc0,0x0000,0x0000,0x001f,0xffff, 0xffff,0xfffc,0x0000,0x0800,0x001f,0xffc0,0x0000,0x0000, 0x000f,0xffff,0xffff,0xfff8,0x0000,0x0800,0x000f,0xffc0, 0x0000,0x0000,0x000f,0xffff,0xffff,0xfff8,0x0000,0x1800, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x003f,0xffff,0xff47,0xfff9,0x0000,0x3800, 0x0003,0xffff,0x0000,0x0000,0x007f,0xffff,0xffff,0xffff, 0x8000,0x7000,0x0003,0xffff,0xc000,0x0000,0x007f,0xffff, 0xffff,0xffff,0x8000,0xf000,0x0001,0xffff,0xe000,0x0000, 0x03ff,0xffff,0xffff,0xffff,0x8000,0xf000,0x0001,0xffff, 0xf800,0x0000,0x1fff,0xffff,0xffff,0xffff,0x0001,0xe000, 0x0000,0xffff,0xfe00,0x0000,0xffff,0xffff,0xffff,0xffff, 0x0003,0xe000,0x0000,0xffff,0xfe00,0x0003,0xffff,0xffff, 0xffff,0xffff,0x0003,0xc000,0x0000,0x7fff,0xfe00,0x0007, 0xffff,0xffff,0xffff,0xffff,0x0007,0xc000,0x0000,0x7fff, 0xfe00,0x0007,0xffff,0xffff,0xffff,0xffff,0x000f,0x8000, 0x0000,0x7fff,0xfe00,0x000f,0xffff,0xffff,0xffff,0xffff, 0x000f,0x8000,0x0000,0x3fff,0xfe00,0x0000,0x0000,0x0000, 0x007f,0xffff,0x001f,0x8000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0fff,0xff00,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x07ff,0xff00,0x003f, 0xffff,0xffff,0xff80,0x0000,0x0000,0x0000,0x0000,0x07ff, 0xff00,0x007f,0xffff,0xffff,0xffff,0xffff,0x00fc,0x0000, 0x0000,0x03ff,0xff00,0x007f,0xffff,0xffff,0xffff,0xffff, 0x01f8,0x0000,0x0000,0x01ff,0xff00,0x00ff,0xffff,0xffff, 0xffff,0xffff,0x07f8,0x0000,0x0000,0x01ff,0xff00,0x00ff, 0xffff,0xffff,0xffff,0xfffe,0x7ff0,0x0000,0x0000,0x00ff, 0xff00,0x01ff,0xffff,0xffff,0xffff,0xffff,0xffe0,0x0000, 0x0000,0x007f,0xff00,0x01ff,0xffff,0xffff,0xffff,0xffff, 0xffe0,0x0000,0x0000,0x003f,0xff00,0x01ff,0xffff,0xffff, 0xffff,0xffff,0xffc0,0x0000,0x0000,0x003f,0xff00,0x01ff, 0xffff,0xffff,0xffff,0xffff,0xff80,0x0000,0x0000,0x001f, 0xff00,0x01ff,0xffff,0xffff,0xffff,0xffff,0xff80,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x007f,0xffff, 0xff00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x01ff, 0xffff,0xffff,0xff80,0x0000,0x0000,0x0000,0x0000,0x0001, 0xffe0,0x03ff,0xffff,0xffff,0xffff,0xffff,0xf000,0x0000, 0x0000,0x0000,0xffe0,0x01ff,0xffff,0xffff,0xffff,0xffff, 0xe000,0x0000,0x0000,0x0000,0xfff0,0x01ff,0xffff,0xffff, 0xffff,0xffff,0xc000,0x0000,0x0000,0x0000,0x7ff8,0x01ff, 0xffff,0xffff,0xffff,0xffff,0x8000,0x0000,0x0000,0x0000, 0x3ffc,0x01ff,0xffff,0xffff,0xffff,0xffff,0x0000,0x0000, 0x0000,0x0000,0x1ffe,0x00ff,0xffff,0xffff,0xffff,0xfffe, 0x0000,0x0000,0x0000,0x0000,0x07ff,0x00ff,0xffff,0xffff, 0xffff,0xfffc,0x0000,0x0000,0x0000,0x0000,0x03ff,0x807f, 0xffff,0xffff,0xffff,0xfff8,0x0000,0x0000,0x0000,0x0000, 0x01ff,0xfe7f,0xffff,0xffff,0xffff,0xfff0,0x0000,0x0000, 0x0000,0x0000,0x00ff,0xffff,0xffff,0xffff,0xffff,0xffe0, 0x0000,0x0000,0x0000,0x0000,0x007f,0xffff,0xffff,0xffff, 0xffff,0xffc0,0x0000,0x0000,0x0000,0x0000,0x0000,0x01ff, 0xffff,0xffff,0xff80,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x63ff, 0xfffe,0xd7ff,0xffff,0xc000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x3fff,0xffff,0xffff,0xffff,0x8000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x03ff,0xffff,0xffff,0xfffe,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x01ff,0xffff,0xffff, 0xfff8,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x01ff, 0xffff,0xffff,0xffc0,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0007,0xffff,0xffff,0xf800,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x3fff,0xffff,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x07ff,0xfff8, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0fff,0x03ff,0xf00f, 0xfc00,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3fff, 0x83ff,0xfc1f,0xfc01,0x8000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x7fff,0x83ff,0xfe3f,0xfe0f,0x8000,0x0000,0x0000, 0x0000,0x0000,0x0000,0xffff,0x87ff,0xfe7f,0xfe1f,0x8000, 0x0000,0x0000,0x0000,0x0000,0x0001,0xffff,0xc7ff,0xff7f, 0xfe1f,0x8000,0x0000,0x0000,0x0000,0x0000,0x0001,0xfc00, 0x0000,0x7f7f,0x001f,0x8000,0x0000,0x0000,0x0000,0x0000, 0x0003,0xf800,0x03f0,0x3f7f,0x007f,0xf1fb,0x81ff,0xe3ff, 0xc07f,0x0000,0x0003,0xf07f,0xc3f0,0x3f7f,0x807f,0xf1ff, 0x87ff,0xe3ff,0xe0ff,0x0000,0x0003,0xf07f,0xc3f0,0x7f3f, 0xc07f,0xf1ff,0x8fff,0xe3ff,0xf1ff,0x8000,0x0003,0xf07f, 0xc3f0,0xfe3f,0xe07f,0xf1ff,0x8fff,0xe3ff,0xf9ff,0x8000, 0x0003,0xf07f,0xc3f1,0xfe1f,0xe07f,0xf1ff,0x9fff,0xe3ff, 0xf9ff,0x8000,0x0003,0xf07f,0xc3f7,0xfc0f,0xf01f,0x81fe, 0x1fc7,0xe3f1,0xf9fc,0x0000,0x0003,0xf00f,0xc3ff,0xf807, 0xf81f,0x81f8,0x1f87,0xe3f1,0xf9fc,0x0000,0x0001,0xf80f, 0xc3ff,0xf003,0xfc1f,0x81f8,0x1f87,0xe3f1,0xf8fe,0x0000, 0x0001,0xf80f,0xc3ff,0xe003,0xfe1f,0x81f8,0x1f87,0xe3f1, 0xf87f,0x0000,0x0001,0xfc0f,0xc3ff,0x8001,0xfe1f,0x81f8, 0x1f87,0xe3f1,0xf87f,0x0000,0x0000,0xfe0f,0xc3fe,0x0000, 0xff1f,0x81f8,0x0fc7,0xe3f1,0xf83f,0x8000,0x0000,0xff0f, 0xc3f8,0x0000,0x7f1f,0x81f8,0x0fe7,0xe3f1,0xf83f,0x8000, 0x0000,0x7fcf,0xc3f0,0x0000,0x7f1f,0x81f8,0x0ff7,0xe3f1, 0xf81f,0xc000,0x0000,0x3fff,0xc3f0,0x007f,0xff1f,0xf1f8, 0x07ff,0xe3f1,0xf9ff,0xc000,0x0000,0x1fff,0xc3f0,0x007f, 0xff1f,0xf1f8,0x03ff,0xe3f1,0xf9ff,0xc000,0x0000,0x0fff, 0xc3f0,0x003f,0xfe0f,0xf1f8,0x01ff,0xe3f1,0xf9ff,0xc000, 0x0000,0x03ff,0xc3f0,0x003f,0xfc0f,0xe1f8,0x00ff,0xe3f1, 0xf8ff,0x8000,0x0000,0x007f,0xc3f0,0x003f,0xf803,0xe1f8, 0x003f,0xe3f1,0xf8fe,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 gpstrans-0.41/src/include/gpstrans_small.gif0000644000175000017500000000042510225356640016156 00000000000000GIF87a@@€’’’,@@ōŒ©Ėķ£œ“€³¶\źYG"€q¢)–ÖXmnü®3ŚM.ß{Æą}P¾_+!]t>ŪĒ,J§ŠÕuUJCÉīóŚtzy¦g))SQŖū ‡“hłœ®–īü ™£'8Gˆ“Ē—ę£hX䘳vXI3IŌV 3łøĒŁéł£§6JZE¹@V6f 7Wŗź€ZXūp«‰eźįYƒKĢĖ(9qklŲ<“ŪźĖ['ķŒĘköw¼•ÜmūķŖmÕė§KĪõnš.®Üī¾n·-ožz©Ÿī=äO4zÆ-Ū4œ—‚ :|ų¦;gpstrans-0.41/src/include/graph.h0000644000175000017500000000002610225356640013705 00000000000000void SetFrameBusy (); gpstrans-0.41/src/include/icon.icon0000644000175000017500000000361510225356640014244 00000000000000/* Format_version=1, Width=64, Height=64, Depth=1, Valid_bits_per_item=16 */ 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x003f,0xf000,0x0000,0x0000,0x01ff,0xc700,0x0000, 0x0000,0x048c,0x00c0,0x0000,0x0000,0x1c00,0x00f0,0x0000, 0x0000,0x0400,0x00c0,0x0000,0x0000,0x7f00,0x07ff,0x0000, 0x0000,0x0f80,0x3ffe,0x4000,0x0000,0x0780,0xfffe,0xc000, 0x0000,0x4300,0x0180,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0001,0xc7c0,0x1f9f,0x8000,0x0003,0x7fff,0xff0f,0x8000, 0x0006,0x1fff,0xff0e,0x0000,0x0006,0x0ffc,0x7f48,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x1fff,0xffc1,0x8000,0x0000,0x3fff,0xffe3,0xf000, 0x0003,0xffff,0xfff8,0x1c00,0x0003,0xf000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x000f,0xfc00,0x0000,0x0000, 0x004f,0xffff,0xff00,0x0000,0x00e7,0xffff,0xff00,0x0000, 0x03ff,0xfffe,0xfe00,0x0000,0x0000,0x0000,0x0000,0x0000, 0x009c,0xa000,0x0000,0x0000,0x38ff,0xffff,0xff00,0x0000, 0x3c3f,0xffff,0xfff0,0x0000,0x3e01,0xffff,0xffff,0x0000, 0x3fc0,0x07f8,0x3fff,0x8000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0fff,0xc000,0x1fc0,0x007f,0xffff,0xc000, 0x1f80,0x003f,0xffff,0xc000,0x1f80,0x0007,0xffff,0xc000, 0x0f80,0x0003,0xffff,0xc020,0x0000,0x0000,0x0000,0x0000, 0x0ff0,0x000f,0xffff,0xe020,0x07fc,0x003f,0xffff,0xe040, 0x07fc,0x00ff,0xffff,0xe0c0,0x03fc,0x01ff,0xffff,0xe0c0, 0x0000,0x0000,0x0000,0x0000,0x01fe,0x0000,0x0000,0x0000, 0x01fe,0x03ff,0xffff,0xe300,0x00fe,0x03ff,0xffff,0xdf00, 0x007e,0x07ff,0xffff,0xfe00,0x003e,0x07ff,0xffff,0xfc00, 0x0000,0x0000,0x0000,0x0000,0x000f,0x07ff,0xffff,0xf000, 0x000f,0x87ff,0xffff,0xe000,0x0003,0xc3ff,0xffff,0xc000, 0x0003,0xfbff,0xffff,0x8000,0x0000,0x07ff,0xffc0,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x1fff,0xfff8,0x0000, 0x0000,0x07ff,0xffe0,0x0000,0x0000,0x003f,0xfc00,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000, 0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000 gpstrans-0.41/src/include/main.gif0000644000175000017500000000321710225356640014053 00000000000000GIF87a ¬€’’’, ¬žŒ©Ėķ˜“Ś;£Ž¼ūbāHfą‰¦Ŗ#†„¹ĘņĢXtŅŽśŽŁ¼Tł ‡G9*‘ĘHsø@•Æjr½Ā°»+Ójķz½\łNēlł¶ÅV‹`]Ń~»īzg<ĖĒŌ—’7ˆ·FxØhØQŲxp7ö'éų “„Ų€iIłéśT*šČ(JVŹrŗ*…Śę¹ˆjšŠŃ—G[i‹“˜6Ź‹@lųŖ–œĆĮé§*ūģŖ<MŚój9¢B½Ü‰]ė[ &Caœ.Īė­mwžż«ŽĖnŸK‹Hļ¦]÷Ÿą=ßōé+cb ĀMÕŅ1“7(ą‹(’U¼hŃĘžŠ=lŲHāB…£Ų@Å/į8†µ`¹¦IóŌ±¹0Ķuōb,—ń§ D9¶wi§ž›8Ł•”ö1%@£F„lrI4 Ռ>u^“е©½K_{ ,Źõ*ŚųŲķå¬Ų‘7œ\z6&P‘zÕ`}źī!Ų°s“öÕ&ß“@ŁVm›µYą¤r ¬‹9Üb­-!÷ ’Vč_Æv•ā­g9Än‡sv¼66lŲ-uę2—ujƶ"®Ü78Ģį›;‹$ö„ėŻŹöõŽĒÆH:ŁŌ·ĪŽģ|&¶ƒo$1ēęl»éˆgՂ&ü™ékó‡MiRÄ}©īļ{iet7äü”ž_ŗ½o•<¬Åw}~!WJ~™ø„q·’€’ØKy–TøE÷‹Zż”ucļÕކ¢4Iū­ĮĖ,ćĮāaŌ¬cGN&ΉęL †#†Ńb ĀĀ v9¾C˜gSµLŽ:īƒŚMs£{Ź=Ł€IžAĀńE“OŖ7N*¤¤}*a‰XˆBłåt“Ui…Dn©¢aAŚ pUį™Cˆė¦ęf­ €¾TŸ¶ØŪq·5xŻEbņĦIˆŹb ÷\jM¦šY—g2 a?…Š:js_\*¬†Ź_dÕZiW3Ķ:Ł…)®Ź+<‹.ö”›1‚Łžh°½’y!؎jö£¤ŠVg+®(«!j§ZvekŲāø-—baZÓ·ī=ƒ$ą•됹ēJ6ģ» Ū­»ņ>ĀeŻ>ĖfŗīØčФööļ”s@yšĄ÷¬ƒ“qÜ p|ŠmrįśūQN¢Z|„ÆG×N\ÆzL„/!ėŪ#ÉĮĄH &*ēĒaÖł²—Ēœ|B>5OjØ8ŅčĪB¾čóĻŪø,“‰rH|4'BŸŅs Z$ŒĘÓ#ÅÅ.Tg<Æ®f‹PCe²l4ÖY76y2‡Ś]Ōi/qufgżo9Ā”½+^¦“µŌxĻźĖĻS Eia„R—>Æf2U¤Źjŗŗ›āŌ¦ōŁ)özźSÜķ&ØNQ‹Ŗ±£j“¤J-šSšŹƒuA•{źüfÕ«–/«Žl)WµŗOs;gpstrans-0.41/src/include/protocols.h0000644000175000017500000016316110427452652014646 00000000000000/* protocols.h - declarations extracted from Garmin device interface specification dated 2004-09-16 */ typedef unsigned char uint8; #define bool uint8 #define sint16 int16_t #define sint32 int32_t #define uint16 u_int16_t #define uint32 u_int32_t #define float32 float #define float64 double #define time_type uint32 typedef struct { sint32 lat; /* latitude in semicircles */ sint32 lon; /* longitude in semicircles */ } position_type; typedef uint16 symbol_type; enum { /* packet IDs for protocol L001, used for the majority of devices */ Pid_Command_Data = 10, /* 0a */ Pid_Xfer_Cmplt = 12, /* 0c */ Pid_Date_Time_Data = 14, /* 0e */ Pid_Position_Data = 17, /* 11 */ Pid_Prx_Wpt_Data = 19, /* 13 */ Pid_Records = 27, /* 1b */ Pid_Rte_Hdr = 29, /* 1d */ Pid_Rte_Wpt_Data = 30, /* 1e */ Pid_Almanac_Data = 31, /* 1f */ Pid_Trk_Data = 34, /* 22 */ Pid_Wpt_Data = 35, /* 23 */ Pid_Pvt_Data = 51, /* 33 */ Pid_Rte_Link_Data = 98, /* 62 */ Pid_Trk_Hdr = 99, /* 63 */ Pid_FlightBook_Record = 134, /* packet with FlightBook data */ Pid_Lap = 149, /* part of Forerunner data */ Pid_Wpt_Cat = 152, /* packet IDs for protocol L002, used mainly for panel-mounted aviation devices */ Pid_Almanac_Data_L002 = 4, Pid_Command_Data_L002 = 11, Pid_Xfer_Cmplt_L002 = 12, Pid_Date_Time_Data_L002 = 20, Pid_Position_Data_L002 = 24, Pid_Prx_Wpt_Data_L002 = 27, Pid_Records_L002 = 35, Pid_Rte_Hdr_L002 = 37, Pid_Rte_Wpt_Data_L002 = 39, Pid_Wpt_Data_L002 = 43, /* following are "basic packet IDs", for protocol L000, used in addition to one of the above sets */ Pid_Ext_Product_Data = 248, Pid_Protocol_Array = 253, Pid_Product_Rqst = 254, Pid_Product_Data = 255 }; /* The enumerated values for symbol_type are shown below. Note that most devices that use this type are limited to a much smaller subset of these symbols, and no attempt is made in this document to indicate which subsets are valid for each of these devices. However, the device will ignore any disallowed symbol values that are received and instead substitute the value for a generic dot symbol. Therefore, there is no harm in attempting to use any value shown in the table below except that the device may not accept the requested value. */ typedef enum { /*--------------------------------------------------------------- Marine symbols ---------------------------------------------------------------*/ sym_anchor = 0, /* white anchor symbol */ sym_bell = 1, /* white bell symbol */ sym_diamond_grn = 2, /* green diamond symbol */ sym_diamond_red = 3, /* red diamond symbol */ sym_dive1 = 4, /* diver down flag 1 */ sym_dive2 = 5, /* diver down flag 2 */ sym_dollar = 6, /* white dollar symbol */ sym_fish = 7, /* white fish symbol */ sym_fuel = 8, /* white fuel symbol */ sym_horn = 9, /* white horn symbol */ sym_house = 10, /* white house symbol */ sym_knife = 11, /* white knife & fork symbol */ sym_light = 12, /* white light symbol */ sym_mug = 13, /* white mug symbol */ sym_skull = 14, /* white skull and crossbones symbol */ sym_square_grn = 15, /* green square symbol */ sym_square_red = 16, /* red square symbol */ sym_wbuoy = 17, /* white buoy waypoint symbol */ sym_wpt_dot = 18, /* waypoint dot */ sym_wreck = 19, /* white wreck symbol */ sym_null = 20, /* null symbol (transparent) */ sym_mob = 21, /* man overboard symbol */ sym_buoy_ambr = 22, /* amber map buoy symbol */ sym_buoy_blck = 23, /* black map buoy symbol */ sym_buoy_blue = 24, /* blue map buoy symbol */ sym_buoy_grn = 25, /* green map buoy symbol */ sym_buoy_grn_red = 26, /* green/red map buoy symbol */ sym_buoy_grn_wht = 27, /* green/white map buoy symbol */ sym_buoy_orng = 28, /* orange map buoy symbol */ sym_buoy_red = 29, /* red map buoy symbol */ sym_buoy_red_grn = 30, /* red/green map buoy symbol */ sym_buoy_red_wht = 31, /* red/white map buoy symbol */ sym_buoy_violet = 32, /* violet map buoy symbol */ sym_buoy_wht = 33, /* white map buoy symbol */ sym_buoy_wht_grn = 34, /* white/green map buoy symbol */ sym_buoy_wht_red = 35, /* white/red map buoy symbol */ sym_dot = 36, /* white dot symbol */ sym_rbcn = 37, /* radio beacon symbol */ sym_boat_ramp = 150, /* boat ramp symbol */ sym_camp = 151, /* campground symbol */ sym_restrooms = 152, /* restrooms symbol */ sym_showers = 153, /* shower symbol */ sym_drinking_wtr = 154, /* drinking water symbol */ sym_phone = 155, /* telephone symbol */ sym_1st_aid = 156, /* first aid symbol */ sym_info = 157, /* information symbol */ sym_parking = 158, /* parking symbol */ sym_park = 159, /* park symbol */ sym_picnic = 160, /* picnic symbol */ sym_scenic = 161, /* scenic area symbol */ sym_skiing = 162, /* skiing symbol */ sym_swimming = 163, /* swimming symbol */ sym_dam = 164, /* dam symbol */ sym_controlled = 165, /* controlled area symbol */ sym_danger = 166, /* danger symbol */ sym_restricted = 167, /* restricted area symbol */ sym_null_2 = 168, /* null symbol */ sym_ball = 169, /* ball symbol */ sym_car = 170, /* car symbol */ sym_deer = 171, /* deer symbol */ sym_shpng_cart = 172, /* shopping cart symbol */ sym_lodging = 173, /* lodging symbol */ sym_mine = 174, /* mine symbol */ sym_trail_head = 175, /* trail head symbol */ sym_truck_stop = 176, /* truck stop symbol */ sym_user_exit = 177, /* user exit symbol */ sym_flag = 178, /* flag symbol */ sym_circle_x = 179, /* circle with x in the center */ sym_open_24hr = 180, /* open 24 hours symbol */ sym_fhs_facility = 181, /* U Fishing Hot SpotsTM Facility */ sym_bot_cond = 182, /* Bottom Conditions */ sym_tide_pred_stn = 183, /* Tide/Current Prediction Station */ sym_anchor_prohib = 184, /* U anchor prohibited symbol */ sym_beacon = 185, /* U beacon symbol */ sym_coast_guard = 186, /* U coast guard symbol */ sym_reef = 187, /* U reef symbol */ sym_weedbed = 188, /* U weedbed symbol */ sym_dropoff = 189, /* U dropoff symbol */ sym_dock = 190, /* U dock symbol */ sym_marina = 191, /* U marina symbol */ sym_bait_tackle = 192, /* U bait and tackle symbol */ sym_stump = 193, /* U stump symbol */ /*--------------------------------------------------------------- User customizable symbols The values from sym_begin_custom to sym_end_custom inclusive are reserved for the identification of user customizable symbols. ---------------------------------------------------------------*/ sym_begin_custom = 7680, /* first user customizable symbol */ sym_end_custom = 8191, /* last user customizable symbol */ /*--------------------------------------------------------------- Land symbols ---------------------------------------------------------------*/ sym_is_hwy = 8192, /* interstate hwy symbol */ sym_us_hwy = 8193, /* us hwy symbol */ sym_st_hwy = 8194, /* state hwy symbol */ sym_mi_mrkr = 8195, /* mile marker symbol */ sym_trcbck = 8196, /* TracBack (feet) symbol */ sym_golf = 8197, /* golf symbol */ sym_sml_cty = 8198, /* small city symbol */ sym_med_cty = 8199, /* medium city symbol */ sym_lrg_cty = 8200, /* large city symbol */ sym_freeway = 8201, /* intl freeway hwy symbol */ sym_ntl_hwy = 8202, /* intl national hwy symbol */ sym_cap_cty = 8203, /* capitol city symbol (star) */ sym_amuse_pk = 8204, /* amusement park symbol */ sym_bowling = 8205, /* bowling symbol */ sym_car_rental = 8206, /* car rental symbol */ sym_car_repair = 8207, /* car repair symbol */ sym_fastfood = 8208, /* fast food symbol */ sym_fitness = 8209, /* fitness symbol */ sym_movie = 8210, /* movie symbol */ sym_museum = 8211, /* museum symbol */ sym_pharmacy = 8212, /* pharmacy symbol */ sym_pizza = 8213, /* pizza symbol */ sym_post_ofc = 8214, /* post office symbol */ sym_rv_park = 8215, /* RV park symbol */ sym_school = 8216, /* school symbol */ sym_stadium = 8217, /* stadium symbol */ sym_store = 8218, /* dept. store symbol */ sym_zoo = 8219, /* zoo symbol */ sym_gas_plus = 8220, /* convenience store symbol */ sym_faces = 8221, /* live theater symbol */ sym_ramp_int = 8222, /* ramp intersection symbol */ sym_st_int = 8223, /* street intersection symbol */ sym_weigh_sttn = 8226, /* inspection/weigh station symbol */ sym_toll_booth = 8227, /* toll booth symbol */ sym_elev_pt = 8228, /* elevation point symbol */ sym_ex_no_srvc = 8229, /* exit without services symbol */ sym_geo_place_mm = 8230, /* Geographic place name, man-made */ sym_geo_place_wtr = 8231, /* Geographic place name, water */ sym_geo_place_lnd = 8232, /* Geographic place name, land */ sym_bridge = 8233, /* bridge symbol */ sym_building = 8234, /* building symbol */ sym_cemetery = 8235, /* cemetery symbol */ sym_church = 8236, /* church symbol */ sym_civil = 8237, /* civil location symbol */ sym_crossing = 8238, /* crossing symbol */ sym_hist_town = 8239, /* historical town symbol */ sym_levee = 8240, /* levee symbol */ sym_military = 8241, /* military location symbol */ sym_oil_field = 8242, /* oil field symbol */ sym_tunnel = 8243, /* tunnel symbol */ sym_beach = 8244, /* beach symbol */ sym_forest = 8245, /* forest symbol */ sym_summit = 8246, /* summit symbol */ sym_lrg_ramp_int = 8247, /* large ramp intersection symbol */ sym_lrg_ex_no_srvc = 8248, /* large exit without services smbl */ sym_badge = 8249, /* police/official badge symbol */ sym_cards = 8250, /* gambling/casino symbol */ sym_snowski = 8251, /* snow skiing symbol */ sym_iceskate = 8252, /* ice skating symbol */ sym_wrecker = 8253, /* tow truck (wrecker) symbol */ sym_border = 8254, /* border crossing (port of entry) */ sym_geocache = 8255, /* geocache location */ sym_geocache_fnd = 8256, /* found geocache */ sym_cntct_smiley = 8257, /* Rino contact symbol, "smiley" */ sym_cntct_ball_cap = 8258, /* Rino contact symbol, "ball cap" */ sym_cntct_big_ears = 8259, /* Rino contact symbol, "big ear" */ sym_cntct_spike = 8260, /* Rino contact symbol, "spike" */ sym_cntct_goatee = 8261, /* Rino contact symbol, "goatee" */ sym_cntct_afro = 8262, /* Rino contact symbol, "afro" */ sym_cntct_dreads = 8263, /* Rino contact symbol, "dreads" */ sym_cntct_female1 = 8264, /* Rino contact symbol, "female 1" */ sym_cntct_female2 = 8265, /* Rino contact symbol, "female 2" */ sym_cntct_female3 = 8266, /* Rino contact symbol, "female 3" */ sym_cntct_ranger = 8267, /* Rino contact symbol, "ranger" */ sym_cntct_kung_fu = 8268, /* Rino contact symbol, "kung fu" */ sym_cntct_sumo = 8269, /* Rino contact symbol, "sumo" */ sym_cntct_pirate = 8270, /* Rino contact symbol, "pirate" */ sym_cntct_biker = 8271, /* Rino contact symbol, "biker" */ sym_cntct_alien = 8272, /* Rino contact symbol, "alien" */ sym_cntct_bug = 8273, /* Rino contact symbol, "bug" */ sym_cntct_cat = 8274, /* Rino contact symbol, "cat" */ sym_cntct_dog = 8275, /* Rino contact symbol, "dog" */ sym_cntct_pig = 8276, /* Rino contact symbol, "pig" */ sym_hydrant = 8282, /* water hydrant symbol */ sym_flag_blue = 8284, /* blue flag symbol */ sym_flag_green = 8285, /* green flag symbol */ sym_flag_red = 8286, /* red flag symbol */ sym_pin_blue = 8287, /* blue pin symbol */ sym_pin_green = 8288, /* green pin symbol */ sym_pin_red = 8289, /* red pin symbol */ sym_block_blue = 8290, /* blue block symbol */ sym_block_green = 8291, /* green block symbol */ sym_block_red = 8292, /* red block symbol */ sym_bike_trail = 8293, /* bike trail symbol */ sym_circle_red = 8294, /* red circle symbol */ sym_circle_green = 8295, /* green circle symbol */ sym_circle_blue = 8296, /* blue circle symbol */ sym_diamond_blue = 8299, /* blue diamond symbol */ sym_oval_red = 8300, /* red oval symbol */ sym_oval_green = 8301, /* green oval symbol */ sym_oval_blue = 8302, /* blue oval symbol */ sym_rect_red = 8303, /* red rectangle symbol */ sym_rect_green = 8304, /* green rectangle symbol */ sym_rect_blue = 8305, /* blue rectangle symbol */ sym_square_blue = 8308, /* blue square symbol */ sym_letter_a_red = 8309, /* red letter 'A' symbol */ sym_letter_b_red = 8310, /* red letter 'B' symbol */ sym_letter_c_red = 8311, /* red letter 'C' symbol */ sym_letter_d_red = 8312, /* red letter 'D' symbol */ sym_letter_a_green = 8313, /* green letter 'A' symbol */ sym_letter_c_green = 8314, /* green letter 'C' symbol */ sym_letter_b_green = 8315, /* green letter 'B' symbol */ sym_letter_d_green = 8316, /* green letter 'D' symbol */ sym_letter_a_blue = 8317, /* blue letter 'A' symbol */ sym_letter_b_blue = 8318, /* blue letter 'B' symbol */ sym_letter_c_blue = 8319, /* blue letter 'C' symbol */ sym_letter_d_blue = 8320, /* blue letter 'D' symbol */ sym_number_0_red = 8321, /* red number '0' symbol */ sym_number_1_red = 8322, /* red number '1' symbol */ sym_number_2_red = 8323, /* red number '2' symbol */ sym_number_3_red = 8324, /* red number '3' symbol */ sym_number_4_red = 8325, /* red number '4' symbol */ sym_number_5_red = 8326, /* red number '5' symbol */ sym_number_6_red = 8327, /* red number '6' symbol */ sym_number_7_red = 8328, /* red number '7' symbol */ sym_number_8_red = 8329, /* red number '8' symbol */ sym_number_9_red = 8330, /* red number '9' symbol */ sym_number_0_green = 8331, /* green number '0' symbol */ sym_number_1_green = 8332, /* green number '1' symbol */ sym_number_2_green = 8333, /* green number '2' symbol */ sym_number_3_green = 8334, /* green number '3' symbol */ sym_number_4_green = 8335, /* green number '4' symbol */ sym_number_5_green = 8336, /* green number '5' symbol */ sym_number_6_green = 8337, /* green number '6' symbol */ sym_number_7_green = 8338, /* green number '7' symbol */ sym_number_8_green = 8339, /* green number '8' symbol */ sym_number_9_green = 8340, /* green number '9' symbol */ sym_number_0_blue = 8341, /* blue number '0' symbol */ sym_number_1_blue = 8342, /* blue number '1' symbol */ sym_number_2_blue = 8343, /* blue number '2' symbol */ sym_number_3_blue = 8344, /* blue number '3' symbol */ sym_number_4_blue = 8345, /* blue number '4' symbol */ sym_number_5_blue = 8346, /* blue number '5' symbol */ sym_number_6_blue = 8347, /* blue number '6' symbol */ sym_number_7_blue = 8348, /* blue number '7' symbol */ sym_number_8_blue = 8349, /* blue number '8' symbol */ sym_number_9_blue = 8350, /* blue number '9' symbol */ sym_triangle_blue = 8351, /* blue triangle symbol */ sym_triangle_green = 8352, /* green triangle symbol */ sym_triangle_red = 8353, /* red triangle symbol */ /*--------------------------------------------------------------- Aviation symbols ---------------------------------------------------------------*/ sym_airport = 16384, /* airport symbol */ sym_int = 16385, /* intersection symbol */ sym_ndb = 16386, /* non-directional beacon symbol */ sym_vor = 16387, /* VHF omni-range symbol */ sym_heliport = 16388, /* heliport symbol */ sym_private = 16389, /* private field symbol */ sym_soft_fld = 16390, /* soft field symbol */ sym_tall_tower = 16391, /* tall tower symbol */ sym_short_tower = 16392, /* short tower symbol */ sym_glider = 16393, /* glider symbol */ sym_ultralight = 16394, /* ultralight symbol */ sym_parachute = 16395, /* parachute symbol */ sym_vortac = 16396, /* VOR/TACAN symbol */ sym_vordme = 16397, /* VOR-DME symbol */ sym_faf = 16398, /* first approach fix */ sym_lom = 16399, /* localizer outer marker */ sym_map = 16400, /* missed approach point */ sym_tacan = 16401, /* TACAN symbol */ sym_seaplane = 16402 /* Seaplane Base */ } symbol_enum_type; typedef struct { char ident[6]; /* identifier */ position_type posn __attribute__ ((packed)); /* position */ uint32 unused __attribute__ ((packed)); /* should be set to zero */ char cmnt[40] __attribute__ ((packed)); /* comment */ } D100_Wpt_Type; typedef struct { char ident[6]; /* identifier */ position_type posn __attribute__ ((packed)); /* position */ uint32 unused __attribute__ ((packed)); /* should be set to zero */ char cmnt[40] __attribute__ ((packed)); /* comment */ float32 dst __attribute__ ((packed)); /* proximity distance (meters) */ uint8 smbl __attribute__ ((packed)); /* symbol id */ } D101_Wpt_Type; /* The enumerated values for the "smbl" member of the D101_Wpt_Type are the same as those for symbol_type (see section 7.3.15 on page 21). However, since the "smbl" member of the D101_Wpt_Type is only 8-bits (instead of 16- bits), all symbol_type values whose upper byte is non-zero are disallowed in the D101_Wpt_Type. The "dst" member is valid only during the Proximity Waypoint Transfer Protocol. */ typedef struct { char ident[6]; /* identifier */ position_type posn __attribute__ ((packed)); /* position */ uint32 unused __attribute__ ((packed)); /* should be set to zero */ char cmnt[40] __attribute__ ((packed)); /* comment */ float32 dst __attribute__ ((packed)); /* proximity distance (meters) */ symbol_type smbl __attribute__ ((packed)); /* symbol id */ } D102_Wpt_Type; /* The "dst" member is valid only during the Proximity Waypoint Transfer Protocol. */ typedef struct { char ident[6]; /* identifier */ position_type posn __attribute__ ((packed)); /* position */ uint32 unused __attribute__ ((packed)); /* should be set to zero */ char cmnt[40] __attribute__ ((packed)); /* comment */ uint8 smbl __attribute__ ((packed)); /* symbol id */ uint8 dspl __attribute__ ((packed)); /* display option */ } D103_Wpt_Type; /* The enumerated values for the "smbl" member of the D103_Wpt_Type are shown below: */ typedef enum { smbl_dot_D103 = 0, /* dot symbol */ smbl_house_D103 = 1, /* house symbol */ smbl_gas_D103 = 2, /* gas symbol */ smbl_car_D103 = 3, /* car symbol */ smbl_fish_D103 = 4, /* fish symbol */ smbl_boat_D103 = 5, /* boat symbol */ smbl_anchor_D103 = 6, /* anchor symbol */ smbl_wreck_D103 = 7, /* wreck symbol */ smbl_exit_D103 = 8, /* exit symbol */ smbl_skull_D103 = 9, /* skull symbol */ smbl_flag_D103 = 10, /* flag symbol */ smbl_camp_D103 = 11, /* camp symbol */ smbl_circle_x_D103 = 12, /* circle with x symbol */ smbl_deer_D103 = 13, /* deer symbol */ smbl_1st_aid_D103 = 14, /* first aid symbol */ smbl_back_track_D103 = 15 /* back track symbol */ } D103_smbl_type; /* The enumerated values for the "dspl" member of the D103_Wpt_Type are shown below: */ typedef enum { dspl_name_D103 = 0, /* Display symbol with waypoint name */ dspl_none_D103 = 1, /* Display symbol by itself */ dspl_cmnt_D103 = 2 /* Display symbol with comment */ } D103_dspl_type; typedef struct { char ident[6]; /* identifier */ position_type posn __attribute__ ((packed)); /* position */ uint32 unused __attribute__ ((packed)); /* should be set to zero */ char cmnt[40] __attribute__ ((packed)); /* comment */ float32 dst __attribute__ ((packed)); /* proximity distance (meters) */ symbol_type smbl __attribute__ ((packed)); /* symbol id */ uint8 dspl __attribute__ ((packed)); /* display option */ } D104_Wpt_Type; /* The enumerated values for the "dspl" member of the D104_Wpt_Type are shown below: */ typedef enum { dspl_smbl_none_D104 = 0, /* Display symbol by itself */ dspl_smbl_only_D104 = 1, /* Display symbol by itself */ dspl_smbl_name_D104 = 3, /* Display symbol with waypoint name */ dspl_smbl_cmnt_D104 = 5 /* Display symbol with comment */ } D104_dspl_type; /* The "dst" member is valid only during the Proximity Waypoint Transfer Protocol. */ typedef struct { position_type posn; /* position */ symbol_type smbl __attribute__ ((packed)); /* symbol id */ char ident[1] __attribute__ ((packed)); /* null-terminated string */ } D105_Wpt_Type; typedef struct { uint8 wpt_class; /* class */ uint8 subclass[13] __attribute__ ((packed)); /* subclass */ position_type posn __attribute__ ((packed)); /* position */ symbol_type smbl __attribute__ ((packed)); /* symbol id */ char ident[1] __attribute__ ((packed)); /* null-terminated string */ /* char lnk_ident[]; null-terminated string */ } D106_Wpt_Type; /* The enumerated values for the "wpt_class" member of the D106_Wpt_Type are as follows: Zero: indicates a user waypoint ("subclass" is ignored). Non-zero: indicates a non-user waypoint ("subclass" must be valid). For non-user waypoints (such as a city in the device map database), the device will provide a non-zero value in the "wpt_class" member, and the "subclass" member will contain valid data to further identify the non-user waypoint. If the host wishes to transfer this waypoint back to the device (as part of a route), the host must leave the "wpt_class" and "subclass" members unmodified. For user waypoints, the host must ensure that the "wpt_class" member is zero, but the "subclass" member will be ignored and should be set to zero. The "lnk_ident" member provides a string that indicates the name of the path from the previous waypoint in the route to this one. For example, "HIGHWAY 101" might be placed in "lnk_ident" to show that the path from the previous waypoint to this waypoint is along Highway 101. The "lnk_ident" string may be empty (i.e., no characters other than the null terminator), which indicates that no particular path is specified. */ typedef struct { char ident[6]; /* identifier */ position_type posn __attribute__ ((packed)); /* position */ uint32 unused __attribute__ ((packed)); /* should be set to zero */ char cmnt[40] __attribute__ ((packed)); /* comment */ uint8 smbl __attribute__ ((packed)); /* symbol id */ uint8 dspl __attribute__ ((packed)); /* display option */ float32 dst __attribute__ ((packed)); /* proximity distance (meters) */ uint8 color __attribute__ ((packed)); /* waypoint color */ } D107_Wpt_Type; /* The enumerated values for the "smbl" member of the D107_Wpt_Type are the same as the "smbl" member of the D103_Wpt_Type. The enumerated values for the "dspl" member of the D107_Wpt_Type are the same as the "dspl" member of the D103_Wpt_Type. The enumerated values for the "color" member of the D107_Wpt_Type are shown below: */ typedef enum { clr_default_D107 = 0, // Default waypoint color clr_red_D107 = 1, // Red clr_green_D107 = 2, // Green clr_blue_D107 = 3 // Blue } D107_color_type; typedef struct { uint8 wpt_class; /* class (see below) */ uint8 color __attribute__ ((packed)); /* color (see below) */ uint8 dspl __attribute__ ((packed)); /* display options (see below) */ uint8 attr __attribute__ ((packed)); /* attributes (see below) */ symbol_type smbl __attribute__ ((packed)); /* waypoint symbol */ uint8 subclass[18] __attribute__ ((packed)); /* subclass */ position_type posn __attribute__ ((packed)); /* position */ float32 alt __attribute__ ((packed)); /* altitude in meters */ float32 dpth __attribute__ ((packed)); /* depth in meters */ float32 dist __attribute__ ((packed)); /* proximity distance in meters */ char state[2] __attribute__ ((packed)); /* state */ char cc[2] __attribute__ ((packed)); /* country code */ char ident[1] __attribute__ ((packed)); /* variable length string*/ /* char comment[]; waypoint user comment */ /* char facility[]; facility name */ /* char city[]; city name */ /* char addr[]; address number */ /* char cross_road[]; intersecting road label */ } D108_Wpt_Type; /* The enumerated values for the "wpt_class" member of the D108_Wpt_Type are defined as follows: */ typedef enum { user_wpt_D108 = 0x00, // user waypoint avtn_apt_wpt_D108 = 0x40, // aviation airport waypoint avtn_int_wpt_D108 = 0x41, // aviation intersection waypoint avtn_ndb_wpt_D108 = 0x42, // aviation NDB waypoint avtn_vor_wpt_D108 = 0x43, // aviation VOR waypoint avtn_arwy_wpt_D108 = 0x44, // aviation airport runway waypoint avtn_aint_wpt_D108 = 0x45, // aviation airport intersection avtn_andb_wpt_D108 = 0x46, // aviation airport ndb waypoint map_pnt_wpt_D108 = 0x80, // map point waypoint map_area_wpt_D108 = 0x81, // map area waypoint map_int_wpt_D108 = 0x82, // map intersection waypoint map_adrs_wpt_D108 = 0x83, // map address waypoint map_line_wpt_D108 = 0x84 // map line waypoint } D108_class_type; /* The "color" member can be one of the following values: */ typedef enum { clr_black_D108 = 0, clr_dark_red_D108 = 1, clr_dark_green_D108 = 2, clr_dark_yellow_D108 = 3, clr_dark_blue_D108 = 4, clr_dark_magenta_D108 = 5, clr_dark_cyan_D108 = 6, clr_light_gray_D108 = 7, clr_dark_gray_D108 = 8, clr_red_D108 = 9, clr_green_D108 = 10, clr_yellow_D108 = 11, clr_blue_D108 = 12, clr_magenta_D108 = 13, clr_cyan_D108 = 14, clr_white_D108 = 15, clr_default_color_D108 = 255, /* default for D108 */ clr_default_color_D109 = 0x1f /* default for D109 */ } D108_color_type; /* The enumerated values for the "dspl" member of the D108_Wpt_Type are the same as the "dspl" member of the D103_Wpt_Type. The "attr" member should be set to a value of 0x60. The "subclass" member of the D108_Wpt_Type is used for map waypoints only, and should be set to 0x0000 0x00000000 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFF for other classes of waypoints. The "alt" and "dpth" members may or may not be supported on a given device. A value of 1.0e25 in either of these fields indicates that this parameter is not supported or is unknown for this waypoint. The "dist" member is used during the Proximity Waypoint Transfer Protocol only, and should be set to 1.0e25 for other cases. The "comment" member of the D108_Wpt_Type is used for user waypoints only, and should be an empty string for other waypoint classes. The "facility" and "city" members are used only for aviation waypoints, and should be empty strings for other waypoint classes. The "addr" member is only valid for MAP_ADRS_WPT class waypoints and will be an empty string otherwise. The "cross_road" member is valid only for MAP_INT_WPT class waypoints, and will be an empty string otherwise. */ typedef struct { uint8 dtyp; /* data packet type (0x01 for D109) */ uint8 wpt_class __attribute__ ((packed)); /* class */ uint8 dspl_color __attribute__ ((packed)); /* display & color (see below) */ uint8 attr __attribute__ ((packed)); /* attributes (0x70 for D109) */ symbol_type smbl __attribute__ ((packed)); /* waypoint symbol */ uint8 subclass[18] __attribute__ ((packed)); /* subclass */ position_type posn __attribute__ ((packed)); /* position */ float32 alt __attribute__ ((packed)); /* altitude in meters */ float32 dpth __attribute__ ((packed)); /* depth in meters */ float32 dist __attribute__ ((packed)); /* proximity distance in meters */ char state[2] __attribute__ ((packed)); /* state */ char cc[2] __attribute__ ((packed)); /* country code */ uint32 ete __attribute__ ((packed)); /* outbound link ete in seconds */ char ident[1] __attribute__ ((packed)); /* variable length string */ /* char comment[]; waypoint user comment */ /* char facility[]; facility name */ /* char city[]; city name */ /* char addr[]; address number */ /* char cross_road[]; intersecting road label */ } D109_Wpt_Type; /* All fields are defined the same as D108_Wpt_Type except as noted below. dtyp - Data packet type, must be 0x01 for D109_Wpt_Type. dspl_color - The 'dspl_color' member contains three fields; bits 0-4 specify the color, bits 5-6 specify the waypoint display attribute and bit 7 is unused and must be 0. Color values are as specified for D108_Wpt_Type except that the default value is 0x1f. Display attribute values are as specified for D108_Wpt_Type. attr - Attribute. Must be 0x70 for D109_Wpt_Type. ete - Estimated time en route in seconds to next waypoint. Default value is 0xFFFFFFFF. */ typedef struct { uint8 dtyp; /* data packet type (0x01 for D110) */ uint8 wpt_class __attribute__ ((packed)); /* class */ uint8 dspl_color __attribute__ ((packed)); /* display & color (see below) */ uint8 attr __attribute__ ((packed)); /* attributes (0x80 for D110) */ symbol_type smbl __attribute__ ((packed)); /* waypoint symbol */ uint8 subclass[18] __attribute__ ((packed)); /* subclass */ position_type posn __attribute__ ((packed)); /* position */ float32 alt __attribute__ ((packed)); /* altitude in meters */ float32 dpth __attribute__ ((packed)); /* depth in meters */ float32 dist __attribute__ ((packed)); /* proximity distance in meters */ char state[2] __attribute__ ((packed)); /* state */ char cc[2] __attribute__ ((packed)); /* country code */ uint32 ete __attribute__ ((packed)); /* outbound link ete in seconds */ float32 temp __attribute__ ((packed)); /* temperature */ time_type time __attribute__ ((packed)); /* timestamp */ uint16 wpt_cat __attribute__ ((packed)); /* category membership */ char ident[1] __attribute__ ((packed)); /* variable length string */ /* char comment[]; waypoint user comment */ /* char facility[]; facility name */ /* char city[]; city name */ /* char addr[]; address number */ /* char cross_road[]; intersecting road label */ } D110_Wpt_Type; /* All fields are defined the same as D109_Wpt_Type except as noted below. The valid values for the "wpt_class" member of the D110_Wpt_Type are defined as follows. If an invalid value is received, the value shall be user_wpt. */ typedef enum { user_wpt_D110 = 0x00, // user waypoint avtn_apt_wpt_D110 = 0x40, // aviation airport waypoint avtn_int_wpt_D110 = 0x41, // aviation intersection waypoint avtn_ndb_wpt_D110 = 0x42, // aviation NDB waypoint avtn_vor_wpt_D110 = 0x43, // aviation VOR waypoint avtn_arwy_wpt_D110 = 0x44, // aviation airport runway waypoint avtn_aint_wpt_D110 = 0x45, // aviation airport intersection avtn_andb_wpt_D110 = 0x46, // aviation airport ndb waypoint map_pnt_wpt_D110 = 0x80, // map point waypoint map_area_wpt_D110 = 0x81, // map area waypoint map_int_wpt_D110 = 0x82, // map intersection waypoint map_adrs_wpt_D110 = 0x83, // map address waypoint map_line_wpt_D110 = 0x84 // map line waypoint } D110_type_type; /* wpt_cat - Waypoint Category. May not be supported by all devices. Default value is 0x0000. This is a bit field that provides category membership information for the waypoint. The waypoint may be a member of up to 16 categories. If a bit is set then the waypoint is a member of the corresponding category. For example, if bits 0 and 4 are set then the waypoint is a member of categories 1 and 5. For more information see section 6.5 on page 12. temp - Temperature. May not be supported by all devices. A value of 1.0e25 in this field indicates that this parameter is not supported or is unknown for this waypoint. time - Time. May not be supported by all devices. A value of 0xFFFFFFFF in this field indicates that this parameter is not supported or is unknown for this waypoint. attr - Attribute. Must be 0x80 for D110_Wpt_Type. dspl_color - The 'dspl_color' member contains three fields; bits 0-4 specify the color, bits 5-6 specify the waypoint display attribute and bit 7 is unused and must be 0. Valid color values are specified below. If an invalid color value is received, the value shall be Black. Valid display attribute values are as shown below. If an invalid display attribute value is received, the value shall be Name. */ typedef enum { clr_Black_D110 = 0, clr_Dark_Red_D110 = 1, clr_Dark_Green_D110 = 2, clr_Dark_Yellow_D110 = 3, clr_Dark_Blue_D110 = 4, clr_Dark_Magenta_D110 = 5, clr_Dark_Cyan_D110 = 6, clr_Light_Gray_D110 = 7, clr_Dark_Gray_D110 = 8, clr_Red_D110 = 9, clr_Green_D110 = 10, clr_Yellow_D110 = 11, clr_Blue_D110 = 12, clr_Magenta_D110 = 13, clr_Cyan_D110 = 14, clr_White_D110 = 15, clr_Transparent_D110 = 16 } D110_color_type; typedef enum { dspl_Smbl_Name_D110 = 0, // Display symbol with waypoint name dspl_Smbl_Only_D110 = 1, // Display symbol by itself dspl_Smbl_Comment_D110 = 2 // Display symbol with comment } D110_attribute_type; /* posn - Position. If a D110 waypoint is received that contains a value in the lat field of the posn field that is greater than 2^30 or less than -2^30, then that waypoint shall be rejected. */ typedef struct { char name[17]; /* category name */ } D120_Wpt_Cat_Type; /* The name field contains a null-terminated string with a maximum length of 16 consecutive non-null characters. If a D120 waypoint category is received that contains a string with more than 16 consecutive non-null characters then that name should be truncated to the first 16 characters and then null terminated. If a D120 waypoint category is received with a null in the first character of the name field then that packet should not be processed. */ typedef struct { char ident[6]; /* identifier */ char cc[2] __attribute__ ((packed)); /* country code */ uint8 wpt_class __attribute__ ((packed)); /* class */ position_type posn __attribute__ ((packed)); /* position */ sint16 alt __attribute__ ((packed)); /* altitude (meters) */ char city[24] __attribute__ ((packed)); /* city */ char state[2] __attribute__ ((packed)); /* state */ char name[30] __attribute__ ((packed)); /* facility name */ char cmnt[40] __attribute__ ((packed)); /* comment */ } D150_Wpt_Type; /* The enumerated values for the "wpt_class" member of the D150_Wpt_Type are shown below: */ typedef enum { apt_wpt_class_D150 = 0, // airport waypoint class int_wpt_class_D150 = 1, // intersection waypoint class ndb_wpt_class_D150 = 2, // NDB waypoint class vor_wpt_class_D150 = 3, // VOR waypoint class usr_wpt_class_D150 = 4, // user defined waypoint class rwy_wpt_class_D150 = 5, // airport runway threshold waypoint class aint_wpt_class_D150 = 6, // airport intersection waypoint class locked_wpt_class_D150 = 7 // locked waypoint class } D150_class_type; /* The "locked_wpt_class" code indicates that a route within a device contains an aviation database waypoint that the device could not find in its aviation database (presumably because the aviation database was updated to a newer version). The host should never send the "locked_wpt_class" code to the device. The "city," "state," "name," and "cc" members are invalid when the "wpt_class" member is equal to usr_wpt_class. The "alt" member is valid only when the "wpt_class" member is equal to apt_wpt_class. */ typedef struct { char ident[6]; /* identifier */ position_type posn __attribute__ ((packed)); /* position */ uint32 unused __attribute__ ((packed)); /* should be set to zero */ char cmnt[40] __attribute__ ((packed)); /* comment */ float32 dst __attribute__ ((packed)); /* proximity distance (meters) */ char name[30] __attribute__ ((packed)); /* facility name */ char city[24] __attribute__ ((packed)); /* city */ char state[2] __attribute__ ((packed)); /* state */ sint16 alt __attribute__ ((packed)); /* altitude (meters) */ char cc[2] __attribute__ ((packed)); /* country code */ char unused2 __attribute__ ((packed)); /* should be set to zero */ uint8 wpt_class __attribute__ ((packed)); /* class */ } D151_Wpt_Type; /* The enumerated values for the "wpt_class" member of the D151_Wpt_Type are shown below: */ typedef enum { apt_wpt_class_D151 = 0, // airport waypoint class vor_wpt_class_D151 = 1, // VOR waypoint class usr_wpt_class_D151 = 2, // user defined waypoint class locked_wpt_class_D151 = 3 // locked waypoint class } D151_class_type; /* The "locked_wpt_class" code indicates that a route within a device contains an aviation database waypoint that the device could not find in its aviation database (presumably because the aviation database was updated to a newer version). The host should never send the "locked_wpt_class" code to the device. The "dst" member is valid only during the Proximity Waypoint Transfer Protocol. The "city," "state," "name," and "cc" members are invalid when the "wpt_class" member is equal to usr_wpt_class. The "alt" member is valid only when the "wpt_class" member is equal to apt_wpt_class. */ typedef struct { char ident[6]; /* identifier */ position_type posn __attribute__ ((packed)); /* position */ uint32 unused __attribute__ ((packed)); /* should be set to zero */ char cmnt[40] __attribute__ ((packed)); /* comment */ float32 dst __attribute__ ((packed)); /* proximity distance (meters) */ char name[30] __attribute__ ((packed)); /* facility name */ char city[24] __attribute__ ((packed)); /* city */ char state[2] __attribute__ ((packed)); /* state */ sint16 alt __attribute__ ((packed)); /* altitude (meters) */ char cc[2] __attribute__ ((packed)); /* country code */ uint8 unused2 __attribute__ ((packed)); /* should be set to zero */ uint8 wpt_class __attribute__ ((packed)); /* class */ } D152_Wpt_Type; /* The enumerated values for the "wpt_class" member of the D152_Wpt_Type are shown below: */ typedef enum { apt_wpt_class_D152 = 0, // airport waypoint class int_wpt_class_D152 = 1, // intersection waypoint class ndb_wpt_class_D152 = 2, // NDB waypoint class vor_wpt_class_D152 = 3, // VOR waypoint class usr_wpt_class_D152 = 4, // user defined waypoint class locked_wpt_class_D152 = 5 // locked waypoint class } D152_class_type; /* The "locked_wpt_class" code indicates that a route within a device contains an aviation database waypoint that the device could not find in its aviation database (presumably because the aviation database was updated to a newer version). The host should never send the "locked_wpt_class" code to the device. The "dst" member is valid only during the Proximity Waypoint Transfer Protocol. The "city," "state," "name," and "cc" members are invalid when the "wpt_class" member is equal to usr_wpt_class. The "alt" member is valid only when the "wpt_class" member is equal to apt_wpt_class. */ typedef struct { char ident[6]; /* identifier */ position_type posn __attribute__ ((packed)); /* position */ uint32 unused __attribute__ ((packed)); /* should be set to zero */ char cmnt[40] __attribute__ ((packed)); /* comment */ float32 dst __attribute__ ((packed)); /* proximity distance (meters) */ char name[30] __attribute__ ((packed)); /* facility name */ char city[24] __attribute__ ((packed)); /* city */ char state[2] __attribute__ ((packed)); /* state */ sint16 alt __attribute__ ((packed)); /* altitude (meters) */ char cc[2] __attribute__ ((packed)); /* country code */ uint8 unused2 __attribute__ ((packed)); /* should be set to zero */ uint8 wpt_class __attribute__ ((packed)); /* class */ symbol_type smbl __attribute__ ((packed)); /* symbol id */ } D154_Wpt_Type; /* The enumerated values for the "wpt_class" member of the D154_Wpt_Type are shown below: */ typedef enum { apt_wpt_class_D154 = 0, // airport waypoint class int_wpt_class_D154 = 1, // intersection waypoint class ndb_wpt_class_D154 = 2, // NDB waypoint class vor_wpt_class_D154 = 3, // VOR waypoint class usr_wpt_class_D154 = 4, // user defined waypoint class rwy_wpt_class_D154 = 5, // airport runway threshold waypoint class aint_wpt_class_D154 = 6, // airport intersection waypoint class andb_wpt_class_D154 = 7, // airport NDB waypoint class sym_wpt_class_D154 = 8, // user defined symbol-only waypoint class locked_wpt_class_D154 = 9 // locked waypoint class } D154_class_type; /* The "locked_wpt_class" code indicates that a route within a device contains an aviation database waypoint that the device could not find in its aviation database (presumably because the aviation database was updated to a newer version). The host should never send the "locked_wpt_class" code to the device. The "dst" member is valid only during the Proximity Waypoint Transfer Protocol. The "city," "state," "name," and "cc" members are invalid when the "wpt_class" member is equal to usr_wpt_class or sym_wpt_class. The "alt" member is valid only when the "wpt_class" member is equal to apt_wpt_class. */ typedef struct { char ident[6]; /* identifier */ position_type posn __attribute__ ((packed)); /* position */ uint32 unused __attribute__ ((packed)); /* should be set to zero */ char cmnt[40] __attribute__ ((packed)); /* comment */ float32 dst __attribute__ ((packed)); /* proximity distance (meters) */ char name[30] __attribute__ ((packed)); /* facility name */ char city[24] __attribute__ ((packed)); /* city */ char state[2] __attribute__ ((packed)); /* state */ sint16 alt __attribute__ ((packed)); /* altitude (meters) */ char cc[2] __attribute__ ((packed)); /* country code */ uint8 unused2 __attribute__ ((packed)); /* should be set to zero */ uint8 wpt_class __attribute__ ((packed)); /* class */ symbol_type smbl __attribute__ ((packed)); /* symbol id */ uint8 dspl __attribute__ ((packed)); /* display option */ } D155_Wpt_Type; /* The enumerated values for the "dspl" member of the D155_Wpt_Type are shown below: */ typedef enum { dspl_smbl_only_D155 = 1, // Display symbol by itself dspl_smbl_name_D155 = 3, // Display symbol with waypoint name dspl_smbl_cmnt_D155 = 5 // Display symbol with comment } D155_dspl_type; /* The enumerated values for the "wpt_class" member of the D155_Wpt_Type are shown below: */ typedef enum { apt_wpt_class_D155 = 0, /* airport waypoint class */ int_wpt_class_D155 = 1, /* intersection waypoint class */ ndb_wpt_class_D155 = 2, /* NDB waypoint class */ vor_wpt_class_D155 = 3, /* VOR waypoint class */ usr_wpt_class_D155 = 4, /* user defined waypoint class */ locked_wpt_class_D155 = 5 /* locked waypoint class */ } D155_class_type; /* The "locked_wpt_class" code indicates that a route within a device contains an aviation database waypoint that the device could not find in its aviation database (presumably because the aviation database was updated to a newer version). The host should never send the "locked_wpt_class" code to the device. The "dst" member is valid only during the Proximity Waypoint Transfer Protocol. The "city," "state," "name," and "cc" members are invalid when the "wpt_class" member is equal to usr_wpt_class. The "alt" member is valid only when the "wpt_class" member is equal to apt_wpt_class. */ typedef uint8 D200_Rte_Hdr_Type; /* route number */ /* The route number contained in the D200_Rte_Hdr_Type must be unique for each route. */ typedef struct { uint8 nmbr; /* route number */ char cmnt[20] __attribute__ ((packed)); /* comment */ } D201_Rte_Hdr_Type; /* The "nmbr" member must be unique for each route. Some devices require a unique "cmnt" for each route, and other devices do not. There is no mechanism available for the host to determine whether a device requires a unique "cmnt", and the host must be prepared to receive unique or non-unique "cmnt" from the device. */ typedef struct { char rte_ident[1]; /* variable length string */ } D202_Rte_Hdr_Type; typedef struct { uint16 class; /* link class; see below */ uint8 subclass[18]__attribute__ ((packed)); /* subclass */ /* char ident[]; variable length string */ } D210_Rte_Link_Type; /* The "class" member can be one of the following values: */ typedef enum { line_D202 = 0, link_D202 = 1, net_D202 = 2, direct_D202 = 3, snap_D202 = 0xFF } D202_class_type; /* The "ident" member has a maximum length of 51 characters, including the terminating NULL. If "class" is set to "direct" or "snap", subclass should be set to its default value of 0x0000 0x00000000 0xFFFFFFFF 0xFFFFFFFF 0xFFFFFFFF. */ typedef struct { position_type posn; /* position */ time_type time __attribute__ ((packed)); /* time */ bool new_trk __attribute__ ((packed)); /* new track segment? */ } D300_Trk_Point_Type; /* The "time" member indicates the time at which the track log point was recorded. When true, the "new_trk" member indicates that the track log point marks the beginning of a new track log segment. */ typedef struct { position_type posn; /* position */ time_type time __attribute__ ((packed)); /* time */ float32 alt __attribute__ ((packed)); /* altitude in meters */ float32 dpth __attribute__ ((packed)); /* depth in meters */ bool new_trk __attribute__ ((packed)); /* new track segment? */ } D301_Trk_Point_Type; /* The "time" member indicates the time at which the track log point was recorded. The `alt' and `dpth' members may or may not be supported on a given device. A value of 1.0e25 in either of these fields indicates that this parameter is not supported or is unknown for this track point. When true, the "new_trk" member indicates that the track log point marks the beginning of a new track log segment. */ typedef struct { position_type posn; /* position */ time_type time __attribute__ ((packed)); /* time */ float32 alt __attribute__ ((packed)); /* altitude in meters */ float32 dpth __attribute__ ((packed)); /* depth in meters */ float32 temp __attribute__ ((packed)); /* temp in degrees C */ bool new_trk __attribute__ ((packed)); /* new track segment? */ } D302_Trk_Point_Type; /* All fields are defined the same as D301_Trk_Point_Type except as noted below. temp - Temperature. May not be supported by all devices. A value of 1.0e25 in this field indicates that this parameter is not supported or is unknown for this track point. */ typedef struct { bool dspl; /* display on the map? */ uint8 color __attribute__ ((packed)); /* color (same as D108) */ char trk_ident[1] __attribute__ ((packed)); /* null-terminated string */ } D310_Trk_Hdr_Type; /* The `trk_ident' member has a maximum length of 51 characters including the terminating NULL. */ typedef struct { uint16 index; /* unique among all tracks received from device */ } D311_Trk_Hdr_Type; typedef struct { bool dspl; /* display on the map? */ uint8 color __attribute__ ((packed)); /* color (same as D110) */ char trk_ident[1] __attribute__ ((packed)); /* null-terminated string */ } D312_Trk_Hdr_Type; /* The 'trk_ident' member has a maximum length of 51 characters including the terminating NULL. */ typedef struct { D100_Wpt_Type wpt; /* waypoint */ float32 dst __attribute__ ((packed)); /* proximity distance (meters) */ } D400_Prx_Wpt_Type; /* The "dst" member is valid only during the Proximity Waypoint Transfer Protocol. */ typedef struct { D103_Wpt_Type wpt; /* waypoint */ float32 dst __attribute__ ((packed)); /* proximity distance (meters) */ } D403_Prx_Wpt_Type; /* The "dst" member is valid only during the Proximity Waypoint Transfer Protocol. */ typedef struct { int idx; /* proximity index */ D150_Wpt_Type wpt __attribute__ ((packed)); /* waypoint */ float32 dst __attribute__ ((packed)); /* proximity distance (meters) */ } D450_Prx_Wpt_Type; /* The "dst" member is valid only during the Proximity Waypoint Transfer Protocol. */ typedef struct { uint16 wn; /* week number (weeks) */ float32 toa __attribute__ ((packed)); /* almanac data reference time (s) */ float32 af0 __attribute__ ((packed)); /* clock correction coefficient (s) */ float32 af1 __attribute__ ((packed)); /* clock correction coefficient (s/s) */ float32 e __attribute__ ((packed)); /* eccentricity (-) */ float32 sqrta __attribute__ ((packed)); /* square root of semi-major axis (a)(m**1/2) */ float32 m0 __attribute__ ((packed)); /* mean anomaly at reference time (r) */ float32 w __attribute__ ((packed)); /* argument of perigee (r) */ float32 omg0 __attribute__ ((packed)); /* right ascension (r) */ float32 odot __attribute__ ((packed)); /* rate of right ascension (r/s) */ float32 i __attribute__ ((packed)); /* inclination angle (r) */ } D500_Almanac_Type; typedef struct { uint16 wn; /* week number (weeks) */ float32 toa __attribute__ ((packed)); /* almanac data reference time (s) */ float32 af0 __attribute__ ((packed)); /* clock correction coefficient (s) */ float32 af1 __attribute__ ((packed)); /* clock correction coefficient (s/s) */ float32 e __attribute__ ((packed)); /* eccentricity (-) */ float32 sqrta __attribute__ ((packed)); /* square root of semi-major axis (a)(m**1/2) */ float32 m0 __attribute__ ((packed)); /* mean anomaly at reference time (r) */ float32 w __attribute__ ((packed)); /* argument of perigee (r) */ float32 omg0 __attribute__ ((packed)); /* right ascension (r) */ float32 odot __attribute__ ((packed)); /* rate of right ascension (r/s) */ float32 i __attribute__ ((packed)); /* inclination angle (r) */ uint8 hlth __attribute__ ((packed)); /* almanac health */ } D501_Almanac_Type; typedef struct { uint8 svid; /* satellite id */ uint16 wn __attribute__ ((packed)); /* week number (weeks) */ float32 toa __attribute__ ((packed)); /* almanac data reference time (s) */ float32 af0 __attribute__ ((packed)); /* clock correction coefficient (s) */ float32 af1 __attribute__ ((packed)); /* clock correction coefficient (s/s) */ float32 e __attribute__ ((packed)); /* eccentricity (-) */ float32 sqrta __attribute__ ((packed)); /* square root of semi-major axis (a)(m**1/2) */ float32 m0 __attribute__ ((packed)); /* mean anomaly at reference time (r) */ float32 w __attribute__ ((packed)); /* argument of perigee (r) */ float32 omg0 __attribute__ ((packed)); /* right ascension (r) */ float32 odot __attribute__ ((packed)); /* rate of right ascension (r/s) */ float32 i __attribute__ ((packed)); /* inclination angle (r) */ } D550_Almanac_Type; /* The "svid" member identifies a satellite in the GPS constellation as follows: PRN-01 through PRN-32 are indicated by "svid" equal to 0 through 31, respectively. */ typedef struct { uint8 svid; /* satellite id */ uint16 wn __attribute__ ((packed)); /* week number (weeks) */ float32 toa __attribute__ ((packed)); /* almanac data reference time (s) */ float32 af0 __attribute__ ((packed)); /* clock correction coefficient (s) */ float32 af1 __attribute__ ((packed)); /* clock correction coefficient (s/s) */ float32 e __attribute__ ((packed)); /* eccentricity (-) */ float32 sqrta __attribute__ ((packed)); /* square root of semi-major axis (a)(m**1/2) */ float32 m0 __attribute__ ((packed)); /* mean anomaly at reference time (r) */ float32 w __attribute__ ((packed)); /* argument of perigee (r) */ float32 omg0 __attribute__ ((packed)); /* right ascension (r) */ float32 odot __attribute__ ((packed)); /* rate of right ascension (r/s) */ float32 i __attribute__ ((packed)); /* inclination angle (r) */ uint8 hlth __attribute__ ((packed)); /* almanac health bits 17:24 (coded) */ } D551_Almanac_Type; /* The "svid" member identifies a satellite in the GPS constellation as follows: PRN-01 through PRN-32 are indicated by "svid" equal to 0 through 31, respectively. */ typedef struct { uint8 month; /* month (1-12) */ uint8 day __attribute__ ((packed)); /* day (1-31) */ uint16 year __attribute__ ((packed)); /* year (1990 means 1990) */ uint16 hour __attribute__ ((packed)); /* hour (0-23) */ uint8 minute __attribute__ ((packed)); /* minute (0-59) */ uint8 second __attribute__ ((packed)); /* second (0-59) */ } D600_Date_Time_Type; /* The D600_Date_Time_Type contains the UTC date and UTC time. */ typedef struct { time_type takeoff_time; /* Time flight started */ time_type landing_time __attribute__ ((packed)); /* Time flight ended */ position_type takeoff_posn __attribute__ ((packed)); /* Takeoff lat/lon */ position_type landing_posn __attribute__ ((packed)); /* Takeoff lat/lon */ uint32 night_time __attribute__ ((packed)); /* Seconds flown in night time conditions */ uint32 num_landings __attribute__ ((packed)); /* Number of landings during the flight */ float32 max_speed __attribute__ ((packed)); /* Max velocity during flight (meters/sec) */ float32 max_alt __attribute__ ((packed)); /* Max altitude above WGS84 ellipsoid (meters) */ float32 distance __attribute__ ((packed)); /* Distance of flight (meters) */ bool cross_country_flag __attribute__ ((packed)); /* Flight met cross country criteria */ /* char departure_name[]; Name of airport <= 31 bytes */ /* char departure_ident[]; ID of airport <= 11 bytes */ /* char arrival_name[]; Name of airport <= 31 bytes */ /* char arrival_ident[];ID of airport <= 11 bytes */ /* char ac_id[]; N Number of airplane <= 11 bytes */ } D650_Flight_Book_Record_Type; typedef struct { float64 lat; float64 lon __attribute__ ((packed)); /* */ } radian_position_type; typedef radian_position_type D700_Position_Type; typedef struct { float32 alt; /* altitude above WGS 84 ellipsoid (meters) */ float32 epe __attribute__ ((packed)); /* estimated position error, 2 sigma (meters) */ float32 eph __attribute__ ((packed)); /* epe, but horizontal only (meters) */ float32 epv __attribute__ ((packed)); /* epe, but vertical only (meters) */ uint16 fix __attribute__ ((packed)); /* type of position fix */ float64 tow __attribute__ ((packed)); /* time of week (seconds) */ radian_position_type posn __attribute__ ((packed)); /* latitude and longitude (radians) */ float32 east __attribute__ ((packed)); /* velocity east (meters/second) */ float32 north __attribute__ ((packed)); /* velocity north (meters/second) */ float32 up __attribute__ ((packed)); /* velocity up (meters/second) */ float32 msl_hght __attribute__ ((packed)); /* height of WGS84 ellipsoid above MSL(meters) */ sint16 leap_scnds __attribute__ ((packed)); /* difference between GPS and UTC (seconds) */ uint32 wn_days __attribute__ ((packed)); /* week number days */ } D800_Pvt_Data_Type; /* The "alt" parameter provides the altitude above the WGS 84 ellipsoid. To find the altitude above mean sea level, add "msl_hght" to "alt" ("msl_hght" gives the height of the WGS 84 ellipsoid above mean sea level at the current position). The "tow" parameter provides the number of seconds (excluding leap seconds) since the beginning of the current week, which begins on Sunday at 12:00 AM (i.e., midnight Saturday night-Sunday morning). The "tow" parameter is based on Universal Coordinated Time (UTC), except UTC is periodically corrected for leap seconds while "tow" is not corrected for leap seconds. To find UTC, subtract "leap_scnds" from "tow." Since this may cause a negative result for the first few seconds of the week (i.e., when "tow" is less than "leap_scnds"), care must be taken to properly translate this negative result to a positive time value in the previous day. Also, since "tow" is a floating point number and may contain fractional seconds, care must be taken to properly round off when using "tow" in integer conversions and calculations. The "wn_days" parameter provides the number of days that have occurred from UTC December 31st, 1989 to the beginning of the current week (thus, "wn_days" always represents a Sunday). To find the total number of days that have occurred from UTC December 31st, 1989 to the current day, add "wn_days" to the number of days that have occurred in the current week (as calculated from the "tow" parameter). The default enumerated values for the "fix" member of the D800_Pvt_Data_Type are shown below. It is important for the host to inspect this value to ensure that other data members in the D800_Pvt_Data_Type are valid. No indication is given as to whether the device is in simulator mode versus having an actual position fix. */ typedef enum { fix_unusable = 0, // failed integrity check fix_invalid = 1, // invalid or unavailable fix_2D = 2, // two dimensional fix_3D = 3, // three dimensional fix_2D_diff = 4, // two dimensional differential fix_3D_diff = 5 // three dimensional differential } D800_fix_type; gpstrans-0.41/src/include/util.h0000644000175000017500000000005110226256231013553 00000000000000long TickCount (); void *xmalloc (int); gpstrans-0.41/src/Makefile0000644000175000017500000000305610240773214012453 00000000000000############################################################################## # # Makefile for the ascii-version of GPStrans # ############################################################################## # # Make changes here, and you don't need to change Makefiles in the sub-dir's # ############################################################################## CC = gcc # use -DSUNOS41 for SunOS 4.1.x # usr -DHPUX for HPUX CFLAGS = -Wall -g -D__LINUX__ # -O3 LDFLAGS = -lm ############################################################################## # Nothing need to be changed below this line. ############################################################################## INCLUDES= -Iinclude -Igetline OFILES = util.o prefs.o graph.o main.o HFILES = include/defs.h include/Prefs.h include/Garmin.h\ include/icon.icon include/gpstrans.icon XFILES = gps/sendgpsinfo.o gps/dms.o gps/datum.o \ gps/calendar.o gps/gpsmessage.o gps/garmincomm.o \ gps/garminserial.o gps/getgpsinfo.o gps/latlong.o \ grid/itm.o grid/bng.o grid/tm.o grid/ups.o \ grid/utm.o grid/seg.o grid/gridutils.o grid/kkj.o \ grid/gkk.o getline/libgetline.a \ .c.o: $(HFILES) $(CC) -c $(CFLAGS) $(INCLUDES) $< all: $(OFILES) $(HFILES) @echo "Making all in ./getline" @(cd getline ; make libgetline.a) @echo "Making all in ./gps" @(cd gps ; make all CC="$(CC)" CFLAGS="$(CFLAGS)") @echo "Making all in ./grid" @(cd grid ; make all CC="$(CC)" CFLAGS="$(CFLAGS)") @echo "Linking file \"gpstrans\"" $(CC) -o gpstrans $(OFILES) $(XFILES) $(LDFLAGS) gpstrans-0.41/src/TAGS0000644000175000017500000006202710235300372011472 00000000000000 include/Garmin.h,535 static const double Pi 1,0 static const double Degree 3,93 typedef unsigned char BYTE;BYTE6,151 #define MAX_LENGTH 8,180 #define MAX_LINE 13,370 #define RTE_NAM 19,526 #define RTE_WPT 20,572 #define ALM 21,622 #define TRK 22,662 #define WPT 23,700 #define GMNID 24,741 #define ALMANAC 27,809 #define ROUTE 28,827 #define TRACK 29,843 #define WAYPOINT 30,859 enum PROTOCOLPROTOCOL32,879 { NONE,33,893 { NONE, GARMIN,33,893 { NONE, GARMIN, NMEA 33,893 struct DATUMDATUM108,3276 struct ELLIPSOIDELLIPSOID117,3364 include/util.h,0 include/Prefs.h,764 #define OKITEM 7,213 #define CANCELITEM 8,247 #define LISTITEM 9,288 #define DESCITEM 10,324 #define DMSITEM 11,384 #define DMMITEM 12,440 #define DDDITEM 13,495 #define UTMITEM 14,548 #define BNGITEM 15,597 #define ITMITEM 16,655 #define SUIITEM 17,712 #define CREATITEM 18,769 #define OFFSETITEM 19,829 #define DUMMYITEM 20,896 #define DIALOGID 24,991 #define DESC_LEN 28,1056 enum FORMATFORMAT30,1077 { DMS,31,1089 { DMS, DMM,31,1089 { DMS, DMM, DDD,31,1089 { DMS, DMM, DDD, UTM,31,1089 { DMS, DMM, DDD, UTM, BNG,31,1089 { DMS, DMM, DDD, UTM, BNG, ITM,31,1089 { DMS, DMM, DDD, UTM, BNG, ITM, KKJ,31,1089 { DMS, DMM, DDD, UTM, BNG, ITM, KKJ, SEG,31,1089 { DMS, DMM, DDD, UTM, BNG, ITM, KKJ, SEG, GKK 31,1089 struct PREFSPREFS33,1139 include/defs.h,345 #define ProgramName 11,163 #define ProgramVersion 12,203 #define ProgramYear 13,239 #define MainMenuHeader 15,276 #define BarWindowHeader 17,321 #define PrefsWindowHeader 18,376 #define PrefFileName 20,420 #define DefaultServerDevice 22,464 #define ServerBaud 23,506 #define TIMEOUT 25,542 #define noErr 27,575 #define X_NULL 29,599 include/graph.h,0 include/protocols.h,15838 typedef unsigned char uint8;uint86,108 #define bool 7,137 #define sint16 8,156 #define sint32 9,179 #define uint16 10,202 #define uint32 11,227 #define float32 12,252 #define float64 13,274 #define time_type 14,297 } position_type;position_type20,433 typedef uint16 symbol_type;symbol_type22,451 Pid_Command_Data 27,558 Pid_Xfer_Cmplt 28,590 Pid_Date_Time_Data 29,622 Pid_Position_Data 30,654 Pid_Prx_Wpt_Data 31,686 Pid_Records 32,718 Pid_Rte_Hdr 33,750 Pid_Rte_Wpt_Data 34,782 Pid_Almanac_Data 35,814 Pid_Trk_Data 36,846 Pid_Wpt_Data 37,878 Pid_Pvt_Data 38,910 Pid_Rte_Link_Data 39,942 Pid_Trk_Hdr 40,974 Pid_FlightBook_Record 41,1006 Pid_Lap 42,1072 Pid_Wpt_Cat 43,1134 Pid_Almanac_Data_L002 47,1257 Pid_Command_Data_L002 48,1289 Pid_Xfer_Cmplt_L002 49,1321 Pid_Date_Time_Data_L002 50,1353 Pid_Position_Data_L002 51,1385 Pid_Prx_Wpt_Data_L002 52,1417 Pid_Records_L002 53,1449 Pid_Rte_Hdr_L002 54,1481 Pid_Rte_Wpt_Data_L002 55,1513 Pid_Wpt_Data_L002 56,1545 Pid_Ext_Product_Data 60,1686 Pid_Protocol_Array 61,1718 Pid_Product_Rqst 62,1750 Pid_Product_Data 63,1782 sym_anchor 81,2525 sym_bell 82,2580 sym_diamond_grn 83,2633 sym_diamond_red 84,2689 sym_dive1 85,2743 sym_dive2 86,2796 sym_dollar 87,2849 sym_fish 88,2904 sym_fuel 89,2957 sym_horn 90,3010 sym_house 91,3063 sym_knife 92,3117 sym_light 93,3178 sym_mug 94,3232 sym_skull 95,3284 sym_square_grn 96,3355 sym_square_red 97,3410 sym_wbuoy 98,3463 sym_wpt_dot 99,3525 sym_wreck 100,3573 sym_null 101,3627 sym_mob 102,3688 sym_buoy_ambr 103,3744 sym_buoy_blck 104,3801 sym_buoy_blue 105,3858 sym_buoy_grn 106,3914 sym_buoy_grn_red 107,3971 sym_buoy_grn_wht 108,4032 sym_buoy_orng 109,4095 sym_buoy_red 110,4153 sym_buoy_red_grn 111,4208 sym_buoy_red_wht 112,4269 sym_buoy_violet 113,4330 sym_buoy_wht 114,4388 sym_buoy_wht_grn 115,4445 sym_buoy_wht_red 116,4508 sym_dot 117,4569 sym_rbcn 118,4621 sym_boat_ramp 119,4676 sym_camp 120,4728 sym_restrooms 121,4781 sym_showers 122,4833 sym_drinking_wtr 123,4882 sym_phone 124,4939 sym_1st_aid 125,4991 sym_info 126,5043 sym_parking 127,5097 sym_park 128,5147 sym_picnic 129,5194 sym_scenic 130,5243 sym_skiing 131,5297 sym_swimming 132,5346 sym_dam 133,5397 sym_controlled 134,5443 sym_danger 135,5501 sym_restricted 136,5550 sym_null_2 137,5608 sym_ball 138,5655 sym_car 139,5702 sym_deer 140,5748 sym_shpng_cart 141,5795 sym_lodging 142,5851 sym_mine 143,5901 sym_trail_head 144,5948 sym_truck_stop 145,6001 sym_user_exit 146,6054 sym_flag 147,6106 sym_circle_x 148,6153 sym_open_24hr 149,6216 sym_fhs_facility 150,6272 sym_bot_cond 151,6338 sym_tide_pred_stn 152,6391 sym_anchor_prohib 153,6458 sym_beacon 154,6520 sym_coast_guard 155,6571 sym_reef 156,6627 sym_weedbed 157,6676 sym_dropoff 158,6728 sym_dock 159,6780 sym_marina 160,6829 sym_bait_tackle 161,6880 sym_stump 162,6940 sym_begin_custom 168,7284 sym_end_custom 169,7350 sym_is_hwy 173,7566 sym_us_hwy 174,7623 sym_st_hwy 175,7672 sym_mi_mrkr 176,7724 sym_trcbck 177,7778 sym_golf 178,7836 sym_sml_cty 179,7883 sym_med_cty 180,7936 sym_lrg_cty 181,7990 sym_freeway 182,8043 sym_ntl_hwy 183,8102 sym_cap_cty 184,8162 sym_amuse_pk 185,8224 sym_bowling 186,8281 sym_car_rental 187,8331 sym_car_repair 188,8384 sym_fastfood 189,8437 sym_fitness 190,8489 sym_movie 191,8539 sym_museum 192,8587 sym_pharmacy 193,8636 sym_pizza 194,8687 sym_post_ofc 195,8735 sym_rv_park 196,8789 sym_school 197,8839 sym_stadium 198,8888 sym_store 199,8938 sym_zoo 200,8992 sym_gas_plus 201,9038 sym_faces 202,9098 sym_ramp_int 203,9153 sym_st_int 204,9213 sym_weigh_sttn 205,9275 sym_toll_booth 206,9342 sym_elev_pt 207,9395 sym_ex_no_srvc 208,9453 sym_geo_place_mm 209,9517 sym_geo_place_wtr 210,9584 sym_geo_place_lnd 211,9648 sym_bridge 212,9711 sym_building 213,9760 sym_cemetery 214,9811 sym_church 215,9862 sym_civil 216,9911 sym_crossing 217,9968 sym_hist_town 218,10019 sym_levee 219,10077 sym_military 220,10125 sym_oil_field 221,10185 sym_tunnel 222,10237 sym_beach 223,10286 sym_forest 224,10334 sym_summit 225,10383 sym_lrg_ramp_int 226,10432 sym_lrg_ex_no_srvc 227,10498 sym_badge 228,10566 sym_cards 229,10630 sym_snowski 230,10688 sym_iceskate 231,10742 sym_wrecker 232,10796 sym_border 233,10858 sym_geocache 234,10925 sym_geocache_fnd 235,10978 sym_cntct_smiley 236,11028 sym_cntct_ball_cap 237,11093 sym_cntct_big_ears 238,11160 sym_cntct_spike 239,11226 sym_cntct_goatee 240,11290 sym_cntct_afro 241,11355 sym_cntct_dreads 242,11418 sym_cntct_female1 243,11483 sym_cntct_female2 244,11550 sym_cntct_female3 245,11617 sym_cntct_ranger 246,11684 sym_cntct_kung_fu 247,11749 sym_cntct_sumo 248,11815 sym_cntct_pirate 249,11878 sym_cntct_biker 250,11943 sym_cntct_alien 251,12007 sym_cntct_bug 252,12071 sym_cntct_cat 253,12133 sym_cntct_dog 254,12195 sym_cntct_pig 255,12257 sym_hydrant 256,12319 sym_flag_blue 257,12375 sym_flag_green 258,12427 sym_flag_red 259,12480 sym_pin_blue 260,12531 sym_pin_green 261,12582 sym_pin_red 262,12634 sym_block_blue 263,12684 sym_block_green 264,12737 sym_block_red 265,12791 sym_bike_trail 266,12843 sym_circle_red 267,12896 sym_circle_green 268,12949 sym_circle_blue 269,13004 sym_diamond_blue 270,13058 sym_oval_red 271,13113 sym_oval_green 272,13164 sym_oval_blue 273,13217 sym_rect_red 274,13269 sym_rect_green 275,13325 sym_rect_blue 276,13383 sym_square_blue 277,13440 sym_letter_a_red 278,13494 sym_letter_b_red 279,13551 sym_letter_c_red 280,13608 sym_letter_d_red 281,13665 sym_letter_a_green 282,13722 sym_letter_c_green 283,13781 sym_letter_b_green 284,13840 sym_letter_d_green 285,13899 sym_letter_a_blue 286,13958 sym_letter_b_blue 287,14016 sym_letter_c_blue 288,14074 sym_letter_d_blue 289,14132 sym_number_0_red 290,14190 sym_number_1_red 291,14247 sym_number_2_red 292,14304 sym_number_3_red 293,14361 sym_number_4_red 294,14418 sym_number_5_red 295,14475 sym_number_6_red 296,14532 sym_number_7_red 297,14589 sym_number_8_red 298,14646 sym_number_9_red 299,14703 sym_number_0_green 300,14760 sym_number_1_green 301,14819 sym_number_2_green 302,14878 sym_number_3_green 303,14937 sym_number_4_green 304,14996 sym_number_5_green 305,15055 sym_number_6_green 306,15114 sym_number_7_green 307,15173 sym_number_8_green 308,15232 sym_number_9_green 309,15291 sym_number_0_blue 310,15350 sym_number_1_blue 311,15408 sym_number_2_blue 312,15466 sym_number_3_blue 313,15524 sym_number_4_blue 314,15582 sym_number_5_blue 315,15640 sym_number_6_blue 316,15698 sym_number_7_blue 317,15756 sym_number_8_blue 318,15814 sym_number_9_blue 319,15872 sym_triangle_blue 320,15930 sym_triangle_green 321,15986 sym_triangle_red 322,16043 sym_airport 326,16252 sym_int 327,16302 sym_ndb 328,16357 sym_vor 329,16422 sym_heliport 330,16479 sym_private 331,16530 sym_soft_fld 332,16586 sym_tall_tower 333,16639 sym_short_tower 334,16692 sym_glider 335,16746 sym_ultralight 336,16795 sym_parachute 337,16848 sym_vortac 338,16900 sym_vordme 339,16952 sym_faf 340,17002 sym_lom 341,17056 sym_map 342,17114 sym_tacan 343,17171 sym_seaplane 344,17219 } symbol_enum_type;symbol_enum_type345,17267 } D100_Wpt_Type __attribute__ ((packed)packed352,17540 } D101_Wpt_Type;D101_Wpt_Type362,17995 } D102_Wpt_Type;D102_Wpt_Type378,18816 } D103_Wpt_Type;D103_Wpt_Type392,19306 smbl_dot_D103 397,19432 smbl_house_D103 398,19479 smbl_gas_D103 399,19528 smbl_car_D103 400,19575 smbl_fish_D103 401,19622 smbl_boat_D103 402,19670 smbl_anchor_D103 403,19718 smbl_wreck_D103 404,19768 smbl_exit_D103 405,19817 smbl_skull_D103 406,19865 smbl_flag_D103 407,19914 smbl_camp_D103 408,19962 smbl_circle_x_D103 409,20010 smbl_deer_D103 410,20067 smbl_1st_aid_D103 411,20115 smbl_back_track_D103 412,20168 } D103_smbl_type;D103_smbl_type413,20221 dspl_name_D103 418,20345 dspl_none_D103 419,20408 dspl_cmnt_D103 420,20462 } D103_dspl_type;D103_dspl_type421,20519 } D104_Wpt_Type;D104_Wpt_Type432,21006 dspl_smbl_none_D104 438,21130 dspl_smbl_only_D104 439,21188 dspl_smbl_name_D104 440,21246 dspl_smbl_cmnt_D104 441,21317 } D104_dspl_type;D104_dspl_type442,21377 } D105_Wpt_Type;D105_Wpt_Type451,21681 } D106_Wpt_Type;D106_Wpt_Type461,22062 } D107_Wpt_Type;D107_Wpt_Type496,23799 clr_default_D107 508,24165 clr_red_D107 509,24217 clr_green_D107 510,24250 clr_blue_D107 511,24285 } D107_color_type;D107_color_type512,24318 } D108_Wpt_Type;D108_Wpt_Type534,25436 user_wpt_D108 539,25571 user_wpt_D108 = 0x00,539,25571 avtn_apt_wpt_D108 540,25618 avtn_apt_wpt_D108 = 0x40,540,25618 avtn_int_wpt_D108 541,25677 avtn_int_wpt_D108 = 0x41,541,25677 avtn_ndb_wpt_D108 542,25741 avtn_ndb_wpt_D108 = 0x42,542,25741 avtn_vor_wpt_D108 543,25796 avtn_vor_wpt_D108 = 0x43,543,25796 avtn_arwy_wpt_D108 544,25851 avtn_arwy_wpt_D108 = 0x44,544,25851 avtn_aint_wpt_D108 545,25917 avtn_aint_wpt_D108 = 0x45,545,25917 avtn_andb_wpt_D108 546,25980 avtn_andb_wpt_D108 = 0x46,546,25980 map_pnt_wpt_D108 547,26043 map_pnt_wpt_D108 = 0x80,547,26043 map_area_wpt_D108 548,26095 map_area_wpt_D108 = 0x81,548,26095 map_int_wpt_D108 549,26146 map_int_wpt_D108 = 0x82,549,26146 map_adrs_wpt_D108 550,26205 map_adrs_wpt_D108 = 0x83,550,26205 map_line_wpt_D108 551,26259 map_line_wpt_D108 = 0x84 551,26259 } D108_class_type;D108_class_type552,26309 clr_black_D108 557,26405 clr_dark_red_D108 558,26438 clr_dark_green_D108 559,26471 clr_dark_yellow_D108 560,26504 clr_dark_blue_D108 561,26537 clr_dark_magenta_D108 562,26570 clr_dark_cyan_D108 563,26603 clr_light_gray_D108 564,26636 clr_dark_gray_D108 565,26669 clr_red_D108 566,26702 clr_green_D108 567,26735 clr_yellow_D108 568,26768 clr_blue_D108 569,26801 clr_magenta_D108 570,26834 clr_cyan_D108 571,26867 clr_white_D108 572,26900 clr_default_color_D108 573,26933 clr_default_color_D109 574,26989 clr_default_color_D109 = 0x1f 574,26989 } D108_color_type;D108_color_type575,27044 } D109_Wpt_Type;D109_Wpt_Type627,29415 } D110_Wpt_Type;D110_Wpt_Type669,31417 user_wpt_D110 678,31682 user_wpt_D110 = 0x00,678,31682 avtn_apt_wpt_D110 679,31729 avtn_apt_wpt_D110 = 0x40,679,31729 avtn_int_wpt_D110 680,31788 avtn_int_wpt_D110 = 0x41,680,31788 avtn_ndb_wpt_D110 681,31852 avtn_ndb_wpt_D110 = 0x42,681,31852 avtn_vor_wpt_D110 682,31907 avtn_vor_wpt_D110 = 0x43,682,31907 avtn_arwy_wpt_D110 683,31962 avtn_arwy_wpt_D110 = 0x44,683,31962 avtn_aint_wpt_D110 684,32028 avtn_aint_wpt_D110 = 0x45,684,32028 avtn_andb_wpt_D110 685,32091 avtn_andb_wpt_D110 = 0x46,685,32091 map_pnt_wpt_D110 686,32154 map_pnt_wpt_D110 = 0x80,686,32154 map_area_wpt_D110 687,32206 map_area_wpt_D110 = 0x81,687,32206 map_int_wpt_D110 688,32257 map_int_wpt_D110 = 0x82,688,32257 map_adrs_wpt_D110 689,32316 map_adrs_wpt_D110 = 0x83,689,32316 map_line_wpt_D110 690,32370 map_line_wpt_D110 = 0x84 690,32370 } D110_type_type;D110_type_type691,32420 clr_Black_D110 721,33698 clr_Dark_Red_D110 722,33727 clr_Dark_Green_D110 723,33756 clr_Dark_Yellow_D110 724,33785 clr_Dark_Blue_D110 725,33814 clr_Dark_Magenta_D110 726,33843 clr_Dark_Cyan_D110 727,33872 clr_Light_Gray_D110 728,33901 clr_Dark_Gray_D110 729,33930 clr_Red_D110 730,33959 clr_Green_D110 731,33988 clr_Yellow_D110 732,34017 clr_Blue_D110 733,34046 clr_Magenta_D110 734,34075 clr_Cyan_D110 735,34104 clr_White_D110 736,34133 clr_Transparent_D110 737,34162 } D110_color_type;D110_color_type738,34190 dspl_Smbl_Name_D110 742,34225 dspl_Smbl_Only_D110 743,34293 dspl_Smbl_Comment_D110 744,34352 } D110_attribute_type;D110_attribute_type745,34413 } D120_Wpt_Cat_Type;D120_Wpt_Cat_Type755,34688 } D150_Wpt_Type;D150_Wpt_Type776,35725 apt_wpt_class_D150 781,35853 int_wpt_class_D150 782,35909 ndb_wpt_class_D150 783,35970 vor_wpt_class_D150 784,36022 usr_wpt_class_D150 785,36074 rwy_wpt_class_D150 786,36135 aint_wpt_class_D150 787,36208 locked_wpt_class_D150 788,36279 } D150_class_type;D150_class_type789,36333 } D151_Wpt_Type;D151_Wpt_Type818,37665 apt_wpt_class_D151 823,37793 vor_wpt_class_D151 824,37849 usr_wpt_class_D151 825,37901 locked_wpt_class_D151 826,37962 } D151_class_type;D151_class_type827,38016 } D152_Wpt_Type;D152_Wpt_Type859,39429 apt_wpt_class_D152 864,39557 int_wpt_class_D152 865,39613 ndb_wpt_class_D152 866,39674 vor_wpt_class_D152 867,39726 usr_wpt_class_D152 868,39778 locked_wpt_class_D152 869,39839 } D152_class_type;D152_class_type870,39893 } D154_Wpt_Type;D154_Wpt_Type902,41347 apt_wpt_class_D154 907,41475 int_wpt_class_D154 908,41531 ndb_wpt_class_D154 909,41592 vor_wpt_class_D154 910,41644 usr_wpt_class_D154 911,41696 rwy_wpt_class_D154 912,41757 aint_wpt_class_D154 913,41830 andb_wpt_class_D154 914,41901 sym_wpt_class_D154 915,41961 locked_wpt_class_D154 916,42034 } D154_class_type;D154_class_type917,42088 } D155_Wpt_Type;D155_Wpt_Type949,43625 dspl_smbl_only_D155 954,43748 dspl_smbl_name_D155 955,43804 dspl_smbl_cmnt_D155 956,43869 } D155_dspl_type;D155_dspl_type957,43927 apt_wpt_class_D155 963,44057 int_wpt_class_D155 964,44115 ndb_wpt_class_D155 965,44178 vor_wpt_class_D155 966,44232 usr_wpt_class_D155 967,44286 locked_wpt_class_D155 968,44349 } D155_class_type;D155_class_type969,44405 typedef uint8 D200_Rte_Hdr_Type;D200_Rte_Hdr_Type985,45020 } D201_Rte_Hdr_Type;D201_Rte_Hdr_Type993,45277 } D202_Rte_Hdr_Type;D202_Rte_Hdr_Type1003,45688 } D210_Rte_Link_Type;1010,45877 line_D202 1014,45975 link_D202 1015,45997 net_D202 1016,46019 direct_D202 1017,46041 snap_D202 1018,46063 snap_D202 = 0xFF1018,46063 } D202_class_type;D202_class_type1019,46084 } D300_Trk_Point_Type;D300_Trk_Point_Type1031,46525 } D301_Trk_Point_Type;D301_Trk_Point_Type1045,47082 } D302_Trk_Point_Type;D302_Trk_Point_Type1064,47905 } D310_Trk_Hdr_Type;D310_Trk_Hdr_Type1075,48364 } D311_Trk_Hdr_Type;D311_Trk_Hdr_Type1082,48574 } D312_Trk_Hdr_Type;D312_Trk_Hdr_Type1089,48802 } D400_Prx_Wpt_Type;D400_Prx_Wpt_Type1097,49060 } D403_Prx_Wpt_Type;D403_Prx_Wpt_Type1105,49305 } D450_Prx_Wpt_Type;D450_Prx_Wpt_Type1114,49609 } D500_Almanac_Type;D500_Almanac_Type1131,50549 } D501_Almanac_Type;D501_Almanac_Type1147,51463 } D550_Almanac_Type;D550_Almanac_Type1163,52376 } D551_Almanac_Type;D551_Almanac_Type1183,53544 } D600_Date_Time_Type;D600_Date_Time_Type1196,54106 } D650_Flight_Book_Record_Type;D650_Flight_Book_Record_Type1216,55360 } radian_position_type;radian_position_type1222,55479 typedef radian_position_type D700_Position_Type;D700_Position_Type1224,55504 } D800_Pvt_Data_Type;D800_Pvt_Data_Type1241,56732 fix_unusable 1275,58570 fix_invalid 1276,58618 fix_2D 1277,58666 fix_3D 1278,58707 fix_2D_diff 1279,58750 fix_3D_diff 1280,58804 } D800_fix_type;D800_fix_type1281,58859 include/gpsinfo.h,0 grid/gridutils.c,21 datumParams 37,2356 grid/seg.c,136 static const double lat0 34,2214 static const double lon0 36,2351 static const double k0 38,2487 DegToSEG 44,2760 SEGtoDeg 61,3304 grid/kkj.c,136 static const double lat0 35,2215 static const double lon0 36,2292 static const double k0 37,2325 DegToKKJ 44,2599 KKJtoDeg 58,3026 grid/tm.c,42 toTM 48,2770 fromTM 89,3941 M 142,5735 grid/utm.c,102 static const double lat0 34,2136 static const double k0 35,2213 DegToUTM 42,2490 UTMtoDeg 91,3545 grid/bng.c,208 static const char *zoneID0 41,2533 static const char *zoneID1 42,2591 static const double lat0 43,2649 static const double lon0 44,2727 static const double k0 45,2780 DegToBNG 53,3062 BNGtoDeg 92,4059 grid/ups.c,50 toUPS 42,2457 fromUPS 70,3346 calcPhi 117,4312 grid/itm.c,171 static const char *zoneID 40,2454 static const double lat0 41,2511 static const double lon0 42,2586 static const double k0 43,2648 DegToITM 51,2928 ITMtoDeg 87,3832 grid/gkk.c,203 #define DIVIDER 54,2974 #define FEAST 56,3047 #define MWIDTH 58,3116 static const double lat0 60,3142 static double lon0 61,3219 static const double k0 62,3291 DegToGKK 69,3604 GKKtoDeg 101,4449 getline/testgl.c,11 main(4,41 getline/getline.c,2055 static char rcsid[2,13 static char *copyright 4,104 int echo 49,1631 #define BUF_SIZE 53,1730 static int gl_init_done 55,1753 static int gl_termw 56,1809 static int gl_scroll 57,1863 static int gl_width 58,1926 static int gl_extent 59,1986 static int gl_overwrite 60,2049 static int gl_pos,61,2099 static int gl_pos, gl_cnt 61,2099 static char gl_buf[62,2163 static char gl_killbuf[63,2212 static char *gl_prompt;64,2269 static char gl_intrc 65,2326 static char gl_quitc 66,2379 static char gl_suspc 67,2433 static char gl_dsuspc 68,2487 static int gl_search_mode 69,2541 char *stop 103,4115 #define __unix__111,4289 #define __unix__117,4382 struct termios new_termios,139,4720 struct termios new_termios, old_termios;139,4720 struct sgttyb new_tty,147,4970 struct sgttyb new_tty, old_tty;147,4970 struct tchars tch;148,5002 struct ltchars ltch;149,5021 struct termio new_termio,152,5093 struct termio new_termio, old_termio;152,5093 static int setbuff[163,5282 static short chan 164,5346 struct dsc$descriptor_s descrip;165,5397 gl_char_init 169,5471 gl_char_cleanup 230,7306 pc_keymap 254,7827 gl_getc 279,8231 gl_putc 345,9313 gl_puts 361,9583 gl_error 374,9718 gl_init 387,9890 gl_cleanup 401,10191 gl_setwidth 410,10327 getline 425,10519 gl_addchar 630,14742 gl_yank 654,15273 gl_transpose 691,16132 gl_newline 709,16479 gl_del 737,17158 gl_kill 758,17592 gl_word 773,17844 gl_redraw 801,18419 gl_fixup 812,18616 gl_tab 971,22787 gl_strwidth 993,23244 #define HIST_SIZE 1004,23434 static int hist_pos 1007,23464 static char *hist_buf[1008,23504 hist_init 1011,23551 gl_histadd 1021,23668 hist_prev 1057,24486 hist_next 1077,24847 hist_save 1096,25149 static char search_prompt[1126,25641 static char search_string[1127,25709 static int search_pos 1128,25741 static int search_forw_flg 1129,25808 static int search_last 1130,25868 search_update 1133,25932 search_addchar 1173,26714 search_term 1214,27282 search_back 1225,27496 search_forw 1268,28284 getlinenoecho 1313,29069 getline/getline.h,82 #define GETLINE_H2,18 typedef size_t (*gl_strwidth_proc)gl_strwidth_proc11,184 gps/sendgpsinfo.c,1351 static char fileData[47,2690 static BYTE newTrack;48,2722 static BYTE message[49,2744 struct PREFS gFilePrefs;50,2824 } column;81,3615 sendGPSOff 88,3869 sendGPSInfo 123,4723 mxmap_route 308,8799 mystrsep2 360,10099 strconvert 378,10381 doWaypoint 469,15988 { LAT 480,16168 { LAT = 0, LON 480,16168 { ZE 482,16195 { ZE = 0, ZN,482,16195 { ZE = 0, ZN, EASTING,482,16195 { ZE = 0, ZN, EASTING, NORTHING 482,16195 { BGZ 484,16254 { BGZ = 0, BGEAST,484,16254 { BGZ = 0, BGEAST, BGNORTH 484,16254 { SEAST 486,16319 { SEAST = 0, SNORTH 486,16319 { SEGEAST 488,16368 { SEGEAST = 0, SEGNORTH 488,16368 doTrack 887,32210 { TYPE,894,32350 { TYPE, DATE,894,32350 { TYPE, DATE, LAT,894,32350 { TYPE, DATE, LAT, LON 894,32350 { ZE 896,32385 { ZE = 2, ZN,896,32385 { ZE = 2, ZN, EASTING,896,32385 { ZE = 2, ZN, EASTING, NORTHING 896,32385 { BGZ 898,32444 { BGZ = 2, BGEAST,898,32444 { BGZ = 2, BGEAST, BGNORTH 898,32444 { SEAST 900,32509 { SEAST = 2, SNORTH 900,32509 { SEGEAST 902,32558 { SEGEAST = 2, SEGNORTH 902,32558 doRoute 1010,36062 #define ALM_BYTES 1037,36791 doAlmanac 1040,36826 records 1076,37692 sendRecords 1127,38802 copyNumber 1154,39500 copyFloat 1170,39909 field 1191,40465 cpystr 1206,40882 getFileFormat 1237,42364 cleanupDMS 1357,45773 gps/gpsmessage.c,391 BYTE m1[36,2333 BYTE m2[37,2400 BYTE p1[39,2447 BYTE p2[40,2500 BYTE alm1[42,2555 BYTE alm2[43,2616 BYTE trk1[45,2683 BYTE trk2[46,2741 BYTE wpt1[48,2806 BYTE wpt2[49,2867 BYTE rte1[51,2935 BYTE rte2[52,2993 BYTE test[54,3058 BYTE gid4[56,3124 BYTE gid5[57,3188 BYTE off1[59,3223 BYTE tim1[60,3279 BYTE almt[62,3333 BYTE rtet[63,3402 BYTE trkt[64,3469 BYTE wptt[65,3536 gps/latlong.c,231 static const double CONVERT 33,2135 static const double PI 35,2217 static const double WGSa 37,2282 static const double WGSinvf 38,2347 static const short WGS84ID 39,2408 translate 50,2948 int2deg 154,6318 deg2int 167,6646 gps/getgpsinfo.c,833 static short records;47,2677 static FILE *FileRefNum;48,2699 static char fileData[49,2724 static int AlmanacSat 50,2758 char GPSVersionStr[51,2785 static int xmap_route_nr 54,2842 static long xmap_time 55,2872 static double xmap_lat 56,2899 static double xmap_lon 57,2927 static float xmap_speed 58,2955 saveFormat 95,4563 getGPSVersion 257,8962 } protocol_t;protocol_t365,12135 getGPSTime 480,19265 getGPSInfo 552,20999 parseGPS 660,23641 doRouteName 702,24627 } route_name_type;route_name_type708,24704 doTrack 765,25951 doTrack_xmap 846,28554 #define DEG2RAD 926,30354 distance 929,30419 doWaypoint_xmap 949,31039 doWaypoint 984,31968 doAlmanac 1323,41829 } almanac_type;almanac_type1333,41984 string 1466,46937 number 1483,47323 tofloat 1497,47706 toshort 1511,48118 FileWrite 1524,48449 gps/dms.c,73 toDMS 37,2340 DMStoDegrees 75,3025 toDM 94,3474 DMtoDegrees 126,4035 gps/garminserial.c,118 int ttyfp;46,2417 struct termio ttyset;47,2428 serialOpen 54,2692 serialCharsAvail 103,3803 serialClose 116,4143 gps/calendar.c,96 #define START 35,2138 secs2dt 52,2992 dt2secs 76,3720 date2days 90,4201 days2date 119,4819 gps/garmincomm.c,173 BYTE gGarminMessage[42,2471 int naks;43,2504 static unsigned char checksum;46,2545 sendGPSMessage 58,3215 CheckGPS 102,4296 getGPSMessage 180,5939 getGPSack 254,7470 gps/datum.c,102 short nDatums 56,3787 struct DATUM const gDatum[58,3809 struct ELLIPSOID const gEllipsoid[165,7915 prefs.c,209 char prop_scratch[43,2399 struct PREFS gPrefs;44,2423 AbsolutFilename 55,2745 AnalyzeLine 99,3777 SavePrefs 140,4661 LoadPrefs 170,5624 InitPrefs 230,6938 WaitforReturn 240,7215 SetupProgram 252,7550 graph.c,88 SetBarGraph 33,2159 InitBarGraph 42,2434 CloseBarGraph 51,2698 SetFrameBusy 60,2963 main.c,421 char cmd 45,2411 char *prog,46,2439 char *prog, *progname;46,2439 char *dowhat;47,2462 char FileName[48,2476 FILE *refNum;49,2507 enum PROTOCOL mode 50,2521 int debugging;51,2550 int verbose;52,2565 NotResponding 59,2822 PrintHeadLine 71,3242 usage 91,4102 ParseError 124,5630 HandleAbout 167,6998 InfoAboutGPS 206,8694 TurnOffGPS 217,9045 AdjustTime 228,9336 TerminateHandler 279,10671 main 302,11318 util.c,213 char gMessageStr[35,2088 unsigned short product_ID;36,2111 unsigned short software_version;37,2138 char *protocols;38,2171 GetLine 47,2576 Message 66,3015 Error 77,3342 TickCount 89,3680 xmalloc 102,4000 gpstrans-0.41/src/graph.c0000644000175000017500000000564710225356640012273 00000000000000/****************************************************************************/ /* */ /* ./ascii/graph.c - Routines to display bargraph */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" /****************************************************************************/ /* Set BarGraph to a value from 0 to 1 - not needed in ascii-version. */ /****************************************************************************/ void SetBarGraph (double value) { } /****************************************************************************/ /* Init BarGraph window - not needed in ascii-version. */ /****************************************************************************/ void InitBarGraph () { } /****************************************************************************/ /* Close BarGraph window - not needed in ascii-version. */ /****************************************************************************/ void CloseBarGraph () { } /****************************************************************************/ /* Set main window busy - not needed in ascii-version. */ /****************************************************************************/ void SetFrameBusy () { } gpstrans-0.41/src/main.c0000644000175000017500000003455710427447231012121 00000000000000/****************************************************************************/ /* */ /* main.c - Main program and small utility procedures */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* Copyright (c) 2001 by Joao Seabra - CT2GNL (seabra@ci.aac.uc.pt) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include "Prefs.h" #include "gpsinfo.h" #include #include /* define external variables */ extern struct PREFS gPrefs; /* Preferences from prefs.c */ /* define global variables */ char cmd = ' ', what = ' '; char *prog, *progname; char *dowhat; char FileName[FILENAME_MAX+1]; FILE *refNum; enum PROTOCOL mode = GARMIN; enum FILE_FORMAT file_format = TSV; int debugging; int verbose; /****************************************************************************/ /* Print message if GPS is not responding and exit. */ /****************************************************************************/ void NotResponding () { fprintf (stderr, "GPS [%s] is not responding - ", gPrefs.Device); fprintf (stderr, "make sure it is on and set to GRMN/GRMN protocol.\n"); exit (1); } /****************************************************************************/ /* Print headline with programname, version and copyright notice. */ /****************************************************************************/ void PrintHeadLine () { fprintf (stderr, "%s (ASCII) - Version %s\nCopyright (c) %s by Carsten ", ProgramName, ProgramVersion, ProgramYear); fprintf (stderr, "Tschach (tschach@zedat.fu-berlin.de)\n"); fprintf (stderr, "Linux/KKJ mods by Janne Sinkkonen (1996)\n"); fprintf (stderr, "Copyright (c) 2000 German Grid by Andreas Lange \n"); fprintf (stderr, "Copyright (c) 1998,2000 Mayko-mXmap mods by Matthias Kattanek \n"); fprintf (stderr, "Copyright (c) 2001 Development by Joao Seabra-CT2GNL \n"); fprintf (stderr, "Copyright (c) 2005 Development by Jim Van Zandt \n"); } /****************************************************************************/ /* Print usage information. */ /****************************************************************************/ void usage () { fprintf (stderr, "Usage: %s flag [filename]\n\n", progname); fprintf (stderr, "Flags are: -v version: information about program\n" " --help print this help text\n" " --debug add debug printouts\n" " --verbose increase verbosity\n" " -p port: set serial I/O-Device\n" " -s setup: set datum, format, offset " "device and model\n" /* " -z model: set model etrex (or similar model)\n\n" */ " -i ident: identify connected GPS\n" " -o off: Turn off GPS Device\n" " -t time: Get time from GPS (-ts " "will set time on host)\n\n" " -d? download: r = route, t = track, w = " "waypoint, a = almanac\n" " -u? upload: r = route, t = track, w = " "waypoint\n\n" " -m format: data in Mayko-mXmap format\n\n" "If no filename is entered, data will be written to stdout " "and read from stdin.\n" "Serial I/O-Device can also be set with the environment " "variable $GPSDEV.\n"); exit (1); } /****************************************************************************/ /* Print error messages. */ /****************************************************************************/ void ParseError (err) int err; { switch (err) { case 1: fprintf (stderr, "You have to specify at least one parameter.\n\n"); fprintf (stderr, "Start %s without any parameters to get usage ", progname); fprintf (stderr, "information.\n"); break; case 2: fprintf (stderr, "You have to specify one of '-da -dr -dt -dw'\n\n"); fprintf (stderr, "Start %s without any parameters to get usage ", progname); fprintf (stderr, "information.\n"); break; case 3: fprintf (stderr, "You have to specify one of '-ur -ut -uw'\n\n"); fprintf (stderr, "Start %s without any parameters to get usage ", progname); fprintf (stderr, "information.\n"); break; case 4: fprintf (stderr, "You have to specify a device name when using '-p'\n\n"); fprintf (stderr, "Start %s without any parameters to get usage ", progname); fprintf (stderr, "information.\n"); break; case 5: fprintf (stderr, "Can't get time from GPS Receiver\n"); break; } fflush (stderr); exit (1); } /****************************************************************************/ /* Print verbose version information and copyright notice. */ /****************************************************************************/ void HandleAbout () { fprintf (stderr, "Parts of this program were taken from MacGPS by %s", "John F. Waers\n\n"); fprintf (stderr, "If you've any questions or bugs please send email to:\n\n"); fprintf (stderr, "%53s", "tschach@zedat.fu-berlin.de"); fprintf (stderr, "\n\n"); fprintf (stderr, "The newest version can always be found at:\n\n"); fprintf (stderr, "%57s", "ftp.fu-berlin.de:/pub/unix/misc/gps"); fprintf (stderr, "\n\n"); fprintf (stderr, "*******************************************************************************\n"); fprintf (stderr, "* Permission to use, copy, modify, and distribute this software and its *\n"); fprintf (stderr, "* documentation for non-commercial purpose, is hereby granted without fee, *\n"); fprintf (stderr, "* providing that the copyright notice appears in all copies and that both *\n"); fprintf (stderr, "* the copyright notice and this permission notice appear in supporting *\n"); fprintf (stderr, "* documentation. I make no representations about the suitability of this *\n"); fprintf (stderr, "* software for any purpose. It is provides \"as is\" without express or *\n"); fprintf (stderr, "* implied warranty. *\n"); fprintf (stderr, "*******************************************************************************\n"); exit (0); } /****************************************************************************/ /* Query GPS for device type and software version. */ /****************************************************************************/ void InfoAboutGPS () { int status; char *string; status = getGPSVersion(&string); printf ("Connected GPS [%s] is: %s\n", gPrefs.Device, string); exit (status); } /****************************************************************************/ /* Turn off GPS device. */ /****************************************************************************/ void TurnOffGPS () { sendGPSOff (); exit (0); } /****************************************************************************/ /* Get time from GPS - compare with local time and adjust if requested. */ /****************************************************************************/ void AdjustTime (char dowhat, int m) { long diffis; time_t clock, clockgps; struct timeval tp; time (&clock); clockgps = getGPSTime (m); if (clockgps == -1) ParseError (5); printf ("Local time determine from GPS-Receiver is: %s", ctime (&clockgps)); printf ("Local time on machine is: %s\n", ctime (&clock)); diffis = (clockgps - clock); if (diffis < 0) diffis = diffis * (-1); printf ("Time difference is %ld seconds.\n", diffis); /* if set-option and uid=root then adjust local time */ if (dowhat == 's') { if (getuid () == 0) { if (diffis <= 7200) { clockgps = getGPSTime (m); tp.tv_sec = clockgps; tp.tv_usec = 5000; /* to adjust lost time in process */ settimeofday (&tp, (struct timezone *) NULL); fprintf (stderr, "\nLocal time set to: %s", ctime (&clockgps)); } else { fprintf (stderr, "\nTime difference is > 2 hours - time not set\n"); } } else fprintf (stderr, "\nSorry, only root can set the time.\n"); } exit (0); } /*****************************************************************************/ /* Catch signals to get grateful death. */ /*****************************************************************************/ void TerminateHandler (sig) int sig; { if (sig == SIGINT) { fprintf (stderr, "\nDon't touch me...but you've pressed CTRL-C\n"); fprintf (stderr, "It was your choice....exiting\n"); } else { fprintf (stderr, "\nGotcha...somebody try to shoot me...but he missed !\n"); fprintf (stderr, "\nBut okay, committing suicide....\n"); } exit (0); } /*****************************************************************************/ /* H a u p t p r o g r a m m */ /*****************************************************************************/ int main (argc, argv) int argc; char *argv[]; { /* Initialize Signal handler */ signal (SIGTERM, TerminateHandler); signal (SIGINT, TerminateHandler); /* Get program name and print headline */ progname = argv[0]; PrintHeadLine (); /* Print usage information if no parameters where given */ if (argc <= 1) usage (); /* Init preferences - overwrite serial device if $GPSDEV is set */ FileName[0] = '\0'; InitPrefs (); if (getenv ("GPSDEV") != NULL) sprintf (gPrefs.Device, "%s", getenv ("GPSDEV")); /* Parse arguments */ for (prog = *argv++; --argc; argv++) { if (strstr(*argv, "--debug")) debugging++; else if (0 == strcmp("--verbose",*argv)) verbose++; else if (0 == strcmp("--help",*argv)) usage(); else if (argv[0][0] == '-') { switch (argv[0][1]) { case 'd': dowhat = *argv + 2; cmd = 'd'; break; case 'u': dowhat = *argv + 2; cmd = 'u'; break; case 'p': if (argv[0][2]) /* device is part of this switch */ sprintf (gPrefs.Device, "%s", *argv + 2); else /* device is in next argument */ if (--argc) sprintf (gPrefs.Device, "%s", *++argv); else usage(); break; case 'v': HandleAbout (); break; case 'i': InfoAboutGPS (); break; case 'o': TurnOffGPS (); break; case 's': SetupProgram (); break; case 't': dowhat = *argv + 2; AdjustTime (*dowhat, 0); break; case 'm': if (file_format==MAYKO) file_format=MAYKO2; /* include rate data */ else file_format=MAYKO; if (verbose) fprintf (stderr, "\n... Mayko-mXmap format is enabled !\n"); break; case 'z': gPrefs.model = 'y'; break; } } else { if (strlen (FileName) == 0) { FileName[FILENAME_MAX] = 0; strncpy(FileName, argv[0], FILENAME_MAX); } } } /* Exit if no serial device */ if (strlen (gPrefs.Device) == 0) ParseError (4); /* Parse up- and download parameters */ if (cmd != ' ') what = dowhat[0]; switch (cmd) { case 'd': { if (strlen (FileName) == 0) refNum = stdout; else { refNum = fopen (FileName, "wt"); if (!refNum) { fprintf(stderr, "Cannot open %s for writing.\n", FileName); exit(1); } } switch (what) { case 'a': getGPSInfo (refNum, ALMANAC); break; case 'r': getGPSInfo (refNum, ROUTE); break; case 't': getGPSInfo (refNum, TRACK); break; case 'w': getGPSInfo (refNum, WAYPOINT); break; default: ParseError (2); break; } break; } case 'u': { if (strlen (FileName) == 0) refNum = stdin; else { refNum = fopen (FileName, "rt"); if (!refNum) { fprintf(stderr, "Cannot open %s for reading.\n", FileName); exit(1); } } switch (what) { case 'r': sendGPSInfo (refNum, ROUTE); break; case 't': sendGPSInfo (refNum, TRACK); break; case 'w': sendGPSInfo (refNum, WAYPOINT); break; default: ParseError (3); break; } break; } default: ParseError (1); break; } exit (0); } gpstrans-0.41/src/prefs.c0000644000175000017500000002257110225356640012304 00000000000000/****************************************************************************/ /* */ /* ./ascii/prefs.c - Set, Load and Save preferences */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* Copyright (c) 2001 by Joao Seabra - CT2GNL (seabra@ci.aac.uc.pt) */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #include "Prefs.h" #include "getline.h" #include #include /* define external variables */ extern struct DATUM const gDatum[]; /* Variables from gps/datum.c */ extern struct ELLIPSOID const gEllipsoid[]; extern short nDatums; extern char gMessageStr[]; /* define global variables */ char prop_scratch[255]; struct PREFS gPrefs; /* prototype functions */ void SetEllipsoid (int n); /****************************************************************************/ /* Expend a filename to absolute path. */ /****************************************************************************/ char * AbsolutFilename (ch) char *ch; { char temp[255], temp1[255]; char *search; struct passwd *pwdentry; if (ch[0] != '~') { sprintf (prop_scratch, "%s", ch); return (&prop_scratch[0]); } sprintf (temp, "%s", ch); if (ch[1] == '/') { sprintf (temp1, "%s%s", getenv ("HOME"), &temp[1]); sprintf (temp, "%s", temp1); } else { sprintf (temp1, "%s", temp); search = strchr (temp1, '/'); *search = (char) 0; pwdentry = getpwnam (&temp1[1]); search = strchr (temp, '/'); if (pwdentry != NULL) { sprintf (temp1, "%s%s", pwdentry->pw_dir, search); sprintf (temp, "%s", temp1); } else { temp[0] = (char) 0; } } sprintf (prop_scratch, "%s", temp); return (&prop_scratch[0]); } /****************************************************************************/ /* Analyzes a dataline and separate keyword and data. */ /****************************************************************************/ int AnalyzeLine (line, key, data) char line[255], key[255], data[255]; { int i; if (line[strlen (line) - 1] == '\n') line[strlen (line) - 1] = '\0'; if (line[0] == '#') return (1 == 2); if (strlen (line) < 5) return (1 == 2); i = 0; while ((i <= strlen (line)) && (line[i] != ':')) i++; if (i >= strlen (line)) return (1 == 2); sprintf (key, "%s", line); key[i] = '\0'; while (key[0] == ' ') sprintf (key, "%s", &key[1]); while (key[0] == '\t') sprintf (key, "%s", &key[1]); if (strlen (key) != 4) return (1 == 2); sprintf (data, "%s", &line[i + 2]); return (1 == 1); } /****************************************************************************/ /* Save preferences in Preference-File defined in defs.h. */ /****************************************************************************/ void SavePrefs () { FILE *preffp; preffp = fopen (AbsolutFilename (PrefFileName), "wt"); if (preffp == (FILE *) 0) { sprintf (gMessageStr, "Can't write preferences in file '%s'", AbsolutFilename (PrefFileName)); Message (gMessageStr); } else { fprintf (preffp, "# Properties file of gpstrans - do not edit this file\n"); fprintf (preffp, "FMAT: %d\n", gPrefs.format); fprintf (preffp, "OFFS: %1.2f\n", gPrefs.offset); fprintf (preffp, "DATU: %d\n", gPrefs.datum); fprintf (preffp, "DEVI: %s\n", gPrefs.Device); fprintf (preffp, "MODL: %c\n", gPrefs.model); fprintf (preffp, "FEET: %d\n", gPrefs.feet); fclose (preffp); } } /****************************************************************************/ /* Load preferences from Preference-File - set default if not exist. */ /****************************************************************************/ void LoadPrefs () { char Line[255], Keyword[255], Data[255]; int value; float floatval; FILE *preffp; gPrefs.format = DMS; gPrefs.offset = +0.0; gPrefs.datum = 100; gPrefs.model = 'n'; gPrefs.feet = 0; sprintf (gPrefs.Device, "%s", DefaultServerDevice); preffp = fopen (AbsolutFilename (PrefFileName), "rt"); if (preffp != (FILE *) 0) { fgets (Line, 255, preffp); while (!feof (preffp)) { if (AnalyzeLine (Line, Keyword, Data)) { if (!strcmp (Keyword, "FMAT")) { sscanf (Data, "%d", &value); gPrefs.format = value; } else if (!strcmp (Keyword, "OFFS")) { sscanf (Data, "%f", &floatval); gPrefs.offset = (double) floatval; } else if (!strcmp (Keyword, "DATU")) { sscanf (Data, "%d", &value); gPrefs.datum = value; } else if (!strcmp (Keyword, "DEVI")) { sprintf (gPrefs.Device, "%s", Data); } if (!strcmp (Keyword, "MODL")) { sscanf (Data, "%c", &gPrefs.model); } } fgets (Line, 255, preffp); } fclose (preffp); } } /****************************************************************************/ /* Init preferences. */ /****************************************************************************/ void InitPrefs () { LoadPrefs (); } /****************************************************************************/ /* Wait for RETURN when called. */ /****************************************************************************/ void WaitforReturn () { printf ("Press RETURN for more "); fflush (stdout); getchar (); } /****************************************************************************/ /* Setup preferences - datum, format, time offset and serial device. */ /****************************************************************************/ void SetupProgram () { int value; short v; float floatval; char *p; for (v = 0; v <= nDatums; v++) { printf ("%3d - %-25s ", v, gDatum[v].name); if (((v + 1) % 2) == 0) printf ("\n"); if ((v == 39) || (v == 85)) WaitforReturn (); } printf ("\n"); do { p = getline ("Please select datum: "); sscanf (p, "%d", &value); printf ("\n"); } while ((value < 0) || (value > nDatums) || (p[0] < '0') || (p[0] > '9')); gPrefs.datum = value; printf ("\n\n"); printf (" 0 - lat/lon ddd°mm'ss.s\"\n"); printf (" 1 - lat/lon ddd°mm.mmm'\n"); printf (" 2 - lat/lon ddd.ddddd\n"); printf (" 3 - utm/ups Grid\n"); printf (" 4 - British Grid\n"); printf (" 5 - Irish Grid\n"); printf (" 6 - Finnish Grid\n"); printf (" 7 - Swedish Grid\n"); printf (" 8 - German Grid\n\n"); do { p = getline ("Please select format: "); sscanf (p, "%d", &value); printf ("\n"); } while ((value < 0) || (value > 8) || (p[0] < '0') || (p[0] > '9')); gPrefs.format = value; printf ("\n"); do { p = getline ("Please select time offset (-12 to +12): "); sscanf (p, "%f", &floatval); printf ("\n"); } while ((floatval < -12.0) || (floatval > 12.0)); gPrefs.offset = (double) floatval; printf ("\n"); do { p = getline ("Please enter serial device name: "); sprintf (gPrefs.Device, "%s", p); printf ("\n"); } while (strlen (gPrefs.Device) == 0); printf ("\n"); do { p = getline ("Is your model etrex (or other similar model) (y/n)?"); /* Add support to several models.Thats why we put the y as char */ /* In practical terms,answer means BYTE not model. */ /* Seabra */ sscanf (p, "%c", &gPrefs.model); } while (strlen (&gPrefs.model) == 0); printf ("\n"); printf ("\n\n"); printf ("Preferences have been saved to ~/.gpstrans and will be used in the"); printf (" future.\n"); SavePrefs (); exit (0); } gpstrans-0.41/src/util.c0000644000175000017500000001000310240772673012132 00000000000000/****************************************************************************/ /* */ /* ./ascii/util.c - Utility procedures */ /* */ /* This file is part of gpstrans - a program to communicate with garmin gps */ /* */ /* */ /* Copyright (c) 1995 by Carsten Tschach (tschach@zedat.fu-berlin.de) */ /* */ /* */ /* This program is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU General Public License */ /* as published by the Free Software Foundation; either version 2 */ /* of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ /* GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License */ /* along with this program; if not, write to the Free Software */ /* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, */ /* USA. */ /****************************************************************************/ #include "defs.h" #include "Garmin.h" #ifdef __LINUX__ #include "time.h" #endif /* define global variables */ char gMessageStr[255]; unsigned short product_ID; unsigned short software_version; char *protocols; /* typical contents: "P000 L001 A010 A100 D108 A201 D202 D108 D210 A301 D310 D301 A500 D501 A600 D600 A700 D700 A800 D800 A900 A902 A903" */ /****************************************************************************/ /* Get line from input file - only implemented for compatibility reason. */ /****************************************************************************/ short GetLine (FILE * refNum, char *line, short init) { while (!feof (refNum)) { fgets (line, MAX_LINE, refNum); if (*line != '#') return 1; } *line = '\0'; return 0; } /****************************************************************************/ /* Print message text. */ /****************************************************************************/ void Message (char *txt) { fprintf (stderr, "INFO: %s\n", txt); fflush (stderr); } /****************************************************************************/ /* Print error message and exit program. */ /****************************************************************************/ void Error (char *txt) { fprintf (stderr, "ERROR: %s\n", txt); fflush (stderr); exit (1); } /****************************************************************************/ /* Get local time in seconds - only implemented for compatibility reason. */ /****************************************************************************/ long TickCount () { time_t count; time (&count); return (long) count; } /****************************************************************************/ /* allocate memory from the heap, checking for out of memory condition */ /****************************************************************************/ void * xmalloc (int num) { void *p; p = malloc(num); if (!p) Error("out of memory"); return p; } gpstrans-0.41/COPYING0000644000175000017500000004307610225356640011270 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. gpstrans-0.41/ChangeLog0000644000175000017500000002727111037770064012010 000000000000002008-07-16 James R. Van Zandt * src/include/defs.h (ProgramVersion): version 0.41 * src/gps/getgpsinfo.c (getGPSVersion): make protocol parsing robust to bogus count read from the device. * README: My modifications are released under the GPL. 2006-05-08 James R. Van Zandt * Makefile (VERSION): use $(shell ), so it's only evaluated once. (distdir): simplify evaluation (would probably fail for some corner cases which don't occur here). 2006-05-07 James R. Van Zandt * Makefile (dist): new target, to make .tar.gz file * src/main.c (InfoAboutGPS): Exit with nonzero status if GPS doesn't respond. * src/include/protocols.h: omit bogus "packed" attribute for struct D100_Wpt_Type. * src/gps/getgpsinfo.c (getGPSVersion): New calling sequence: return nonzero status on error. * src/gps/sendgpsinfo.c (sendGPSInfo): use new calling sequence for getGPSVersion. * src/gps/getgpsinfo.c (getGPSInfo): use new calling sequence for getGPSVersion. * src/include/defs.h (ProgramVersion): version 0.40 2005-06-05 James R. Van Zandt * src/gps/getgpsinfo.c (doAlmanac): leave health flag ~1 if not set in the packet. 2005-05-31 James R. Van Zandt * src/gps/sendgpsinfo.c (sendGPSInfo): Report the number of tracks uploaded. 2005-05-30 James R. Van Zandt * src/main.c (usage): consolidate several calls to fprintf. Document --help, --debug, and --verbose. 2005-05-12 James R. Van Zandt * src/gps/garmincomm.c (CheckGPS): Fix wording of some messages and comments. * src/sendgpsinfo.c: move error messages to just after a test. (saveFormat): add ";" after last case label, to silence gcc warning. (field): If input line doesn't have enough tabs, fail with error message. (getFileFormat): rename buffer "data" -> "first". Test the input file rather than relying on input switch to determine file format. * src/main.c (main): recognize "--debug" switch even if more letters are appended (e.g. "--debugging"). * src/include/protocols.h (enum): Add hex packet IDs as comments. * src/main.c (PrintHeadLine): add to copyright printout * src/Makefile (CFLAGS): remove -pedantic (unhelpful) 2005-05-08 James R. Van Zandt * src/util.c (GetLine): lines starting with '#' in input file are comments. 2005-05-05 James R. Van Zandt * src/main.c (main): check whether specified input or output file could be opened, and complain if not. 2005-05-02 James R. Van Zandt * src/gps/getgpsinfo.c (doTrack_xmap): functionality moved into doWaypoint. (doTrack): functionality moved into doWaypoint. (doWaypoint): factored function into read-from-device (loading a struct) then write-to-file. For CSV, supporting waypoint, route, and track formats. For MAYKO, supporting route and track formats. * src/include/defs.h (ProgramYear): update from 1995 to 2005. (Apparently had not been noticed by previous maintainers.) 2005-05-01 James R. Van Zandt * src/main.c (main): Prevent buffer overflow when copying filename. Allow FILENAME_MAX (POSIX value) characters in filename. Added command line options --debug (replacing #define DEBUG) and --verbose. New variable file_format selects format of output file, default is TSV (tab separated value), otherwise MAYKO. (Planning for comma separated value (CSV), and others.) 2005-04-22 James R. Van Zandt * src/gps/garmincomm.c (getGPSack): If expecting an ACK and packet ID for received packet is neither ACK nor NAK, just discard it. (Sometimes getting packet with ID=9, which isn't even listed in the ICD). 2005-04-15 James R. Van Zandt * src/gps/getgpsinfo.c (saveFormat): If format isn't recognized, use DDD. 2005-04-10 James R. Van Zandt * src/util.c (xmalloc): safely allocate memory from heap. * src/gps/sendgpsinfo.c (getFileFormat): rename getFileData->getFileFormat for clarity. * src/gps/getgpsinfo.c (doAlmanac): Read almanac data in any of the Garmin formats. Print time of applicability (AKA almanac data reference time) from packet (was always printing 32768). Print satellite ID from packet if available (was assuming packets are read in satellite order, starting at 001). Print health from packet if available (was always printing 000). 2005-04-09 James R. Van Zandt * src/gps/sendgpsinfo.c (sendGPSInfo): fix spelling of "transferred". 2005-04-08 James R. Van Zandt * src/include/protocols.h (enum): adjust spacing of L001 enum and "packed" attribute declarations. * src/gps/getgpsinfo.c (doWaypoint): Handle route and track packets as well as waypoint packets. 2005-04-07 James R. Van Zandt * src/gps/getgpsinfo.c (doWaypoint): waypoint name can be up to 15 characters (for models with zero-terminated strings). (getGPSInfo): reformat code for compactness. 2005-04-06 James R. Van Zandt * src/include/protocols.h (struct): Add "packed" attribute to all structs, so compiler doesn't add padding. 2005-04-02 James R. Van Zandt * src/gps/garmincomm.c (sendGPSMessage): added separate buffer for outgoing message, so it won't be necessary to write the ACK before reading the corresponding packet. (getGPSack): new function to read and validate the ACK packets. * src/gps/sendgpsinfo.c: records() accepts file pointer as a parameter instead of via a global variable. Rename variables "refNum" and "FileRefNum" to "ifile". * src/gps/getgpsinfo.c (getGPSVersion): If the device doesn't implement the protocol capability protocol, deduce its capabilities from the product ID and software version. * src/main.c (main): Allow serial device to be either part of the switch ("-p/dev/ttyS0") or in the next argument ("-p /dev/ttyS0"). 2005-03-31 James R. Van Zandt * src/gps/getgpsinfo.c (getGPSVersion): If the device implements the protocol capability protocol, save the protocols supported in a string. * document the waypoint packet formats implemented so far (D100 and D108). * util.c: save the Garmin product ID from the product data packet. 2005-03-27 James R. Van Zandt * getgpsinfo.c (getGPSInfo): Calculate total (=number of records) in endian-neutral fashion. Revision History: ================= GPStrans (version 0.39) - release 01/06/16 ------------------------------------------ Changed by Joao Seabra * Changed code to GNU GPL (with Carsten Tschach's permission) This and future releases will be totally under GNU GPL * Added altitude support for etrex waypoint download * man page corrections and changes ( Thanks to James R. Van Zandt ) * Changed default model to n to avoid misterious failures after upgrades ( Thanks to James R. Van Zandt ) * Removed deb dir ( Thaks to James R. Van Zandt ) * Source code indented (GNU style) Changed by David Gesswein djg@pdp8online.com * Fixed waypoints to work with GPSII+. * Fixed calculation of UTM zone and conversion from UTM to lat-lon * Wrote comments for waypoints left justified in file since the upload code sent the comment with all the extra spaces right justifying added (gps/sendgpsinfo.c) * Code cleanup (warnings from gps/dms.c and grid/kkj.c). Don't know if kkj.c fix is really correct. GPStrans (version 0.38) - release 01/03/03 ------------------------------------------ * Code clean-up and minor code correction * -z command line option added * setup config support for etrex and other models * prepared the setup to support all garmin models (code) * removed the -tm option. Use setup or -z option * Correct download of waypoints for etrex and other models * Corrected the isblank() to be fully ANSI comliant * Updated the uninstall to remove the ~/.gpstrans GPStrans (version 0.37) - release 01/02/19 ------------------------------------------ * Code clean-up and some minor code correction. * Added command line time support for etrex (and other models like) * Added install/uninstall * Documentation updated * Added a TODO Matthias Kattanek has not answered my mails about gpstrans update.I would like to know if he plans to keep up with gpstrans or not. Since i have permission from the author i've decided to post a new version... Bug reports are welcome to GPStrans (version 0.36) - release 00/07/15 ------------------------------------------ * Thanks to "Andreas Lange" to implementing the german grid (aka Gauss-Krueger Grid) and adding the potsdam map datum. GPStrans (version 0.35) - release 00/03/06 ------------------------------------------ * Thanks to "Anders Lennartsson" for providing a patch for swedish grid . GPStrans (version 0.34a) - release 98/08/17 ------------------------------------------ * Thanks to "Jim R. Van Zandt" for the modified man page. GPStrans (version 0.34) - release 98/08/15 ------------------------------------------ * Up and download routes (*.xrou) in Mayko mXmap format * Correct route upload counter (could cause segmentation fault) GPStrans (version 0.33-mk) - release 98/07/28 --------------------------------------------- Thanks to "Jim R. Van Zandt" , who send a patch which addresses several problems in addition to the broken "extract model name and software version" function: * Added wait, to allow receiver time to respond with model name and software version. * Increased maximum record length read from device, to suit Garmin 90 (bug reported by Klaus Wacker ) * Maximum length line read from data file now limited to size of available buffer. * ascii/gps/garminserial.c: setting CLOCAL, so /dev/ttyS? works (formerly, only /dev/cua? worked) * ascii/main.c: Modified byte order conversions to work correctly on either big endian or little endian machine. * The format for a time should be %ld. * fix some English spelling and usage errors. * latlong.c: Under Linux, PI is already #defined in math.h. * gpstrans.1: Added circuit diagrams, added highlighting, noted that -s saves the values in ~/.gpstrans. GPStrans (version 0.32b-mk) - release 98/04/23 -------------------------------------------------- - hacked to save track data Mayko-Xmap format (.xlog) - version 0.32b-mk (versa 0.32-mk) will calculate speed based on distance and time between two gps points. GPStrans (version 0.31beta-js1) - release 12/10/96 -------------------------------------------------- - Contains only the ascii version, hacked to work with Garmin 45XL in Linux. - A Finnish national grid (one-zone KKJ called yhtenaiskoordinaatisto, Grid 27E) implemented. GPStrans (version 0.31beta) - release 06/07/95 --------------------------------------------- - Bugfix: Input-file will be opened for writing. GPStrans (version 0.3beta) - release 06/05/95 --------------------------------------------- - A full working ASCII-Version comes with gpstrans: with extra features like adjusting unix-clock from GPS. - Fix a bug in UTM convertion - The X11-Version is now called 'xgpstrans' and the ASCII-Version is 'gpstrans' GPStrans (version 0.2beta) - release 05/23/95 --------------------------------------------- - Identify GPS Model in about-window - Menu on Quit: Let decide to Cancel, Just Quit and Turn of GPS and Quit. GPStrans (version 0.1beta) - release 05/18/95 --------------------------------------------- - First public release of GPStrans gpstrans-0.41/INSTALL0000644000175000017500000000105710225356640011257 00000000000000Installing GPStrans ==================== Just type: shell> make shell> make install This will put the binary under the directory /usr/local/bin. To run gpstrans just type: shell> gpstrans If you need any help try to read the man pages shell> man gpstrans Uninstalling GPStrans ==================== If you want to remove gpstrans binary from your HD just type in the GPStrans directory: shell> make uninstall This will also remove GPStrans manpage from HD. Please report any bugs/questions to: Have fun! Joao Seabra gpstrans-0.41/LICENSE0000644000175000017500000003522510225356640011237 00000000000000GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS gpstrans-0.41/Makefile0000644000175000017500000000522410427763761011700 00000000000000############################################################################## # # Makefile for the ascii-version of GPStrans # ############################################################################## PACKAGE=gpstrans all: @make -C src/ clean: @echo "Cleaning all in ./" @rm -f src/core src/gpstrans src/*.o src/*.bak src/*~ src/#*# @echo "Cleaning all in ./gps" @(cd src/gps ; make clean) @echo "Cleaning all in ./grid" @(cd src/grid ; make clean) @echo "Cleaning all in ./getline" @(cd src/getline ; make clean) install: @strip src/gpstrans @cp src/gpstrans debian/gpstrans/usr/bin/gpstrans # @gzip -9 doc/gpstrans.1 > /usr/share/man/man1/gpstrans.1.gz @echo "Installation complete!" make uninstall: @rm -f /usr/local/bin/gpstrans @rm -f /usr/share/man/man1/gpstrans.1.gz @rm -f ~/.gpstrans @echo "Uninstall complete!" DIRS= doc \ src \ src/gps \ src/grid \ src/getline \ src/include DISTFILES=COPYING \ ChangeLog \ INSTALL \ LICENSE \ Makefile \ README \ README.mxmap \ TODO \ copyright \ doc/gpstrans-old.html \ doc/gpstrans.1 \ src/Makefile \ src/TAGS \ src/graph.c \ src/main.c \ src/prefs.c \ src/util.c \ src/getline/CHANGES \ src/getline/Makefile \ src/getline/README \ src/getline/getline.3 \ src/getline/getline.c \ src/getline/getline.h \ src/getline/testgl.c \ src/gps/Makefile \ src/gps/calendar.c \ src/gps/datum.c \ src/gps/dms.c \ src/gps/garmincomm.c \ src/gps/garminserial.c \ src/gps/getgpsinfo.c \ src/gps/gpsmessage.c \ src/gps/latlong.c \ src/gps/sendgpsinfo.c \ src/grid/Makefile \ src/grid/bng.c \ src/grid/gkk.c \ src/grid/gridutils.c \ src/grid/itm.c \ src/grid/kkj.c \ src/grid/seg.c \ src/grid/tm.c \ src/grid/ups.c \ src/grid/utm.c \ src/include/Garmin.h \ src/include/Prefs.h \ src/include/defs.h \ src/include/gpsinfo.h \ src/include/gpstrans.gif \ src/include/gpstrans.icon \ src/include/gpstrans_small.gif \ src/include/graph.h \ src/include/icon.icon \ src/include/main.gif \ src/include/protocols.h \ src/include/util.h srcdir = . top_srcdir = . top_distdir = . VERSION := $(shell perl -ne 'if (/ProgramVersion.*"([0-9.]*)"/){ print "$$1";}' src/include/defs.h) distdir := $(PACKAGE)-$(VERSION) distdir: $(DISTFILES) rm -fr $(distdir) $(am__remove_distdir) mkdir $(distdir) for d in $(DIRS); do mkdir $(distdir)/$$d; chmod 755 $(distdir)/$$d; done for f in $(DISTFILES); do cp -p $$f $(distdir)/$$f; done dist: distdir tar chof - $(distdir) | GZIP=--best gzip -c >$(distdir).tar.gz rm -fr $(distdir) gpstrans-0.41/README0000644000175000017500000002270211037770101011100 00000000000000GPStrans-0.37 ------------- Code clean-up and some minor code correction. Added command line time support for etrex (and other models like) Added install/uninstall Documentation updated Added a TODO Since i got no answer from mattes@ugraf.com and i had permission from the author, i've decided to post this new version of gpstrans. Bug reports are welcome to GPStrans-0.36 ------------- This implements german grid (aka Gauss-Krueger Grid) and adds the potsdam map datum. Contribution made by Andreas Lange . GPStrans-0.35 ------------- includes adds functionality for Swedish grid coordinates to gpstrans. Thanks to Anders Lennartsson for the contribution. GPStrans-0.34 ------------- GPStrans-0.34 will allow you to exchange "routes" between Mayko mXmap and the Garmin GPS receiver. You can create your 'route' easily within mXmap and save in a file to upload it later into your Garmin device. gpstrans -m -ur your_mxmap_route.xrou Note: the route will be saved as the default route (0) with the name MAYKO MXMAP in the Garmin itself. From there you can activate it or store (if available) in one of the route registers. It needs to be addressed that the Garmin has some limitation for the route name and the route waypoints. All routes appear in capital letters and spaces will be automatically eliminated by gpstrans when saving the route. Route names will be displayed with the max. length of your device. Route waypoints are stripped down to 6 chars. Vice versa you can save a route from the Garmin in a file "*.xrou" and import this into mXmap to display the route on a map. gpstrans -m -dr fromgarmin.xrou Bugfixes: On saving routes a segmentation fault could happen, because the record counter used to compute one route too much. What is GPStrans-0.33 --------------------- This version (re-)support the '-i' option, which tells you model name and software version from your Garmin GPS. Thanks to Jim Van Zandt , who send the patch. (see CHANGELOG for more details) usage - 'gpstrans -i' will output the following for example: Connected GPS [/dev/cua0] is: Garmin GPS 38 - V3.04 or Connected GPS [/dev/cua0] is: Garmin GPS II+ SOFTWARE - V3.00 What is GPStrans-0.32 --------------------- GPStrans-0.32-mk is a program which allows to download tracks from your Garmin GPS and save the data in the Mayko Xmap format. Tracks retrieved from your Garmin GPS could be feed back into Mayko Xmap application (see www.mayko.com/xmap) and replayed with the "Track from log" feature. This allows you to display your recorded track on your favorite map in Mayko Xmap. It is tested on Intel-based Linux machines (2.0.33, gcc-2.7.2.1) with Garmin GPS II Plus. I haven't test it with other operating systems or with other GPS receivers. Please report any problem to mxmap@mayko.com. See the README of gpstrans-0.31b-js1 for further information. Changes to GPStrans-0.32b-mk vs. GPStrans-0.32-mk ------------------------------------------------- Version 0.32b-mk (versa 0.32-mk) will calculate speed based on distance and time between two gps points. Note, this speed is 'average' information and does not necessarily reflect the 'real' speed expirienced at track time. Use Mayko's Xmap "track to log" feature to log more detailed information. Altitude data can not be generated. Unfortunately this information (even if produced by certain Garmin GPSs) is not natively saved by a Garmin GPS and the Garmin protocol does not deliver such data either. How to use GPStrans-0.32 ------------------------ Gpstrans-0.32 includes a new option which needs to be applied to save downloaded data in the Xmap format: gpstrans -s // configure gpstrans gpstrans -m -dt >track.xlog //download and save in Xmap format Note, the current version only allows to save 'track' information of the Garmin GPS in Xmap-format. On interest we will follow up with an updated version to utilize route data between Garmin and Mayko-Xmap. How to get GPStrans ------------------- The Linux/Mayko-Xmap version of gpstrans-0.32-mk is available at: http://www.mayko.com/xmap ftp://ftp.mayko.com/pub/gpstrans Gpstrans is based on the Linux/KKJ version (gpstrans-0.31b-js) and should be available at: http://www.psych.helsinki.fi/~janne/gps/ Modified and new sources are: ----------------------------- README.xmap CHANGELOG main.c gps/getgpsinfo.c include/defs.h The diff-patch file was created using gnu's diff: diff -r -u -N gpstrans-0.31b-js1 gpstrans-0.32b-mk/ You should be able to apply the patch the following: cd you_gpstrans_direct patch -p1 yourpath/patch-0.31b_to_0.32b or gzip -dc yourpath/patch-0.31b_to_0.32b.gz |patch -p1 ------------- from here on, README of gpstrans-0.31b-js ----------------- What is GPStrans ---------------- GPStrans is a program which allows to up- and download waypoints, route, almanac and trackroutes from you Garmin GPS. This version (gpstrans-0.31b-js1) is pure ASCII and seems to work in Intel-based Linux machines (2.0, gcc-2.7.2) with Garmin 45XL. I haven't test it in other operating systems or with other GPS receivers. See Linux-diff-* files for differences between gpstrans-0.31b and gpstrans-0.31b-js. How to get GPStrans ------------------- The Linux/KKJ version (gpstrans-0.31b-js) should be available in http://www.psych.helsinki.fi/~janne/gps/ and in Peter Bennett's GPS ftp directory: ftp://sundae.triumf.ca/pub/peter/index.html. Software and Hardware Requirements ---------------------------------- To successfully compile GPStrans you'll need 'gcc' or another ansi-C compatible Compiler. GPStrans was developed using a Sun Workstation with SunOS 4.1.3. The Linux/KKJ version (gpstrans-0.31b-js) should work where the original (gpstrans-0.31b-js) works, and in Linux as well. If you have problems in Alpha-based machines for example, check the points of the code where byte order is relevant (search for __LINUX__ and you find them). Installation of GPStrans ------------------------ Check the Makefile and edit if necessary. Compile by writing 'make'. Install by hand - only the binary needs to be installed, there's not even a manual page :). If you have problems, check your serial port settings and hardware (see below). Connection the GPS to the Workstation ------------------------------------- You'll need a DB-25 connector. You'll need to connect pin 4, 5 and 6, 8, 20 together. This is used to set handshake and DTR to the correct value so that your workstation can use the serial port to communicate with the GPS. 1 ### ##### o o o # # # o # o o o o o o o o o o o # o o o o o Connect the Garmin cable as follows: 2 3 7 o o o o o o o o o o o o o 2: TX 3: RD o o o o o o o o o o o o 7: GND Pin 2 goes to DATA IN (White) Pin 3 goes to DATA OUT (Brown) Pin 7 goes to GROUND (Black) If it doesn't work in this way, try to chance Pin 2 and 3 at the connector. If you don't have any success at the first time, you might try it using a terminal program like Kermit and set the GPS to NMEA-Output. The GPS will send a data record every 2 second. As long as you don't see any data on your computer GPStrans won't work. After finishing it, be sure to set you GPS receiver to GRMN/GRMN in the I/O-Setup. Using the program ----------------- I think that the program is so easy to use that we don't need a description about it here. A couple of hints: just run it to get help; use the '-s' option at some point, it makes the use even easier. The file format --------------- If you're using GPStrans to upload data to you GPS be sure that the first line of the datafile contains a line like (without the --- line) -------8<-------------------8<------------------->8------------------->8------- Format: DMS UTC Offset: 2.00 hrs Datum[100]: WGS 84 -------8<-------------------8<------------------->8------------------->8------- GPStrans will need this line to interpret the following datalines. It gives information about the latitude/longitude format you used, the offset from local to UTC-time and the map-datum. Be sure you not change the position of the the characters in this line. After this line follows the data. Waypoints are marked with 'W', Routes with 'R', Tracks with 'T' and Almanac Data with 'A'. Each field in a line will be separated using a TAB-character and maybe some spaces (experiment or read the code). The simpliest way to understand the format is to just download data from your GPS and look at them. GPStrans Licensing Information ------------------------------ GPStrans is FreeWare. I'm releasing this source code to the public domain. You can redistribute it as often as you want as long as you let the original copyright notice in. If you like to do changes to GPStrans, please contact me before so that we can coordinate the work. GPStrans is Copyright 1995 by Carsten tschach (tschach@zedat.fu-berlin.de). The datum translation-routines are based on the program MacGPS from John F. Waers (jfwaers@csn.net). Linux/KKJ modifications Copyright 1996 by Janne Sinkkonen (janne@iki.fi). Modifications to read many more Garmin formats Copyright 2005 by Jim Van Zandt , and can be redistributed or modified under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. gpstrans-0.41/README.mxmap0000644000175000017500000000474010225356640012231 00000000000000What is GPStrans-0.32 --------------------- GPStrans-0.32-mk is a program which allows to download tracks from your Garmin GPS and save the data in the Mayko mXmap format. Tracks retrieved from your Garmin GPS could be feed back into Mayko mXmap application (see www.mayko.com/mxmap) and replayed with the "Track from log" feature. This allows you to display your recorded track on your favorite map in Mayko mXmap. It is tested on Intel-based Linux machines (2.0.33, gcc-2.7.2.1) with Garmin GPS II Plus. I haven't test it with other operating systems or with other GPS receivers. Please report any problem to xmap@mayko.com. See the README of gpstrans-0.31b-js1 for further information. Changes to GPStrans-0.32b-mk vs. GPStrans-0.32-mk ------------------------------------------------- Version 0.32b-mk (versa 0.32-mk) will calculate speed based on distance and time between two gps points. Note, this speed is 'average' information and does not necessarily reflect the 'real' speed expirienced at track time. Use Mayko's mXmap "track to log" feature to log more detailed information. Altitude data can not be generated. Unfortunately this information (even if produced by certain Garmin GPSs) is not natively saved by a Garmin GPS and the Garmin protocol does not deliver such data either. How to use GPStrans-0.32 ------------------------ Gpstrans-0.32 includes a new option which needs to be applied to save downloaded data in the Xmap format: gpstrans -s // configure gpstrans gpstrans -m -dt >track.xlog //download and save in Xmap format Note, the current version only allows to save 'track' information of the Garmin GPS in mXmap-format. On interest we will follow up with an updated version to utilize route data between Garmin and Mayko mXmap. How to get GPStrans ------------------- The Linux/Mayko mXmap version of gpstrans-0.32-mk is available at: http://www.mayko.com/xmap ftp://ftp.mayko.com/pub/gpstrans Gpstrans is based on the Linux/KKJ version (gpstrans-0.31b-js) and should be available at: http://www.psych.helsinki.fi/~janne/gps/ Modified and new sources are: ----------------------------- README.xmap CHANGELOG main.c gps/getgpsinfo.c include/defs.h The diff-patch file was created using gnu's diff: diff -r -u -N gpstrans-0.31b-js1 gpstrans-0.32b-mk/ You should be able to apply the patch the following: cd you_gpstrans_direct patch -p1 yourpath/patch-0.31b_to_0.32b or gzip -dc yourpath/patch-0.31b_to_0.32b.gz |patch -p1 gpstrans-0.41/TODO0000644000175000017500000000311710246700016010706 00000000000000 * code optimization * Update manpage (even more) * Totally GARMIN protocol compliant * Add special feature (note for me) * Add suport to upload waypoints @ 115k (?) * identify the symbols (house,hospital,etc) * download of the current position * auto-model ID to correct problem reported to me by Bertrand Orvoine. I believe this is very important and its to be corrected in the next version (i hope!) Joao Seabra - CT2GNL * etrex does not seem to download all fields and does not seem to have upload code. * Does not have good handling of serial errors. David Gesswein - djg@pdp8online.com bug fix * upload to etrex (currently the etrex receives packets and sends ACKs, but doesn't actually store the new data) (x) download waypoints (A100) (x) download tracks (A300) (x) download routes (A200) (/) upload waypoints (A100) (works with GPS II, fails with etrex) ( ) upload tracks (A300) (/) upload routes (A200) (works with GPS II, fails with etrex) implementation * parse command line with getopt_long() * recognize Mayko format input file automatically (no switch needed) * move protocol table to a configuration file * wrap sendGPSmessage and receiveGPSmessage to hide the ACK/NAK * retransmit packet if NAK is received * request retransmission if packet with bad checksum is received features * USB physical protocol * comma separated value (CSV) input/output format * shapefile input/output (for ESRI map programs and others) * some XML input/output format, preferably GML Jim Van Zandt gpstrans-0.41/copyright0000644000175000017500000000104510225356640012156 00000000000000This package was debianized by James R. Van Zandt jrv@vanzandt.mv.com on Fri, 7 Aug 1998 19:37:56 -0400. It was downloaded from http://www.sourceforge.net/projects/gpstrans Current upstream maintainers: Joao Seabra - CT2GNL David Gesswein - djg@pdp8online.com Previous contributors: Matthias Kattanek "Andreas Lange" "Anders Lennartsson" "Jim Van Zandt" Original Author: Carsten tschach (tschach@zedat.fu-berlin.de)