diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2012-08-22 13:18:05 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2012-08-22 13:18:05 -0400 |
commit | 426b494ea32489981d68fa568a3c1bb7bfaa8cf0 (patch) | |
tree | 88d20fc17b2e6954ce44a42bb33290f153dcfe45 | |
parent | 221b7d774bc6862490ade04a41f23de6e086dbda (diff) | |
download | gpsd-426b494ea32489981d68fa568a3c1bb7bfaa8cf0.tar.gz |
Fix scaling of AIS navigation message 'course' member.
-rw-r--r-- | gpsd.h-tail | 3 | ||||
-rw-r--r-- | gpsd_json.c | 4 | ||||
-rw-r--r-- | test/sample.aivdm.js.chk | 8 |
3 files changed, 8 insertions, 7 deletions
diff --git a/gpsd.h-tail b/gpsd.h-tail index 9ba01289..d278d40d 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -37,9 +37,10 @@ typedef unsigned int speed_t; * 3.6 VERSION, WATCH, and DEVICES from slave gpsds get "remote" attribute. * 3.7 PPS message added to repertoire. SDDBT water depth reported as * negative altitude with Mode 3 set. + * 3.8 AIS course nember becomes float in scaled mode (bug fix). */ #define GPSD_PROTO_MAJOR_VERSION 3 /* bump on incompatible changes */ -#define GPSD_PROTO_MINOR_VERSION 7 /* bump on compatible changes */ +#define GPSD_PROTO_MINOR_VERSION 8 /* bump on compatible changes */ #define JSON_DATE_MAX 24 /* ISO8601 timestamp with 2 decimal places */ diff --git a/gpsd_json.c b/gpsd_json.c index cd864730..8ae338b3 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -1690,7 +1690,7 @@ void json_aivdm_dump(const struct ais_t *ais, (void)snprintf(buf + strlen(buf), buflen - strlen(buf), "\"status\":\"%s\",\"turn\":%s,\"speed\":%s," "\"accuracy\":%s,\"lon\":%.4f,\"lat\":%.4f," - "\"course\":%u,\"heading\":%u,\"second\":%u," + "\"course\":%.1f,\"heading\":%u,\"second\":%u," "\"maneuver\":%u,\"raim\":%s,\"radio\":%u}\r\n", nav_legends[ais->type1.status], turnlegend, @@ -1698,7 +1698,7 @@ void json_aivdm_dump(const struct ais_t *ais, JSON_BOOL(ais->type1.accuracy), ais->type1.lon / AIS_LATLON_DIV, ais->type1.lat / AIS_LATLON_DIV, - ais->type1.course, + ais->type1.course / 10.0, ais->type1.heading, ais->type1.second, ais->type1.maneuver, diff --git a/test/sample.aivdm.js.chk b/test/sample.aivdm.js.chk index 37d42243..53e33167 100644 --- a/test/sample.aivdm.js.chk +++ b/test/sample.aivdm.js.chk @@ -1,7 +1,7 @@ -{"class":"AIS","device":"stdin","type":1,"repeat":0,"mmsi":371798000,"scaled":true,"status":"Under way using engine","turn":"fastleft","speed":12.3,"accuracy":true,"lon":-123.3954,"lat":48.3816,"course":2240,"heading":215,"second":33,"maneuver":0,"raim":false,"radio":68034}
-{"class":"AIS","device":"stdin","type":1,"repeat":0,"mmsi":440348000,"scaled":true,"status":"Under way using engine","turn":"nan","speed":0.0,"accuracy":false,"lon":-70.7582,"lat":43.0802,"course":934,"heading":511,"second":13,"maneuver":0,"raim":false,"radio":66548}
-{"class":"AIS","device":"stdin","type":2,"repeat":0,"mmsi":356302000,"scaled":true,"status":"Under way using engine","turn":"fastright","speed":13.9,"accuracy":false,"lon":-71.6261,"lat":40.3924,"course":877,"heading":91,"second":41,"maneuver":0,"raim":false,"radio":98316}
-{"class":"AIS","device":"stdin","type":3,"repeat":0,"mmsi":563808000,"scaled":true,"status":"Moored","turn":0,"speed":0.0,"accuracy":true,"lon":-76.3275,"lat":36.9100,"course":2520,"heading":352,"second":35,"maneuver":0,"raim":false,"radio":0}
+{"class":"AIS","device":"stdin","type":1,"repeat":0,"mmsi":371798000,"scaled":true,"status":"Under way using engine","turn":"fastleft","speed":12.3,"accuracy":true,"lon":-123.3954,"lat":48.3816,"course":224.0,"heading":215,"second":33,"maneuver":0,"raim":false,"radio":68034}
+{"class":"AIS","device":"stdin","type":1,"repeat":0,"mmsi":440348000,"scaled":true,"status":"Under way using engine","turn":"nan","speed":0.0,"accuracy":false,"lon":-70.7582,"lat":43.0802,"course":93.4,"heading":511,"second":13,"maneuver":0,"raim":false,"radio":66548}
+{"class":"AIS","device":"stdin","type":2,"repeat":0,"mmsi":356302000,"scaled":true,"status":"Under way using engine","turn":"fastright","speed":13.9,"accuracy":false,"lon":-71.6261,"lat":40.3924,"course":87.7,"heading":91,"second":41,"maneuver":0,"raim":false,"radio":98316}
+{"class":"AIS","device":"stdin","type":3,"repeat":0,"mmsi":563808000,"scaled":true,"status":"Moored","turn":0,"speed":0.0,"accuracy":true,"lon":-76.3275,"lat":36.9100,"course":252.0,"heading":352,"second":35,"maneuver":0,"raim":false,"radio":0}
{"class":"AIS","device":"stdin","type":4,"repeat":0,"mmsi":3669702,"scaled":true,"timestamp":"2007-05-14T19:57:39Z","accuracy":true,"lon":-76.3524,"lat":36.8838,"epfd":"Surveyed","raim":false,"radio":67039}
{"class":"AIS","device":"stdin","type":5,"repeat":0,"mmsi":351759000,"scaled":true,"imo":9134270,"ais_version":0,"callsign":"3FOF8","shipname":"EVER DIADEM","shiptype":"Cargo - all ships of this type","to_bow":225,"to_stern":70,"to_port":1,"to_starboard":31,"epfd":"GPS","eta":"05-15T14:00Z","draught":12.2,"destination":"NEW YORK","dte":0}
{"class":"AIS","device":"stdin","type":6,"repeat":1,"mmsi":150834090,"scaled":true,"seqno":3,"dest_mmsi":313240222,"retransmit":false,"dac":669,"fid":11,"data":"48:eb2f118f7ff1"}
|