Parameters in Production

The application parameters allow to add some flexibility to your application. Each application can define its own parameters, accessible and modifiable in the ZED Hub interface.

Define parameters

In a production environment, application parameters are defined in the app.json file, one of the files you need to provide in your packaged application.

For an example on how to use application parameters in an non packaged application, you can refer to this tutorial.

Definition

"key": "value",                     // Define the default value of application parameter "key"
"$key": {                           // Define the properties of application parameter "key"
  "name": "Key Name",
  "order": 2,
  "group": "Key Group",
  "type": "string",
  "unit": "",
  "description": "Key description"
}

Application parameters are defined by a default value and some additional fields that define its properties.

  • name: Name of the application parameter

  • order: Order in which the application parameter is displayed in

  • group: Group of the application parameter

  • type: Type of the application parameter

    • boolean: The value is true or false

    • string: The value is a string

    • number: The value is a number and have some specific fields:

      • min: Min of the range values of the application parameter

      • max: Max of the range values of the application parameter

      • step: Step of the range values of the application parameter

        "min": 0,
        "max": 8,
        "step": 1
        
    • list: The value is a string that must be chose between predefined options and have one specific field:

      • options: Possibilities of values for the application parameter

        "options": [
          {
            "legend": "Option 1",
            "value": "option_1"
          },
          {
            "legend": "Option 2",
            "value": "option_2"
          },
          {
            "legend": "Option 3",
            "value": "option_3"
          }
        ]
        
    • button: The button is a bit special: it will trigger a Remote function at the endpoint named after the key

  • unit: Unit of the application parameter

  • description: Description of the application parameter

Modify the parameter’s value

In your code

In order to update and use updated values, you need to create and register callback function(s) to detect application parameter changes and retrieve the new values with HubClient::getParameter in your application.

For an example on how to use application parameters callback functions, you can refer to this tutorial.

Applications

Applications that have been deployed are visible in the Applications panel of every device. The number of parameters available for each application is displayed. If you click on the number of parameters, you have access to the Parameter Panel, where you can modify the application parameters.

Do not forget to click on Update to save your modifications.