summaryrefslogtreecommitdiff
path: root/driver_ais.c
diff options
context:
space:
mode:
authorJon Schlueter <jschlueter@redhat.com>2016-01-05 01:49:48 -0500
committerJon Schlueter <jschlueter@redhat.com>2016-01-05 02:10:40 -0500
commit08bb7332fbd7d7f925972d2f3d43fed60da61f65 (patch)
treef58820e40294f8897fe1cd647705ca65b3bf57e6 /driver_ais.c
parent4a08a3c9e8f54d8dd1b8bc0c3b1176b24bcccab0 (diff)
downloadgpsd-08bb7332fbd7d7f925972d2f3d43fed60da61f65.tar.gz
[aivdm] Make type=1 more permissive of short data
saw in live data type=1 records with length of 163 right after 168 with same data payload except for padding bits type=1 length=163 !AIVDM,1,1,,A,13aIkM@P00PJ@qPNL=e@0?wJ28JO,5*63 1|0|244740981|0|-128|0|1|3442480|31919541|0|511|45|0x0|1|0x434 type=1 length=168 !AIVDM,1,1,,A,13aIkM@P00PJ@qPNL=e@0?wJ28JO,0*66 1|0|244740981|0|-128|0|1|3442480|31919541|0|511|45|0x0|1|0x869f This could make sense for re-broadcast data but there may be other issues with type=1,2,3 because the message lengths vary from 163 up to 700 some bits long and logic only parses first 168 bits
Diffstat (limited to 'driver_ais.c')
-rw-r--r--driver_ais.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/driver_ais.c b/driver_ais.c
index 0dcaebea..4977bcce 100644
--- a/driver_ais.c
+++ b/driver_ais.c
@@ -118,7 +118,7 @@ bool ais_binary_decode(const struct gpsd_errout_t *errout,
case 1: /* Position Report */
case 2:
case 3:
- PERMISSIVE_LENGTH_CHECK(168)
+ PERMISSIVE_LENGTH_CHECK(163)
ais->type1.status = UBITS(38, 4);
ais->type1.turn = SBITS(42, 8);
ais->type1.speed = UBITS(50, 10);
@@ -131,7 +131,10 @@ bool ais_binary_decode(const struct gpsd_errout_t *errout,
ais->type1.maneuver = UBITS(143, 2);
//ais->type1.spare = UBITS(145, 3);
ais->type1.raim = UBITS(148, 1)!=0;
- ais->type1.radio = UBITS(149, 19);
+ if(bitlen >= 168)
+ ais->type1.radio = UBITS(149, 19);
+ if(bitlen < 168)
+ ais->type1.radio = UBITS(149, bitlen - 149);
break;
case 4: /* Base Station Report */
case 11: /* UTC/Date Response */