# Parameter specification

A number of generation tasks (e.g. simulator, model quality checks, or test client) require the specification of values for input parameters of commands and signals, and in some cases, the parameter values of replies and notifications. Values for these parameters are provided for a given interface in a file with extension `.params`.

For a given interface, the following parameters have to be provided:

- parameters for commands and signals

- parameters for replies and notifications with variables

- parameters for replies and notifications that contain the any value expression (*)

In order to create a parameters file, follow the steps:

- Next to a `INTERFACE_NAME.interface` file, create a file called `INTERFACE_NAME.params`.

- Insert, as the first line of the file, an import of the interface (i.e., `import INTERFACE_NAME.interface`).

- The parameters have to be given in the following order: triggers (commands and signals), notifications, replies to commands. Open the content assist (ctrl + space) and select one of "Autocomplete missing triggers", "Autocomplete missing notifications", and "Autocomplete missing replies". Do this for all required events.

- Fill in the desired parameters and the `.params` file is complete.

An example of a `.params` file:

    // Imports
    import "Camera.interface"

    // The interface we want to provide parameters for
    interface: Camera

    //optional definition of variables
    variables
    int i

    //optional initialization of variables
    init
    i := 5

    // The trigger (command or signal)
    trigger: SetZoom
    // The state we are providing parameters for
    state: PoweredOn
    // The provided parameters, note that multiple parameters sets can be provided. Variables can be used as parameter values
    params: ( 3, 9 )
    params: ( 11, i )
    // Next to SetZoom in the PoweredOn state, we also provided parameters for SetZoom in the PoweredOff state.
    state: PoweredOff
    params: ( 21, 5 )

    trigger: GetCapacity
    state: PoweredOn
    params: ( CapacityType::Total )
    params: ( CapacityType::Remaining )

    // Similarly to triggers (commands and signals), parameters can be given for notifications if in the interface definition they are used in actions with variables or with expression '*'
    notification: BatteryLevel
    state: PoweredOn
    params: (35)

    // Parameters for replies can be given if they are used in actions with variables or with expression '*'
    reply to: GetCapacity
    state: PoweredOn
    params: (120)

When simulating or testing a component some transitions can be skipped using the `skip` keyword.

An example of a `.params` file using `skip`:

    // Imports
    import "Camera.interface"

    // The trigger command
    trigger: SetZoom
    // The state we are providing parameters for
    state: PoweredOn
    // Skip this transitions regardless of the parameters
    skip

    trigger: GetCapacity
    state: PoweredOn
    params: ( CapacityType::Total )
    // Skip the transition with the CapacityType::Remaining parameter
    params: ( CapacityType::Remaining ) skip

    // Reply values can be skipped
    reply to: GetCapacity
    state: PoweredOn
    params: (110)
    // Skip this transition with the 120 parameter
    params: (120) skip

    // Similarly to commands for notifications and signals, complete transitions or parameters can be skipped
    notification: BatteryLevel
    // Skip this transitions regardless of the parameters
    state: PoweredOn skip

The usage of the defined parameter values depends on the scenario (or generator). For example, a simulator uses all the supplied parameters while a test client for a component uses information that depends on the role an interface plays (in a provided versus required port). Regardless the scenario, the parameters file has to be complete and has to provide values for all relevant events.

The table below shows which parts of the parameters files are used for generating simulators and test clients for interface or component respectively.

| Simulator | Test Client

Interface

- Commands and Signals

- Replies and notifications with variables

- Replies and notifications with Any (*) value

- Commands and Signals

Component, provided port

- Commands and Signals

- Replies and notifications with variables

- Replies and notifications with Any (*) value

- Commands and Signals

Component, required port

- Commands and Signals

- Replies and notifications with variables

- Replies and notifications with Any (*) value

- Replies and notifications with variables

- Replies and notifications with Any (*) value

Transitions can be skipped for generating simulators and test clients for interface or component respectively