HSL2.0 - XML definition file
Content
1.
Introduction
2.
Structure of the XML definition file
3.
Example of an XML definition file
Description of the XML definition file

## 1.Introduction

The XML definition file specifies the basic properties of HSL-2.0 logic blocks:

- Name, ID, category (for administration in the expert and for display in the GLE)
- Context
- Number, designations and types of inputs and outputs
- Number and names of remanent variables
- Framework and standard modules that must be imported
- Type of logging

From this XML definition file, the HSL 2.0 generator first creates a Python file. This file contains a Python class, which must be supplemented and programmed by the developer. With the help of the Python file and the XML definition file, the HSL 2.0 generator can then generate the finished logic module (.hsl file).

## 2.Structure of the XML definition file

    <?xml version="1.0" encoding="UTF-8"?>
    <config>
       <modules>
          <module category="" context="" id="" name="" version="">

             <inputs>
                <input type="" init_value="" const_name="">E_BEZ</input>
             </inputs>

             <outputs>
                <output type="" init_value="" const_name="">A_BEZ</output>
             </outputs>

             <remanent_variables>
                <remanent_variable type="" init_value="" const_name="">V_BEZ</remanent_variable>
             </remanent_variables>

             <imports>
                <import>M_NAME</import>
             </imports>

             <translations>
                <translation language="XX" name="" category="">
                   <translation_inputs>
                      <translation_input>E_BEZ_IN_SPRACHE_XX</translation_input>
                   </translation_inputs>
                   <translation_outputs>
                      <translation_output>A_BEZ_IN_SPRACHE_XX</translation_output>
                   </translation_outputs>
                </translation>
             </translations>

          </module>
       </modules>
       <logging type="" ip="" port="" />
    </config>

- <config>
  Container.
- <modules>
  Contains all logic module definitions of the project. Any number of modules can be defined here.
- <modules>
  Definition of a single logic block.
  - category
    Module category for the GLE (Graphical Logic Editor) in HS/FS Experte.
  - context
    Context in which the module is defined. See also: Threading.
  - id
    ID of the building block
  - name, internal_name, external_name
    - internal_name:
      Name of the Python class. Also used for the name of the module file (.hsl). (Should not contain umlauts)
    - external_name:
      Name in GLE (Graphical Logic Editor of the Expert)
    - name:
      Is used if external_name and/or internal_name are not specified. (Should not contain umlauts)
  - version
    Version designation of the module
- <inputs>
  Contains all inputs of a logic device
- <input> Defines a single input of a logic device
  - type
    Input type: number, string, destination_port or base_path.
    - number: Numerical value.
    - string: Alphanumeric value / character string.
      Note
      For fixed texts, which are on the input of a logic block, the encoding "iso-8859-1" is used.
    - destination_port: Port at which the module must listen if it is to be reached from outside via the base path. For further explanations see here.
    - base_path: Base path via which all calls are forwarded to the module. If the HomeServer URL is appended. For further explanations see here.
      Note
      The input types destination_port and base_path may only be used in one input per module. If an input has the type destination_port, an input with the type base_path must also exist and vice versa.
  - init_value
    Value with which the input is initialised. The generator checks for inputs of type number whether the specified init_value is valid.
    Example (number) `init_value="5"`
    Example (string) `init_value="abc"`
  - const_name
    (optional) Name of the constant for this input in the Python script. If const_name is not specified, E_BEZ is used instead.
  - E_BEZ
    Name of the entrance. Displayed in the GLE.
- <outputs>
  Contains all outputs of a logic module
  Note
  At least one output must be created!
- <output>
  Defines a single output of a logic device.
  - type
    Output type: number or string.
  - init_value
    Value with which the output is initialised. The generator checks for outputs of the type number whether the specified init_value is valid.
    Example (number) `init_value="5"`
    Example (string) `init_value="abc"`
  - const_name
    (optional) Name of the constant for this output in the Python script. If const_name is not specified, A_BEZ is used instead.
  - A_BEZ
    Name of the output. Displayed in the GLE.
- <remanent_variables>
  Contains all remanent variables of a logic module
- <remanent_variable>
  Defines a single remanent variable
  - type
    Type of remanent variable: number or string.
  - init_value
    (optional) Value with which the remanent variable is initialised. For remanent variables of type number the generator checks if the specified init_value is valid.
  - const_name
    (optional) Name of the remanent variables in the Python script. If const_name is not specified, V_BEZ is used instead.
  - V_BEZ
    Name of the variable.
- <imports>
  Contains all import instructions for framework modules or directory / ZIP archive names of external libraries to be used by the block.
- <import>
  Defines a single module import
  Note
  These are not logic blocks, but modules that are included in the framework (e.g. interval timer) or libraries that are not included in the standard Python package!
