Skip to main content

Rawplayback Module

Description

warning

The "rawplayback" module is intended for system and unit testing only. Its use in a production environment is not permitted!

The rawplayback module plays back a prepared sequence of raw telegrams on a timed schedule. The messages are read from an external file and then sent via the smartCORE Fast Message Dispatcher architecture.

The timestamps in the input file are interpreted relative to the start of a cycle. This allows a fixed sequence of telegrams with defined time intervals to be played back in a reproducible manner. Typical use cases include:

Typical use cases include:

  • Repeating recorded raw data sequences for testing and simulation purposes
  • Deterministic playback of a known message stream
  • Cyclic transmission of the same telegram sequence

Interfaces

  • Files (playbackFile)
  • smartCORE Fast Message Dispatcher

JSON Configuration

The following section describes examples and parameters of the module.

Example Configuration (Minimal)

{
"module": "rawplayback_instance",
"factory": "rawplayback",
"config": {
"playbackFile": "/opt/smartcore/data/rawplayback.txt"
}
}

Example configuration (maximum)

{
"module": "rawplayback_instance",
"factory": "rawplayback",
"config": {
"playbackFile": "/opt/smartcore/data/rawplayback.txt",
"separator": ";",
"numCycles": 5,
"cycleOffset": 1000,
"exitOnEnd": true,
"exitDelay": 10
}
}

Parameter List

Global Parameters

Parameter NameRequiredData TypeValid RangeDefaultDescription
playbackFileYesStringvalid file path-Path to the input file containing the messages to be played. If the file cannot be opened, the module will not start correctly.
separatorNoStringexactly 1 character, not .TabSeparator between the three columns of a row in the input file. If the value is empty or invalid, the default is used.
numCyclesNoNumberInteger >= 01Number of complete playback cycles. 1 means a single playback. 0 effectively results in no playback. Invalid values fall back to 1.
cycleOffsetNoNumberInteger >= 0 (ms)0Additional wait time in milliseconds between two cycles. Invalid values fall back to 0.
exitOnEndNoBooltrue / falsefalseIf true, smartCORE exits after all cycles are completed.
exitDelayNoNumberInteger >= 0 (s)0Additional wait time in seconds before optionally terminating smartCORE. Effective only when exitOnEnd=true. Invalid values default to 0.

Playback File Format

Each non-empty line of the file describes exactly one message and must consist of three columns:

  1. Timestamp
  2. Message ID
  3. Payload

The default column separator is a tab and can be changed via separator.

General Structure

<timestamp><separator><message_id><separator><data>

Column Descriptions

ColumnDescription
TimestampRelative time within a cycle. The integer part is interpreted as seconds, the fractional part as nanoseconds.
Message IDNumeric message ID. It is read using toUInt(..., 0), which allows for decimal values and C/Qt-standard prefixes such as 0x....
DataRaw data of the message. Hex, binary, or Base64 are supported.

Supported Data Formats

Hexadecimal

Prefix: 0x

Example:

0.000000000    100    0x11 22 33 44

Permitted delimiters within the data are spaces, periods (.) and underscores (_). Incomplete bytes are not padded, but are treated as the lower-order part of a byte.

Binary

Prefix: 0b

Example:

0.050000000    100    0b00010001 00100010

Here, too, spaces, periods (.) and underscores (_) are allowed within the data. Incomplete bytes are also not padded.

Base64

Without the prefix 0x or 0b, the field is interpreted as Base64.

Example:

0.100000000    100    ESIzRA==

Restrictions and Notes

Configuration

  • separator must be a single character.
  • separator must not be identical to the decimal separator ., otherwise timestamps cannot be parsed unambiguously.
  • For numCycles, cycleOffset, and exitDelay, only non-negative integers are processed correctly.
  • If playbackFile is unreadable or does not exist, no messages are prepared.

Input File

  • Each line used must contain exactly three columns.
  • Empty lines are ignored.
  • Invalid lines are logged and skipped.
  • The timestamp is relative, not absolute. It therefore describes the time elapsed since the start of the current playback cycle.
  • Decimal places in the timestamp are normalized to nanoseconds. More than 9 decimal places are truncated; fewer than 9 are padded with zeros.
  • For hex data, only characters from [0-9A-Fa-f] as well as ., _, and whitespace are allowed.
  • For binary data, only 0, 1, ., _, and whitespace are allowed.
  • Base64 data is processed via the Base64 decoder without validation; invalid content may result in erroneous or empty data, depending on the decoder’s behavior.

Runtime Behavior

  • The module sends all prepared messages in the order specified in the file.
  • The module does not explicitly sort the timestamps. The input file should therefore already be in the desired chronological order.
  • A pause (cycleOffset) can optionally be inserted between two cycles.
  • If exitOnEnd=true, the module optionally terminates the smartCORE application after the last cycle with an additional delay (exitDelay).

Example of a complete playback file

Example with tab as column separator:

0.000000000    256    0x11 22 33 44
0.050000000 257 0b10101010 00001111
0.100000000 258 ESIzRA==

Module Information

InformationValue
AuthorsoptiMEAS GmbH
Module TypeProducer
DependenciesFast Message Dispatcher, readable input file