Json::Value root;
if (reader.parse(event.getContent(), root)) {
+
+ bool modified = false;
+
if (root.isMember(TIMEOUT_KEY)) {
int timeout = root[TIMEOUT_KEY].asInt();
if (timeout > 0) {
LOG_D(TAG, "SettingsHandler: keepalive timeout set to %d", timeout);
NetworkManager::Settings::instance().setKeepAliveTimeout(std::chrono::milliseconds(timeout));
+ modified = true;
} else {
LOG_E(TAG, "SettingsHandler: wrong timeout value %d", timeout);
}
bool lock = root[LOCK_KEY].asBool();
LOG_D(TAG, "SettingsHandler: lock set to %d", int(lock));
NetworkManager::Settings::instance().setLock(lock);
+ modified = true;
+ }
+
+ if (modified) {
+ NetworkManager::Settings::instance().save();
}
- NetworkManager::Settings::instance().save();
event.confirm();
}
} catch (std::exception& e) {