Additional Examples#

Configuration example#

Note

Example can be found in <output-folder>/examples/bin and can be executed:
configuration_example

This example loads a VAPI Component with a configuration file as seen below. The example shows how the configuration file is parsed and the huge possibilities to configure almost any type of data.

[Configuration]
Version = 100

[[Component]]
Path = "configuration_component_example.sdv"
Class = "Configuration_Example"
[Component.Parameters]
updatableValue = 13
Message = "It's me"
### the following is a valid JSON structure in a muliline string
JSONConfig = """{
         "Logging": {
               "Sinks": [ { "Type": "Stdout", "Level": "Info" } ]
                    },
                }"""
Id = 42
Pi = 3.1415926
Boolean = true
Array = [ 1, 2, 3 , 5 , 7, 11, 13, 17 ]
Table = { a = 77, b = 1.2, c = "this is a string" }

The example contains also a parameter map. The parameter map allows to predefine and to configure easily parameters for a vehicle device for example. The Headlight Example contains such a map for the tunnel parameters. With such map you do not need to parse a configuration file on your own, avoiding maintenance and errors.

BEGIN_SDV_PARAM_MAP()
   SDV_PARAM_ENABLE_LOCKING() // Parameters will be protected against writing when locked (e.g. after initialization).
   SDV_PARAM_ENTRY(m_InitializedValue, "initializedValue", 7, "km/h", "Description for an initialized parameter.")
   SDV_PARAM_ENTRY(m_UpdatableValue,   "updatableValue",   7, "m/s", "Description for an updatable parameter.")
END_SDV_PARAM_MAP()

Tasktimer example#

There are 2 examples: tasktimer and simulation tasktimer, the difference and how they can be used. The simulation tasktimer is meant to be used for the simulation with OpenXilEnv.

Note

Example can be found in <output-folder>/examples/bin and can be executed:
tasktimer_example
simulation_tasktimer_example