2025-09-04 19:31:04 +08:00
|
|
|
|
#include "DataStruct.h"
|
|
|
|
|
|
|
|
|
|
|
|
void EMSYX::fromJson(const std::string& str)
|
|
|
|
|
|
{
|
2025-09-06 15:23:07 +08:00
|
|
|
|
njson jsonroot;
|
|
|
|
|
|
auto ret = JSON::parse(str, jsonroot);
|
2025-09-04 19:31:04 +08:00
|
|
|
|
if (!ret) { return; }
|
2025-09-06 15:23:07 +08:00
|
|
|
|
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);
|
2025-09-04 19:31:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
std::string EMSYX::toJson()
|
|
|
|
|
|
{
|
2025-09-06 15:23:07 +08:00
|
|
|
|
njson jsonroot;
|
2025-09-04 19:31:04 +08:00
|
|
|
|
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();
|
|
|
|
|
|
}
|