summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tools/ivigenerator/generator/filters.py15
-rw-r--r--tests/auto/core/ivigenerator/org.example.echo.yaml47
2 files changed, 48 insertions, 14 deletions
diff --git a/src/tools/ivigenerator/generator/filters.py b/src/tools/ivigenerator/generator/filters.py
index 737143c..b7ee9ff 100644
--- a/src/tools/ivigenerator/generator/filters.py
+++ b/src/tools/ivigenerator/generator/filters.py
@@ -437,8 +437,19 @@ def simulationData(module):
and p in property.tags['config_simulator']):
if property.name not in iData:
iData[property.name] = {}
- iData[property.name][p] = symbolToJson(property.tags['config_simulator'][p],
- property.type)
+ if p not in iData[property.name]:
+ iData[property.name][p] = {}
+ zones = iData.get('zones', None)
+ res = property.tags['config_simulator'][p]
+ if isinstance(res, dict) and zones:
+ for zone in zones:
+ if zone in res:
+ iData[property.name][p][zone] = symbolToJson(res[zone], property.type)
+ # Also check the entry for the general zone (=)
+ if "=" in res:
+ iData[property.name][p]["="] = symbolToJson(res["="], property.type)
+ else:
+ iData[property.name][p] = symbolToJson(res, property.type)
data[interface.name] = iData
return json.dumps(data, indent=' ')
diff --git a/tests/auto/core/ivigenerator/org.example.echo.yaml b/tests/auto/core/ivigenerator/org.example.echo.yaml
index 10953f0..d1750bf 100644
--- a/tests/auto/core/ivigenerator/org.example.echo.yaml
+++ b/tests/auto/core/ivigenerator/org.example.echo.yaml
@@ -1,15 +1,47 @@
+org.example.echo.EchoZoned#stringValue:
+ config_simulator:
+ default: "two"
+
+org.example.echo.Echo#intValue:
+ config_simulator:
+ default_value: 61
+ range_high: 150
+ range_low: 0
+
+org.example.echo.Echo#contact:
+ config_simulator:
+ zoned: true
+ default: [ "foo", 23, true, 1234 ]
+
+org.example.echo.Echo#combo:
+ config_simulator:
+ zoned: true
+ default: [ [ "foo", 23, true, 1234 ], WeekDay.Monday ]
+
+org.example.echo.Echo#intList:
+ config_simulator:
+ default: [1, 2, 3, 4]
+
+org.example.echo.Echo#comboList:
+ config_simulator:
+ default: [[ [ "foo", 23, true, 1234 ], WeekDay.Monday ], [ [ "bar", 21, false, "foo" ], WeekDay.Tuesday ]]
+
+org.example.echo.Echo#contactList:
+ config_simulator:
+ default: [[ "foo", 23, true, WeekDay.Monday ], [ "bar", 12, false, false ]]
+
org.example.echo.EchoZoned:
config_simulator:
zones: [ FrontLeft, FrontRight, Rear ]
org.example.echo.EchoZoned#stringValue:
config_simulator:
- default: "two"
+ default: { FrontLeft: "two", Rear: "one", =: "general" }
org.example.echo.EchoZoned#intValue:
config_simulator:
default: 11
- range: [10, 33]
+ range: { FrontLeft: [10, 33], Rear: [0, 11] }
org.example.echo.EchoZoned#zonedValue:
config_simulator:
@@ -35,16 +67,10 @@ org.example.echo.EchoZoned#rangedValueWithDefault:
range_high: 150
range_low: 0
-org.example.echo.Echo#intValue:
- config_simulator:
- default_value: 61
- range_high: 150
- range_low: 0
-
org.example.echo.EchoZoned#contact:
config_simulator:
zoned: true
- default: [ "foo", 23, true, 1234 ]
+ default: { FrontLeft: [ "foo", 23, true, 1234 ], Rear: [ "bar", 1, false, 3456 ] }
org.example.echo.EchoZoned#combo:
config_simulator:
@@ -59,6 +85,3 @@ org.example.echo.EchoZoned#comboList:
config_simulator:
default: [[ [ "foo", 23, true, 1234 ], WeekDay.Monday ], [ [ "bar", 21, false, "foo" ], WeekDay.Tuesday ]]
-org.example.echo.Echo#contactList:
- config_simulator:
- default: [[ "foo", 23, true, WeekDay.Monday ], [ "bar", 12, false, false ]]