summaryrefslogtreecommitdiff
path: root/rtcm2_json.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-08-28 12:30:33 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-08-28 12:30:33 +0000
commit3cca5bc4c78f2e364c87605d150621ca17ae401f (patch)
tree34dc9495ec408a9e4e2ccbbce3543d992adb8c2d /rtcm2_json.c
parentc9234e4cdb313dd47566c5970d84e59e23a4cc1c (diff)
downloadgpsd-3cca5bc4c78f2e364c87605d150621ca17ae401f.tar.gz
Use enumerated string values for the "system" field in RTCM2 type 4 messages.
Register a synthetic test load for checking decoding of unusual message types.
Diffstat (limited to 'rtcm2_json.c')
-rw-r--r--rtcm2_json.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/rtcm2_json.c b/rtcm2_json.c
index 2283931b..9209c072 100644
--- a/rtcm2_json.c
+++ b/rtcm2_json.c
@@ -72,10 +72,20 @@ int json_rtcm2_read(const char *buf,
{NULL},
};
+ /*
+ * Beware! Needs to stay synchronized with a corresponding
+ * nam,e array in the RTCM2 JSON dump code. This interpretation of
+ * NAVSYSTEM_GALILEO is assumed from RTCM3, it's not actually
+ * documented in RTCM 2.1.
+ */
+ const struct json_enum_t system_table[] = {
+ {"GPS", 0}, {"GLONASS", 1}, {"GALILEO", 2}, {"UNKNOWN", 2}, {NULL}
+ };
const struct json_attr_t json_rtcm4[] = {
RTCM2_HEADER
{"valid", boolean, .addr.boolean = &rtcm2->reference.valid},
- {"system", integer, .addr.integer = &rtcm2->reference.system},
+ {"system", integer, .addr.integer = &rtcm2->reference.system,
+ .map=system_table},
{"sense", integer, .addr.integer = &rtcm2->reference.sense},
{"datum", string, .addr.string = rtcm2->reference.datum,
.len = sizeof(rtcm2->reference.datum)},