summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ais_json.c4
-rw-r--r--json.c5
-rw-r--r--test/synthetic-ais.json3
3 files changed, 9 insertions, 3 deletions
diff --git a/ais_json.c b/ais_json.c
index d143190e..22fa9bd8 100644
--- a/ais_json.c
+++ b/ais_json.c
@@ -133,9 +133,9 @@ int json_ais_read(const char *buf,
} else if (strstr(buf, "\"type\":21,") != NULL) {
status = json_read_object(buf, json_ais21, endptr);
} else if (strstr(buf, "\"type\":22,") != NULL) {
- status = json_read_object(buf, json_ais23, endptr);
- } else if (strstr(buf, "\"type\":23,") != NULL) {
status = json_read_object(buf, json_ais22, endptr);
+ } else if (strstr(buf, "\"type\":23,") != NULL) {
+ status = json_read_object(buf, json_ais23, endptr);
} else if (strstr(buf, "\"type\":24,") != NULL) {
status = json_read_object(buf, json_ais24, endptr);
} else if (strstr(buf, "\"type\":25,") != NULL) {
diff --git a/json.c b/json.c
index a7a671c4..e191aac3 100644
--- a/json.c
+++ b/json.c
@@ -250,9 +250,12 @@ static int json_internal_read_object(const char *cp,
*pattr++ = '\0';
json_debug_trace((1, "Collected attribute name %s\n",
attrbuf));
- for (cursor = attrs; cursor->attribute != NULL; cursor++)
+ for (cursor = attrs; cursor->attribute != NULL; cursor++) {
+ json_debug_trace((2, "Checking against %s\n",
+ cursor->attribute));
if (strcmp(cursor->attribute, attrbuf) == 0)
break;
+ }
if (cursor->attribute == NULL) {
json_debug_trace((1,
"Unknown attribute name '%s' (attributes begin with '%s').\n",
diff --git a/test/synthetic-ais.json b/test/synthetic-ais.json
index ca3b8168..befd1144 100644
--- a/test/synthetic-ais.json
+++ b/test/synthetic-ais.json
@@ -43,3 +43,6 @@
{"class":"AIS","type":20,"repeat":3,"mmsi":3669705,"scaled":false,"offset1":2182,"number1":5,"timeout1":7,"increment1":225,"offset2":0,"number2":0,"timeout2":0,"increment2":0,"offset3":0,"number3":0,"timeout3":0,"increment3":0,"offset4":0,"number4":0,"timeout4":0,"increment4":0}
{"class":"AIS","type":20,"repeat":0,"mmsi":3160097,"scaled":false,"offset1":47,"number1":1,"timeout1":7,"increment1":250,"offset2":2250,"number2":1,"timeout2":7,"increment2":1125,"offset3":856,"number3":5,"timeout3":7,"increment3":1125,"offset4":0,"number4":0,"timeout4":0,"increment4":0}
{"class":"AIS","type":21,"repeat":0,"mmsi":123456789,"scaled":false,"aid_type":20,"name":"CHINA ROSE MURPHY EXPRESS ALERT","accuracy":false,"lon":-73619155,"lat":28752371,"to_bow":5,"to_stern":5,"to_port":5,"to_starboard":5,"epfd":1,"second":50,"regional":165,"off_position":false,"raim":false,"virtual_aid":false}
+{"class":"AIS","type":22,"repeat":0,"mmsi":3160048,"scaled":false,"channel_a":2087,"channel_b":2088,"txrx":0,"power":false,"ne_lon":-44100,"ne_lat":27330,"sw_lon":-48100,"sw_lat":25400,"addressed":false,"band_a":false,"band_b":false,"zonesize":4}
+{"class":"AIS","type":23,"repeat":0,"mmsi":2268120,"scaled":false,"ne_lon":1578,"ne_lat":30642,"sw_lon":1096,"sw_lat":30408,"stationtype":6,"shiptype":0,"interval":9,"quiet":0}
+{"class":"AIS","type":24,"repeat":2,"mmsi":338085242,"scaled":false,"shipname":"CAPTAIN`S PARADISE","shiptype":54,"vendorid":"ACR1234","callsign":"WDD7883","to_bow":8,"to_stern":3,"to_port":2,"to_starboard":1}