summaryrefslogtreecommitdiff
path: root/ais_json.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2011-05-04 05:20:09 -0400
committerEric S. Raymond <esr@thyrsus.com>2011-05-04 05:20:09 -0400
commit8a2dfdb4992763b2aee83453d014133553f08447 (patch)
tree9c8acf22c37736d843a91e2cb4f3c171056cf76d /ais_json.c
parentbe1322ed7650164813daec7b923385557311c087 (diff)
downloadgpsd-8a2dfdb4992763b2aee83453d014133553f08447.tar.gz
In AIS, support for IMO236 type 8 DAC = 1 FID = 13.
Diffstat (limited to 'ais_json.c')
-rw-r--r--ais_json.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/ais_json.c b/ais_json.c
index eb1211d2..1ac2f398 100644
--- a/ais_json.c
+++ b/ais_json.c
@@ -62,6 +62,11 @@ int json_ais_read(const char *buf,
.dflt.uinteger = 0},\
{"fid", t_uinteger, .addr.uinteger = &ais->type6.fid,\
.dflt.uinteger = 0},
+#define AIS_TYPE8 \
+ {"dac", t_uinteger, .addr.uinteger = &ais->type8.dac,\
+ .dflt.uinteger = 0},\
+ {"fid", t_uinteger, .addr.uinteger = &ais->type8.fid,\
+ .dflt.uinteger = 0},
int status;
@@ -195,7 +200,31 @@ int json_ais_read(const char *buf,
} else if (strstr(buf, "\"type\":8,") != NULL) {
bool imo = false;
if (strstr(buf, "\"dac\":1,") != NULL) {
- if (strstr(buf, "\"fid\":29,") != NULL) {
+ if (strstr(buf, "\"fid\":13,") != NULL) {
+ status = json_read_object(buf, json_ais8_fid13, endptr);
+ if (status == 0) {
+ ais->type8.dac1fid13.fmonth = AIS_MONTH_NOT_AVAILABLE;
+ ais->type8.dac1fid13.fday = AIS_DAY_NOT_AVAILABLE;
+ ais->type8.dac1fid13.fhour = AIS_HOUR_NOT_AVAILABLE;
+ ais->type8.dac1fid13.fminute = AIS_MINUTE_NOT_AVAILABLE;
+ (void)sscanf(departure, "%02u-%02uT%02u:%02uZ",
+ &ais->type8.dac1fid13.fmonth,
+ &ais->type8.dac1fid13.fday,
+ &ais->type8.dac1fid13.fhour,
+ &ais->type8.dac1fid13.fminute);
+ ais->type8.dac1fid13.tmonth = AIS_MONTH_NOT_AVAILABLE;
+ ais->type8.dac1fid13.tday = AIS_DAY_NOT_AVAILABLE;
+ ais->type8.dac1fid13.thour = AIS_HOUR_NOT_AVAILABLE;
+ ais->type8.dac1fid13.tminute = AIS_MINUTE_NOT_AVAILABLE;
+ (void)sscanf(eta, "%02u-%02uT%02u:%02uZ",
+ &ais->type8.dac1fid13.tmonth,
+ &ais->type8.dac1fid13.tday,
+ &ais->type8.dac1fid13.thour,
+ &ais->type8.dac1fid13.tminute);
+ }
+ imo = true;
+ }
+ else if (strstr(buf, "\"fid\":29,") != NULL) {
status = json_read_object(buf, json_ais8_fid29, endptr);
imo = true;
}