-
-
Notifications
You must be signed in to change notification settings - Fork 134
4.4. Field templates
John edited this page Dec 25, 2015
·
3 revisions
In order to avoid repetitions of identical field definitions, the field templates were introduced. These have to be placed into a file named "_templates.csv
" (either directly in the configuration directory or a subdirectory in which case the templates are only valid for message definitions in that subdirectory).
A field template definition consists of the following columns:
TEMPLATE,DATATYPE,DIVIDER/VALUES,UNIT,COMMENT
The individual columns are these:
-
TEMPLATE[:FIELDNAME]
The name of the template, optionally followed by the field name that will be used when the template is referenced by a message definition. -
DATATYPE: BASETYPE|TEMPLATE[;BASETYPE|TEMPLATE]*
A list of builtin base data types and/or already defined template names separated by semicolon. - [DIVIDER/VALUES]: either a DIVIDER or VALUE=NAME[;VALUE=NAME]*
The divider to apply on the numeric base type or a list of name/value associations separated by semicolon (value either in decimal or starting with "0x" for hex). - [UNIT]
The value unit (e.g. "°C"). - [COMMENT]
A comment for the field.
name | type/templates | divider/values | unit | comment |
---|---|---|---|---|
temp:temperature | D2C | °C | ||
sensor | UCH | 0=ok;85=circuit;170=cutoff | sensor status | |
tempsensor | temp;sensor | |||
calibration | D2C | K | ||
Download CSV |
By using defaults and templates as described above, the example from a previous chapter can be further reduced to this:
type | circuit | name | comment | ZZ | PBSB | ID | field1 | part | type/templates | divider/values | unit | comment | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
*r | ehp | 08 | B509 | 0D | |||||||||
*w | ehp | 08 | B509 | 0E | |||||||||
r1 | brinetemp | 0F00 | tempsensor | ||||||||||
r;w | brinetempcal | CD00 | calibration | ||||||||||
Download CSV |