diff options
-rw-r--r-- | ais_json.c | 4 | ||||
-rw-r--r-- | driver_aivdm.c | 4 | ||||
-rw-r--r-- | gps.h | 6 | ||||
-rw-r--r-- | gpsd_json.c | 5 | ||||
-rw-r--r-- | jsongen.py.in | 16 | ||||
-rw-r--r-- | www/AIVDM.txt | 4 |
6 files changed, 37 insertions, 2 deletions
@@ -102,6 +102,10 @@ int json_ais_read(const char *buf, status = json_read_object(buf, json_ais6_fid32, endptr); imo = true; } + else if (strstr(buf, "\"fid\":30,") != NULL) { + status = json_read_object(buf, json_ais6_fid30, endptr); + imo = true; + } if (!imo) { status = json_read_object(buf, json_ais6, endptr); if (status == 0) diff --git a/driver_aivdm.c b/driver_aivdm.c index a3580808..3aca0869 100644 --- a/driver_aivdm.c +++ b/driver_aivdm.c @@ -369,6 +369,10 @@ bool aivdm_decode(const char *buf, size_t buflen, case 28: /* IMO289 - Route info - addressed */ break; case 30: /* IMO289 - Text description - addressed */ + ais->type6.dac1fid30.linkage = UBITS(88, 10); + from_sixbit((char *)ais_context->bits, + 98, ais_context->bitlen-98, + ais->type6.dac1fid30.text); break; case 32: /* IMO289 - Tidal Window */ ais->type6.dac1fid32.month = UBITS(88, 4); @@ -932,6 +932,12 @@ struct ais_t struct { unsigned persons; /* number of persons */ } dac1fid16; + /* IMO289 - Text message (addressed) */ + struct { + unsigned int linkage; +#define AIS_DAC1FID30_TEXT_MAX 154 /* 920 bits of six-bit, plus NUL */ + char text[AIS_DAC1FID30_TEXT_MAX]; + } dac1fid30; /* IMO236 & IMO289 - Tidal Window */ struct { unsigned int month; /* month of year */ diff --git a/gpsd_json.c b/gpsd_json.c index 247d18c0..5d8605bf 100644 --- a/gpsd_json.c +++ b/gpsd_json.c @@ -1770,6 +1770,11 @@ void json_aivdm_dump(const struct ais_t *ais, case 28: /* IMO289 - Route info - addressed */ break; case 30: /* IMO289 - Text description - addressed */ + (void)snprintf(buf + strlen(buf), buflen - strlen(buf), + "\"linkage\":%u,\"text\":\"%s\"}\r\n", + ais->type6.dac1fid30.linkage, + json_stringify(buf1, sizeof(buf1), + ais->type6.dac1fid30.text)); break; } if (!imo) diff --git a/jsongen.py.in b/jsongen.py.in index bc379f27..d420293f 100644 --- a/jsongen.py.in +++ b/jsongen.py.in @@ -109,6 +109,22 @@ ais_specs = ( ), }, { + "initname" : "json_ais6_fid30", + "header": "\tAIS_HEADER,", + "structname": "ais->type6", + "fieldmap":( + # fieldname type default + ('seqno', 'uinteger', '0'), + ('dest_mmsi', 'uinteger', '0'), + ('retransmit', 'boolean', 'false'), + ('dac', 'uinteger', '0'), + ('fid', 'uinteger', '0'), + ('dac1fid30.linkage', 'uinteger', '0'), + ('dac1fid30.text', 'string', '0'), + ), + "stringbuffered":("dacfid31.text",), + }, + { "initname" : "json_ais6_fid32", "header": "\tAIS_HEADER,", "structname": "ais->type6", diff --git a/www/AIVDM.txt b/www/AIVDM.txt index e16ecced..8660c826 100644 --- a/www/AIVDM.txt +++ b/www/AIVDM.txt @@ -754,7 +754,7 @@ the dimensions to port and starboard, the special value 63 indicates |56 |Spare - Local Vessel |57 |Spare - Local Vessel |58 |Medical Transport -|59 |Ship according to RR Resolution No. 18 +|59 |Noncombatant ship according to RR Resolution No. 18 |60 |Passenger, all ships of this type |61 |Passenger, Hazardous category A |62 |Passenger, Hazardous category B @@ -887,7 +887,7 @@ This is the <<IMO236>> version, now deprecated; there is a later |122-126 | 5 |ETA day |lday |1-31, 0=N/A (default) |127-131 | 5 |ETA hour |lhour |0-23, 24=N/A (default) |132-137 | 6 |ETA minute |lminute |0-59, 60=N/A (default) -|138-167 | 30 |Last Port Of Call |nextport |5 6-bit characters, UN locode +|138-167 | 30 |Next Port Of Call |nextport |5 6-bit characters, UN locode |168-171 | 4 |ETA month |nmonth |1-12, 0=N/A (default) |172-176 | 5 |ETA day |nday |1-31, 0=N/A (default) |177-181 | 5 |ETA hour |nhour |0-23, 24=N/A (default) |