summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2010-05-20 06:41:32 -0400
committerEric S. Raymond <esr@thyrsus.com>2010-05-20 06:41:32 -0400
commit8366778e09592b65b7ef8ad9367151d1d13aa3f8 (patch)
tree8aee261acfdca9d0971ed2c3194966be395b4b01
parentfc07400653635c8065adad2edd5bfb3852113e56 (diff)
downloadgpsd-8366778e09592b65b7ef8ad9367151d1d13aa3f8.tar.gz
The last change in gpsdecode was not entirely correct. Fixes from Nirgal.
-rwxr-xr-xdevtools/ais.py2
-rw-r--r--gpsdecode.c18
-rw-r--r--test/sample.aivdm.chk26
3 files changed, 23 insertions, 23 deletions
diff --git a/devtools/ais.py b/devtools/ais.py
index a05700df..762902ad 100755
--- a/devtools/ais.py
+++ b/devtools/ais.py
@@ -824,7 +824,7 @@ def aivdm_unpack(lc, data, offset, values, instructions):
# of a variable-length string field, as in messages 12 and 14
try:
for i in range(inst.width/6):
- newchar = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^- !\"#$%&`()*+,-./0123456789:;<=>?"[data.ubits(offset + 6*i, 6)]
+ newchar = "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^- !\"#$%&'()*+,-./0123456789:;<=>?"[data.ubits(offset + 6*i, 6)]
if newchar == '@':
break
else:
diff --git a/gpsdecode.c b/gpsdecode.c
index a9431e08..0996c327 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -53,7 +53,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
case 2:
case 3:
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%u|%d|%u|%u|%d|%d|%u|%u|%u,0x%x|%u,0x%x",
+ "%u|%d|%u|%u|%d|%d|%u|%u|%u|0x%x|%u|0x%x",
ais->type1.status,
ais->type1.turn,
ais->type1.speed,
@@ -69,7 +69,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
case 4: /* Base Station Report */
case 11: /* UTC/Date Response */
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%04u:%02u:%02uT%02u:%02u:%02uZ|%u|%d|%d|%u|%u,0x%x",
+ "%04u:%02u:%02uT%02u:%02u:%02uZ|%u|%d|%d|%u|%u|0x%x",
ais->type4.year,
ais->type4.month,
ais->type4.day,
@@ -132,7 +132,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
break;
case 9:
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%u|%u|%u|%d|%d|%u|%u,0x%x|%u|%u,0x%x",
+ "%u|%u|%u|%d|%d|%u|%u|0x%x|%u|%u|0x%x",
ais->type9.alt,
ais->type9.speed,
(uint) ais->type9.accuracy,
@@ -190,7 +190,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
break;
case 18:
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%u|%u|%u|%d|%d|%u|%u|%u,0x%x|%u|%u|%u|%u|%u|%u,0x%x",
+ "%u|%u|%u|%d|%d|%u|%u|%u|0x%x|%u|%u|%u|%u|%u|%u|0x%x",
ais->type18.reserved,
ais->type18.speed,
(uint) ais->type18.accuracy,
@@ -209,7 +209,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
break;
case 19:
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%u|%u|%u|%d|%d|%u|%u|%u,0x%x|%s|%u|%u|%u|%u|%u|%u|%u|%u|%u",
+ "%u|%u|%u|%d|%d|%u|%u|%u|0x%x|%s|%u|%u|%u|%u|%u|%u|%u|%u|%u",
ais->type19.reserved,
ais->type19.speed,
(uint) ais->type19.accuracy,
@@ -250,7 +250,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
break;
case 21: /* Aid to Navigation */
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%u|%s|%u|%d|%d|%u|%u|%u|%u|%u|%u|%u,0x%x|%u|%u",
+ "%u|%s|%u|%d|%d|%u|%u|%u|%u|%u|%u|%u|0x%x|%u|%u",
ais->type21.aid_type,
ais->type21.name,
(uint) ais->type21.accuracy,
@@ -309,11 +309,11 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
break;
case 24: /* Class B CS Static Data Report */
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%s,", ais->type24.shipname);
+ "%s|", ais->type24.shipname);
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%u,", ais->type24.shiptype);
+ "%u|", ais->type24.shiptype);
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%s|%s,", ais->type24.vendorid, ais->type24.callsign);
+ "%s|%s|", ais->type24.vendorid, ais->type24.callsign);
if (AIS_AUXILIARY_MMSI(ais->mmsi)) {
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
"%u", ais->type24.mothership_mmsi);
diff --git a/test/sample.aivdm.chk b/test/sample.aivdm.chk
index 6d4689fa..df2dab47 100644
--- a/test/sample.aivdm.chk
+++ b/test/sample.aivdm.chk
@@ -1,8 +1,8 @@
-1|0|371798000|0|-127|123|1|-74037230|29028980|2240|215|33,0x0|0,0x109c2
-1|0|440348000|0|-128|0|0|-42454920|25848090|934|511|13,0x0|0,0x103f4
-2|0|356302000|0|127|139|0|-42975686|24235415|877|91|41,0x0|0,0x1800c
-3|0|563808000|5|0|0|1|-45796520|22146000|2520|352|35,0x0|0,0x0
-4|0|003669702|2007:05:14T19:57:39Z|1|-45811417|22130260|7|0,0x105df
+1|0|371798000|0|-127|123|1|-74037230|29028980|2240|215|33|0x0|0|0x109c2
+1|0|440348000|0|-128|0|0|-42454920|25848090|934|511|13|0x0|0|0x103f4
+2|0|356302000|0|127|139|0|-42975686|24235415|877|91|41|0x0|0|0x1800c
+3|0|563808000|5|0|0|1|-45796520|22146000|2520|352|35|0x0|0|0x0
+4|0|003669702|2007:05:14T19:57:39Z|1|-45811417|22130260|7|0|0x105df
5|0|351759000|9134270|0|3FOF8|EVER DIADEM|70|225|70|1|31|1|05-15T14:00Z|122|NEW YORK|0
6|1|150834090|3|313240222|0|669|11|48:eb2f118f7ff1
6|0|265538450|0|2655651|0|1|40|16:0000
@@ -11,10 +11,10 @@
7|2|537411077|43101326|717096664|76161024|0
8|0|366999712|366|22|256:3a53dbb7be4a773137f87d7b0445f040dea05d93f593783194ae9b9d9dbe05fb
8|0|999999999|366|22|256:eb0d4f917a035b2dfca3d4739381735c18ebbe754936f66850037dcacd9538b8
-9|0|111265591|15|0|0|7128960|34667073|0|28,0x0|0|0,0x6015
+9|0|111265591|15|0|0|7128960|34667073|0|28|0x0|0|0|0x6015
10|0|366814480|366832740
10|0|440882000|366972000
-11|0|304137000|2009:05:22T02:22:40Z|1|-56644610|17045470|1|0,0x0
+11|0|304137000|2009:05:22T02:22:40Z|1|-56644610|17045470|1|0|0x0
12|0|002275200|0|215724000|0|PLEASE REPORT TO JOBOURG TRAFFIC CHANNEL 13
12|0|351853000|0|316123456|0|GOOD
12|0|351853000|1|351809000|0|THANX
@@ -30,15 +30,15 @@
15|3|003669720|367014320|3|516|5|617|0|0|0
16|0|002053501|224251000|200|0|0|0|0
17|0|002734450|17478|35992|376:7c0556c07031febbf52924fe33fa2933ffa0fd2932fdb7062922fe3809292afde9122929fcf7002923ffd20c29aaaa
-18|0|338087471|0|1|0|-44443279|24410724|796|511|49,0x0|1|0|1|1|1|1,0xe0006
-18|0|338088483|0|0|0|-42486718|25869335|1716|511|20,0x0|1|0|1|1|1|1,0xe0006
-18|0|368161000|0|51|1|-43340309|23688555|349|511|17,0x0|1|0|1|1|0|1,0xe0006
-19|0|367059850|248|87|0|-53286235|17726217|3359|511|46,0x4|CAPT.J.RIMES|70|5|21|4|4|0|0|0|0
+18|0|338087471|0|1|0|-44443279|24410724|796|511|49|0x0|1|0|1|1|1|1|0xe0006
+18|0|338088483|0|0|0|-42486718|25869335|1716|511|20|0x0|1|0|1|1|1|1|0xe0006
+18|0|368161000|0|51|1|-43340309|23688555|349|511|17|0x0|1|0|1|1|0|1|0xe0006
+19|0|367059850|248|87|0|-53286235|17726217|3359|511|46|0x4|CAPT.J.RIMES|70|5|21|4|4|0|0|0|0
20|3|003669705|2182|5|7|225|0|0|0|0|0|0|0|0|0|0|0|0
20|0|003160097|47|1|7|250|2250|1|7|1125|856|5|7|1125|0|0|0|0
-21|0|123456789|20|CHINA ROSE MURPHY EXPRESS ALERT|0|-73619155|28752371|5|5|5|5|1|50|165,0x0|0|0
+21|0|123456789|20|CHINA ROSE MURPHY EXPRESS ALERT|0|-73619155|28752371|5|5|5|5|1|50|165|0x0|0|0
22|0|003160048|2087|2088|0|0|-44100|27330|-48100|25400|0|0|0|4
23|0|002268120|1578|30642|1096|30408|6|0|2|9|0
-24|2|338085242|CAPTAIN'S PARADISE,54,ACR1234|WDD7883,8|3|2|1
+24|2|338085242|CAPTAIN'S PARADISE|54|ACR1234|WDD7883|8|3|2|1
5|0|271010059|0|0|TCA2350|HEALTH CONTROL 13|55|6|10|2|2|1|00-00T24:60Z|20||0
5|0|271010059|0|0|TCA2350|HEALTH CONTROL 13|55|6|10|2|2|1|00-00T24:60Z|20||0