OutputConfig¶
struct nmeasim::io::OutputConfig ยท Library API
One configured output channel, an entry of the outputs array of a profile.
#include <nmeasim/io/profile/profile.hpp>
Declared in src/io/include/nmeasim/io/profile/profile.hpp (line 45)
The fields form a union of the settings of every transport type: only those that belong to type and encoding are used, and Profile::to_json writes only those, so the others come back with their defaults after a round trip through JSON. The initialisers are the defaults a missing key takes when a profile is read.
See also
- ADR 0014 for the encodings,
docs/reference/transports.mdfor the transports.
Nested types¶
| Type | Description |
|---|---|
OutputConfig::TagBlock |
IEC 61162-450 TAG block in front of every sentence of an NMEA 0183 output. |
Summary¶
Public types
| Name | Description |
|---|---|
Type |
Kind of transport, the type key of an output. |
Encoding |
What the output carries, the encoding key of an output; see ADR 0014. |
Public data members
| Name | Description |
|---|---|
type |
Transport kind, the type key; required in a profile file. |
enabled |
The enabled key; a disabled output is kept in the profile but never opened. |
encoding |
What the output carries, the encoding key: nmea0183, signalk or viewsync. |
filter |
The filter key: what this output sends; empty sends everything. |
period_ms |
Period of the messages of a Signal K or ViewSync output in milliseconds, the period_ms key; [50, 3600000]. |
tag_block |
The tag_block object; used and written by NMEA 0183 outputs only. |
signalk |
The signalk object: context (empty derives vessels.urn:mrn:imo:mmsi: followed by the own MMSI) and source_label (default nmeasim). |
viewsync |
The viewsync object: camera_altitude_m (default 500), tilt_deg (default 60), roll_deg (default 0) and planet (empty for Earth, or sky, mars, moon). |
bind_address |
Local address a TCP or WebSocket server listens on, the bind_address key; 0.0.0.0 listens on every IPv4 interface. |
port |
Port a server listens on or a TCP client connects to, the port key; [0, 65535]. |
host |
Host name or address a TCP client connects to, the host key. |
reconnect_ms |
Delay before a TCP client reconnects after the connection drops, in milliseconds; the reconnect_ms key, [1, 3600000]. |
udp |
UDP settings, from the keys mode (unicast, broadcast or multicast, default unicast), address (default 127.0.0.1), port, interface (default empty) and multicast_ttl (default 1, [1, 255]). |
serial |
Serial port settings, from the keys port_name (required for a serial output), baud_rate (default 4800), data_bits (5 to 8, default 8), parity (none, even, odd, mark or space), stop_bits (1, 1.5 or 2) and flow_control (none, hardware or software). |
path |
File a file or log output writes, the path key; required for those two types. |
append |
The append key: true appends to an existing file, false truncates it when the run first opens it; stopping and starting the run again continues the file. |
Public types¶
Type¶
enum class Type
Kind of transport, the type key of an output.
Each enumerator is written as the string given in its description; to_string and output_type_from_string convert.
| Enumerator | Value | Description |
|---|---|---|
TcpServer |
tcp-server: listens for any number of TCP clients. |
|
TcpClient |
tcp-client: connects to a TCP server and reconnects when dropped. |
|
Udp |
udp: one datagram per line, unicast, broadcast or multicast. |
|
WebSocketServer |
websocket-server: one text frame per line to every WebSocket client. |
|
Serial |
serial: a serial port. |
|
File |
file: a plain file. |
|
Stdout |
stdout: standard output. |
|
Log |
log: a recording, every line prefixed with the wall-clock time, see ADR 0012. |
Declared in src/io/include/nmeasim/io/profile/profile.hpp:50
Encoding¶
enum class Encoding
What the output carries, the encoding key of an output; see ADR 0014.
Each enumerator is written as the string given in its description; to_string and encoding_from_string convert.
| Enumerator | Value | Description |
|---|---|---|
Nmea0183 |
nmea0183, the default: the NMEA 0183 sentences the simulation emits. |
|
SignalK |
signalk: Signal K delta messages built from the state every period_ms. |
|
ViewSync |
viewsync: ViewSync camera packets built from the state every period_ms. |
Declared in src/io/include/nmeasim/io/profile/profile.hpp:72
Public data members¶
type¶
Type type{Type::TcpServer}
Transport kind, the type key; required in a profile file.
Reading an unknown name is an error.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:96
enabled¶
bool enabled{true}
The enabled key; a disabled output is kept in the profile but never opened.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:98
encoding¶
Encoding encoding{Encoding::Nmea0183}
What the output carries, the encoding key: nmea0183, signalk or viewsync.
Reading an unknown name is an error.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:102
filter¶
QStringList filter
The filter key: what this output sends; empty sends everything.
For an NMEA 0183 output the entries are registry ids and custom sentence ids. For a Signal K output they are paths or leading path segments such as navigation or environment.wind, each admitting the paths below it. Both are matched without regard to case. A ViewSync output ignores it.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:109
period_ms¶
int period_ms{1000}
Period of the messages of a Signal K or ViewSync output in milliseconds, the period_ms key; [50, 3600000].
A value outside the range is rejected when the profile is read. The simulation tick bounds the resolution. NMEA 0183 outputs ignore it and do not write it.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:115
tag_block¶
TagBlock tag_block
The tag_block object; used and written by NMEA 0183 outputs only.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:117
signalk¶
core::signalk::SignalKOptions signalk
The signalk object: context (empty derives vessels.urn:mrn:imo:mmsi: followed by the own MMSI) and source_label (default nmeasim).
Used and written by Signal K outputs only.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:121
viewsync¶
core::viewsync::ViewSyncOptions viewsync
The viewsync object: camera_altitude_m (default 500), tilt_deg (default 60), roll_deg (default 0) and planet (empty for Earth, or sky, mars, moon).
Used and written by ViewSync outputs only.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:125
bind_address¶
QString bind_address{QStringLiteral("0.0.0.0")}
Local address a TCP or WebSocket server listens on, the bind_address key; 0.0.0.0 listens on every IPv4 interface.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:130
port¶
quint16 port{10110}
Port a server listens on or a TCP client connects to, the port key; [0, 65535].
Read only for the TCP server and client, UDP and WebSocket types, which reject a value outside the range when the profile is read; the other types ignore the key and keep the default. 0 lets a server pick a free port. The default 10110 is the port conventionally used for NMEA 0183 over IP. A UDP output uses UdpConfig::port, read from the same key.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:137
host¶
QString host{QStringLiteral("127.0.0.1")}
Host name or address a TCP client connects to, the host key.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:140
reconnect_ms¶
int reconnect_ms{2000}
Delay before a TCP client reconnects after the connection drops, in milliseconds; the reconnect_ms key, [1, 3600000].
Read only for a TCP client, which rejects a value outside the range when the profile is read.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:146
udp¶
UdpConfig udp
UDP settings, from the keys mode (unicast, broadcast or multicast, default unicast), address (default 127.0.0.1), port, interface (default empty) and multicast_ttl (default 1, [1, 255]).
Read only for a UDP output, which rejects an unknown mode and a multicast_ttl outside its range when the profile is read.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:154
serial¶
SerialConfig serial
Serial port settings, from the keys port_name (required for a serial output), baud_rate (default 4800), data_bits (5 to 8, default 8), parity (none, even, odd, mark or space), stop_bits (1, 1.5 or 2) and flow_control (none, hardware or software).
Read only for a serial output, which rejects a baud_rate that is not positive and any other data_bits, parity, stop_bits or flow_control value when the profile is read. Missing keys take the defaults (4800, 8, none, 1, none).
Declared in src/io/include/nmeasim/io/profile/profile.hpp:164
path¶
QString path
File a file or log output writes, the path key; required for those two types.
Held as written. A relative path is relative to Profile::base_directory, and SimulationRunner resolves it with Profile::resolve_path when it builds the transport.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:171
append¶
bool append{true}
The append key: true appends to an existing file, false truncates it when the run first opens it; stopping and starting the run again continues the file.
Declared in src/io/include/nmeasim/io/profile/profile.hpp:174