Skip to main content

Raw binary values

VILLASnode supports sending samples formatted as raw binary data.

Signal values are encoded according to their configured data-type in either integer or IEEE-754 floating point values.

Implementation​

The source code of the format-type is available here: https://github.com/VILLASframework/node/blob/master/lib/formats/raw.cpp

Configuration​

bits
integer
Default: 32

Number of bits per signal. Must be one of 8, 16, 32, 64 or 128.

endianess
string
Default: "little"
Enum: "big" "little"

The endianess of the data.

fake
boolean
Default: false

Send and interpret the first three signals of each sample as the following header fields:

  • sequence number
  • timestamp seconds
  • timestamp nano-seconds
real_precision
integer
Default: 17

Output all real numbers with at most n digits of precision. The valid range for this setting is between 0 and 31 (inclusive), and other values result in an undefined behavior.

By default, the precision is 17, to correctly and losslessly encode all IEEE 754 double precision floating point numbers.

ts_origin
boolean
Default: true

If set, include the origin timestamp in the output.

ts_received
boolean
Default: true

If set, include the received timestamp in the output.

sequence
boolean
Default: true

If set, include the sequence number in the output.

data
boolean
Default: true

If set, include the data in the output.

offset
boolean
Default: true

If set, include the offset between origin and received timestamp in the output.

{
  • "bits": 32,
  • "endianess": "big",
  • "fake": false,
  • "real_precision": 17,
  • "ts_origin": true,
  • "ts_received": true,
  • "sequence": true,
  • "data": true,
  • "offset": true
}

Example Configuration​

node/etc/examples/formats/raw.conf
nodes = {
node = {
type = "file"
uri = "/dev/null"

format = {
type = "raw"

bits = 32
endianess = "little"
fake = false
}
}
}

Notes​

  • Floating-point encoding is only supported for width larger or equal to 32 bit.
  • The raw format-type does not support vectors. Only a single sample can be encoded per payload as there is no way to identify sample boundaries in the raw format.
  • Complex sample values are supported and are encoded by real and imaginary parts with half of the precision as noted in the "Floating-point Precision" column above. E.g. in 64 bit mode real and imaginary components are encoded as two single-precision values encoded right after each other.
  • Support for 128-bit wide values depends on you compiler support.