summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2008-06-30 10:14:20 +0000
committerEric S. Raymond <esr@thyrsus.com>2008-06-30 10:14:20 +0000
commitb4cc7d133f33f23dc6813452c971803329a25330 (patch)
tree23aa227f567609015a5779f0dce05aad85ddf9ed
parent8fc264c45005872f6a2fbf9365378b89c8a8b9e6 (diff)
downloadgpsd-b4cc7d133f33f23dc6813452c971803329a25330.tar.gz
RTCM104v3 packet detection.
This is without checksum support, and the daemon code does not do anything with the RTCM data yet.
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac43
-rw-r--r--dgnss.c4
-rw-r--r--drivers.c8
-rw-r--r--gps.h2
-rw-r--r--gpsd.c2
-rw-r--r--gpsd.h-tail26
-rw-r--r--libgpsd_core.c14
-rw-r--r--packet.c93
-rw-r--r--packet_states.h11
-rw-r--r--packet_test.c19
-rw-r--r--rtcm2.c4
12 files changed, 152 insertions, 76 deletions
diff --git a/Makefile.am b/Makefile.am
index dfb23a08..27c485f4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,7 +18,7 @@ DBUSPROGS = gpxlogger
gpxlogger_LDADD = $(DBUS_GLIB_LIBS) libgps.la -lm
endif
-if HAVE_RTCM104
+if HAVE_RTCM104V2
RTCM104PROGS = rtcmdecode
RTCM104PAGES = rtcmdecode.1
endif
diff --git a/configure.ac b/configure.ac
index d513c475..72eaf6cd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -443,23 +443,41 @@ else
AC_MSG_RESULT([no])
fi
-dnl check for RTCM104 support
-AC_ARG_ENABLE(rtcm104,
- AC_HELP_STRING([--disable-rtcm104],
- [disable rtcm104 support]),
- [ac_rtcm104=$enableval], [ac_rtcm104=yes])
-AC_MSG_CHECKING([for rtcm104 support])
+dnl check for RTCM104V2 support
+AC_ARG_ENABLE(rtcm104v2,
+ AC_HELP_STRING([--disable-rtcm104v2],
+ [disable rtcm104v2 support]),
+ [ac_rtcm104v2=$enableval], [ac_rtcm104v2=yes])
+AC_MSG_CHECKING([for rtcm104v2 support])
if test x"$ac_earthmate" = "xno" -a x"$ac_evermore" = "xno" -a x"$ac_garmin" = "xno" -a x"$ac_itrax" = "xno" -a x"$ac_sirf" = "xno" -a x"$ac_tsip" = "xno" -a x"$ac_navcom" = "xno"; then
- ac_rtcm104=no
+ ac_rtcm104v2=no
fi
-if test x"$ac_rtcm104" = "xyes"; then
+if test x"$ac_rtcm104v2" = "xyes"; then
AC_MSG_RESULT([yes])
- AC_DEFINE([RTCM104_ENABLE], 1, [rtcm104 binary support])
+ AC_DEFINE([RTCM104V2_ENABLE], 1, [rtcm104v2 binary support])
else
AC_MSG_RESULT([no])
fi
-AM_CONDITIONAL([HAVE_RTCM104], [test "$ac_rtcm104" = "yes"])
+AM_CONDITIONAL([HAVE_RTCM104V2], [test "$ac_rtcm104v2" = "yes"])
+
+dnl check for RTCM104V3 support
+AC_ARG_ENABLE(rtcm104v2,
+ AC_HELP_STRING([--disable-rtcm104v3],
+ [disable rtcm104v3 support]),
+ [ac_rtcm104v3=$enableval], [ac_rtcm104v3=yes])
+AC_MSG_CHECKING([for rtcm104v3 support])
+if test x"$ac_earthmate" = "xno" -a x"$ac_evermore" = "xno" -a x"$ac_garmin" = "xno" -a x"$ac_itrax" = "xno" -a x"$ac_sirf" = "xno" -a x"$ac_tsip" = "xno" -a x"$ac_navcom" = "xno"; then
+ ac_rtcm104v3=no
+fi
+if test x"$ac_rtcm104v3" = "xyes"; then
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([RTCM104V3_ENABLE], 1, [rtcm104v3 binary support])
+else
+ AC_MSG_RESULT([no])
+fi
+
+AM_CONDITIONAL([HAVE_RTCM104V3], [test "$ac_rtcm104v3" = "yes"])
dnl check for NTRIP support
AC_ARG_ENABLE(ntrip,
@@ -730,7 +748,8 @@ echo "iTrax : $ac_itrax"
echo "NMEA : $ac_nmea"
echo "NTRIP : $ac_ntrip"
echo "Navcom : $ac_navcom"
-echo "RTCM104 : $ac_rtcm104"
+echo "RTCM104V2 : $ac_rtcm104v2"
+echo "RTCM104V3 : $ac_rtcm104v3"
echo "SiRF : $ac_sirf"
echo "Trimble TSIP : $ac_tsip"
echo "Tripmate : $ac_tripmate"
@@ -766,7 +785,7 @@ if test "xdummy" = "xdummy" -a \
x"$ac_navcom" = "xno" -a \
x"$ac_nmea" = "xno" -a \
x"$ac_ntrip" = "xno" -a \
- x"$ac_rtcm104" = "xno" -a \
+ x"$ac_rtcm104v2" = "xno" -a \
x"$ac_sirf" = "xno" -a \
x"$ac_tnt" = "xno" -a \
x"$ac_tripmate" = "xno" -a \
diff --git a/dgnss.c b/dgnss.c
index 2b0abf67..6f517212 100644
--- a/dgnss.c
+++ b/dgnss.c
@@ -81,7 +81,7 @@ void dgnss_autoconnect(struct gps_context_t *context, double lat, double lon)
}
}
-void rtcm2_relay(struct gps_device_t *session)
+void rtcm_relay(struct gps_device_t *session)
/* pass a DGNSS connection report to a session */
{
if (session->gpsdata.gps_fd !=-1
@@ -91,7 +91,7 @@ void rtcm2_relay(struct gps_device_t *session)
if (session->device_type->rtcm_writer(session,
session->context->rtcmbuf,
(size_t)session->context->rtcmbytes) == 0)
- gpsd_report(LOG_ERROR, "Write to rtcm sink failed\n");
+ gpsd_report(LOG_ERROR, "Write to RTCM sink failed\n");
else {
session->rtcmtime = timestamp();
gpsd_report(LOG_IO, "<= DGPS: %d bytes of RTCM relayed.\n", session->context->rtcmbytes);
diff --git a/drivers.c b/drivers.c
index 98df9d77..b8c2a1f0 100644
--- a/drivers.c
+++ b/drivers.c
@@ -736,7 +736,7 @@ struct gps_type_t trueNorth = {
.cycle = 20, /* updates per second */
};
#endif
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
/**************************************************************************
*
* RTCM-104, used for broadcasting DGPS corrections and by DGPS radios
@@ -776,7 +776,7 @@ static struct gps_type_t rtcm104 = {
.wrapup = NULL, /* no wrapup code */
.cycle = 1, /* updates every second */
};
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
#ifdef GARMINTXT_ENABLE
/**************************************************************************
@@ -874,9 +874,9 @@ static struct gps_type_t *gpsd_driver_array[] = {
#ifdef ITRAX_ENABLE
&italk_binary,
#endif /* ITRAX_ENABLE */
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
&rtcm104,
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
#ifdef GARMINTXT_ENABLE
&garmintxt,
#endif /* GARMINTXT_ENABLE */
diff --git a/gps.h b/gps.h
index b5f708da..a46be8c8 100644
--- a/gps.h
+++ b/gps.h
@@ -99,7 +99,7 @@ struct gps_fix_t {
typedef /*@unsignedintegraltype@*/ uint32_t isgps30bits_t;
#endif /* S_SPLINT_S */
-typedef enum {unknown, gps, glonass, galileo} navsystem;
+ typedef enum {gps, glonass, galileo, unknown} navsystem;
struct rtcm2_t {
/* header contents */
diff --git a/gpsd.c b/gpsd.c
index c6458298..036e41f5 100644
--- a/gpsd.c
+++ b/gpsd.c
@@ -1623,7 +1623,7 @@ int main(int argc, char *argv[])
/* pass the current RTCM correction to the GPS if new */
if (channel->device_type)
- rtcm2_relay(channel);
+ rtcm_relay(channel);
/* get data from the device */
changed = 0;
diff --git a/gpsd.h-tail b/gpsd.h-tail
index 04c77287..3dbdba4f 100644
--- a/gpsd.h-tail
+++ b/gpsd.h-tail
@@ -25,7 +25,7 @@ enum isgpsstat_t {
};
#define ISGPS_ERRLEVEL_BASE 5
-#define RTCM_MAX (RTCM_WORDS_MAX * sizeof(isgps30bits_t))
+#define RTCM_MAX (RTCM2_WORDS_MAX * sizeof(isgps30bits_t))
/*
* The packet buffers need to be as long than the longest packet we
@@ -62,8 +62,10 @@ struct gps_packet_t {
#define RTCM_PACKET 7
#define GARMIN_PACKET 8
#define NAVCOM_PACKET 9
-#define UBX_PACKET 10
-#define GARMINTXT_PACKET 11
+#define RTCM2_PACKET 10
+#define RTCM3_PACKET 11
+#define UBX_PACKET 12
+#define GARMINTXT_PACKET 13
unsigned int state;
size_t length;
unsigned char inbuffer[MAX_PACKET_LENGTH*2+1];
@@ -85,7 +87,7 @@ struct gps_packet_t {
bool locked;
int curr_offset;
isgps30bits_t curr_word;
- isgps30bits_t buf[RTCM_WORDS_MAX];
+ isgps30bits_t buf[RTCM2_WORDS_MAX];
unsigned int bufindex;
} isgps;
};
@@ -105,12 +107,12 @@ enum isgpsstat_t isgps_decode(struct gps_packet_t *,
extern unsigned int isgps_parity(isgps30bits_t);
extern void isgps_output_magnavox(isgps30bits_t *, unsigned int, FILE *);
-extern enum isgpsstat_t rtcm_decode(struct gps_packet_t *, unsigned int);
-extern void rtcm_dump(struct rtcm_t *, /*@out@*/char[], size_t);
-extern int rtcm_undump(/*@out@*/struct rtcm_t *, char *);
-extern void rtcm_unpack(/*@out@*/struct rtcm_t *, char *);
-extern bool rtcm_repack(struct rtcm_t *, isgps30bits_t *);
-extern void rtcm_output_magnavox(isgps30bits_t *, FILE *);
+extern enum isgpsstat_t rtcm2_decode(struct gps_packet_t *, unsigned int);
+extern void rtcm2_dump(struct rtcm2_t *, /*@out@*/char[], size_t);
+extern int rtcm2_undump(/*@out@*/struct rtcm2_t *, char *);
+extern void rtcm2_unpack(/*@out@*/struct rtcm2_t *, char *);
+extern bool rtcm2_repack(struct rtcm2_t *, isgps30bits_t *);
+extern void rtcm2_output_magnavox(isgps30bits_t *, FILE *);
/* Next, declarations for the core library... */
@@ -318,7 +320,7 @@ struct gps_device_t {
bool locked;
int curr_offset;
isgps30bits_t curr_word;
- isgps30bits_t buf[RTCM_WORDS_MAX];
+ isgps30bits_t buf[RTCM2_WORDS_MAX];
unsigned int bufindex;
} isgps;
#endif /* BINARY_ENABLE */
@@ -361,7 +363,7 @@ extern void dgnss_report(struct gps_device_t *);
extern void dgnss_autoconnect(struct gps_context_t *, double, double);
extern void rtcm_relay(struct gps_device_t *);
-extern void rtcm_output_mag(isgps30bits_t *, FILE *);
+extern void rtcm2_output_mag(isgps30bits_t *, FILE *);
extern int dgpsip_open(struct gps_context_t *, const char *);
extern void dgpsip_report(struct gps_device_t *);
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 493fc039..5787b3c1 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -333,7 +333,7 @@ char /*@observer@*/ *gpsd_id(/*@in@*/struct gps_device_t *session)
return(buf);
}
-#if defined(BINARY_ENABLE) || defined(RTCM2_ENABLE) || defined(NTRIP_ENABLE)
+#if defined(BINARY_ENABLE) || defined(RTCM104V2_ENABLE) || defined(NTRIP_ENABLE)
/*
* Support for generic binary drivers. These functions dump NMEA for passing
* to the client in raw mode. They assume that (a) the public gps.h structure
@@ -732,11 +732,11 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
(void)gpsd_switch_driver(session, "iTalk binary");
break;
#endif /* ITRAX_ENABLE */
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
case RTCM2_PACKET:
(void)gpsd_switch_driver(session, "RTCM104");
break;
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
}
} else if (!gpsd_next_hunt_setting(session))
return ERROR_SET;
@@ -817,19 +817,19 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
char buf2[MAX_PACKET_LENGTH*3+2];
buf2[0] = '\0';
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if ((session->gpsdata.set & RTCM2_SET) != 0)
rtcm2_dump(&session->gpsdata.rtcm,
buf2+strlen(buf2),
(sizeof(buf2)-strlen(buf2)));
else {
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
#ifdef BINARY_ENABLE
gpsd_binary_dump(session, buf2, sizeof(buf2));
#endif /* BINARY_ENABLE */
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
if (buf2[0] != '\0') {
gpsd_report(LOG_IO, "<= GPS: %s", buf2);
if (session->gpsdata.raw_hook)
diff --git a/packet.c b/packet.c
index 837f97f5..02f79fa2 100644
--- a/packet.c
+++ b/packet.c
@@ -73,9 +73,9 @@ enum {
static void nextstate(struct gps_packet_t *lexer,
unsigned char c)
{
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
enum isgpsstat_t isgpsstat;
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
/*@ +charint -casebreak @*/
switch(lexer->state)
{
@@ -114,24 +114,24 @@ static void nextstate(struct gps_packet_t *lexer,
#endif /* TSIP_ENABLE || EVERMORE_ENABLE || GARMIN_ENABLE */
#ifdef TRIPMATE_ENABLE
if (c == 'A') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = ASTRAL_1;
break;
}
#endif /* TRIPMATE_ENABLE */
#ifdef EARTHMATE_ENABLE
if (c == 'E') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = EARTHA_1;
break;
}
@@ -160,7 +160,7 @@ static void nextstate(struct gps_packet_t *lexer,
break;
}
#endif /* NAVCOM_ENABLE */
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if ((isgpsstat = rtcm2_decode(lexer, c)) == ISGPS_SYNC) {
lexer->state = RTCM2_SYNC_STATE;
break;
@@ -168,7 +168,13 @@ static void nextstate(struct gps_packet_t *lexer,
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
+#ifdef RTCM104V3_ENABLE
+ if (c == 0xD3) {
+ lexer->state = RTCM3_LEADER_1;
+ break;
+ }
+#endif /* RTCM104V3_ENABLE */
break;
case COMMENT_BODY:
if (c == '\n')
@@ -259,60 +265,60 @@ static void nextstate(struct gps_packet_t *lexer,
#ifdef TRIPMATE_ENABLE
case ASTRAL_1:
if (c == 'S') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = ASTRAL_2;
} else
lexer->state = GROUND_STATE;
break;
case ASTRAL_2:
if (c == 'T') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = ASTRAL_3;
} else
lexer->state = GROUND_STATE;
break;
case ASTRAL_3:
if (c == 'R') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = ASTRAL_5;
} else
lexer->state = GROUND_STATE;
break;
case ASTRAL_4:
if (c == 'A') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = ASTRAL_2;
} else
lexer->state = GROUND_STATE;
break;
case ASTRAL_5:
if (c == 'L') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = NMEA_RECOGNIZED;
} else
lexer->state = GROUND_STATE;
@@ -321,60 +327,60 @@ static void nextstate(struct gps_packet_t *lexer,
#ifdef EARTHMATE_ENABLE
case EARTHA_1:
if (c == 'A') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = EARTHA_2;
} else
lexer->state = GROUND_STATE;
break;
case EARTHA_2:
if (c == 'R') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = EARTHA_3;
} else
lexer->state = GROUND_STATE;
break;
case EARTHA_3:
if (c == 'T') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = EARTHA_4;
} else
lexer->state = GROUND_STATE;
break;
case EARTHA_4:
if (c == 'H') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = EARTHA_5;
} else
lexer->state = GROUND_STATE;
break;
case EARTHA_5:
if (c == 'A') {
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
if (rtcm2_decode(lexer, c) == ISGPS_MESSAGE) {
lexer->state = RTCM2_RECOGNIZED;
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
lexer->state = NMEA_RECOGNIZED;
} else
lexer->state = GROUND_STATE;
@@ -516,6 +522,21 @@ static void nextstate(struct gps_packet_t *lexer,
break;
#endif /* NAVCOM_ENABLE */
#endif /* TSIP_ENABLE || EVERMORE_ENABLE || GARMIN_ENABLE */
+#ifdef RTCM104V3_ENABLE
+ case RTCM3_LEADER_1:
+ if ((c & 0xFC) == 0) {
+ lexer->length = (c << 8);
+ lexer->state = RTCM3_LEADER_2;
+ break;
+ } else
+ lexer->state = GROUND_STATE;
+ break;
+ case RTCM3_LEADER_2:
+ lexer->length |= c;
+ lexer->length += 3; /* to get the three checksum bytes */
+ lexer->state = RTCM3_RECOGNIZED;
+ break;
+#endif /* RTCM104V3_ENABLE */
#ifdef ZODIAC_ENABLE
case ZODIAC_EXPECTED:
case ZODIAC_RECOGNIZED:
@@ -741,7 +762,7 @@ static void nextstate(struct gps_packet_t *lexer,
lexer->state = GROUND_STATE;
break;
#endif /* TSIP_ENABLE */
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
case RTCM2_SYNC_STATE:
case RTCM2_SKIP_STATE:
if ((isgpsstat = rtcm2_decode(lexer, c)) == ISGPS_MESSAGE) {
@@ -758,7 +779,7 @@ static void nextstate(struct gps_packet_t *lexer,
} else
lexer->state = GROUND_STATE;
break;
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
}
/*@ -charint +casebreak @*/
}
@@ -1044,6 +1065,14 @@ ssize_t packet_parse(struct gps_packet_t *lexer, size_t fix)
}
}
#endif /* TSIP_ENABLE || GARMIN_ENABLE */
+#ifdef RTCM104V3_ENABLE
+ else if (lexer->state == RTCM3_RECOGNIZED) {
+ // FIXME: Do the "Qualcomm CRC" check against the last three bytes
+ packet_accept(lexer, RTCM3_PACKET);
+ packet_discard(lexer);
+ break;
+ }
+#endif /* RTCM104V3_ENABLE */
#ifdef ZODIAC_ENABLE
else if (lexer->state == ZODIAC_RECOGNIZED) {
short len, n, sum;
@@ -1191,7 +1220,7 @@ ssize_t packet_parse(struct gps_packet_t *lexer, size_t fix)
break;
}
#endif /* NAVCOM_ENABLE */
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
else if (lexer->state == RTCM2_RECOGNIZED) {
/*
* RTCM packets don't have checksums. The six bits of parity
@@ -1202,7 +1231,7 @@ ssize_t packet_parse(struct gps_packet_t *lexer, size_t fix)
packet_discard(lexer);
break;
}
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
} /* while */
return (ssize_t)fix;
diff --git a/packet_states.h b/packet_states.h
index 0070b42b..8d86ccc9 100644
--- a/packet_states.h
+++ b/packet_states.h
@@ -126,10 +126,17 @@
GARMIN_RECOGNIZED, /* found end of Garmin packet */
#endif /* TSIP_ENABLE GARMIN_ENABLE */
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
RTCM2_SYNC_STATE, /* we have sync lock */
RTCM2_SKIP_STATE, /* we have sync lock, but this character is bad */
RTCM2_RECOGNIZED, /* we have an RTCM packet */
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */
+
+#ifdef RTCM104V3_ENABLE
+ RTCM3_LEADER_1, /* constant leader byte found */
+ RTCM3_LEADER_2, /* second leader byte found (high 6 bits zero) */
+ RTCM3_PAYLOAD, /* gathering payload */
+ RTCM3_RECOGNIZED, /* RTCM3 packet recognized */
+#endif
/* end of packet_states.h */
diff --git a/packet_test.c b/packet_test.c
index 086ac86b..b2be347b 100644
--- a/packet_test.c
+++ b/packet_test.c
@@ -197,6 +197,25 @@ static struct map tests[] = {
.garbage_offset = 3,
.type = EVERMORE_PACKET,
},
+ {
+ .legend = "RTCM104V3 type 1005 packet",
+ /*
+ * Reference Station Id = 2003
+ * GPS Service supported, but not GLONASS or Galileo
+ * ARP ECEF-X = 1114104.5999 meters
+ * ARP ECEF-Y = -4850729.7108 meters
+ * ARP ECEF-Z = 3975521.4643 meters
+ */
+ .test = {
+ 0xD3, 0x00, 0x13, 0x3E, 0xD7, 0xD3, 0x02, 0x02,
+ 0x98, 0x0E, 0xDE, 0xEF, 0x34, 0xB4, 0xBD, 0x62,
+ 0xAC, 0x09, 0x41, 0x98, 0x6F, 0x33, 0x36, 0x0B,
+ 0x98,
+ },
+ .testlen = 25,
+ .garbage_offset = 0,
+ .type = RTCM3_PACKET,
+ },
};
/*@ +initallelements -charint +usedef @*/
diff --git a/rtcm2.c b/rtcm2.c
index 91466b43..f5884eff 100644
--- a/rtcm2.c
+++ b/rtcm2.c
@@ -62,7 +62,7 @@ Starlink's website.
#include "gpsd.h"
#include "rtcm2.h"
-#ifdef RTCM104_ENABLE
+#ifdef RTCM104V2_ENABLE
#define PREAMBLE_PATTERN 0x66
@@ -734,4 +734,4 @@ void rtcm2_output_magnavox(isgps30bits_t *ip, FILE *fp)
}
#endif /* __UNUSED__ */
-#endif /* RTCM104_ENABLE */
+#endif /* RTCM104V2_ENABLE */