summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/ivivehiclefunctions/vehiclefunctions_simulator/QIviConcreteWindowControlSimulation.qml77
-rw-r--r--src/tools/ivigenerator/templates/common/backend_simulation.qml.tpl28
2 files changed, 55 insertions, 50 deletions
diff --git a/src/plugins/ivivehiclefunctions/vehiclefunctions_simulator/QIviConcreteWindowControlSimulation.qml b/src/plugins/ivivehiclefunctions/vehiclefunctions_simulator/QIviConcreteWindowControlSimulation.qml
index 94e7d2b..770f847 100644
--- a/src/plugins/ivivehiclefunctions/vehiclefunctions_simulator/QIviConcreteWindowControlSimulation.qml
+++ b/src/plugins/ivivehiclefunctions/vehiclefunctions_simulator/QIviConcreteWindowControlSimulation.qml
@@ -140,45 +140,47 @@ QtObject {
function setHeaterMode(heaterMode, zone) {
- if (IviSimulator.checkSettings(settings["heaterMode"], heaterMode, zone)) {
- if (zone) {
- console.log("SIMULATION heaterMode for zone: " + zone + " changed to: " + heaterMode);
- backend.zones[zone].heaterMode = heaterMode
- } else {
- console.log("SIMULATION heaterMode changed to: " + heaterMode);
- backend.heaterMode = heaterMode
- }
- } else {
+ if ("heaterMode" in settings && !IviSimulator.checkSettings(settings["heaterMode"], heaterMode, zone)) {
console.error("SIMULATION changing heaterMode is not possible: provided: " + heaterMode + "constraint: " + IviSimulator.constraint(settings["heaterMode"]));
+ return;
+ }
+
+ if (zone) {
+ console.log("SIMULATION heaterMode for zone: " + zone + " changed to: " + heaterMode);
+ backend.zones[zone].heaterMode = heaterMode
+ } else {
+ console.log("SIMULATION heaterMode changed to: " + heaterMode);
+ backend.heaterMode = heaterMode
}
}
function setHeater(heater, zone) {
- if (IviSimulator.checkSettings(settings["heater"], heater, zone)) {
- console.log("SIMULATION heater changed to: " + heater);
- if (zone) {
- console.log("SIMULATION heater for zone: " + zone + " changed to: " + heater);
- backend.zones[zone].heater = heater
- } else {
- console.log("SIMULATION heater changed to: " + heater);
- backend.heater = heater
- }
- } else {
+ if ("heater" in settings && !IviSimulator.checkSettings(settings["heater"], heater, zone)) {
console.error("SIMULATION changing heater is not possible: provided: " + heater + "constraint: " + IviSimulator.constraint(settings["heater"]));
+ return;
+ }
+
+ if (zone) {
+ console.log("SIMULATION heater for zone: " + zone + " changed to: " + heater);
+ backend.zones[zone].heater = heater
+ } else {
+ console.log("SIMULATION heater changed to: " + heater);
+ backend.heater = heater
}
}
function setState(state, zone) {
- if (IviSimulator.checkSettings(settings["state"], state, zone)) {
- if (zone) {
- console.log("SIMULATION state for zone: " + zone + " changed to: " + state);
- backend.zones[zone].state = state
- } else {
- console.log("SIMULATION state changed to: " + state);
- backend.state = state
- }
- } else {
+ if ("state" in settings && !IviSimulator.checkSettings(settings["state"], state, zone)) {
console.error("SIMULATION changing state is not possible: provided: " + state + "constraint: " + IviSimulator.constraint(settings["state"]));
+ return;
+ }
+
+ if (zone) {
+ console.log("SIMULATION state for zone: " + zone + " changed to: " + state);
+ backend.zones[zone].state = state
+ } else {
+ console.log("SIMULATION state changed to: " + state);
+ backend.state = state
}
}
@@ -190,16 +192,17 @@ QtObject {
}
function setBlindState(blindState, zone) {
- if (IviSimulator.checkSettings(settings["blindState"], blindState, zone)) {
- if (zone) {
- console.log("SIMULATION blindState for zone: " + zone + " changed to: " + blindState);
- backend.zones[zone].blindState = blindState
- } else {
- console.log("SIMULATION blindState changed to: " + blindState);
- backend.blindState = blindState
- }
- } else {
+ if ("blindState" in settings && !IviSimulator.checkSettings(settings["blindState"], blindState, zone)) {
console.error("SIMULATION changing blindState is not possible: provided: " + blindState + "constraint: " + IviSimulator.constraint(settings["blindState"]));
+ return;
+ }
+
+ if (zone) {
+ console.log("SIMULATION blindState for zone: " + zone + " changed to: " + blindState);
+ backend.zones[zone].blindState = blindState
+ } else {
+ console.log("SIMULATION blindState changed to: " + blindState);
+ backend.blindState = blindState
}
}
}
diff --git a/src/tools/ivigenerator/templates/common/backend_simulation.qml.tpl b/src/tools/ivigenerator/templates/common/backend_simulation.qml.tpl
index 2cbbd11..1ee5e6b 100644
--- a/src/tools/ivigenerator/templates/common/backend_simulation.qml.tpl
+++ b/src/tools/ivigenerator/templates/common/backend_simulation.qml.tpl
@@ -70,26 +70,28 @@ QtObject {
{% if interface_zoned %}
function {{property|setter_name}}({{property}}, zone) {
- if (IviSimulator.checkSettings(settings["{{property}}"], {{property}}, zone)) {
- if (zone) {
- console.log(qLc{{interface|upperfirst}}, "SIMULATION {{ property }} for zone: " + zone + " changed to: " + {{property}});
- backend.zones[zone].{{property}} = {{property}}
- } else {
- console.log(qLc{{interface|upperfirst}}, "SIMULATION {{ property }} changed to: " + {{property}});
- backend.{{property}} = {{property}}
- }
- } else {
+ if ("{{property}}" in settings && !IviSimulator.checkSettings(settings["{{property}}"], {{property}}, zone)) {
console.error(qLc{{interface|upperfirst}}, "SIMULATION changing {{property}} is not possible: provided: " + {{property}} + " constraint: " + IviSimulator.constraint(settings["{{property}}"]));
+ return;
+ }
+
+ if (zone) {
+ console.log(qLc{{interface|upperfirst}}, "SIMULATION {{ property }} for zone: " + zone + " changed to: " + {{property}});
+ backend.zones[zone].{{property}} = {{property}}
+ } else {
+ console.log(qLc{{interface|upperfirst}}, "SIMULATION {{ property }} changed to: " + {{property}});
+ backend.{{property}} = {{property}}
}
}
{% else %}
function {{property|setter_name}}({{property}}) {
- if (IviSimulator.checkSettings(settings["{{property}}"], {{property}})) {
- console.log(qLc{{interface|upperfirst}}, "SIMULATION {{ property }} changed to: " + {{property}});
- backend.{{property}} = {{property}}
- } else {
+ if ("{{property}}" in settings && !IviSimulator.checkSettings(settings["{{property}}"], {{property}})) {
console.error(qLc{{interface|upperfirst}}, "SIMULATION changing {{property}} is not possible: provided: " + {{property}} + " constraint: " + IviSimulator.constraint(settings["{{property}}"]));
+ return;
}
+
+ console.log(qLc{{interface|upperfirst}}, "SIMULATION {{ property }} changed to: " + {{property}});
+ backend.{{property}} = {{property}}
}
{% endif %}
{% endfor %}