Loopback
The loopback node-type loops back every sample which has been sent to it.
Internally it is implemented by a FIFO queue.
It can be used to chain multiple paths together by using the same loopback node as an output node in the first path and as a source in the second path.
Prerequisites
This node-type does not have any special library dependencies. It is always available.
Implementation
The source code of the node-type is available here: https://github.com/VILLASframework/node/blob/master/lib/nodes/loopback.cpp
Configuration
| queuelen | integer >= 0 The queue length of the internal queue which buffers the samples. |
| samplelen | integer >= 0 The number of values each buffered sample can store. |
| mode | string Default: "auto" Enum: "pthread" "polling" "pipe" "eventfd" "auto" Specify the synchronization mode of the internal queue. |
object (Input configuration (received by VILLASnode)) | |
| vectorize | integer Default: 1 This setting allows to send multiple samples in a single message to the destination nodes. The value of this setting determines how many samples will be combined into one packet. |
Array of Hook Object (object) or Hook Name (string) (hook_list) | |
| builtin | boolean (Builtin hook functions) Default: true By default, each node and paths has a couple of default hooks attached to them. With this setting the attachment of built-in hooks can be disabled. |
object (Output configuration (sent out by VILLASnode)) |
{- "queuelen": 0,
- "samplelen": 0,
- "mode": "pthread",
- "in": {
- "signals": [
- {
- "name": "tap_position",
- "type": "integer",
- "init": 0
}, - {
- "name": "voltage",
- "type": "float",
- "unit": "V",
- "init": 230
}
], - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}, - "vectorize": 1,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
], - "builtin": true,
- "out": {
- "vectorize": 0,
- "hooks": [
- "print",
- {
- "type": "limit_rate",
- "rate": 1000
}
]
}
}Example
nodes = {
loopback_node = {
# A loopback node will receive exactly the same data which has been sent to it
type = "loopback"
# The internal implementation is based on queue
# The queue length of the internal queue which buffers the samples
queuelen = 1024
# Use busy polling for synchronization of the read and write side of the queue
mode = "polling"
}
}