From 61b3bb773a2edbc64a7a26c6f3b9cdea48ea1204 Mon Sep 17 00:00:00 2001 From: Christian Gagneraud Date: Mon, 4 Jun 2012 01:14:27 +0100 Subject: [AIS] Fix previous AIS merge Some modifications were lost during last merge, fix that. Regression pass except for ait250. --- SConstruct | 1 + gpsd_json.c | 2 +- test/sample.aivdm | 2 -- test/sample.aivdm.chk | 6 +++--- test/sample.aivdm.js.chk | 6 +++--- test/sample.aivdm.ju.chk | 6 +++--- 6 files changed, 11 insertions(+), 12 deletions(-) diff --git a/SConstruct b/SConstruct index 5c27ddf4..9a9dca23 100644 --- a/SConstruct +++ b/SConstruct @@ -1432,6 +1432,7 @@ aivdm_regress = Utility('aivdm-regress', [gpsdecode], [ 'rm -f $${TMPFILE}; ' 'done;', '@echo "Testing idempotency of unscaled JSON dump/decode for AIS"', + 'TMPFILE=`mktemp -t gpsd-test-XXXXXXXXXXXXXX.chk`; ' '$SRCDIR/gpsdecode -u -e -j <$SRCDIR/test/sample.aivdm.ju.chk >$${TMPFILE}; ' 'grep -v "^#" $SRCDIR/test/sample.aivdm.ju.chk | diff -ub - $${TMPFILE}; ' 'rm -f $${TMPFILE}; ', diff --git a/gpsd_json.c b/gpsd_json.c index 7fb359ab..49afd012 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -2979,7 +2979,7 @@ void json_aivdm_dump(const struct ais_t *ais, ais->type24.callsign)); if (AIS_AUXILIARY_MMSI(ais->mmsi)) { (void)snprintf(buf + strlen(buf), buflen - strlen(buf), - "mothership_\"mmsi\":%u}\r\n", + "\"mothership_mmsi\":%u}\r\n", ais->type24.mothership_mmsi); } else { (void)snprintf(buf + strlen(buf), buflen - strlen(buf), diff --git a/test/sample.aivdm b/test/sample.aivdm index 7637fe0c..bb008082 100644 --- a/test/sample.aivdm +++ b/test/sample.aivdm @@ -958,5 +958,3 @@ AIVDM,2,2,1,B,00000000000,2*26 # Array of struct. use to crash "gpsdecode -j -e -u" !AIVDM,1,1,,A,6h2E3MHrg19P0600@00000000000,0*02 !AIVDM,1,1,,A,6h2E3N0rThqP0600J00000000000,0*51 - - diff --git a/test/sample.aivdm.chk b/test/sample.aivdm.chk index 31dc496e..29cfa40f 100644 --- a/test/sample.aivdm.chk +++ b/test/sample.aivdm.chk @@ -54,14 +54,14 @@ 25|0|563648328|0|1|0|134|112:082900a31880a2a636fffe034108 25|0|440002170|0|0|0|0|128:00001a438085956deb8d86a0100008c8 26|1|137920605|1|1|838351848|23587|180:efa1708f32fc0a85c39e2c007006cf026c0f4882faad00:0 -26|0|084148325|1|0|834699643|0|228:q:0 +26|0|084148325|1|0|834699643|0|228:c70205ef90710000000000000001000000f500c7006d00000019ad204c:0 26|2|633353704|0|1|0|24576|92:0014f2251db2ce9000ff9600:0 -26|0|016777280|0|0|0|0|116::0 +26|0|016777280|0|0|0|0|116:c700ef007300e0000000080018282e:0 27|1|236091959|3|0|-92521|52239|0|0|0|0 24|0|271040660|GOZDEM-1|37|1C00045|YM5504|0|24|0|6 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 -6|0|276747000|0|2766160|0|1|40|16: 8 +6|0|276747000|0|2766160|0|1|40|16:0938 4|0|002470052|0000-00-00T24:60:60Z|0|108600000|54600000|0|0|0x2c080 4|0|002242115|2012-06-01T24:60:60Z|1|-5031130|26021408|7|0|0x208ca 4|0|972158237|10196-00-24T09:57:37Z|1|123070132|65599231|14|1|0x8c8 diff --git a/test/sample.aivdm.js.chk b/test/sample.aivdm.js.chk index ff61c1b5..c32c13ed 100644 --- a/test/sample.aivdm.js.chk +++ b/test/sample.aivdm.js.chk @@ -54,14 +54,14 @@ {"class":"AIS","device":"stdin","type":25,"repeat":0,"mmsi":563648328,"scaled":true,"addressed":false,"structured":true,"dest_mmsi":0,"app_id":134,"data":"112:082900a31880a2a636fffe034108"} {"class":"AIS","device":"stdin","type":25,"repeat":0,"mmsi":440002170,"scaled":true,"addressed":false,"structured":false,"dest_mmsi":0,"app_id":0,"data":"128:00001a438085956deb8d86a0100008c8"} {"class":"AIS","device":"stdin","type":26,"repeat":1,"mmsi":137920605,"scaled":true,"addressed":true,"structured":true,"dest_mmsi":838351848,"app_id":23587,"data":"180:efa1708f32fc0a85c39e2c007006cf026c0f4882faad00","radio":0} -{"class":"AIS","device":"stdin","type":26,"repeat":0,"mmsi":84148325,"scaled":true,"addressed":true,"structured":false,"dest_mmsi":834699643,"app_id":0,"data":"228:q","radio":0} +{"class":"AIS","device":"stdin","type":26,"repeat":0,"mmsi":84148325,"scaled":true,"addressed":true,"structured":false,"dest_mmsi":834699643,"app_id":0,"data":"228:c70205ef90710000000000000001000000f500c7006d00000019ad204c","radio":0} {"class":"AIS","device":"stdin","type":26,"repeat":2,"mmsi":633353704,"scaled":true,"addressed":false,"structured":true,"dest_mmsi":0,"app_id":24576,"data":"92:0014f2251db2ce9000ff9600","radio":0} -{"class":"AIS","device":"stdin","type":26,"repeat":0,"mmsi":16777280,"scaled":true,"addressed":false,"structured":false,"dest_mmsi":0,"app_id":0,"data":"116:","radio":0} +{"class":"AIS","device":"stdin","type":26,"repeat":0,"mmsi":16777280,"scaled":true,"addressed":false,"structured":false,"dest_mmsi":0,"app_id":0,"data":"116:c700ef007300e0000000080018282e","radio":0} {"class":"AIS","device":"stdin","type":27,"repeat":1,"mmsi":236091959,"scaled":true,"status":"Restricted manoeuverability","accuracy":false,"lon":-154.2,"lat":87.1,"speed":0,"course":0,"raim":false,"gnss":false} {"class":"AIS","device":"stdin","type":24,"repeat":0,"mmsi":271040660,"scaled":true,"shipname":"GOZDEM-1","shiptype":"Pleasure Craft","vendorid":"1C00045","callsign":"YM5504","to_bow":0,"to_stern":24,"to_port":0,"to_starboard":6} {"class":"AIS","device":"stdin","type":5,"repeat":0,"mmsi":271010059,"scaled":true,"imo":0,"ais_version":0,"callsign":"TCA2350","shipname":"HEALTH CONTROL 13","shiptype":"Law Enforcement","to_bow":6,"to_stern":10,"to_port":2,"to_starboard":2,"epfd":"GPS","eta":"00-00T24:60Z","draught":2.0,"destination":"","dte":0} {"class":"AIS","device":"stdin","type":5,"repeat":0,"mmsi":271010059,"scaled":true,"imo":0,"ais_version":0,"callsign":"TCA2350","shipname":"HEALTH CONTROL 13","shiptype":"Law Enforcement","to_bow":6,"to_stern":10,"to_port":2,"to_starboard":2,"epfd":"GPS","eta":"00-00T24:60Z","draught":2.0,"destination":"","dte":0} -{"class":"AIS","device":"stdin","type":6,"repeat":0,"mmsi":276747000,"scaled":true,"seqno":0,"dest_mmsi":2766160,"retransmit":false,"dac":1,"fid":40,"data":"16:\t8"} +{"class":"AIS","device":"stdin","type":6,"repeat":0,"mmsi":276747000,"scaled":true,"seqno":0,"dest_mmsi":2766160,"retransmit":false,"dac":1,"fid":40,"data":"16:0938"} {"class":"AIS","device":"stdin","type":4,"repeat":0,"mmsi":2470052,"scaled":true,"timestamp":"0-00-00T24:60:60Z","accuracy":false,"lon":181.0000,"lat":91.0000,"epfd":"Undefined","raim":false,"radio":180352} {"class":"AIS","device":"stdin","type":4,"repeat":0,"mmsi":2242115,"scaled":true,"timestamp":"2012-06-01T24:60:60Z","accuracy":true,"lon":-8.3852,"lat":43.3690,"epfd":"Surveyed","raim":false,"radio":133322} {"class":"AIS","device":"stdin","type":4,"repeat":0,"mmsi":972158237,"scaled":true,"timestamp":"10196-00-24T09:57:37Z","accuracy":true,"lon":205.1169,"lat":109.3321,"epfd":"(null)","raim":true,"radio":2248} diff --git a/test/sample.aivdm.ju.chk b/test/sample.aivdm.ju.chk index e73afb80..7e709001 100644 --- a/test/sample.aivdm.ju.chk +++ b/test/sample.aivdm.ju.chk @@ -54,14 +54,14 @@ {"class":"AIS","device":"stdin","type":25,"repeat":0,"mmsi":563648328,"scaled":false,"addressed":false,"structured":true,"dest_mmsi":0,"app_id":134,"data":"112:082900a31880a2a636fffe034108"} {"class":"AIS","device":"stdin","type":25,"repeat":0,"mmsi":440002170,"scaled":false,"addressed":false,"structured":false,"dest_mmsi":0,"app_id":0,"data":"128:00001a438085956deb8d86a0100008c8"} {"class":"AIS","device":"stdin","type":26,"repeat":1,"mmsi":137920605,"scaled":false,"addressed":true,"structured":true,"dest_mmsi":838351848,"app_id":23587,"data":"180:efa1708f32fc0a85c39e2c007006cf026c0f4882faad00","radio":0} -{"class":"AIS","device":"stdin","type":26,"repeat":0,"mmsi":84148325,"scaled":false,"addressed":true,"structured":false,"dest_mmsi":834699643,"app_id":0,"data":"228:q","radio":0} +{"class":"AIS","device":"stdin","type":26,"repeat":0,"mmsi":84148325,"scaled":false,"addressed":true,"structured":false,"dest_mmsi":834699643,"app_id":0,"data":"228:c70205ef90710000000000000001000000f500c7006d00000019ad204c","radio":0} {"class":"AIS","device":"stdin","type":26,"repeat":2,"mmsi":633353704,"scaled":false,"addressed":false,"structured":true,"dest_mmsi":0,"app_id":24576,"data":"92:0014f2251db2ce9000ff9600","radio":0} -{"class":"AIS","device":"stdin","type":26,"repeat":0,"mmsi":16777280,"scaled":false,"addressed":false,"structured":false,"dest_mmsi":0,"app_id":0,"data":"116:","radio":0} +{"class":"AIS","device":"stdin","type":26,"repeat":0,"mmsi":16777280,"scaled":false,"addressed":false,"structured":false,"dest_mmsi":0,"app_id":0,"data":"116:c700ef007300e0000000080018282e","radio":0} {"class":"AIS","device":"stdin","type":27,"repeat":1,"mmsi":236091959,"scaled":false,"status":3,"accuracy":false,"lon":-92521,"lat":52239,"speed":0,"course":0,"raim":false,"gnss":false} {"class":"AIS","device":"stdin","type":24,"repeat":0,"mmsi":271040660,"scaled":false,"shipname":"GOZDEM-1","shiptype":37,"vendorid":"1C00045","callsign":"YM5504","to_bow":0,"to_stern":24,"to_port":0,"to_starboard":6} {"class":"AIS","device":"stdin","type":5,"repeat":0,"mmsi":271010059,"scaled":false,"imo":0,"ais_version":0,"callsign":"TCA2350","shipname":"HEALTH CONTROL 13","shiptype":55,"to_bow":6,"to_stern":10,"to_port":2,"to_starboard":2,"epfd":1,"eta":"00-00T24:60Z","draught":20,"destination":"","dte":0} {"class":"AIS","device":"stdin","type":5,"repeat":0,"mmsi":271010059,"scaled":false,"imo":0,"ais_version":0,"callsign":"TCA2350","shipname":"HEALTH CONTROL 13","shiptype":55,"to_bow":6,"to_stern":10,"to_port":2,"to_starboard":2,"epfd":1,"eta":"00-00T24:60Z","draught":20,"destination":"","dte":0} -{"class":"AIS","device":"stdin","type":6,"repeat":0,"mmsi":276747000,"scaled":false,"seqno":0,"dest_mmsi":2766160,"retransmit":false,"dac":1,"fid":40,"data":"16:\t8"} +{"class":"AIS","device":"stdin","type":6,"repeat":0,"mmsi":276747000,"scaled":false,"seqno":0,"dest_mmsi":2766160,"retransmit":false,"dac":1,"fid":40,"data":"16:0938"} {"class":"AIS","device":"stdin","type":4,"repeat":0,"mmsi":2470052,"scaled":false,"timestamp":"0-00-00T24:60:60Z","accuracy":false,"lon":108600000,"lat":54600000,"epfd":0,"raim":false,"radio":180352} {"class":"AIS","device":"stdin","type":4,"repeat":0,"mmsi":2242115,"scaled":false,"timestamp":"2012-06-01T24:60:60Z","accuracy":true,"lon":-5031130,"lat":26021408,"epfd":7,"raim":false,"radio":133322} {"class":"AIS","device":"stdin","type":4,"repeat":0,"mmsi":972158237,"scaled":false,"timestamp":"10196-00-24T09:57:37Z","accuracy":true,"lon":123070132,"lat":65599231,"epfd":14,"raim":true,"radio":2248} -- cgit v1.2.1