diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2013-10-05 17:40:36 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2013-10-05 17:40:36 -0400 |
commit | 51acb55669c76de87d0af493039dd7caf2ab2f2b (patch) | |
tree | 6b7b133d005016554d30930c695149232e69213e | |
parent | 23b9cc85e2382ced71430386e1ff98fd293be268 (diff) | |
download | gpsd-51acb55669c76de87d0af493039dd7caf2ab2f2b.tar.gz |
Inland AIS Water level support is done except for the JSON dumping.
-rw-r--r-- | ais_json.c | 4 | ||||
-rw-r--r-- | driver_ais.c | 15 | ||||
-rw-r--r-- | gps.h | 10 | ||||
-rw-r--r-- | jsongen.py.in | 14 |
4 files changed, 43 insertions, 0 deletions
@@ -358,6 +358,10 @@ int json_ais_read(const char *buf, &ais->type8.dac200fid23.end_minute); imo = true; } + else if (strstr(buf, "\"fid\":24,") != NULL) { + status = json_read_object(buf, json_ais8_fid24, endptr); + imo = true; + } else if (strstr(buf, "\"fid\":27,") != NULL) { status = json_read_object(buf, json_ais8_fid27, endptr); if (status == 0) { diff --git a/driver_ais.c b/driver_ais.c index d3452255..17d5cb89 100644 --- a/driver_ais.c +++ b/driver_ais.c @@ -678,6 +678,21 @@ bool ais_binary_decode(const int debug, /* skip 6 bits */ imo = true; break; + case 24: + UCHARS(56, ais->type8.dac200fid24.country); +#define ARRAY_BASE 68 +#define ELEMENT_SIZE 25 + for (i = 0; ARRAY_BASE + (ELEMENT_SIZE*i) < bitlen; i++) { + int a = ARRAY_BASE + (ELEMENT_SIZE*i); + ais->type8.dac200fid24.gauges[i].id = UBITS(a+0, 11); + ais->type8.dac200fid24.gauges[i].level = SBITS(a+11, 14); + } + ais->type8.dac200fid24.ngauges = i; +#undef ARRAY_BASE +#undef ELEMENT_SIZE + /* skip 6 bits */ + imo = true; + break; } } /* land here if we failed to match a known DAC/FID */ @@ -1288,6 +1288,16 @@ struct ais_t unsigned int wind; /* Wind Direction */ #define DAC200FID23_WIND_UNKNOWN 0 } dac200fid23; + struct { + char country[2+1]; /* UN Country Code */ + signed int ngauges; + struct gauge_t { + unsigned int id; /* Gauge ID */ +#define DAC200FID24_GAUGE_ID_UNKNOWN 0 + signed int level; /* Water Level */ +#define DAC200FID24_GAUGE_LEVEL_UNKNOWN 0 + } gauges[4]; + } dac200fid24; /* IMO236 - Meteorological-Hydrological data * Trial message, not to be used after January 2013 * Replaced by IMO289 (DAC 1, FID 31) diff --git a/jsongen.py.in b/jsongen.py.in index 8a64c6dc..c9398f3b 100644 --- a/jsongen.py.in +++ b/jsongen.py.in @@ -514,6 +514,20 @@ ais_specs = ( 'stringbuffered' : ('start', 'end'), }, { + "initname" : "json_ais8_fid24", + "headers": ("AIS_HEADER","AIS_TYPE8"), + "structname": "ais->type8.dac200fid24", + "fieldmap":( + # fieldname type default + ('country', 'string', None), + ('gauges', 'array', ( + ('gauge_t', 'ngauges', ( + ('id', 'uinteger', 'DAC200FID24_GAUGE_ID_UNKNOWN'), + ('level', 'integer', 'DAC200FID24_GAUGE_LEVEL_UNKNOWN'), + )))), + ), + }, + { "initname" : "json_ais8_fid27", "headers": ("AIS_HEADER","AIS_TYPE8",), "structname": "ais->type8.dac1fid27", |