summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2005-08-01 15:15:55 +0000
committerEric S. Raymond <esr@thyrsus.com>2005-08-01 15:15:55 +0000
commit1aead380840db92adbb6ed3cdb213e93276956a9 (patch)
tree6e907f5825b16671d29f7cae1b01ebdd4139bc96
parentef029f6a2a1a47be5bd566a21b9b73d1ff0dd22f (diff)
downloadgpsd-1aead380840db92adbb6ed3cdb213e93276956a9.tar.gz
True North support integrated.
It's not compiled in by default, but it does require one architecture change -- device channels is now a driver- specific capability, since the Thales GPS our TrueNorth user is working with has 14 channels.
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac14
-rw-r--r--driver_proto.c1
-rw-r--r--drivers.c23
-rw-r--r--evermore.c5
-rw-r--r--garmin.c1
-rw-r--r--gps.h15
-rw-r--r--gpsd.h3
-rw-r--r--gpsd.spec.in1
-rw-r--r--gpsd.xml4
-rw-r--r--gpsutils.c2
-rw-r--r--italk.c1
-rw-r--r--libgps.c4
-rw-r--r--libgpsd_core.c4
-rw-r--r--nmea_parse.c81
-rw-r--r--packet.c14
-rw-r--r--packet_states.h4
-rw-r--r--sirf.c1
-rw-r--r--tsip.c6
-rw-r--r--zodiac.c1
20 files changed, 155 insertions, 31 deletions
diff --git a/Makefile.am b/Makefile.am
index 2cb2ac3e..8a3dd6b7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -95,6 +95,7 @@ libgps_c_sources = \
rtcm.c \
srecord.c \
bits.h \
+ trueNorth.c \
timebase.h
packet_names.h: packet_states.h
diff --git a/configure.ac b/configure.ac
index 4c78e8da..d3834fc5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -240,6 +240,19 @@ else
AC_MSG_RESULT([no])
fi
+dnl check for True North support
+AC_ARG_ENABLE(tnt,
+ AC_HELP_STRING([--enable-tnt],
+ [enable True North Technologies support]),
+ [ac_tnt=$enableval], [ac_tnt=no])
+AC_MSG_CHECKING([for True North support])
+if test x"$ac_tnt" = "xyes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([TNT_ENABLE], 1, [True North Technologies support])
+else
+ AC_MSG_RESULT([no])
+fi
+
dnl check for Evermore support
AC_ARG_ENABLE(evermore,
AC_HELP_STRING([--disable-evermore],
@@ -368,6 +381,7 @@ echo "Earthmate : $ac_earthmate"
echo "iTrax : $ac_itrax"
echo "iTalk : $ac_italk"
echo "Garmin : $ac_garmin"
+echo "True North : $ac_tnt"
echo "Evermore : $ac_evermore"
echo "RTCM104 support : $ac_rtcm104"
echo "NTP SHM : $ac_ntpshm"
diff --git a/driver_proto.c b/driver_proto.c
index e79761b4..8947700d 100644
--- a/driver_proto.c
+++ b/driver_proto.c
@@ -115,6 +115,7 @@ struct gps_type_t proto_binary =
{
.typename = "Prototype driver", /* full name of type */
.trigger = NULL, /* recognize the type */
+ .channels = 12, /* consumer-grade GPS */
.probe = NULL, /* no probe */
.initializer = proto_initializer,/* initialize the device */
.get_packet = packet_get, /* use generic packet getter */
diff --git a/drivers.c b/drivers.c
index 2589c942..eaaaa8dd 100644
--- a/drivers.c
+++ b/drivers.c
@@ -26,7 +26,7 @@ ssize_t pass_rtcm(struct gps_device_t *session, char *buf, size_t rtcmbytes)
*
**************************************************************************/
-static gps_mask_t nmea_parse_input(struct gps_device_t *session)
+gps_mask_t nmea_parse_input(struct gps_device_t *session)
{
if (session->packet_type == SIRF_PACKET) {
gpsd_report(2, "SiRF packet seen when NMEA expected.\n");
@@ -108,6 +108,7 @@ static void nmea_initializer(struct gps_device_t *session)
static struct gps_type_t nmea = {
.typename = "Generic NMEA", /* full name of type */
.trigger = NULL, /* it's the default */
+ .channels = 12, /* consumer-grade GPS */
.probe = NULL, /* no probe */
.initializer = nmea_initializer, /* probe for special types */
.get_packet = packet_get, /* use generic packet getter */
@@ -131,6 +132,7 @@ static struct gps_type_t nmea = {
static struct gps_type_t fv18 = {
.typename = "San Jose Navigation FV18", /* full name of type */
.trigger = FV18_PROBE, /* FV18s should echo the probe */
+ .channels = 12, /* consumer-grade GPS */
.probe = NULL, /* mo probe */
.initializer = NULL, /* to be sent unconditionally */
.get_packet = packet_get, /* how to get a packet */
@@ -188,13 +190,14 @@ static void sirf_mode(struct gps_device_t *session, int mode)
}
static struct gps_type_t sirfII_nmea = {
- .typename = "SiRF-II NMEA", /* full name of type */
+ .typename = "SiRF-II NMEA", /* full name of type */
#ifndef SIRFII_ENABLE
- .trigger = "$Ack Input105.", /* expected response to SiRF PSRF105 */
+ .trigger = "$Ack Input105.", /* expected response to SiRF PSRF105 */
#else
- .trigger = NULL, /* let the binary driver have it */
+ .trigger = NULL, /* let the binary driver have it */
#endif /* SIRFII_ENABLE */
- .probe = NULL, /* no probe */
+ .channels = 12, /* consumer-grade GPS */
+ .probe = NULL, /* no probe */
.initializer = sirf_initializer, /* turn off debugging messages */
.get_packet = packet_get, /* how to get a packet */
.parse_packet = nmea_parse_input, /* how to interpret a packet */
@@ -233,6 +236,7 @@ static void tripmate_initializer(struct gps_device_t *session)
static struct gps_type_t tripmate = {
.typename = "Delorme TripMate", /* full name of type */
.trigger ="ASTRAL", /* tells us to switch */
+ .channels = 12, /* consumer-grade GPS */
.probe = NULL, /* no probe */
.initializer = tripmate_initializer, /* send unconfitionally */
.get_packet = packet_get, /* how to get a packet */
@@ -281,6 +285,7 @@ static void earthmate_initializer(struct gps_device_t *session)
static struct gps_type_t earthmate = {
.typename = "Delorme EarthMate (pre-2003, Zodiac chipset)",
.trigger = "EARTHA", /* Earthmate trigger string */
+ .channels = 12, /* consumer-grade GPS */
.probe = NULL, /* no probe */
.initializer = earthmate_initializer, /* switch us to Zodiac mode */
.get_packet = packet_get, /* how to get a packet */
@@ -296,6 +301,7 @@ static struct gps_type_t earthmate = {
/*@ -redef @*/
#endif /* EARTHMATE_ENABLE */
+
#ifdef ITRAX_ENABLE
/**************************************************************************
*
@@ -390,6 +396,7 @@ static void itrax_wrap(struct gps_device_t *session)
static struct gps_type_t itrax = {
.typename = "iTrax", /* full name of type */
.trigger = "$PFST,OK", /* tells us to switch to Itrax */
+ .channels = 12, /* consumer-grade GPS */
.probe = NULL, /* no probe */
.initializer = itrax_initializer, /* initialize */
.get_packet = packet_get, /* how to get a packet */
@@ -425,6 +432,7 @@ static gps_mask_t rtcm104_analyze(struct gps_device_t *session)
static struct gps_type_t rtcm104 = {
.typename = "RTCM104", /* full name of type */
.trigger = NULL, /* no recognition string */
+ .channels = 12, /* consumer-grade GPS */
.probe = NULL, /* no probe */
.initializer = NULL, /* no initializer */
.get_packet = packet_get, /* how to get a packet */
@@ -440,7 +448,7 @@ static struct gps_type_t rtcm104 = {
#endif /* RTCM104_ENABLE */
extern struct gps_type_t garmin_binary, sirf_binary, tsip_binary;
-extern struct gps_type_t evermore_binary, italk_binary;
+extern struct gps_type_t evermore_binary, italk_binary, trueNorth;
/*@ -nullassign @*/
/* the point of this rigamarole is to not have to export a table size */
@@ -473,6 +481,9 @@ static struct gps_type_t *gpsd_driver_array[] = {
#ifdef TSIP_ENABLE
&tsip_binary,
#endif /* TSIP_ENABLE */
+#ifdef TNT_ENABLE
+ &trueNorth,
+#endif /* TSIP_ENABLE */
#ifdef EVERMORE_ENABLE
&evermore_binary,
#endif /* EVERMORE_ENABLE */
diff --git a/evermore.c b/evermore.c
index 3ac1e994..d6ac894b 100644
--- a/evermore.c
+++ b/evermore.c
@@ -116,6 +116,8 @@
#define PUT_ORIGIN 0
#include "bits.h"
+#define EVERMORE_CHANNELS 12
+
/*@ +charint -usedef -compdef @*/
static bool evermore_write(int fd, unsigned char *msg, size_t msglen)
{
@@ -268,7 +270,7 @@ gps_mask_t evermore_parse(struct gps_device_t *session, unsigned char *buf, size
gpsd_report(4, "Warning: EverMore packet has information about %d satellites!\n",
session->gpsdata.satellites);
}
- if (session->gpsdata.satellites > MAXCHANNELS) session->gpsdata.satellites = MAXCHANNELS;
+ if (session->gpsdata.satellites > EVERMORE_CHANNELS) session->gpsdata.satellites = EVERMORE_CHANNELS;
satcnt = 0;
for (i = 0; i < (size_t)session->gpsdata.satellites; i++) {
int prn;
@@ -537,6 +539,7 @@ struct gps_type_t evermore_binary =
.typename = "EverMore binary", /* full name of type */
//.trigger = "$PEMT,100,05.", /* recognize the type */
.trigger = "\x10\x02\x04\x38\x8d\xc5\x10\x03",
+ .channels = EVERMORE_CHANNELS, /* consumer-grade GPS */
.probe = NULL, /* no probe */
.initializer = evermore_initializer, /* initialize the device */
.get_packet = packet_get, /* use generic one */
diff --git a/garmin.c b/garmin.c
index ffb4f0d7..df781cbf 100644
--- a/garmin.c
+++ b/garmin.c
@@ -840,6 +840,7 @@ struct gps_type_t garmin_binary =
{
.typename = "Garmin binary", /* full name of type */
.trigger = NULL, /* no trigger, it has a probe */
+ .channels = GARMIN_CHANNELS, /* consumer-grade GPS */
.probe = garmin_probe, /* how to detect at startup time */
.initializer = garmin_init, /* initialize the device */
.get_packet = garmin_get_packet,/* how to grab a packet */
diff --git a/gps.h b/gps.h
index bf9877f4..bf19dc8e 100644
--- a/gps.h
+++ b/gps.h
@@ -17,11 +17,9 @@ extern "C" {
#include <pthread.h> /* pacifies OpenBSD's compiler */
#endif
-#define MAXTAGLEN 6 /* maximum length of sentence tag name */
-#define MAXCHANNELS 12 /* maximum GPS channels (*not* satellites!) */
-#define NMEA_CHANNELS 12 /* max channels allowed in NMEA format */
+#define MAXTAGLEN 8 /* maximum length of sentence tag name */
+#define MAXCHANNELS 14 /* maximum GPS channels (*not* satellites!) */
#define SIRF_CHANNELS 12 /* max channels allowed in SiRF format */
-#define EVERMORE_CHANNELS 12 /* max channels allowed in EverMore format */
/*
* The structure describing an uncertainty volume in kinematic space.
@@ -68,6 +66,9 @@ struct gps_fix_t {
double eps; /* Speed uncertainty, meters/sec */
double climb; /* Vertical speed, meters/sec */
double epc; /* Vertical speed uncertainty */
+ double pitch; /* Pitch angle in degrees */
+ double roll; /* Roll angle in degrees */
+ double dip; /* Dip angle in degrees */
};
/*
@@ -251,6 +252,12 @@ struct gps_data_t {
#define SAT_FIX_USED 0x40 /* used for position fix */
#endif
+ /* compass status */
+ char headingStatus;
+ char pitchStatus;
+ char rollStatus;
+ double horzField; /* Magnitude of horizontal magnetic field */
+
/* where and what gpsd thinks the device is */
char gps_device[PATH_MAX]; /* only valid if non-null. */
char *gps_id; /* only valid if non-null. */
diff --git a/gpsd.h b/gpsd.h
index 59131bb5..b1de3e67 100644
--- a/gpsd.h
+++ b/gpsd.h
@@ -70,6 +70,7 @@ struct gps_type_t {
/* GPS method table, describes how to talk to a particular GPS type */
/*@observer@*/char *typename;
/*@observer@*//*@null@*/char *trigger;
+ int channels;
/*@null@*/bool (*probe)(struct gps_device_t *session);
/*@null@*/void (*initializer)(struct gps_device_t *session);
/*@null@*/ssize_t (*get_packet)(struct gps_device_t *session);
@@ -230,6 +231,7 @@ struct gps_device_t {
extern struct gps_type_t **gpsd_drivers;
/* GPS library internal prototypes */
+extern gps_mask_t nmea_parse_input(struct gps_device_t *);
extern gps_mask_t nmea_parse(char *, struct gps_device_t *);
extern int nmea_send(int, const char *, ... );
extern void nmea_add_checksum(char *);
@@ -238,7 +240,6 @@ ssize_t pass_rtcm(struct gps_device_t *, char *, size_t);
extern gps_mask_t sirf_parse(struct gps_device_t *, unsigned char *, size_t);
extern gps_mask_t evermore_parse(struct gps_device_t *, unsigned char *, size_t);
-
extern void packet_reset(struct gps_device_t *);
extern void packet_pushback(struct gps_device_t *);
extern ssize_t packet_parse(struct gps_device_t *, size_t);
diff --git a/gpsd.spec.in b/gpsd.spec.in
index 874094cc..5e034a84 100644
--- a/gpsd.spec.in
+++ b/gpsd.spec.in
@@ -141,6 +141,7 @@ cp gps.py gpsfake.py "$RPM_BUILD_ROOT"%{_libdir}/python${PYVERSION}/site-package
RTCM104 and display differential-GPS data in a readable format; also,
gpsd can now serve RTCM104 on port 2101. Added dangerous alpha version
of gpsflash. Work around a nasty bug in the i.Trek M3's firmware.
+ Added support for True North Technologies Revolution 2X Digital compass.
* Wed Jul 6 2005 Eric S. Raymond <esr@snark.thyrsus.com> - 2.28-1
- The 2.27 source tarball somehow got truncated on upload.
diff --git a/gpsd.xml b/gpsd.xml
index 8b473c1b..45f69665 100644
--- a/gpsd.xml
+++ b/gpsd.xml
@@ -60,7 +60,9 @@ extended NMEA used by iTrax. <application>gpsd</application>
effectively hides the differences among these. It also knows about and
uses commands that tune the GPS for lower latency, decrease bandwidth
usage, or increased accuracy on the San Jose Navigation FV18, the Sony
-CXD2951, the uBlox, and the Motorola OnCore GT+.</para>
+CXD2951, the uBlox, and the Motorola OnCore GT+. It can read heading
+and attitude information from the True North Technologies Revolution
+2X Digital compass.</para>
<para><application>gpsd</application> can use differential-GPS
corrections from a DGPS radio or over the net, from a ground station running a
diff --git a/gpsutils.c b/gpsutils.c
index ade5cd57..f05188b6 100644
--- a/gpsutils.c
+++ b/gpsutils.c
@@ -408,7 +408,7 @@ gps_mask_t dop(struct gps_data_t *gpsdata)
#ifdef __UNUSED__
gpsd_report(0, "Satellite picture:\n");
- for (k = 0; k < MAXCHANNELS; k++) {
+ for (k = 0; k < gpsdata->device_type.channels; k++) {
if (gpsdata->used[k])
gpsd_report(0, "az: %d el: %d SV: %d\n",
gpsdata->azimuth[k], gpsdata->elevation[k], gpsdata->used[k]);
diff --git a/italk.c b/italk.c
index bf60aa91..e734cba1 100644
--- a/italk.c
+++ b/italk.c
@@ -110,6 +110,7 @@ struct gps_type_t italk_binary =
{
.typename = "iTalk binary", /* full name of type */
.trigger = NULL, /* recognize the type */
+ .channels = 12, /* consumer-grade GPS */
.probe = NULL, /* no probe */
.initializer = italk_initializer,/* initialize the device */
.get_packet = packet_get, /* use generic packet grabber */
diff --git a/libgps.c b/libgps.c
index 50f5edd6..574ab9ed 100644
--- a/libgps.c
+++ b/libgps.c
@@ -257,7 +257,7 @@ static void gps_unpack(char *buf, struct gps_data_t *gpsdata)
char eph[20], epv[20], track[20],speed[20], climb[20];
char epd[20], eps[20], epc[20];
int st = sscanf(sp+2,
- "%6s %lf %lf %lf %lf %s %s %s %s %s %s %s %s %s",
+ "%8s %lf %lf %lf %lf %s %s %s %s %s %s %s %s %s",
tag, &nf.time, &nf.ept,
&nf.latitude, &nf.longitude,
alt, eph, epv, track, speed, climb,
@@ -289,7 +289,7 @@ static void gps_unpack(char *buf, struct gps_data_t *gpsdata)
gpsdata->set |= SPEEDERR_SET;
if (isnan(nf.epc)==0)
gpsdata->set |= CLIMBERR_SET;
-
+ nf.pitch = nf.roll = nf.dip = NAN;
gpsdata->fix = nf;
(void)strcpy(gpsdata->tag, tag);
gpsdata->set = TIME_SET|TIMERR_SET|LATLON_SET|MODE_SET;
diff --git a/libgpsd_core.c b/libgpsd_core.c
index a3ce3c9f..d44f77ee 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -328,7 +328,7 @@ static void gpsd_binary_quality_dump(struct gps_device_t *session,
(void)snprintf(bufp, len-strlen(bufp),
"$GPGSA,%c,%d,", 'A', session->gpsdata.fix.mode);
j = 0;
- for (i = 0; i < NMEA_CHANNELS; i++) {
+ for (i = 0; i < session->device_type->channels; i++) {
if (session->gpsdata.used[i]) {
bufp += strlen(bufp);
(void)snprintf(bufp, len-strlen(bufp),
@@ -336,7 +336,7 @@ static void gpsd_binary_quality_dump(struct gps_device_t *session,
j++;
}
}
- for (i = j; i < NMEA_CHANNELS; i++) {
+ for (i = j; i < session->device_type->channels; i++) {
bufp += strlen(bufp);
(void)strcpy(bufp, ",");
}
diff --git a/nmea_parse.c b/nmea_parse.c
index 944cfe82..5e54f577 100644
--- a/nmea_parse.c
+++ b/nmea_parse.c
@@ -99,21 +99,21 @@ static void merge_hhmmss(char *hhmmss, struct gps_device_t *session)
**************************************************************************/
static gps_mask_t processGPRMC(int count, char *field[], struct gps_device_t *session)
-/* Recommend Minimum Specific GPS/TRANSIT Data */
+/* Recommend Minimum Course Specific GPS/TRANSIT Data */
{
/*
RMC,225446.33,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E,A*68
225446.33 Time of fix 22:54:46 UTC
- A Navigation receiver warning A = OK, V = warning
+ A Status of Fix A = Autonomous, valid; D = Differential, valid; V = invalid
4916.45,N Latitude 49 deg. 16.45 min North
12311.12,W Longitude 123 deg. 11.12 min West
000.5 Speed over ground, Knots
- 054.7 Course Made Good, True
+ 054.7 Course Made Good, True north
191194 Date of fix 19 November 1994
020.3,E Magnetic variation 20.3 deg East
A FAA mode indicator (NMEA 2.3 and later)
A=autonomous, D=differential, E=Estimated,
- N=not valid, S=Simulator
+ N=not valid, S=Simulator, M=Manual input mode
*68 mandatory nmea_checksum
* SiRF chipsets don't return either Mode Indicator or magnetic variation.
@@ -231,7 +231,10 @@ static gps_mask_t processGPGGA(int c UNUSED, char *field[], struct gps_device_t
123519 Fix taken at 12:35:19 UTC
4807.038,N Latitude 48 deg 07.038' N
01131.324,E Longitude 11 deg 31.324' E
- 1 Fix quality: 0 = invalid, 1 = GPS fix, 2 = DGPS fix
+ 1 Fix quality: 0 = invalid, 1 = GPS fix, 2 = DGPS fix,
+ 3=PPS (Precise Position Service),
+ 4=RTK (Real Time Kinematic) with fixed integers,
+ 5=Float RTK, 6=Estimated, 7=Manual, 8=Simulator
08 Number of satellites being tracked
0.9 Horizontal dilution of position
545.4,M Altitude, Metres above mean sea level
@@ -330,12 +333,12 @@ static gps_mask_t processGPGSA(int count, char *field[], struct gps_device_t *se
session->gpsdata.newdata.mode = atoi(field[2]);
mask = MODE_SET;
gpsd_report(3, "GPGSA sets mode %d\n", session->gpsdata.newdata.mode);
- session->gpsdata.pdop = atof(field[15]);
- session->gpsdata.hdop = atof(field[16]);
- session->gpsdata.vdop = atof(field[17]);
+ session->gpsdata.pdop = atof(field[session->device_type->channels+3]);
+ session->gpsdata.hdop = atof(field[session->device_type->channels+4]);
+ session->gpsdata.vdop = atof(field[session->device_type->channels+5]);
session->gpsdata.satellites_used = 0;
memset(session->gpsdata.used,0,sizeof(session->gpsdata.used));
- for (i = 0; i < NMEA_CHANNELS; i++) {
+ for (i = 0; i < session->device_type->channels; i++) {
int prn = atoi(field[i+3]);
if (prn > 0)
session->gpsdata.used[session->gpsdata.satellites_used++] = prn;
@@ -373,7 +376,7 @@ static gps_mask_t processGPGSV(int count, char *field[], struct gps_device_t *se
gpsd_zero_satellites(&session->gpsdata);
for (fldnum = 4; fldnum < count; ) {
- if (session->gpsdata.satellites >= NMEA_CHANNELS) {
+ if (session->gpsdata.satellites >= session->device_type->channels) {
gpsd_report(0, "internal error - too many satellites!\n");
gpsd_zero_satellites(&session->gpsdata);
break;
@@ -465,6 +468,61 @@ static gps_mask_t processGPZDA(int c UNUSED, char *field[], struct gps_device_t
return mask;
}
+#ifdef TNT_ENABLE
+static gps_mask_t processTNTHTM(int c UNUSED, char *field[], struct gps_device_t *session)
+{
+ /*
+ * Proprietary sentence for True North Technologies Magnetic Compass.
+ * This may also apply to some Honeywell units since they may have been
+ * designed by True North.
+
+ HTM,x.x,a,x.x,a,x.x,a,x.x,x.x*hh<cr><lf>
+ Fields in order:
+ 1. True heading in degrees
+ 2. magnetometer status character:
+ C = magnetometer calibration alarm
+ L = low alarm
+ M = low warning
+ N = normal
+ O = high warning
+ P = high alarm
+ V = magnetometer voltage level alarm
+ 3. pitch angle
+ 4. pitch status character - see field 2 above
+ 5. roll angle
+ 6. roll status character - see field 2 above
+ 7. dip angle
+ 8. relative magnitude horizontal component of earth's magnetic field
+ *hh mandatory nmea_checksum
+ */
+ gps_mask_t mask;
+ mask = ONLINE_SET;
+
+ //gpsd_zero_satellites(&session->gpsdata);
+
+ session->gpsdata.fix.time = timestamp();
+ session->gpsdata.newdata.track = atof(field[1]);
+ session->gpsdata.headingStatus = *field[2];
+ mask |= (TRACK_SET | MODE_SET);
+ session->gpsdata.status = STATUS_FIX; /* could be DGPS_FIX, we can't tell */
+ //session->gpsdata.newdata.mode = MODE_2D;
+ session->gpsdata.newdata.mode = MODE_2D;
+ //session->gpsdata.newdata.mode = MODE_NO_FIX;
+
+ session->gpsdata.newdata.pitch = atof(field[3]);
+ session->gpsdata.pitchStatus = *field[4];
+
+ session->gpsdata.newdata.roll = atof(field[5]);
+ session->gpsdata.rollStatus = *field[6];
+
+ session->gpsdata.newdata.dip = atof(field[7]);
+ session->gpsdata.horzField = atof(field[8]);
+
+ //gpsd_report(5, "Heading %lf %c.\n", session->gpsdata.fix.track, session->gpsdata.fix.headingStatus);
+ return mask;
+}
+#endif /* TNT_ENABLE */
+
#ifdef __UNUSED__
static short nmea_checksum(char *sentence, unsigned char *correct_sum)
/* is the checksum on the specified sentence good? */
@@ -502,6 +560,9 @@ gps_mask_t nmea_parse(char *sentence, struct gps_device_t *session)
{"GSV", processGPGSV},
{"ZDA", processGPZDA},
{"PGRME", processPGRME},
+#ifdef TNT_ENABLE
+ {"PTNTHTM", processTNTHTM},
+#endif /* TNT_ENABLE */
};
unsigned char buf[NMEA_MAX+1];
diff --git a/packet.c b/packet.c
index fac06048..0d4ebe30 100644
--- a/packet.c
+++ b/packet.c
@@ -73,13 +73,20 @@ static void nextstate(struct gps_device_t *session, unsigned char c)
/*@ +charint */
switch(session->packet_state)
{
-#ifdef NMEA_ENABLE
case GROUND_STATE:
+#ifdef NMEA_ENABLE
if (c == '$') {
session->packet_state = NMEA_DOLLAR;
break;
}
#endif /* NMEA_ENABLE */
+
+#ifdef TNT_ENABLE
+ if (c == '@') {
+ session->packet_state = TNT_LEADER;
+ break;
+ }
+#endif
#ifdef SIRFII_ENABLE
if (c == 0xa0) {
session->packet_state = SIRF_LEADER_1;
@@ -149,6 +156,11 @@ static void nextstate(struct gps_device_t *session, unsigned char c)
else
session->packet_state = GROUND_STATE;
break;
+#ifdef TNT_ENABLE
+ case TNT_LEADER:
+ session->packet_state = NMEA_LEADER_END;
+ break;
+#endif
case NMEA_LEADER_END:
if (c == '\r')
session->packet_state = NMEA_CR;
diff --git a/packet_states.h b/packet_states.h
index c04b8a40..7b2d8519 100644
--- a/packet_states.h
+++ b/packet_states.h
@@ -56,6 +56,10 @@
ZODIAC_RECOGNIZED, /* found end of the Zodiac packet */
#endif /* ZODIAC_ENABLE */
+#ifdef TNT_ENABLE
+ TNT_LEADER, /* saw True North status leader '@' */
+#endif
+
#ifdef EVERMORE_ENABLE
EVERMORE_LEADER_1, /* a DLE after having seen EverMore data */
EVERMORE_LEADER_2, /* seen opening STX of EverMore packet */
diff --git a/sirf.c b/sirf.c
index 6bf3d232..ecbf8e69 100644
--- a/sirf.c
+++ b/sirf.c
@@ -706,6 +706,7 @@ struct gps_type_t sirf_binary =
{
.typename = "SiRF-II binary", /* full name of type */
.trigger = "$Ack Input105.", /* expected response to SiRF PSRF105 */
+ .channels = SIRF_CHANNELS, /* consumer-grade GPS */
.probe = NULL, /* no probe */
.initializer = sirfbin_initializer,/* initialize the device */
.get_packet = packet_get, /* use the generic packet getter */
diff --git a/tsip.c b/tsip.c
index 8206dc3d..e440d734 100644
--- a/tsip.c
+++ b/tsip.c
@@ -15,6 +15,7 @@
#define SEMI_2_DEG (180.0 / 2147483647) /* 2^-31 semicircle to deg */
#ifdef TSIP_ENABLE
+#define TSIP_CHANNELS 12
static int tsip_write(int fd, unsigned int id, unsigned char *buf, size_t len)
{
@@ -233,7 +234,7 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session)
u1 = getub(buf,5*i + 1);
if ((f1 = getf(buf,5*i + 2)) < 0)
f1 = 0.0;
- for (j = 0; j < MAXCHANNELS; j++)
+ for (j = 0; j < TSIP_CHANNELS; j++)
if (session->gpsdata.PRN[j] == (int)u1) {
session->gpsdata.ss[j] = (int)roundf(f1);
break;
@@ -364,7 +365,7 @@ static gps_mask_t tsip_analyze(struct gps_device_t *session)
d2 = getf(buf,16) * RAD_2_DEG; /* Azimuth */
i = (int)(u2 >> 3); /* channel number */
gpsd_report(4, "Satellite Tracking Status %d: %2d 0x%02x %d %d %.1f %f %.1f %.1f\n",i,u1,u2,u3,u4,f1,f2,d1,d2);
- if (i < MAXCHANNELS) {
+ if (i < TSIP_CHANNELS) {
if (d1 >= 0.0) {
session->gpsdata.PRN[i] = (int)u1;
session->gpsdata.ss[i] = (int)roundf(f1);
@@ -676,6 +677,7 @@ struct gps_type_t tsip_binary =
{
.typename = "Trimble TSIP", /* full name of type */
.trigger = NULL, /* no trigger */
+ .channels = TSIP_CHANNELS, /* consumer-grade GPS */
.probe = NULL, /* no probe */
.initializer = tsip_initializer, /* initialization */
.get_packet = packet_get, /* use the generic packet getter */
diff --git a/zodiac.c b/zodiac.c
index 252c8f20..2f36b058 100644
--- a/zodiac.c
+++ b/zodiac.c
@@ -389,6 +389,7 @@ struct gps_type_t zodiac_binary =
{
.typename = "Zodiac binary", /* full name of type */
.trigger = NULL, /* no trigger */
+ .channels = 12, /* consumer-grade GPS */
.probe = NULL, /* no probe */
.initializer = NULL, /* no initialization */
.get_packet = packet_get, /* use the generic packet getter */