diff options
-rw-r--r-- | driver_ais.c | 9 | ||||
-rw-r--r-- | gps.h | 4 | ||||
-rw-r--r-- | gpsd_json.c | 5 | ||||
-rw-r--r-- | jsongen.py.in | 9 |
4 files changed, 26 insertions, 1 deletions
diff --git a/driver_ais.c b/driver_ais.c index b69a0592..b2131169 100644 --- a/driver_ais.c +++ b/driver_ais.c @@ -240,7 +240,7 @@ bool ais_binary_decode(const int debug, ais->type6.dac1fid15.airdraught = UBITS(56, 11); imo = true; break; - case 16: /* IMO236 - Number of persons on board */ + case 16: /* IMO236 - Number of persons on board */ if (ais->type6.bitcount == 136) ais->type6.dac1fid16.persons = UBITS(88, 13);/* 289 */ else @@ -467,6 +467,13 @@ bool ais_binary_decode(const int debug, /* skip 5 bits */ imo = true; break; + case 16: /* Number of Persons On Board */ + if (ais->type8.bitcount == 136) + ais->type8.dac1fid16.persons = UBITS(88, 13);/* 289 */ + else + ais->type8.dac1fid16.persons = UBITS(55, 13);/* 236 */ + imo = true; + break; case 17: /* IMO289 - VTS-generated/synthetic targets */ #define ARRAY_BASE 56 #define ELEMENT_SIZE 122 @@ -1319,6 +1319,10 @@ struct ais_t struct { unsigned int airdraught; /* Air Draught */ } dac1fid15; + /* IMO286 - Number of Persons on board */ + struct { + unsigned persons; /* number of persons */ + } dac1fid16; /* IMO289 - VTS-generated/Synthetic Targets */ struct { signed int ntargets; diff --git a/gpsd_json.c b/gpsd_json.c index cd2d215f..fc76385f 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -2314,6 +2314,11 @@ void json_aivdm_dump(const struct ais_t *ais, ais->type8.dac1fid15.airdraught); imo = true; break; + case 16: /* IMO289 - Number of persons on board */ + (void)snprintf(buf + strlen(buf), buflen - strlen(buf), + "\"persons\":%u}\t\n", ais->type6.dac1fid16.persons); + imo = true; + break; case 17: /* IMO289 - VTS-generated/synthetic targets */ (void)strlcat(buf, "\"targets\":[", buflen); for (i = 0; i < ais->type8.dac1fid17.ntargets; i++) { diff --git a/jsongen.py.in b/jsongen.py.in index 74fa23a4..89a976e1 100644 --- a/jsongen.py.in +++ b/jsongen.py.in @@ -367,6 +367,15 @@ ais_specs = ( ), }, { + "initname" : "json_ais8_fid16", + "headers": ("AIS_HEADER","AIS_TYPE8",), + "structname": "ais->type8.dac1fid16", + "fieldmap":( + # fieldname type default + ('persons', 'uinteger', '0'), + ), + }, + { "initname" : "json_ais8_fid17", "headers": ("AIS_HEADER","AIS_TYPE8",), "structname": "ais->type8.dac1fid17", |