From 6faf8943ddb3888485a50269fe43a6d5b6f68afc Mon Sep 17 00:00:00 2001 From: Matthew Barth Date: Tue, 22 Jan 2019 09:26:09 -0600 Subject: Override setting Current mode property When the Current mode property changes, the persisted value is updated. Change-Id: I319fbe2afb8112f7425dc0a1d765fe8f1c408bae Signed-off-by: Matthew Barth --- control/zone.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'control/zone.cpp') diff --git a/control/zone.cpp b/control/zone.cpp index 8408e8d..bc40b7e 100644 --- a/control/zone.cpp +++ b/control/zone.cpp @@ -604,6 +604,18 @@ const std::string& Zone::addServices(const std::string& path, return empty; } +std::string Zone::current(std::string value) +{ + auto current = value; + if (current != ThermalObject::current()) + { + current = ThermalObject::current(value); + saveCurrentMode(); + // TODO Trigger event(s) for mode property change + } + return current; +} + void Zone::saveCurrentMode() { fs::path path{CONTROL_PERSIST_ROOT_PATH}; -- cgit v1.2.1