diff options
author | Dominik Holland <dominik.holland@pelagicore.com> | 2019-05-27 13:26:18 +0200 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2019-05-27 14:05:33 +0200 |
commit | 389ab535b7dde10178f8fd53ad4fc7e8f1bb1c7c (patch) | |
tree | fb17bc71d24e2d579d1c6f0b482c0ae99ebed7b9 | |
parent | 30576ef8de7a3a7c0ea9d98175ab353d30cff2d3 (diff) |
ivigenerator: fix the autogenerated domain checking in the simulation
The QIviSimulationEngine read the domain values using 'min' and 'max'
instead of using 'minimum' and 'maximum' as documented and generated
by the ivigenerator.
In addition the autogenerated code called checkSettings with incorrect
arguments and used the setError function to indicate an error which
doesn't exist.
Change-Id: Ib9dbaf0176e5bff11d8697cfe0bbefd946c053ad
Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
3 files changed, 14 insertions, 14 deletions
diff --git a/src/ivicore/qivisimulationglobalobject.cpp b/src/ivicore/qivisimulationglobalobject.cpp index 569ff6b..63a6e74 100644 --- a/src/ivicore/qivisimulationglobalobject.cpp +++ b/src/ivicore/qivisimulationglobalobject.cpp @@ -47,8 +47,8 @@ QT_BEGIN_NAMESPACE namespace qtivi_helper { static const QString unsupportedLiteral = QStringLiteral("unsupported"); - static const QString minLiteral = QStringLiteral("min"); - static const QString maxLiteral = QStringLiteral("max"); + static const QString minLiteral = QStringLiteral("minimum"); + static const QString maxLiteral = QStringLiteral("maximum"); static const QString domainLiteral = QStringLiteral("domain"); } diff --git a/src/plugins/ivivehiclefunctions/vehiclefunctions_simulator/QIviConcreteWindowControlSimulation.qml b/src/plugins/ivivehiclefunctions/vehiclefunctions_simulator/QIviConcreteWindowControlSimulation.qml index d0f2bde..0aa9ed7 100644 --- a/src/plugins/ivivehiclefunctions/vehiclefunctions_simulator/QIviConcreteWindowControlSimulation.qml +++ b/src/plugins/ivivehiclefunctions/vehiclefunctions_simulator/QIviConcreteWindowControlSimulation.qml @@ -140,7 +140,7 @@ QtObject { function setHeaterMode(heaterMode, zone) { - if (IviSimulator.checkSettings(heaterMode, settings["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 @@ -149,12 +149,12 @@ QtObject { backend.heaterMode = heaterMode } } else { - setError("SIMULATION changing heaterMode is not possible: provided: " + heaterMode + "constraint: " + IviSimulator.constraint_string(settings["heaterMode"])); + console.error("SIMULATION changing heaterMode is not possible: provided: " + heaterMode + "constraint: " + IviSimulator.constraint_string(settings["heaterMode"])); } } function setHeater(heater, zone) { - if (IviSimulator.checkSettings(heater, settings["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); @@ -164,12 +164,12 @@ QtObject { backend.heater = heater } } else { - setError("SIMULATION changing heater is not possible: provided: " + heater + "constraint: " + IviSimulator.constraint_string(settings["heater"])); + console.error("SIMULATION changing heater is not possible: provided: " + heater + "constraint: " + IviSimulator.constraint_string(settings["heater"])); } } function setState(state, zone) { - if (IviSimulator.checkSettings(state, settings["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 @@ -178,7 +178,7 @@ QtObject { backend.state = state } } else { - setError("SIMULATION changing state is not possible: provided: " + state + "constraint: " + IviSimulator.constraint_string(settings["state"])); + console.error("SIMULATION changing state is not possible: provided: " + state + "constraint: " + IviSimulator.constraint_string(settings["state"])); } } @@ -190,7 +190,7 @@ QtObject { } function setBlindState(blindState, zone) { - if (IviSimulator.checkSettings(blindState, settings["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 @@ -199,7 +199,7 @@ QtObject { backend.blindState = blindState } } else { - setError("SIMULATION changing blindState is not possible: provided: " + blindState + "constraint: " + IviSimulator.constraint_string(settings["blindState"])); + console.error("SIMULATION changing blindState is not possible: provided: " + blindState + "constraint: " + IviSimulator.constraint_string(settings["blindState"])); } } } diff --git a/src/tools/ivigenerator/common/backend_simulation.qml.tpl b/src/tools/ivigenerator/common/backend_simulation.qml.tpl index 56e8b8c..2cbbd11 100644 --- a/src/tools/ivigenerator/common/backend_simulation.qml.tpl +++ b/src/tools/ivigenerator/common/backend_simulation.qml.tpl @@ -70,7 +70,7 @@ QtObject { {% if interface_zoned %} function {{property|setter_name}}({{property}}, zone) { - if (IviSimulator.checkSettings({{property}}, settings["{{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}} @@ -79,16 +79,16 @@ QtObject { backend.{{property}} = {{property}} } } else { - setError(qLc{{interface|upperfirst}}, "SIMULATION changing {{property}} is not possible: provided: " + {{property}} + " constraint: " + IviSimulator.constraint_string(settings["{{property}}"])); + console.error(qLc{{interface|upperfirst}}, "SIMULATION changing {{property}} is not possible: provided: " + {{property}} + " constraint: " + IviSimulator.constraint(settings["{{property}}"])); } } {% else %} function {{property|setter_name}}({{property}}) { - if (IviSimulator.checkSettings({{property}}, settings["{{property}}"])) { + if (IviSimulator.checkSettings(settings["{{property}}"], {{property}})) { console.log(qLc{{interface|upperfirst}}, "SIMULATION {{ property }} changed to: " + {{property}}); backend.{{property}} = {{property}} } else { - setError(qLc{{interface|upperfirst}}, "SIMULATION changing {{property}} is not possible: provided: " + {{property}} + " constraint: " + IviSimulator.constraint_string(settings["{{property}}"])); + console.error(qLc{{interface|upperfirst}}, "SIMULATION changing {{property}} is not possible: provided: " + {{property}} + " constraint: " + IviSimulator.constraint(settings["{{property}}"])); } } {% endif %} |