summaryrefslogtreecommitdiff
path: root/ais_json.c
diff options
context:
space:
mode:
authorChristian Gagneraud <chgans@gna.org>2012-05-20 18:30:41 +0100
committerChristian Gagneraud <chgans@gna.org>2012-05-20 22:59:37 +0100
commit2b1cf23a8b428f9cb14017c7cc598e9c6569c209 (patch)
treeff123782b19ca24840b3090227cccaee35722037 /ais_json.c
parentc30d3fc6e497722033794f9873820d04a79855ae (diff)
downloadgpsd-2b1cf23a8b428f9cb14017c7cc598e9c6569c209.tar.gz
[AIS] Use a dedicated stucture for IMO236 met/hydro message
Diffstat (limited to 'ais_json.c')
-rw-r--r--ais_json.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/ais_json.c b/ais_json.c
index 6f285a2b..1b041b4c 100644
--- a/ais_json.c
+++ b/ais_json.c
@@ -228,7 +228,21 @@ 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\":13,") != NULL) {
+ if (strstr(buf, "\"fid\":11,") != NULL) {
+ status = json_read_object(buf, json_ais8_fid11, endptr);
+ if (status == 0) {
+ ais->type8.dac1fid11.day = AIS_DAY_NOT_AVAILABLE;
+ ais->type8.dac1fid11.hour = AIS_HOUR_NOT_AVAILABLE;
+ ais->type8.dac1fid11.minute = AIS_MINUTE_NOT_AVAILABLE;
+ // cppcheck-suppress uninitvar
+ (void)sscanf(timestamp, "%02uT%02u:%02uZ",
+ &ais->type8.dac1fid11.day,
+ &ais->type8.dac1fid11.hour,
+ &ais->type8.dac1fid11.minute);
+ }
+ imo = true;
+ }
+ else 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;
@@ -286,7 +300,7 @@ int json_ais_read(const char *buf,
status = json_read_object(buf, json_ais8_fid29, endptr);
imo = true;
}
- else if (strstr(buf, "\"fid\":31,") != NULL || strstr(buf, "\"fid\":11,") != NULL) {
+ else if (strstr(buf, "\"fid\":31,") != NULL) {
status = json_read_object(buf, json_ais8_fid31, endptr);
if (status == 0) {
ais->type8.dac1fid31.day = AIS_DAY_NOT_AVAILABLE;