- M_NAME
  Absolute or relative path to a directory or ZIP archive, or the name of a framework module.
  - Directory:
    The directory represents a single library whose name corresponds to that of the directory (e.g. `C:\Python27\Lib\site-packages\websocket`).
  - ZIP archive:
    The ZIP archive can contain several directories like the one described above and/or individual Python files.
  - Framwork module:
    Name of a framework module (e.g. `hsl20_4_timer`).
  - For the use of imports see also: Code example "EasterDate".
    Note
    In the '.py' file, Python 'import' statements must be used in the upper area not overwritten by the generator to access internal or external libraries.
    Import' statements within methods or at runtime only work with Python standard modules (e.g. import math)!
- <translations>
  Contains all texts of the module visible in the GLE. One translation instruction per language must be given.
  If the texts are not available in the set language, the expert uses the texts defined in the module, input and output tags.
- <translation>
  Defines the texts of a block for a language.
  - language
    Language abbreviation. Valid are all languages supported by the expert. Currently these are:
    - de (German)
    - en (English)
    - fr (French)
    - it (Italian)
  - name
    Display name in the GLE in language language for the module.
  - category
    Name and path in language language under which the block is to be displayed in the context menu of the GLE.
- <translation_inputs>
  Contains the names for all inputs of the block.
- <translation_input>
  Contains the name in language language for an input of the block. For each input defined in the block (<input> ) a translation_input element must be created in the same order.
- <translation_outputs>
  Contains the names for all outputs of the block.
- <translation_output>
  Contains the name in language language for one output of the block. For each output defined in the block (<output> ) a translation_output element must be created in the same order.
- <logging>
  Optional. Specifies the logging server and the type of logging.
  - type
    Logging type. Is either Syslog or None (No logging)
  - ip
    Only for logging type Syslog. IP address of the syslog server
  - port
    Only for logging type Syslog. Port of the syslog server. Default is 514.

## 3.Example of an XML definition file

    01 <?xml version="1.0" encoding="UTF-8"?>
    02 <config>
    03   <modules>
    04     <module category="Blind-Shutter-Partition Wall" context="JALOUSIE" id="19015" name="Storm shutter control " version="v1.0">
    05       <inputs>
    06         <input type="number">Long-term (1 bit; 1=close, 0=open)</input>
    07         <input type="number">Short-term (1 bit)</input>
    08         <input type="number">Measured movement time for Leaf 1 in seconds</input>
    09         <input type="number">Measured movement time for Leaf 2 in seconds</input>
    10       </inputs>
    11       <outputs>
    12         <output type="number">Long-term object (1 bit) Leaf 1</output>
    13         <output type="number">Short-term object (1 bit) Leaf 1</output>
    14         <output type="number">Long-term object (1 bit) Leaf 2</output>
    15         <output type="number">Short-term object (1 bit) Leaf 2</output>
    16       </outputs>
    17       <remanent_variables>
    18         <remanent_variable>Movement time for Leaf 1</remanent_variable>
    19         <remanent_variable>Movement time for Leaf 1</remanent_variable>
    20         <remanent_variable>Condition of Leaf</remanent_variable>
    21       </remanent_variables>
    22       <imports>
    23         <import>hsl20_4_timer</import>
    24       </imports>
    25       <translations>
    26         <translation language="de" name="Schlagladensteuerung" category="Jalousie-Rollladen-Trennwand">
    27           <translation_inputs>
    28             <translation_input>Eingang 1 (1 Bit; 0=öffnen/1=schließen)</translation_input>
    29             <translation_input>Stop/Kurzzeit (1Bit)</translation_input>
    30             <translation_input>Fahrzeit Flügel 1 (sek.)</translation_input>
    31             <translation_input>Fahrzeit Flügel 2 (sek.)</translation_input>
    32           </translation_inputs>
    33           <translation_outputs>
    34             <translation_output>Flügel 1 (Langzeit)</translation_output>
    35             <translation_output>Flügel 1 (Kurzzeit)</translation_output>
    36             <translation_output>Flügel 2 (Langzeit)</translation_output>
    37             <translation_output>Flügel 2 (Kurzzeit)</translation_output>
    38           </translation_outputs>
    39         </translation>
    40       </translations>
    41     </module>
    42   </modules>
    43   <logging type="Syslog" ip="192.168.123.45" port="514" />
    44 </config>

In the definition of the module the English language is used and there is a translation for the language German.
This means that if the language "German" is set for the HS/FS Expert, this block is displayed in German in the GLE.
When using any other language setting in the HS/FS Expert, the block is displayed in English in the GLE, as this is the default setting.