diff --git a/kw11-l.cpp b/kw11-l.cpp index f94e4f3..4fb7c74 100644 --- a/kw11-l.cpp +++ b/kw11-l.cpp @@ -216,19 +216,18 @@ uint8_t kw11_l::get_lf_crs() return rc; } -#if IS_POSIX -json_t *kw11_l::serialize() +JsonDocument kw11_l::serialize() { - json_t *j = json_object(); + JsonDocument j; - json_object_set(j, "CSR", json_integer(lf_csr)); + j["CSR"] = lf_csr; return j; } kw11_l *kw11_l::deserialize(const json_t *const j, bus *const b, console *const cnsl) { - uint16_t CSR = json_integer_value(json_object_get(j, "CSR")); + uint16_t CSR = j["CSR"]; kw11_l *out = new kw11_l(b); out->lf_csr = CSR; @@ -236,4 +235,3 @@ kw11_l *kw11_l::deserialize(const json_t *const j, bus *const b, console *const return out; } -#endif diff --git a/kw11-l.h b/kw11-l.h index f7f8fcc..d0e418c 100644 --- a/kw11-l.h +++ b/kw11-l.h @@ -1,6 +1,7 @@ // (C) 2018-2024 by Folkert van Heusden // Released under MIT license +#include #include #include @@ -42,10 +43,8 @@ public: void show_state(console *const cnsl) const override; -#if IS_POSIX - json_t *serialize(); - static kw11_l *deserialize(const json_t *const j, bus *const b, console *const cnsl); -#endif + JsonDocument serialize(); + static kw11_l *deserialize(const JsonDocument j, bus *const b, console *const cnsl); void begin(console *const cnsl); void operator()();