aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2018-10-25 09:50:03 +0200
committerDominik Holland <dominik.holland@pelagicore.com>2018-10-26 08:09:35 +0000
commit5b1c4b033d0d08782cbafcf7fba9eef07f0d430d (patch)
treef80545ee3d2f15bca5b726caa8ca1f24e7849410
parente04775548b3cd69dc3e8f32930025fb1f1f4b002 (diff)
Change the zone annotation to be a list instead of a map
This makes the annotation and the template code much easier and the annotation more intuitive to read and write. Change-Id: If59b6aac6259e9d98b090a5d7a1831f3d55acb1a Reviewed-by: Robert Griebl <robert.griebl@pelagicore.com>
-rw-r--r--src/ivicore/doc/src/ivigenerator/generator-usage.qdoc7
-rw-r--r--src/ivivehiclefunctions/ivivehiclefunctions.yaml6
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl10
-rw-r--r--tests/auto/core/ivigenerator/org.example.echo.yaml2
4 files changed, 12 insertions, 13 deletions
diff --git a/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc b/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc
index 6df2840..9f2dbdf 100644
--- a/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc
+++ b/src/ivicore/doc/src/ivigenerator/generator-usage.qdoc
@@ -242,12 +242,11 @@ annotations used for defining various aspects of the generation of the backend-s
\li
\code
config_simulator:
- zones: { left : FrontLeft, right : FrontRight, rear: Rear }
+ zones: { FrontLeft, FrontRight, Rear }
\endcode
\li Accompanying YAML file
\li Interface
- \li For the backend simulator defines a list of zones supported by the simulation code
- with their names
+ \li For the backend simulator defines a list of zones supported by the simulation code.
\row
\li
\target config_simulator_default
@@ -262,7 +261,7 @@ annotations used for defining various aspects of the generation of the backend-s
For zoned properties a mapping from a zone to a default value can be used. The default key of the map is "=".
\code
config_simulator:
- default: { left: 21.0, right: 22.5, =: 0.0 }
+ default: { FrontLeft: 21.0, FrontRight: 22.5, =: 0.0 }
\endcode
\row
\li \code
diff --git a/src/ivivehiclefunctions/ivivehiclefunctions.yaml b/src/ivivehiclefunctions/ivivehiclefunctions.yaml
index c9dfdd7..1240b1d 100644
--- a/src/ivivehiclefunctions/ivivehiclefunctions.yaml
+++ b/src/ivivehiclefunctions/ivivehiclefunctions.yaml
@@ -1,7 +1,7 @@
QtIviVehicleFunctions.QIviClimateControl:
config_simulator:
zoned: true
- zones: { left : FrontLeft, right : FrontRight, rear: Rear }
+ zones: { FrontLeft, FrontRight, Rear }
QtIviVehicleFunctions.QIviClimateControl#airConditioningEnabled:
config_simulator:
@@ -52,7 +52,7 @@ QtIviVehicleFunctions.QIviClimateControl#automaticClimateFanIntensityLevel:
QtIviVehicleFunctions.QIviClimateControl#targetTemperature:
config_simulator:
- default: { left: 21.0, right: 22.5, =: 0.0 }
+ default: { FrontLeft: 21.0, FrontRight: 22.5, =: 0.0 }
zoned: true
QtIviVehicleFunctions.QIviClimateControl#seatCooler:
@@ -72,7 +72,7 @@ QtIviVehicleFunctions.QIviClimateControl#outsideTemperature:
QtIviVehicleFunctions.QIviWindowControl:
config_simulator:
zoned: true
- zones: { left : FrontLeft, right : FrontRight, rearLeft: RearLeft, rearRight: RearRight, rear: Rear, roof: Roof }
+ zones: [ FrontLeft, FrontRight, RearLeft, RearRight, Rear, Roof ]
QtIviVehicleFunctions.QIviWindowControl#heaterMode:
config_simulator:
diff --git a/src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl b/src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl
index 90df932..b91dbfa 100644
--- a/src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl
+++ b/src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl
@@ -96,18 +96,18 @@ QT_BEGIN_NAMESPACE
{{module.module_name|upperfirst}}Module::registerTypes();
{% set zones = interface.tags.config_simulator.zones if interface.tags.config_simulator and interface.tags.config_simulator.zones else {} %}
-{% for zone_name, zone_id in zones.items() %}
- ZoneBackend {{zone_name}}Zone;
+{% for zone_id in zones %}
+ ZoneBackend {{zone_id|lowerfirst}}Zone;
{% for property in interface.properties %}
{% if property.tags.config_simulator and property.tags.config_simulator.zoned %}
{% if property.type.is_model %}
- {{zone_name}}Zone.{{property}} = new {{property|upperfirst}}Model(this);
+ {{zone_id|lowerfirst}}Zone.{{property}} = new {{property|upperfirst}}Model(this);
{% else %}
- {{zone_name}}Zone.{{property}} = {{property|default_value(zone_name)}};
+ {{zone_id|lowerfirst}}Zone.{{property}} = {{property|default_value(zone_id)}};
{% endif %}
{% endif %}
{% endfor %}
- m_zoneMap.insert("{{zone_id}}", {{zone_name}}Zone);
+ m_zoneMap.insert("{{zone_id}}", {{zone_id|lowerfirst}}Zone);
{% endfor %}
}
diff --git a/tests/auto/core/ivigenerator/org.example.echo.yaml b/tests/auto/core/ivigenerator/org.example.echo.yaml
index ad8fb25..f0d1769 100644
--- a/tests/auto/core/ivigenerator/org.example.echo.yaml
+++ b/tests/auto/core/ivigenerator/org.example.echo.yaml
@@ -1,6 +1,6 @@
org.example.echo.EchoZoned:
config_simulator:
- zones: { left : FrontLeft, right : FrontRight, rear: Rear }
+ zones: [ FrontLeft, FrontRight, Rear ]
org.example.echo.EchoZoned#stringValue:
config_simulator: