From fb36efb873fb5158f4c0977617c7c22e7d9fb187 Mon Sep 17 00:00:00 2001 From: RobertPiet Date: Thu, 17 Dec 2020 17:22:31 +0100 Subject: [PATCH] [EGD-4960] Settings Interface added parameter do distinguish global/app settings [EGD-4960] global/local setting determined by enum value, unregister all variables in one call, ut updated [EGD-4960] SettingsScope usage in SettingsMessages --- module-apps/Application.cpp | 7 +- .../ApplicationDesktop.cpp | 13 ++-- .../ApplicationSettings.cpp | 19 +++--- .../model/ApplicationManager.cpp | 24 ++++--- .../service-cellular/ServiceCellular.cpp | 4 +- .../service-db/agents/settings/Settings.cpp | 67 ++++++++++++------- .../agents/settings/SettingsAgent.cpp | 39 ++++------- .../agents/settings/SettingsAgent.hpp | 3 +- .../service-db/service-db/Settings.hpp | 25 ++++--- .../service-db/SettingsMessages.hpp | 30 +++++++++ .../service-db/service-db/SettingsScope.hpp | 12 ++++ .../test-service-db-settings-messages.cpp | 8 +-- .../test-service-db-settings-testservices.hpp | 10 +-- 13 files changed, 170 insertions(+), 91 deletions(-) create mode 100644 module-services/service-db/service-db/SettingsScope.hpp diff --git a/module-apps/Application.cpp b/module-apps/Application.cpp index bf2123a8061a11cb84af103679dc3e0a161f3b98..c5494fa5b9fa28eb060049a80c83705626b2c160 100644 --- a/module-apps/Application.cpp +++ b/module-apps/Application.cpp @@ -84,13 +84,16 @@ namespace app connect(typeid(AppRefreshMessage), [this](sys::Message *msg) -> sys::MessagePointer { return handleAppRefresh(msg); }); - settings->registerValueChange(settings::SystemProperties::timeFormat12, - [this](std::string value) { timeFormatChanged(value); }); + settings->registerValueChange( + settings::SystemProperties::timeFormat12, + [this](std::string value) { timeFormatChanged(value); }, + settings::SettingsScope::Global); } Application::~Application() noexcept { windowsStack.windows.clear(); + settings->unregisterValueChange(); } Application::State Application::getState() diff --git a/module-apps/application-desktop/ApplicationDesktop.cpp b/module-apps/application-desktop/ApplicationDesktop.cpp index 70fdebc4da3561282d5fed569dd784d566a6f683..758a8880b72f5032ac05f1105624c854a853cae3 100644 --- a/module-apps/application-desktop/ApplicationDesktop.cpp +++ b/module-apps/application-desktop/ApplicationDesktop.cpp @@ -323,11 +323,15 @@ namespace app std::make_shared(updateos::UpdateMessageType::UpdateCheckForUpdateOnce); sys::Bus::SendUnicast(msgToSend, service::name::service_desktop, this); - settings->registerValueChange(settings::SystemProperties::activeSim, - [this](std::string value) { activeSimChanged(value); }); + settings->registerValueChange( + settings::SystemProperties::activeSim, + [this](std::string value) { activeSimChanged(value); }, + settings::SettingsScope::Global); Store::GSM::get()->selected = Store::GSM::SIM::NONE; - settings->registerValueChange(settings::SystemProperties::lockPassHash, - [this](std::string value) { lockPassHashChanged(value); }); + settings->registerValueChange( + settings::SystemProperties::lockPassHash, + [this](std::string value) { lockPassHashChanged(value); }, + settings::SettingsScope::Global); return sys::ReturnCodes::Success; } @@ -335,6 +339,7 @@ namespace app sys::ReturnCodes ApplicationDesktop::DeinitHandler() { LOG_INFO("DeinitHandler"); + settings->unregisterValueChange(); return sys::ReturnCodes::Success; } diff --git a/module-apps/application-settings/ApplicationSettings.cpp b/module-apps/application-settings/ApplicationSettings.cpp index 540677f7529a4462cc20ca3279351b4e45253717..e0e2c2ae2f4046b050afe867e538f3e1888483f6 100644 --- a/module-apps/application-settings/ApplicationSettings.cpp +++ b/module-apps/application-settings/ApplicationSettings.cpp @@ -47,16 +47,18 @@ namespace app switchWindow(app::sim_select); return msgHandled(); }); - settings->registerValueChange(settings::SystemProperties::lockPassHash, - [this](std::string value) { lockPassChanged(value); }); - settings->registerValueChange(settings::SystemProperties::timeDateFormat, - [this](std::string value) { timeDateChanged(value); }); + settings->registerValueChange( + settings::SystemProperties::lockPassHash, + [this](std::string value) { lockPassChanged(value); }, + settings::SettingsScope::Global); + settings->registerValueChange( + settings::SystemProperties::timeDateFormat, + [this](std::string value) { timeDateChanged(value); }, + settings::SettingsScope::Global); } ApplicationSettings::~ApplicationSettings() { - settings->unregisterValueChange(settings::SystemProperties::lockPassHash); - settings->unregisterValueChange(settings::SystemProperties::timeDateFormat); } // Invoked upon receiving data message @@ -173,13 +175,14 @@ namespace app void ApplicationSettings::setPin(unsigned int value) { - settings->setValue(settings::SystemProperties::lockPassHash, std::to_string(value)); + settings->setValue( + settings::SystemProperties::lockPassHash, std::to_string(value), settings::SettingsScope::Global); lockPassHash = value; } void ApplicationSettings::clearPin() { - settings->setValue(settings::SystemProperties::lockPassHash, ""); + settings->setValue(settings::SystemProperties::lockPassHash, "", settings::SettingsScope::Global); lockPassHash = 0U; } diff --git a/module-services/service-appmgr/model/ApplicationManager.cpp b/module-services/service-appmgr/model/ApplicationManager.cpp index 6e0b4eb81ef7afb3fd9dc74e352c6b4b6fdd8b95..e6794aa845f2d37e830d16fb9040b00720f50fdc 100644 --- a/module-services/service-appmgr/model/ApplicationManager.cpp +++ b/module-services/service-appmgr/model/ApplicationManager.cpp @@ -106,12 +106,18 @@ namespace app::manager { registerMessageHandlers(); blockingTimer->connect([this](sys::Timer &) { onPhoneLocked(); }); - settings->registerValueChange(settings::SystemProperties::displayLanguage, - [this](std::string value) { displayLanguageChanged(value); }); - settings->registerValueChange(settings::SystemProperties::inputLanguage, - [this](std::string value) { inputLanguageChanged(value); }); - settings->registerValueChange(settings::SystemProperties::lockTime, - [this](std::string value) { lockTimeChanged(value); }); + settings->registerValueChange( + settings::SystemProperties::displayLanguage, + [this](std::string value) { displayLanguageChanged(value); }, + settings::SettingsScope::Global); + settings->registerValueChange( + settings::SystemProperties::inputLanguage, + [this](std::string value) { inputLanguageChanged(value); }, + settings::SettingsScope::Global); + settings->registerValueChange( + settings::SystemProperties::lockTime, + [this](std::string value) { lockTimeChanged(value); }, + settings::SettingsScope::Global); } sys::ReturnCodes ApplicationManager::InitHandler() @@ -161,6 +167,7 @@ namespace app::manager sys::ReturnCodes ApplicationManager::DeinitHandler() { + settings->unregisterValueChange(); closeApplications(); closeServices(); return sys::ReturnCodes::Success; @@ -540,7 +547,8 @@ namespace app::manager return false; } displayLanguage = requestedLanguage; - settings->setValue(settings::SystemProperties::displayLanguage, displayLanguage); + settings->setValue( + settings::SystemProperties::displayLanguage, displayLanguage, settings::SettingsScope::Global); utils::localize.setDisplayLanguage(displayLanguage); rebuildActiveApplications(); return true; @@ -555,7 +563,7 @@ namespace app::manager return false; } inputLanguage = requestedLanguage; - settings->setValue(settings::SystemProperties::inputLanguage, inputLanguage); + settings->setValue(settings::SystemProperties::inputLanguage, inputLanguage, settings::SettingsScope::Global); utils::localize.setInputLanguage(inputLanguage); return true; } diff --git a/module-services/service-cellular/ServiceCellular.cpp b/module-services/service-cellular/ServiceCellular.cpp index 8741f13038a5360fb103109e45c6b7b514412520..44c6b2f2b00dc676f5b728e87a79fc0dc7bb0fc0 100644 --- a/module-services/service-cellular/ServiceCellular.cpp +++ b/module-services/service-cellular/ServiceCellular.cpp @@ -1284,7 +1284,9 @@ bool ServiceCellular::handleSimState(at::SimState state, const std::string messa switch (state) { case at::SimState::Ready: Store::GSM::get()->sim = Store::GSM::get()->selected; - settings->setValue(settings::SystemProperties::activeSim, utils::enumToString(Store::GSM::get()->selected)); + settings->setValue(settings::SystemProperties::activeSim, + utils::enumToString(Store::GSM::get()->selected), + settings::SettingsScope::Global); // SIM causes SIM INIT, only on ready response = std::move(std::make_unique(CellularNotificationMessage::Type::SIM_READY)); diff --git a/module-services/service-db/agents/settings/Settings.cpp b/module-services/service-db/agents/settings/Settings.cpp index 211252f04d6368f6ada87d60419cb31bb381cc64..29d99582b7063caf2b32f3cd8bfcdb13d05f07a2 100644 --- a/module-services/service-db/agents/settings/Settings.cpp +++ b/module-services/service-db/agents/settings/Settings.cpp @@ -52,9 +52,9 @@ namespace settings { LOG_DEBUG("handleVariableChanged"); if (auto msg = dynamic_cast(req)) { - auto key = msg->getPath().variable; + auto key = msg->getPath(); auto val = msg->getValue(); - LOG_DEBUG("handleVariableChanged: (k=v): (%s=%s)", key.c_str(), val.value_or("").c_str()); + LOG_DEBUG("handleVariableChanged: (k=v): (%s=%s)", key.to_string().c_str(), val.value_or("").c_str()); ValueCb::iterator it_cb = cbValues.find(key); if (cbValues.end() != it_cb) { auto [cb, cbWithName] = it_cb->second; @@ -62,13 +62,13 @@ namespace settings // in case of two callbacks there is a need to duplicate the value auto value = std::move(val.value_or("")); cb(std::string{value}); - cbWithName(key, std::move(value)); + cbWithName(key.variable, std::move(value)); } else if (nullptr != cb) { cb(std::move(val.value_or(""))); } else { - cbWithName(key, std::move(val.value_or(""))); + cbWithName(key.variable, std::move(val.value_or(""))); } } } @@ -115,56 +115,77 @@ namespace settings return std::make_shared(); } - void Settings::registerValueChange(const std::string &variableName, ValueChangedCallback cb) + void Settings::registerValueChange(const std::string &variableName, ValueChangedCallback cb, SettingsScope scope) { - ValueCb::iterator it_cb = cbValues.find(variableName); - if (cbValues.end() != it_cb && nullptr != it_cb->second.first) { - LOG_INFO("Callback function on value change (%s) already exists, rewriting", variableName.c_str()); - } - cbValues[variableName].first = cb; EntryPath path; path.variable = variableName; path.service = app->GetName(); + path.scope = scope; + + auto it_cb = cbValues.find(path); + if (cbValues.end() != it_cb && nullptr != it_cb->second.first) { + LOG_INFO("Callback function on value change (%s) already exists, rewriting", path.to_string().c_str()); + } + cbValues[path].first = cb; + auto msg = std::make_shared(path); sendMsg(std::move(msg)); } - void Settings::registerValueChange(const std::string &variableName, ValueChangedCallbackWithName cb) + void Settings::registerValueChange(const std::string &variableName, + ValueChangedCallbackWithName cb, + SettingsScope scope) { - auto it_cb = cbValues.find(variableName); - if (cbValues.end() != it_cb && nullptr != it_cb->second.second) { - LOG_INFO("Callback function on value change (%s) already exists, rewriting", variableName.c_str()); - } - cbValues[variableName].second = cb; EntryPath path; path.variable = variableName; path.service = app->GetName(); + path.scope = scope; + + auto it_cb = cbValues.find(path); + if (cbValues.end() != it_cb && nullptr != it_cb->second.second) { + LOG_INFO("Callback function on value change (%s) already exists, rewriting", path.to_string().c_str()); + } + cbValues[path].second = cb; + auto msg = std::make_shared(path); sendMsg(std::move(msg)); } - void Settings::unregisterValueChange(const std::string &variableName) + void Settings::unregisterValueChange(const std::string &variableName, SettingsScope scope) { - ValueCb::iterator it_cb = cbValues.find(variableName); + EntryPath path; + path.variable = variableName; + path.service = app->GetName(); + path.scope = scope; + + auto it_cb = cbValues.find(path); if (cbValues.end() == it_cb) { - LOG_INFO("Callback function on value change (%s) does not exist", variableName.c_str()); + LOG_INFO("Callback function on value change (%s) does not exist", path.to_string().c_str()); } else { cbValues.erase(it_cb); } - EntryPath path; - path.variable = variableName; - path.service = app->GetName(); auto msg = std::make_shared(path); sendMsg(std::move(msg)); } - void Settings::setValue(const std::string &variableName, const std::string &variableValue) + void Settings::unregisterValueChange() + { + for (auto it_cb : cbValues) { + auto msg = std::make_shared(it_cb.first); + sendMsg(std::move(msg)); + } + cbValues.clear(); + LOG_INFO("Unregistered all settings variable change on application (%s)", app->GetName().c_str()); + } + + void Settings::setValue(const std::string &variableName, const std::string &variableValue, SettingsScope scope) { EntryPath path; path.variable = variableName; path.service = app->GetName(); + path.scope = scope; auto msg = std::make_shared(path, variableValue); sendMsg(std::move(msg)); } diff --git a/module-services/service-db/agents/settings/SettingsAgent.cpp b/module-services/service-db/agents/settings/SettingsAgent.cpp index ec71526c850fc89214b836eefe6dd3c5fc314126..e3246d8d1262c6fbefe855043466a595b0d8a85a 100644 --- a/module-services/service-db/agents/settings/SettingsAgent.cpp +++ b/module-services/service-db/agents/settings/SettingsAgent.cpp @@ -4,8 +4,6 @@ #include "SettingsAgent.hpp" #include "Settings_queries.hpp" -#include - #include #include #include @@ -24,16 +22,6 @@ SettingsAgent::SettingsAgent(sys::Service *parentService) : DatabaseAgent(parent void SettingsAgent::initDb() { - auto notifications = database->query(settings::Statements::getAllNotifications); - if (nullptr == notifications || 0 == notifications->getRowCount()) { - return; - } - do { - variableChangeRecipents[(*notifications)[0].getString()].insert((*notifications)[1].getString()); - /*what about mode/profile - modeChangeRecipents; - profileChangeRecipents;*/ - } while (notifications->nextRow()); } void SettingsAgent::deinitDb() @@ -95,8 +83,7 @@ auto SettingsAgent::getAgentName() -> const std::string // dbSingleVar auto SettingsAgent::dbGetValue(settings::EntryPath path) -> std::optional { - // auto retQuery = database->query(settings::Statements::getValue, path.to_string()); - auto retQuery = database->query(settings::Statements::getValue, path.variable.c_str()); + auto retQuery = database->query(settings::Statements::getValue, path.to_string().c_str()); if (nullptr == retQuery || 1 != retQuery->getRowCount()) { return std::string{}; } @@ -106,17 +93,18 @@ auto SettingsAgent::dbGetValue(settings::EntryPath path) -> std::optional bool { /// insert or update - return database->execute(settings::Statements::insertValue, path.variable.c_str(), value.c_str()); + return database->execute(settings::Statements::insertValue, path.to_string().c_str(), value.c_str()); } auto SettingsAgent::dbRegisterValueChange(settings::EntryPath path) -> bool { - return database->execute(settings::Statements::setNotification, path.variable.c_str(), path.service.c_str()); + return database->execute(settings::Statements::setNotification, path.to_string().c_str(), path.service.c_str()); } auto SettingsAgent::dbUnregisterValueChange(settings::EntryPath path) -> bool { - return database->execute(settings::Statements::clearNotificationdRow, path.variable.c_str()); + return database->execute( + settings::Statements::clearNotificationdRow, path.to_string().c_str(), path.service.c_str()); } // db Profile @@ -223,12 +211,11 @@ auto SettingsAgent::handleSetVariable(sys::Message *req) -> sys::MessagePointer auto oldValue = dbGetValue(path); if (oldValue.has_value() && oldValue.value() != value) { dbSetValue(path, value); - // for (auto service : variableChangeRecipents[path.to_string()]) { - for (auto service : variableChangeRecipents[path.variable]) { - if (service != path.service) { + for (auto regPath : variableChangeRecipents[path.to_string()]) { + if (regPath.service != path.service) { auto updateMsg = - std::make_shared(path, value, oldValue.value_or("")); - sys::Bus::SendUnicast(std::move(updateMsg), service, parentService); + std::make_shared(regPath, value, oldValue.value_or("")); + sys::Bus::SendUnicast(std::move(updateMsg), regPath.service, parentService); } } } @@ -242,14 +229,14 @@ auto SettingsAgent::handleRegisterOnVariableChange(sys::Message *req) -> sys::Me auto path = msg->getPath(); if (dbRegisterValueChange(path)) { auto it = variableChangeRecipents.find(path.to_string()); - if (variableChangeRecipents.end() == it || it->second.end() == it->second.find(path.service)) { - variableChangeRecipents[path.to_string()] = {path.service}; + if (variableChangeRecipents.end() == it || it->second.end() == it->second.find(path)) { + variableChangeRecipents[path.to_string()] = {path}; auto currentValue = dbGetValue(path).value_or(""); auto msgValue = std::make_shared<::settings::Messages::VariableChanged>(path, currentValue, ""); sys::Bus::SendUnicast(std::move(msgValue), msg->sender, parentService); } else { - it->second.insert(path.service); + it->second.insert(path); } } } @@ -263,7 +250,7 @@ auto SettingsAgent::handleUnregisterOnVariableChange(sys::Message *req) -> sys:: if (dbUnregisterValueChange(path)) { auto it = variableChangeRecipents.find(path.to_string()); if (variableChangeRecipents.end() != it) { - it->second.erase(path.service); + it->second.erase(path); } } } diff --git a/module-services/service-db/agents/settings/SettingsAgent.hpp b/module-services/service-db/agents/settings/SettingsAgent.hpp index 144f22a85206c80fef401bc3326a534b82dabfc4..9cf045fbb136a809401c0c7e446ee2c45ffa08a1 100644 --- a/module-services/service-db/agents/settings/SettingsAgent.hpp +++ b/module-services/service-db/agents/settings/SettingsAgent.hpp @@ -32,7 +32,8 @@ class SettingsAgent : public DatabaseAgent auto getAgentName() -> const std::string override; private: - using MapOfRecipentsToBeNotified = std::map>; + // using MapOfRecipentsToBeNotified = std::map>; + using MapOfRecipentsToBeNotified = std::map>; MapOfRecipentsToBeNotified variableChangeRecipents; using SetOfRecipents = std::set; SetOfRecipents profileChangedRecipents; diff --git a/module-services/service-db/service-db/Settings.hpp b/module-services/service-db/service-db/Settings.hpp index 41e27965e9159f90ecc94a854c89ef1b228ec26a..6e16398af8dacef57066075b82bb8bdd499a980f 100644 --- a/module-services/service-db/service-db/Settings.hpp +++ b/module-services/service-db/service-db/Settings.hpp @@ -5,6 +5,8 @@ #include #include +#include "SettingsScope.hpp" +#include "SettingsMessages.hpp" #include #include @@ -16,11 +18,6 @@ namespace settings { - namespace Messages - { - class SettingsMessage; - } - class Settings { public: @@ -36,10 +33,18 @@ namespace settings Settings(sys::Service *app, const std::string &dbAgentName = service::name::db); virtual ~Settings(); - void setValue(const std::string &variableName, const std::string &variableValue); - void registerValueChange(const std::string &variableName, ValueChangedCallback cb); - void registerValueChange(const std::string &variableName, ValueChangedCallbackWithName cb); - void unregisterValueChange(const std::string &variableName); + void setValue(const std::string &variableName, + const std::string &variableValue, + SettingsScope scope = SettingsScope::AppLocal); + void registerValueChange(const std::string &variableName, + ValueChangedCallback cb, + SettingsScope scope = SettingsScope::AppLocal); + void registerValueChange(const std::string &variableName, + ValueChangedCallbackWithName cb, + SettingsScope scope = SettingsScope::AppLocal); + void unregisterValueChange(const std::string &variableName, SettingsScope scope = SettingsScope::AppLocal); + /// unregisters all registered variables (both global and local) + void unregisterValueChange(); void getAllProfiles(OnAllProfilesRetrievedCallback cb); void setCurrentProfile(const std::string &profile); @@ -61,7 +66,7 @@ namespace settings std::string phoneMode; std::string profile; - using ValueCb = std::map>; + using ValueCb = std::map>; ValueCb cbValues; ModeChangedCallback cbMode; OnAllModesRetrievedCallback cbAllModes; diff --git a/module-services/service-db/service-db/SettingsMessages.hpp b/module-services/service-db/service-db/SettingsMessages.hpp index 0bee4e09de46b636ead2d106e40e789084721498..260a0059a5ade3aa26ce0a48670f7be206d2c4a6 100644 --- a/module-services/service-db/service-db/SettingsMessages.hpp +++ b/module-services/service-db/service-db/SettingsMessages.hpp @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -20,11 +21,40 @@ namespace settings std::string service; std::string profile; std::string variable; + SettingsScope scope; [[nodiscard]] auto to_string(std::string sep = "\\") const -> std::string { + if (SettingsScope::Global == scope) { + return variable; + } return mode + sep + service + sep + profile + sep + variable; } + + bool operator<(const EntryPath &other) const + { + if (mode < other.mode) + return true; + if (mode > other.mode) + return false; + if (service < other.service) + return true; + if (service > other.service) + return false; + if (profile < other.profile) + return true; + if (profile > other.profile) + return false; + if (variable < other.variable) + return true; + if (variable > other.variable) + return false; + if (scope < other.scope) + return true; + if (scope > other.scope) + return false; + return false; + } }; namespace Messages diff --git a/module-services/service-db/service-db/SettingsScope.hpp b/module-services/service-db/service-db/SettingsScope.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d5c1614d76b789d953e7fdb2e80b1045290cf75b --- /dev/null +++ b/module-services/service-db/service-db/SettingsScope.hpp @@ -0,0 +1,12 @@ +// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#pragma once +namespace settings +{ + enum class SettingsScope + { + Global, + AppLocal + }; +} diff --git a/module-services/service-db/test/test-service-db-settings-messages.cpp b/module-services/service-db/test/test-service-db-settings-messages.cpp index 34ebeb1eaa849843a1501c996fec4ce3925de214..789f71b9d70301f25521d42d1da8ee015254a52c 100644 --- a/module-services/service-db/test/test-service-db-settings-messages.cpp +++ b/module-services/service-db/test/test-service-db-settings-messages.cpp @@ -118,13 +118,13 @@ TEST_CASE("Settings Messages") settings::Service settings("settings"); settings.InitHandler(); - sys::Bus::SendUnicast(std::make_shared( - settings::EntryPath({"mode", "service", "profile", "variable"})), + sys::Bus::SendUnicast(std::make_shared(settings::EntryPath( + {"mode", "service", "profile", "variable", settings::SettingsScope::AppLocal})), "db-worker", &settings); - sys::Bus::SendUnicast(std::make_shared( - settings::EntryPath({"mode", "service", "profile", "variable"})), + sys::Bus::SendUnicast(std::make_shared(settings::EntryPath( + {"mode", "service", "profile", "variable", settings::SettingsScope::AppLocal})), "db-worker", &settings); } diff --git a/module-services/service-db/test/test-service-db-settings-testservices.hpp b/module-services/service-db/test/test-service-db-settings-testservices.hpp index 0d255b43571a150619fabf1265f8de7ca2d31753..1ff8ea06c665813875d134a4ddb499b21e1ad1a1 100644 --- a/module-services/service-db/test/test-service-db-settings-testservices.hpp +++ b/module-services/service-db/test/test-service-db-settings-testservices.hpp @@ -28,26 +28,28 @@ namespace settings if (auto msg = dynamic_cast(req)) { debug("ReqRegValChg", msg->name, msg->value); whoRequestedNotifyOnChange = msg->sender; - mySettings->registerValueChange(msg->name, ([this](std::string value) { + mySettings->registerValueChange(msg->name, + ([this](std::string value) { ValueChanged(value); auto cnf = std::make_shared("", value); sys::Bus::SendUnicast( std::move(cnf), whoRequestedNotifyOnChange, this); - })); + }), + settings::SettingsScope::Global); auto cnf = std::make_shared(msg->name, msg->value); sys::Bus::SendUnicast(std::move(cnf), whoRequestedNotifyOnChange, this); } else if (auto msg = dynamic_cast(req)) { // unregister debug("ReqUnRegValChg", msg->name, msg->value); - mySettings->unregisterValueChange(msg->name); + mySettings->unregisterValueChange(msg->name, settings::SettingsScope::Global); auto cnf = std::make_shared(msg->name, msg->value); sys::Bus::SendUnicast(std::move(cnf), msg->sender, this); } else if (auto msg = dynamic_cast(req)) { // set value debug("ReqSetVal", msg->name, msg->value); - mySettings->setValue(msg->name, msg->value); + mySettings->setValue(msg->name, msg->value, settings::SettingsScope::Global); auto cnf = std::make_shared(msg->name, msg->value); sys::Bus::SendUnicast(std::move(cnf), msg->sender, this); }