Linux - bare-metal communication
This section describes the Linux - bare-metal communication needed to allow
for the flexibility of having settable Parameters. Bare-metal core
sends the Parameter map with all the settable Parameters
present in the binary using the message queue, and receives commands containing
name - value pairs and sets them.
Parameter map
Parameter map is a JSON object sent from the Vloop binary to the Linux cores
during the startup of the binary, upon entering the Unconfigured state.
The JSON contains the information regarding the settable Parameters and
the Components owning them, including the Component hierarchy.
The base unit of the Parameter map is individual Component declared in the user-code.
Each Component has the following fields serialized:
name: containing name of the
Componenttype: type of the
Componentparameters: list of serialized
Parameterscontrolled by thisComponent
Then, each Parameter has the following fields:
name: free string identifier
type: one of the supported types Parameter
length: 1 for scalar types, length of the arrays in case of arrays
value: value stored by the
Parameterlimit_min: If defined, minimal numerical value that will be accepted
limit_max: If defined, maximal numerical value that will be accepted
fields: for enumerations, all of the options that the enum can be set to
Examples
enum class Status
{
uninitialized,
ready,
updating,
fault
};
// ************************************************************
class Status : public Component
{
public:
Status(std::string_view name, Component* parent)
: Component("RST", name, parent),
status(*this, "status"),
{
}
parameters::Parameter<Status> status;
};
int main()
{
Component root("root", "root", nullptr);
Status status("status_1", &root);
return 0;
}
The definitions above will result in the following Parameter map:
[
{
"components": [],
"name": "status_1",
"parameters":
[
{
"fields":
[
"uninitialized",
"ready",
"updating",
"fault"
],
"length": 4,
"name": "status",
"type": "Enum",
"value": {}
}
],
"type": "Status"
}
]
Schema
"title": "ParameterMap",
"description": "Parameter map with all settable parameters of a vloop binary",
"type": "array",
"items": {
"oneOf": [
{
"type": "object",
"properties": {
"version": {
"type": "array",
"minItems": 3
}
},
"required": ["version"]
},
{
"type": "object",
"minItems": 1,
"properties": {
"components": {
"type": "array"
},
"name": {
"type": "string"
},
"parameters": {
"type": "array",
"items": {
"type": "object",
"properties": {
"length": {
"type": "integer"
},
"name": {
"type": "string"
},
"type": {
"type": "string"
},
"value": {
"type": ["array", "boolean", "number", "object", "string"]
},
"limit_max": {
"type": "number"
},
"limit_min": {
"type": "number"
},
"fields": {
"type": "array",
"description": "All available values for an enumeration"
}
},
"required": ["name", "length", "type"]
}
},
"type": {
"type": "string"
}
},
"uniqueItems": true,
"required": ["components", "name", "parameters", "type"]
}
]
}
Commands
Commands are created by Linux cores and are received by the vloop.
The command contains the full name of the Parameter and
a new value to be set, and a version of the communication interface.
The full Parameter name will include the full name of
the Component hierarchy of the Component owning this
Parameters, separated with dots. The value must be of the same type,
fit in the (optionally defined) limits specified for this Parameters,
have the same length if the type is an array, or be one of the
available enumrations in case of enum.
In case any issue during setting arises, the feedback message queue will be
filled with a Warning message describing the reason why the setting
of the new value has failed.
Schema
{
"title": "Command",
"description": "Command with a new value to be set",
"type": "object",
"properties": {
"name": {
"description": "Unique string identifier for a parameter",
"type": "string",
"minLength": 1
},
"value": {
"description": "New value to be set to the parameter",
"type": ["array", "boolean", "number", "string"]
},
"version": {
"description": "Version of the command interface",
"type": "string"
}
},
"required": ["name", "value", "version"]
}