Skip to content

OutputChannel

struct nmeasim::io::OutputChannel · Library API

One enabled output of a running profile: its transport, its filter and its counters.

#include <nmeasim/io/simulation_runner.hpp>

Declared in src/io/include/nmeasim/io/simulation_runner.hpp (line 42)

The channel owns its transport. It is move-only because of that std::unique_ptr. The runner builds one channel per enabled output in SimulationRunner::apply_profile and keeps it, counters included, until the next profile is applied.

Summary

Public member functions

Name Description
admits() Returns whether the filter admits an NMEA 0183 sentence.
admits_path() Returns whether the filter admits a Signal K path.
carries_sentences() Returns whether this channel carries NMEA 0183 sentences.

Public data members

Name Description
config The profile output this channel was built from; encoding decides what it carries.
transport The transport built from config; never null in a channel built by the runner.
filter Entries of the output's filter; empty admits everything.
lines_sent Lines written to the transport since the profile was applied: NMEA 0183 sentences for an NMEA 0183 channel, Signal K deltas or ViewSync packets for the others, as the encoding decides.
next_due Simulated time, as core::simulation::Simulation::elapsed counts it, at which the next state message of a Signal K or ViewSync channel is due.
counter Packet counter of a ViewSync channel, sent as the first field of the next packet.

Public member functions

admits()

bool admits(const QString& id) const

Returns whether the filter admits an NMEA 0183 sentence.

Ids are compared without regard to case, like the paths of admits_path: registry and custom sentence ids are upper case, so an entry such as rmc means RMC.

Parameters

Name Type Description
id const QString& Registry or custom sentence id, such as RMC or BARO.

Returns bool: True when the filter is empty or one of its entries equals id, ignoring case.

Declared in src/io/include/nmeasim/io/simulation_runner.hpp:81 · defined in src/io/src/simulation_runner.cpp:66

admits_path()

bool admits_path(const QString& path) const

Returns whether the filter admits a Signal K path.

An entry names whole path segments: it admits the path equal to it and every path below it, so environment.wind admits environment.wind.speedApparent and navigation.speed does not admit navigation.speedThroughWater. A trailing dot of an entry is ignored, an empty entry admits every path, and case is ignored.

Parameters

Name Type Description
path const QString& Full Signal K path, such as environment.wind.speedApparent.

Returns bool: True when the filter is empty or one of its entries is path or a leading run of its segments.

Declared in src/io/include/nmeasim/io/simulation_runner.hpp:92 · defined in src/io/src/simulation_runner.cpp:75

carries_sentences()

bool carries_sentences() const noexcept

Returns whether this channel carries NMEA 0183 sentences.

Returns bool: True for the NMEA 0183 encoding; false for Signal K and ViewSync, which carry state messages instead.

Declared in src/io/include/nmeasim/io/simulation_runner.hpp:97

Public data members

config

OutputConfig config

The profile output this channel was built from; encoding decides what it carries.

Declared in src/io/include/nmeasim/io/simulation_runner.hpp:44

transport

std::unique_ptr<Transport> transport

The transport built from config; never null in a channel built by the runner.

Declared in src/io/include/nmeasim/io/simulation_runner.hpp:46

filter

QSet<QString> filter

Entries of the output's filter; empty admits everything.

For an NMEA 0183 channel the entries are registry or custom sentence ids, for a Signal K channel they are paths or leading path segments, and a ViewSync channel ignores them. Both kinds are matched without regard to case.

Declared in src/io/include/nmeasim/io/simulation_runner.hpp:52

lines_sent

qint64 lines_sent{0}

Lines written to the transport since the profile was applied: NMEA 0183 sentences for an NMEA 0183 channel, Signal K deltas or ViewSync packets for the others, as the encoding decides.

Counts only lines handed to an open transport, and keeps counting across stop and start.

Declared in src/io/include/nmeasim/io/simulation_runner.hpp:59

next_due

std::chrono::milliseconds next_due{0}

Simulated time, as core::simulation::Simulation::elapsed counts it, at which the next state message of a Signal K or ViewSync channel is due.

Set to the current elapsed time by SimulationRunner::start, so the first message goes out on the first tick, then advanced by period_ms with core::simulation::next_due_after. Unused by NMEA 0183 channels.

Declared in src/io/include/nmeasim/io/simulation_runner.hpp:66

counter

quint32 counter{0}

Packet counter of a ViewSync channel, sent as the first field of the next packet.

Reset to zero by SimulationRunner::start and incremented after every packet; unused by other encodings.

Declared in src/io/include/nmeasim/io/simulation_runner.hpp:71