summaryrefslogtreecommitdiff
path: root/gpsdecode.c
diff options
context:
space:
mode:
authorChristian Gagneraud <cgagneraud@techworks.ie>2012-06-04 01:14:27 +0100
committerChristian Gagneraud <chris@techworks.ie>2012-06-20 10:05:41 +0100
commit5214d309cf07b428ccfac647f7ac9ed8d597186f (patch)
tree672ecb9d61a1973252be347eb5b1bf13b7dfe7d1 /gpsdecode.c
parent9e6cdcb27d6af143721bb27bd886fc43d1214626 (diff)
downloadgpsd-5214d309cf07b428ccfac647f7ac9ed8d597186f.tar.gz
[AIS] Fix plenty of small bugs unveiled by aishub test campaign.
A test campaign was run with live data from aishub.net (ca. 25 millions sentence, 1.2 GB of logs), the goal was to check the decoding and the JSON parsing and dumping code. On all the AIS data, the following tests were done: - AIVDM decoding - JSON scaled dump - JSON validity check on scaled dump. - JSON unscaled dump - JSON validity check on unscaled dump - JSON unscaled idempotency check - JSON unscaled/scaled idempotency check The last check consisted of: - parsing the unscaled dump - dumping it back in scaled mode - compare it with the original scaled dump. This test campaign has unveiled plenty of small bugs all around the AIS code. This patch fixes all of them and adds new sentences in the regression tests.
Diffstat (limited to 'gpsdecode.c')
-rw-r--r--gpsdecode.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/gpsdecode.c b/gpsdecode.c
index 51a9c2eb..1664e5ac 100644
--- a/gpsdecode.c
+++ b/gpsdecode.c
@@ -443,7 +443,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
break;
case 25: /* Binary Message, Single Slot */
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%u|%u|%u|%u|%zd:%s\r\n",
+ "%u|%u|%u|%u|%zd:%s",
(uint) ais->type25.addressed,
(uint) ais->type25.structured,
ais->type25.dest_mmsi,
@@ -454,7 +454,7 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
break;
case 26: /* Binary Message, Multiple Slot */
(void)snprintf(buf + strlen(buf), buflen - strlen(buf),
- "%u|%u|%u|%u|%zd:%s:%u\r\n",
+ "%u|%u|%u|%u|%zd:%s:%u",
(uint) ais->type26.addressed,
(uint) ais->type26.structured,
ais->type26.dest_mmsi,
@@ -464,6 +464,18 @@ static void aivdm_csv_dump(struct ais_t *ais, char *buf, size_t buflen)
(ais->type26.bitcount + 7) / 8),
ais->type26.radio);
break;
+ case 27: /* Long Range AIS Broadcast message */
+ (void)snprintf(buf + strlen(buf), buflen - strlen(buf),
+ "%u|%u|%d|%d|%u|%u|%u|%u",
+ ais->type27.status,
+ (uint)ais->type27.accuracy,
+ ais->type27.lon,
+ ais->type27.lat,
+ ais->type27.speed,
+ ais->type27.course,
+ (uint)ais->type27.raim,
+ (uint)ais->type27.gnss);
+ break;
default:
(void)snprintf(buf + strlen(buf),
buflen - strlen(buf),