KW11-L new serialization
This commit is contained in:
parent
e0e0e93b20
commit
798d69fc7a
2 changed files with 7 additions and 10 deletions
10
kw11-l.cpp
10
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
|
||||
|
|
7
kw11-l.h
7
kw11-l.h
|
@ -1,6 +1,7 @@
|
|||
// (C) 2018-2024 by Folkert van Heusden
|
||||
// Released under MIT license
|
||||
|
||||
#include <ArduinoJson.h>
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
|
@ -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()();
|
||||
|
|
Loading…
Add table
Reference in a new issue