Format-types
Some of the VILLASnode node-types are transports which can exchange arbitrary payloads. Examples for these node-types are: MQTT, AMQP and Socket.
The format of the payload for these node-types is configurable. New formats can be added via plugins.
Currently, the following formats are supported:
Type | Description | Status |
---|---|---|
csv | Comma-separated values | stable |
iotagent-ul | FIWARE IoTAgent Ultralight 2.0 Protocol | stable |
json.kafka | Kafka Schema/Payload Javascript Object Notation | stable |
json | Javascript Object Notation | stable |
opal.asyncip | OPAL-RT AsyncIP example format | stable |
protobuf | Google Protobuf | stable |
raw | Raw binary values | stable |
tsv | Tabulator-separated values | stable |
value | Single value text | stable |
villas.binary | Custom VILLAS Binary | stable |
villas.human | Custom VILLAS Human Readable | stable |
Configuration
To use one of the format-types above, a setting named format
must be present in the configuration of the respective node instance.
The value of the format
setting can be eiter a simple string identifying one of the available format-types from the table above.
Alternatively, a JSON dictionary can be used to provide additional configuration settings to the payload format.
Please see below for examples of both approaches.
If the format-type is provided as an argument to a VILLASnode command-line tool (see Usage), also both variants are supported:
# Simple
villas signal -f json -v 5 sine
# Advanced
villas signal -f '{ "type": "json", "indent": 4, "precision": 4 }' -v 5 sine
Please note, that depending on you system configuration not all format-types might be available.
Use the following command to get a list of all available types on your system: villas node -h
.
All format-types share the following common options:
Example
Simple
nodes = {
udp_json_node = {
type = "socket"
layer = "udp"
format = "json"
...
}
}
Advanced
nodes = {
udp_json_node = {
type = "socket"
layer = "udp"
format = {
"type": "json",
"precision": 4,
"indent": 4
}
...
}
}
Abstract format-types
Thanks to C++ inheritance some format-types are well-suited as a base for other more specific format types: