The legalValues
definition
Work in progress.
Purpose
Impose constraints on the possible values for an object.
Syntax
{
"cdlOptions": {
"<name>": {
...
"legalValues": "expression" | [ "<expression>",... ],
...
}
}
}
The value of the legalValues
property is a string or an array of strings containing the restrictions.
Default value
If missing, no value based constraints are imposed.
Description
Objects with a valueType
of int
or string
can have any values as their data. In nearly all cases, some restrictions have to be imposed. For example, the data should correspond to a number within a certain range or be one of a small number of constants. The legalValues
property can be used to impose such constraints. The value of the property is an array of string with xCDL list expression, see the Section called List Expressions in xCDL packages for the syntactic details. Common examples include:
"legalValues": "0 to 0x7fff"
"legalValues": [ "9600", "19200", "38400" ],
"legalValues": [ "RAM", "ROM" ]
The legalValues
property can only be used for objects with the int
or string
types, as it makes little sense to further constrain a boolean object.
Example
{
"cdlOptions": {
"std-default-offset": {
"parent": "libc/time",
"display": "Default Standard Time offset",
"description": "This option controls the offset from UTC in seconds when in local Standard Time. This value can be positive or negative. It can also be set at run time using the os_libc_time_setzoneoffsets() function.",
"generatedDefinition": "OS_INTEGER_LIBC_TIME_STD_DEFAULT_OFFSET",
"valueType": "int",
"legalValues": "-90000 to 90000",
"defaultValue": "0"
}
}
}
See also
computed
propertydefaultValue
propertyvalueType
property
eCos reference
legal-values
property