#include "DataStruct.h" void EMSYX::fromJson(const std::string& str) { njson jsonroot; auto ret = JSON::parse(str, jsonroot); if (!ret) { return; } JSON::read(jsonroot, "mcu", mcu); JSON::read(jsonroot, "pcs", pcs); JSON::read(jsonroot, "electMeterMainPoint", electMeterMainPoint); JSON::read(jsonroot, "electMeter", electMeter); JSON::read(jsonroot, "fireSystem", fireSystem); JSON::read(jsonroot, "ups", ups); JSON::read(jsonroot, "temHumMainPoint", temHumMainPoint); JSON::read(jsonroot, "temHum", temHum); JSON::read(jsonroot, "aircMainPoint", aircMainPoint); JSON::read(jsonroot, "airc", airc); JSON::read(jsonroot, "controlDryContact", controlDryContact); JSON::read(jsonroot, "statusDryContact", statusDryContact); JSON::read(jsonroot, "bcuMain", bcuMain); JSON::read(jsonroot, "pcuMain", pcuMain); JSON::read(jsonroot, "electMeterMain", electMeterMain); JSON::read(jsonroot, "fireSystemMain", fireSystemMain); JSON::read(jsonroot, "upsMain", upsMain); JSON::read(jsonroot, "temHumMain", temHumMain); JSON::read(jsonroot, "aircMain", aircMain); JSON::read(jsonroot, "emu", emu); JSON::read(jsonroot, "chillerMain", chillerMain); JSON::read(jsonroot, "chillerMainPoint", chillerMainPoint); JSON::read(jsonroot, "chiller", chiller); } std::string EMSYX::toJson() { njson jsonroot; jsonroot["bms"] = bms; jsonroot["bcu"] = bcu; jsonroot["mcu"] = mcu; jsonroot["pcs"] = pcs; jsonroot["electMeterMainPoint"] = electMeterMainPoint; jsonroot["electMeter"] = electMeter; jsonroot["fireSystem"] = fireSystem; jsonroot["ups"] = ups; jsonroot["temHumMainPoint"] = temHumMainPoint; jsonroot["temHum"] = temHum; jsonroot["aircMainPoint"] = aircMainPoint; jsonroot["airc"] = airc; jsonroot["controlDryContact"] = controlDryContact; jsonroot["statusDryContact"] = statusDryContact; jsonroot["bcuMain"] = bcuMain; jsonroot["pcuMain"] = pcuMain; jsonroot["electMeterMain"] = electMeterMain; jsonroot["fireSystemMain"] = fireSystemMain; jsonroot["upsMain"] = upsMain; jsonroot["temHumMain"] = temHumMain; jsonroot["aircMain"] = aircMain; jsonroot["emu"] = emu; jsonroot["chillerMain"] = chillerMain; jsonroot["chillerMainPoint"] = chillerMainPoint; jsonroot["chiller"] = chiller; return jsonroot.dump(); }