summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-02-23 11:32:46 -0500
committerEric S. Raymond <esr@thyrsus.com>2011-02-23 11:32:46 -0500
commita096b651899bc37f24b2c6a426873230c77a068e (patch)
tree4a6ba1592b7e0e55c5c2bee53ee652442dd6da8d
parent1915ea04efe8688d9f65753f159d3695ebc01b03 (diff)
downloadgpsd-a096b651899bc37f24b2c6a426873230c77a068e.tar.gz
Add and document gpsdecode -v option.
-rw-r--r--gpsdecode.c12
-rw-r--r--gpsdecode.xml14
2 files changed, 17 insertions, 9 deletions
diff --git a/gpsdecode.c b/gpsdecode.c
index e92e1a2f..134dd232 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -380,7 +380,9 @@ static void decode(FILE * fpin, FILE * fpout)
if (changed == ERROR_IS || changed == NODATA_IS)
break;
- else if ((changed & (REPORT_IS|AIS_IS|RTCM2_IS|RTCM3_IS)) == 0)
+ if (verbose >= 1 && TEXTUAL_PACKET_TYPE(session.packet.type))
+ (void)fputs((char *)session.packet.outbuffer, stdout);
+ if ((changed & (REPORT_IS|AIS_IS|RTCM2_IS|RTCM3_IS)) == 0)
continue;
/*
* We really ought to get rid of the non-JSON cases someday.
@@ -397,8 +399,6 @@ static void decode(FILE * fpin, FILE * fpout)
#endif
#ifdef AIVDM_ENABLE
} else if (session.packet.type == AIVDM_PACKET) {
- if (verbose >= 1)
- (void)fputs((char *)session.packet.outbuffer, stdout);
if ((changed & AIS_IS)!=0) {
aivdm_csv_dump(&session.gpsdata.ais, buf, sizeof(buf));
(void)fputs(buf, fpout);
@@ -457,7 +457,7 @@ int main(int argc, char **argv)
enum
{ doencode, dodecode } mode = dodecode;
- while ((c = getopt(argc, argv, "cdejpuVD:")) != EOF) {
+ while ((c = getopt(argc, argv, "cdejpuvVD:")) != EOF) {
switch (c) {
case 'c':
json = false;
@@ -479,6 +479,10 @@ int main(int argc, char **argv)
scaled = false;
break;
+ case 'v':
+ verbose = 1;
+ break;
+
case 'D':
verbose = atoi(optarg);
gpsd_hexdump_level = verbose;
diff --git a/gpsdecode.xml b/gpsdecode.xml
index c776b2e1..381e6a4d 100644
--- a/gpsdecode.xml
+++ b/gpsdecode.xml
@@ -16,7 +16,7 @@ BSD terms apply: see the file COPYING in the distribution root for details.
</refmeta>
<refnamediv id='name'>
<refname>gpsdecode</refname>
-<refpurpose>decode GPS, RTCM or AIVDM streams into a readable format</refpurpose>
+<refpurpose>decode GPS, RTCM or AIS streams into a readable format</refpurpose>
</refnamediv>
<refsynopsisdiv id='synopsis'>
@@ -27,6 +27,7 @@ BSD terms apply: see the file COPYING in the distribution root for details.
<arg choice='opt'>-e</arg>
<arg choice='opt'>-j</arg>
<arg choice='opt'>-u</arg>
+ <arg choice='opt'>-v</arg>
<arg choice='opt'>-D <replaceable>debuglevel</replaceable></arg>
<arg choice='opt'>-V</arg>
</cmdsynopsis>
@@ -38,10 +39,9 @@ BSD terms apply: see the file COPYING in the distribution root for details.
packet formats associated with GPS, AIS, and differential-correction
services. It produces a JSON dump on standard output from binary on
standard input. The JSON is the same format documented in
-<citerefentry><refentrytitle>gpsd</refentrytitle><manvolnum>8</manvolnum></citerefentry>;
-this tool uses the same decoding logic as gpsd, but with a simpler interface
-intended for batch processing of data files.
-</para>
+<citerefentry><refentrytitle>gpsd</refentrytitle><manvolnum>8</manvolnum></citerefentry>;
+this tool uses the same decoding logic as gpsd, but with a simpler
+interface intended for batch processing of data files.</para>
<para>All sensor-input formats known to the GPSD project can be
decoded by this tool. These include: NMEA, AIVDM (the NMEA-derived
@@ -76,6 +76,10 @@ code.</para>
quantities and text expansion of numeric codes. A dump with this
option is lossless.</para>
+<para>The <option>-v</option> enables dumping of textual packets
+to output as they are received on input, immediately preceding
+corresponding output.</para>
+
<para>The <option>-c</option> sets the AIS dump format to separate
fields with an ASCII pipe symbol. Fields are dumped in the order they
occur in the AIS packet. Numerics are not scaled (-u is