Model File Reference
The data model is described in JSON (or YAML) files placed in a single directory. All files in the
directory are merged before validation, so you can split the model across as many files as you like.
Only the top-level keys Groups, Datapoints, Structs, Enums, and Types are
recognised.
groups.json
Defines one or more groups. Each datapoint belongs to exactly one group. A group carries a
baseId — the base address for the ID space — and a version used by the serialization layer.
{
"Groups": [
{
"name": "DefaultGroup",
"persistence": "None",
"baseId": "0x4000",
"version": "1.0.1",
"description": "Default group with no persistence."
},
{
"name": "CyclicGroup",
"persistence": "Cyclic",
"baseId": "0x5000",
"version": "2.0.0",
"description": "Group persisted cyclically to external memory."
}
]
}
Field |
Required |
Description |
|---|---|---|
|
Yes |
Unique group name. Used as the C++ variable name in the generated header. |
|
Yes |
Base address (hex string or integer). All datapoint IDs in this group are offset from here. |
|
Yes |
Semantic version string |
|
No |
One of |
|
No |
Human-readable description (informational only). |
datapoints.json
Defines the individual datapoints.
{
"Datapoints": [
{
"name": "test",
"group": "DefaultGroup",
"id": 1,
"type": "int32_t",
"default": 4211,
"access": "READ_WRITE",
"namespace": "Testify",
"version": "1.0.1",
"description": "Test int32_t datapoint."
},
{
"name": "test4",
"group": "CyclicGroup",
"id": 4,
"type": "Temperature",
"default": { "value": 123.0, "raw": 5555 },
"access": "READ_WRITE",
"version": "1.0.0"
}
]
}
Field |
Required |
Description |
|---|---|---|
|
Yes |
Unique name within the group. |
|
Yes |
Name of the group this datapoint belongs to. |
|
Yes |
Offset from the group’s |
|
Yes |
One of the C++ base types ( |
|
No |
Default value. For struct types use a JSON object with one key per struct field. For array types use a JSON array. |
|
Yes |
|
|
No |
Optional C++ namespace for the generated global variable. |
|
No |
Semantic version |
|
No |
Human-readable description. |
structs.json
Defines custom struct types that can be used as datapoint types. Structs can contain scalar fields or other struct fields (nested structs).
{
"Structs": [
{
"name": "Temperature",
"parameter": [
{ "value": "float" },
{ "raw": "uint32_t" }
]
},
{
"name": "Environment",
"parameter": [
{ "internal": "Temperature" },
{ "external": "Temperature" }
]
}
]
}
enums.json
Defines custom enum types. Two modes:
Auto-ID ("autoId": true) — values assigned starting at 0:
{
"Enums": [
{
"name": "Status",
"type": "uint32_t",
"values": ["Booting", "Starting", "Finished"],
"autoId": true
}
]
}
Explicit values ("autoId": false) — each entry is a { "EnumeratorName": intValue } object:
{
"Enums": [
{
"name": "ErrorStates",
"type": "uint32_t",
"autoId": false,
"values": [
{ "None": 0 }, { "Info": 1 }, { "Warn": 4 },
{ "Error": 5 }, { "Critical": 9 }, { "Fatal": 10 }
]
}
]
}
types.json
Defines alias types — thin wrappers around a base type with optional compile-time range bounds.
{
"Types": [
{
"name": "AliasTypeUint32t",
"type": "uint32_t",
"min": 100,
"max": 200
},
{
"name": "AliasTypeFloat",
"type": "float"
}
]
}
When "min" and "max" are present, DataLayer::Detail::checkValue() enforces the range
on every set() call and returns DataLayer::Detail::RangeCheck:
underflowif the value is belowminoverflowif the value is abovemaxokif within range
YAML Support
All model files can be written in YAML instead of JSON. The generator accepts any mix of .json
and .yaml / .yml files in the model directory. Use --convert to convert an existing JSON
model to YAML.
</content>
</invoke>