mirror of
https://github.com/Laxilef/OTGateway.git
synced 2025-12-11 18:54:28 +05:00
refactor: sensors type settings moved to portal, entities for HA have been deleted; logging settings moved; bump version
This commit is contained in:
29
src/utils.h
29
src/utils.h
@@ -234,9 +234,11 @@ bool jsonToNetworkSettings(const JsonVariantConst src, NetworkSettings& dst) {
|
||||
}
|
||||
|
||||
void settingsToJson(const Settings& src, JsonVariant dst, bool safe = false) {
|
||||
dst["debug"] = src.debug;
|
||||
|
||||
if (!safe) {
|
||||
dst["system"]["debug"] = src.system.debug;
|
||||
dst["system"]["useSerial"] = src.system.useSerial;
|
||||
dst["system"]["useTelnet"] = src.system.useTelnet;
|
||||
|
||||
dst["portal"]["useAuth"] = src.portal.useAuth;
|
||||
dst["portal"]["login"] = src.portal.login;
|
||||
dst["portal"]["password"] = src.portal.password;
|
||||
@@ -318,13 +320,24 @@ void safeSettingsToJson(const Settings& src, JsonVariant dst) {
|
||||
bool jsonToSettings(const JsonVariantConst src, Settings& dst, bool safe = false) {
|
||||
bool changed = false;
|
||||
|
||||
if (src["debug"].is<bool>()) {
|
||||
dst.debug = src["debug"].as<bool>();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
||||
if (!safe) {
|
||||
// system
|
||||
if (src["system"]["debug"].is<bool>()) {
|
||||
dst.system.debug = src["system"]["debug"].as<bool>();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (src["system"]["useSerial"].is<bool>()) {
|
||||
dst.system.useSerial = src["system"]["useSerial"].as<bool>();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (src["system"]["useTelnet"].is<bool>()) {
|
||||
dst.system.useTelnet = src["system"]["useTelnet"].as<bool>();
|
||||
changed = true;
|
||||
}
|
||||
|
||||
|
||||
// portal
|
||||
if (src["portal"]["useAuth"].is<bool>()) {
|
||||
dst.portal.useAuth = src["portal"]["useAuth"].as<bool>();
|
||||
|
||||
Reference in New Issue
Block a user