Skip to content

OutputsPage

class nmeasim::app::OutputsPage · Applications

Settings tab with the list of outputs and an editor for the selected one.

Inherits QWidget

Declared in src/app/dialogs/outputs_page.hpp (line 51)

The left column holds list, one row per output in the order the outputs are opened, with an Add menu offering every io::OutputConfig::Type and a Remove button. The right column shows the fields every output has (enabled_check, filter_edit, encoding_combo, period_spin), then editor_stack with the fields of the selected type, then the option group of the selected encoding (tag_block_box, signalk_box or viewsync_box).

The page keeps its own copy of the outputs. The editor widgets show one of them at a time; their values are written back into the copy (committed) when another output is selected, an output is added, or outputs, validate or store is called. Nothing reaches a profile before store, so discarding the page discards every change.

Every widget is a Qt child of the page and lives as long as it. The widget members are public so that tests and SettingsDialog can drive them; code that sets them directly must call outputs or store afterwards to read the result. The page declares no signals or slots of its own: the Add menu, the Remove button and the list's QListWidget::currentRowChanged signal are connected to member functions in the constructor.

See also

Summary

Public member functions

Name Description
OutputsPage() Builds the page with every editor widget and shows the empty page.
load() Replaces the edited outputs with those of a profile and selects the first one.
store() Writes the edited outputs into a profile, including the values in the editor.
validate() Checks that every output has the setting its transport cannot open without.
add_output() Appends an output of the given type with the defaults of io::OutputConfig and selects it.
remove_current() Removes the selected output and shows the one that takes its row.
select() Selects an output and shows it in the editor, committing the one shown before.
count() Returns the number of outputs being edited.
current_index() Returns the row of the selected output.
outputs() Returns the list as edited so far, including the output being edited.

Public data members

Name Description
list The outputs, one row each, titled with the type, the address, port or path, and (Signal K), (ViewSync) or (disabled) when they apply.
enabled_check Edits io::OutputConfig::enabled; a disabled output stays in the profile but is not opened.
filter_edit Edits io::OutputConfig::filter as a comma-separated list; empty sends everything.
encoding_combo Edits io::OutputConfig::encoding: NMEA 0183, Signal K, ViewSync in io::OutputConfig::Encoding order, so the index is the enumerator's value.
period_spin Edits io::OutputConfig::period_ms, the interval of Signal K deltas and ViewSync packets, in milliseconds; [50, 3600000] in steps of 100, the range the profile accepts.
editor_stack The fields of the selected output's type, one page per group of types.
tag_block_box The IEC 61162-450 TAG block group, shown only for an NMEA 0183 output.
tag_block_check Edits io::OutputConfig::TagBlock::enabled: whether every sentence gets a TAG block.
tag_source_edit Edits the s: source identifier, core::nmea0183::TagBlockOptions::source; at most 15 characters, the length core::nmea0183::sanitize_tag_source keeps.
tag_time_check Edits core::nmea0183::TagBlockOptions::include_time: whether the c: time is sent.
tag_milliseconds_check Edits core::nmea0183::TagBlockOptions::milliseconds: c: in Unix milliseconds instead of seconds.
signalk_box The Signal K group, shown only for a Signal K output.
signalk_context_combo Chooses core::signalk::SignalKOptions::context: 0 the vessel context derived from the AIS MMSI (stored as an empty context), 1 aircraft, 2 the text of signalk_context_edit.
signalk_context_edit The custom Signal K context, such as vessels.urn:mrn:imo:mmsi:239000001; enabled only when signalk_context_combo is on the custom entry.
signalk_source_edit Edits core::signalk::SignalKOptions::source_label, sent as source.label in every update.
viewsync_box The ViewSync camera group, shown only for a ViewSync output.
camera_altitude_spin Edits core::viewsync::ViewSyncOptions::camera_altitude_m, the camera height above the vessel in metres; [0, 100000] in whole metres.
tilt_spin Edits core::viewsync::ViewSyncOptions::tilt_deg in whole degrees; [0, 90], 0 looking straight down and 90 at the horizon.
roll_spin Edits core::viewsync::ViewSyncOptions::roll_deg in whole degrees; [-180, 180].
planet_combo Chooses core::viewsync::ViewSyncOptions::planet: Earth (stored as empty), sky, mars or moon.
bind_address_edit Edits io::OutputConfig::bind_address of a TCP or WebSocket server, trimmed when committed; 0.0.0.0 listens on every IPv4 interface.
server_port_spin Edits io::OutputConfig::port of a TCP or WebSocket server; [0, 65535], 0 lets the server pick a free port.
host_edit Edits io::OutputConfig::host of a TCP client, trimmed when committed; must not be empty, see validate.
client_port_spin Edits io::OutputConfig::port of a TCP client; [0, 65535].
reconnect_spin Edits io::OutputConfig::reconnect_ms, the delay before a TCP client reconnects, in milliseconds; [1, 3600000], the range the profile accepts, so a loaded value is kept.
udp_mode_combo Edits io::UdpConfig::mode: unicast, broadcast, multicast in io::UdpConfig::Mode order, so the index is the enumerator's value.
udp_address_edit Edits io::UdpConfig::address, the destination IPv4 address, trimmed when committed.
udp_port_spin Edits io::UdpConfig::port, the destination port; [0, 65535].
udp_interface_edit Edits io::UdpConfig::interface_name, trimmed when committed; empty lets the operating system choose.
udp_ttl_spin Edits io::UdpConfig::multicast_ttl in router hops; [1, 255], the range the profile accepts, so a loaded value is kept.
serial_port_combo Edits io::SerialConfig::port_name: an editable list of the serial ports found when the page was built, so any other device path can be typed.
baud_combo Edits io::SerialConfig::baud_rate: an editable list of the common rates from 1200 to 115200 bit/s, accepting any positive whole number, as the profile does.
data_bits_combo Edits io::SerialConfig::data_bits: 5, 6, 7 or 8, the index plus 5.
parity_combo Edits io::SerialConfig::parity: none, even, odd, space, mark.
stop_bits_combo Edits io::SerialConfig::stop_bits: 1, 1.5 or 2.
flow_control_combo Edits io::SerialConfig::flow_control: none, hardware (RTS/CTS), software (XON/XOFF) in QSerialPort::FlowControl order, so the index is the enumerator's value.
file_path_edit Edits io::OutputConfig::path of a file or log output, trimmed when committed; must not be empty, see validate.
append_check Edits io::OutputConfig::append: checked appends to an existing file, unchecked truncates it when the output opens.

Private member functions

Name Description
show_output() Shows an output in the editor, committing the one shown before.
commit_editor() Writes the editor widgets into the output being edited and refreshes the titles.
edited() Returns an output with the values of the editor widgets written into it.
update_encoding_widgets() Shows the option group of the encoding selected in encoding_combo, hides the other two, and enables period_spin and filter_edit for it.
refresh_titles() Sets the text of every row of list from title_of of its output.

Private static member functions

Name Description
title_of() Returns the title of an output in list.
page_of() Returns the editor_stack page that edits a transport type.

Private data members

Name Description
outputs_ The outputs being edited, in list order; row n of list shows element n.
editing_ Index in outputs_ of the output the editor widgets show, or -1 when they show none and must not be committed.
loading_ True while load refills list, so that the row changes it causes do not show or commit an output.
profile_directory_ Directory of the loaded profile's file, io::Profile::base_directory, against which the file dialog of the Browse... button resolves a relative output path; empty for a profile without a file.

Public member functions

OutputsPage()

explicit OutputsPage(QWidget* parent = nullptr)

Builds the page with every editor widget and shows the empty page.

The serial port list is filled once, here, from io::available_serial_ports; a device plugged in later can still be typed. Call load to show a profile's outputs.

Parameters

Name Type Description
parent QWidget* Qt parent that owns the page; null leaves ownership to the caller.

Declared in src/app/dialogs/outputs_page.hpp:61 · defined in src/app/dialogs/outputs_page.cpp:90

load()

void load(const io::Profile& profile)

Replaces the edited outputs with those of a profile and selects the first one.

The edits of the output shown before are discarded, not committed. With no outputs the editor shows the hint to add one and the common fields are disabled.

Parameters

Name Type Description
profile const io::Profile& The profile whose outputs are copied; only that field is read.

Declared in src/app/dialogs/outputs_page.hpp:69 · defined in src/app/dialogs/outputs_page.cpp:321

store()

void store(io::Profile& profile) const

Writes the edited outputs into a profile, including the values in the editor.

Nothing is validated here; SettingsDialog::accept calls validate first.

Parameters

Name Type Description
profile io::Profile& The profile whose outputs are replaced; no other field is touched.

Declared in src/app/dialogs/outputs_page.hpp:75 · defined in src/app/dialogs/outputs_page.cpp:338

validate()

QString validate() const

Checks that every output has the setting its transport cannot open without.

Reads the output being edited from the editor. The checks, in list order: a serial output needs a port name and a baud rate (a cleared field reads as 0), a file or log output a path and a TCP client a host; values made of spaces count as missing. Everything else is either limited by its widget or accepted as it is.

Returns QString: An empty string when every output is complete, otherwise a message about the first incomplete one, numbered from 1, such as Output 3: the serial port name is missing.

Declared in src/app/dialogs/outputs_page.hpp:86 · defined in src/app/dialogs/outputs_page.cpp:351

add_output()

void add_output(io::OutputConfig::Type type)

Appends an output of the given type with the defaults of io::OutputConfig and selects it.

The editor is committed first. A WebSocket server starts on port 3000, the default of Signal K servers, instead of 10110; every other type keeps the defaults.

Parameters

Name Type Description
type io::OutputConfig::Type The transport type of the new output.

Declared in src/app/dialogs/outputs_page.hpp:95 · defined in src/app/dialogs/outputs_page.cpp:373

remove_current()

void remove_current()

Removes the selected output and shows the one that takes its row.

The edits of the removed output are dropped. Does nothing when no output is selected.

Declared in src/app/dialogs/outputs_page.hpp:99 · defined in src/app/dialogs/outputs_page.cpp:385

select()

void select(int index)

Selects an output and shows it in the editor, committing the one shown before.

Parameters

Name Type Description
index int Row in list, from 0. -1 selects nothing and shows the empty page.

Declared in src/app/dialogs/outputs_page.hpp:103 · defined in src/app/dialogs/outputs_page.cpp:402

count()

int count() const

Returns the number of outputs being edited.

Returns int: The size of the page's copy of the outputs, equal to the number of rows of list; 0 when there are none.

Declared in src/app/dialogs/outputs_page.hpp:108 · defined in src/app/dialogs/outputs_page.cpp:406

current_index()

int current_index() const

Returns the row of the selected output.

Returns int: The current row of list, from 0, or -1 when no output is selected.

Declared in src/app/dialogs/outputs_page.hpp:112 · defined in src/app/dialogs/outputs_page.cpp:410

outputs()

QList<io::OutputConfig> outputs() const

Returns the list as edited so far, including the output being edited.

The output being edited is read from the editor widgets; the page's copy and list are not changed.

Returns QList<io::OutputConfig>: The outputs in list order.

Declared in src/app/dialogs/outputs_page.hpp:119 · defined in src/app/dialogs/outputs_page.cpp:342

Public data members

list

QListWidget* list

The outputs, one row each, titled with the type, the address, port or path, and (Signal K), (ViewSync) or (disabled) when they apply.

Selecting a row shows that output in the editor. The rows follow the order of io::Profile::outputs, which is the order the outputs are opened in.

Declared in src/app/dialogs/outputs_page.hpp:126

enabled_check

QCheckBox* enabled_check

Edits io::OutputConfig::enabled; a disabled output stays in the profile but is not opened.

Disabled while no output is selected.

Declared in src/app/dialogs/outputs_page.hpp:129

filter_edit

QLineEdit* filter_edit

Edits io::OutputConfig::filter as a comma-separated list; empty sends everything.

For an NMEA 0183 output the entries are sentence ids, trimmed and upper-cased when committed; for a Signal K output they are path prefixes, trimmed only. Empty entries are dropped. Disabled for a ViewSync output, which ignores the filter, and while no output is selected.

Declared in src/app/dialogs/outputs_page.hpp:136

encoding_combo

QComboBox* encoding_combo

Edits io::OutputConfig::encoding: NMEA 0183, Signal K, ViewSync in io::OutputConfig::Encoding order, so the index is the enumerator's value.

Changing it shows the option group of the new encoding and enables period_spin and filter_edit as that encoding requires.

Declared in src/app/dialogs/outputs_page.hpp:142

period_spin

QSpinBox* period_spin

Edits io::OutputConfig::period_ms, the interval of Signal K deltas and ViewSync packets, in milliseconds; [50, 3600000] in steps of 100, the range the profile accepts.

Disabled for an NMEA 0183 output, whose sentences follow their own periods.

Declared in src/app/dialogs/outputs_page.hpp:147

editor_stack

QStackedWidget* editor_stack

The fields of the selected output's type, one page per group of types.

The pages, by index: 0 TCP and WebSocket server, 1 TCP client, 2 UDP, 3 serial port, 4 file and log, 5 standard output (an explanation only), 6 the hint shown when no output is selected.

Declared in src/app/dialogs/outputs_page.hpp:153

tag_block_box

QGroupBox* tag_block_box

The IEC 61162-450 TAG block group, shown only for an NMEA 0183 output.

See also

  • IEC 61162-450, TAG block parameters "s" and "c".

Declared in src/app/dialogs/outputs_page.hpp:158

tag_block_check

QCheckBox* tag_block_check

Edits io::OutputConfig::TagBlock::enabled: whether every sentence gets a TAG block.

Declared in src/app/dialogs/outputs_page.hpp:160

tag_source_edit

QLineEdit* tag_source_edit

Edits the s: source identifier, core::nmea0183::TagBlockOptions::source; at most 15 characters, the length core::nmea0183::sanitize_tag_source keeps.

Trimmed when committed; left empty, it stores the default SIM0001 shown as placeholder.

Declared in src/app/dialogs/outputs_page.hpp:166

tag_time_check

QCheckBox* tag_time_check

Edits core::nmea0183::TagBlockOptions::include_time: whether the c: time is sent.

Declared in src/app/dialogs/outputs_page.hpp:168

tag_milliseconds_check

QCheckBox* tag_milliseconds_check

Edits core::nmea0183::TagBlockOptions::milliseconds: c: in Unix milliseconds instead of seconds.

Declared in src/app/dialogs/outputs_page.hpp:171

signalk_box

QGroupBox* signalk_box

The Signal K group, shown only for a Signal K output.

Declared in src/app/dialogs/outputs_page.hpp:173

signalk_context_combo

QComboBox* signalk_context_combo

Chooses core::signalk::SignalKOptions::context: 0 the vessel context derived from the AIS MMSI (stored as an empty context), 1 aircraft, 2 the text of signalk_context_edit.

A loaded context is shown as 0 when empty, 1 when it is exactly aircraft and 2 otherwise.

Declared in src/app/dialogs/outputs_page.hpp:180

signalk_context_edit

QLineEdit* signalk_context_edit

The custom Signal K context, such as vessels.urn:mrn:imo:mmsi:239000001; enabled only when signalk_context_combo is on the custom entry.

Trimmed and stored as given when committed; left empty, the output falls back to the vessel context.

Declared in src/app/dialogs/outputs_page.hpp:186

signalk_source_edit

QLineEdit* signalk_source_edit

Edits core::signalk::SignalKOptions::source_label, sent as source.label in every update.

Trimmed when committed; left empty, it stores the default nmeasim.

Declared in src/app/dialogs/outputs_page.hpp:189

viewsync_box

QGroupBox* viewsync_box

The ViewSync camera group, shown only for a ViewSync output.

Declared in src/app/dialogs/outputs_page.hpp:191

camera_altitude_spin

QDoubleSpinBox* camera_altitude_spin

Edits core::viewsync::ViewSyncOptions::camera_altitude_m, the camera height above the vessel in metres; [0, 100000] in whole metres.

Declared in src/app/dialogs/outputs_page.hpp:194

tilt_spin

QDoubleSpinBox* tilt_spin

Edits core::viewsync::ViewSyncOptions::tilt_deg in whole degrees; [0, 90], 0 looking straight down and 90 at the horizon.

Declared in src/app/dialogs/outputs_page.hpp:197

roll_spin

QDoubleSpinBox* roll_spin

Edits core::viewsync::ViewSyncOptions::roll_deg in whole degrees; [-180, 180].

Declared in src/app/dialogs/outputs_page.hpp:199

planet_combo

QComboBox* planet_combo

Chooses core::viewsync::ViewSyncOptions::planet: Earth (stored as empty), sky, mars or moon.

A loaded planet that is none of these is shown, and stored again, as Earth.

Declared in src/app/dialogs/outputs_page.hpp:204

bind_address_edit

QLineEdit* bind_address_edit

Edits io::OutputConfig::bind_address of a TCP or WebSocket server, trimmed when committed; 0.0.0.0 listens on every IPv4 interface.

Declared in src/app/dialogs/outputs_page.hpp:208

server_port_spin

QSpinBox* server_port_spin

Edits io::OutputConfig::port of a TCP or WebSocket server; [0, 65535], 0 lets the server pick a free port.

Declared in src/app/dialogs/outputs_page.hpp:211

host_edit

QLineEdit* host_edit

Edits io::OutputConfig::host of a TCP client, trimmed when committed; must not be empty, see validate.

Declared in src/app/dialogs/outputs_page.hpp:214

client_port_spin

QSpinBox* client_port_spin

Edits io::OutputConfig::port of a TCP client; [0, 65535].

Declared in src/app/dialogs/outputs_page.hpp:216

reconnect_spin

QSpinBox* reconnect_spin

Edits io::OutputConfig::reconnect_ms, the delay before a TCP client reconnects, in milliseconds; [1, 3600000], the range the profile accepts, so a loaded value is kept.

Declared in src/app/dialogs/outputs_page.hpp:219

udp_mode_combo

QComboBox* udp_mode_combo

Edits io::UdpConfig::mode: unicast, broadcast, multicast in io::UdpConfig::Mode order, so the index is the enumerator's value.

Declared in src/app/dialogs/outputs_page.hpp:222

udp_address_edit

QLineEdit* udp_address_edit

Edits io::UdpConfig::address, the destination IPv4 address, trimmed when committed.

In broadcast mode an empty address sends to the subnet broadcast address of udp_interface_edit's interface, or to 255.255.255.255 without one. The address is not checked here; one that does not parse makes the transport fail when it opens.

Declared in src/app/dialogs/outputs_page.hpp:228

udp_port_spin

QSpinBox* udp_port_spin

Edits io::UdpConfig::port, the destination port; [0, 65535].

Declared in src/app/dialogs/outputs_page.hpp:230

udp_interface_edit

QLineEdit* udp_interface_edit

Edits io::UdpConfig::interface_name, trimmed when committed; empty lets the operating system choose.

Declared in src/app/dialogs/outputs_page.hpp:233

udp_ttl_spin

QSpinBox* udp_ttl_spin

Edits io::UdpConfig::multicast_ttl in router hops; [1, 255], the range the profile accepts, so a loaded value is kept.

Declared in src/app/dialogs/outputs_page.hpp:236

serial_port_combo

QComboBox* serial_port_combo

Edits io::SerialConfig::port_name: an editable list of the serial ports found when the page was built, so any other device path can be typed.

Trimmed when committed; must not be empty, see validate.

Declared in src/app/dialogs/outputs_page.hpp:241

baud_combo

QComboBox* baud_combo

Edits io::SerialConfig::baud_rate: an editable list of the common rates from 1200 to 115200 bit/s, accepting any positive whole number, as the profile does.

A cleared field reads as 0, which validate rejects.

Declared in src/app/dialogs/outputs_page.hpp:246

data_bits_combo

QComboBox* data_bits_combo

Edits io::SerialConfig::data_bits: 5, 6, 7 or 8, the index plus 5.

Declared in src/app/dialogs/outputs_page.hpp:248

parity_combo

QComboBox* parity_combo

Edits io::SerialConfig::parity: none, even, odd, space, mark.

Declared in src/app/dialogs/outputs_page.hpp:250

stop_bits_combo

QComboBox* stop_bits_combo

Edits io::SerialConfig::stop_bits: 1, 1.5 or 2.

Declared in src/app/dialogs/outputs_page.hpp:252

flow_control_combo

QComboBox* flow_control_combo

Edits io::SerialConfig::flow_control: none, hardware (RTS/CTS), software (XON/XOFF) in QSerialPort::FlowControl order, so the index is the enumerator's value.

Declared in src/app/dialogs/outputs_page.hpp:255

file_path_edit

QLineEdit* file_path_edit

Edits io::OutputConfig::path of a file or log output, trimmed when committed; must not be empty, see validate.

Browse... next to it opens a save dialog that does not ask for confirmation when an existing file is chosen, because choosing it changes nothing: append_check decides whether it is truncated. A relative path is not resolved against the profile's directory.

Declared in src/app/dialogs/outputs_page.hpp:263

append_check

QCheckBox* append_check

Edits io::OutputConfig::append: checked appends to an existing file, unchecked truncates it when the output opens.

Declared in src/app/dialogs/outputs_page.hpp:266

Private member functions

show_output()

void show_output(int index)

Shows an output in the editor, committing the one shown before.

Connected to QListWidget::currentRowChanged of list. Filling the widgets also updates the visible option group, period_spin, filter_edit and the enabled state of signalk_context_edit for the shown output. Does nothing while load refills the list.

Parameters

Name Type Description
index int Row of the output to show; a value outside [0, count) shows the empty page, disables the common fields and hides every option group.

Declared in src/app/dialogs/outputs_page.hpp:278 · defined in src/app/dialogs/outputs_page.cpp:434

commit_editor()

void commit_editor()

Writes the editor widgets into the output being edited and refreshes the titles.

Does nothing when no output is being edited.

Declared in src/app/dialogs/outputs_page.hpp:282 · defined in src/app/dialogs/outputs_page.cpp:538

edited()

io::OutputConfig edited(io::OutputConfig output) const

Returns an output with the values of the editor widgets written into it.

Only the fields of the output's type are written; the common fields and every encoding group are written whatever the encoding. Nothing of the page changes.

Parameters

Name Type Description
output io::OutputConfig The output the editor shows, as last committed; taken by value.

Returns io::OutputConfig: output with the edited values.

Declared in src/app/dialogs/outputs_page.hpp:290 · defined in src/app/dialogs/outputs_page.cpp:546

update_encoding_widgets()

void update_encoding_widgets()

Shows the option group of the encoding selected in encoding_combo, hides the other two, and enables period_spin and filter_edit for it.

Connected to QComboBox::currentIndexChanged of encoding_combo.

Declared in src/app/dialogs/outputs_page.hpp:295 · defined in src/app/dialogs/outputs_page.cpp:310

refresh_titles()

void refresh_titles()

Sets the text of every row of list from title_of of its output.

Declared in src/app/dialogs/outputs_page.hpp:297 · defined in src/app/dialogs/outputs_page.cpp:632

Private static member functions

title_of()

static QString title_of(const io::OutputConfig& output)

Returns the title of an output in list.

Parameters

Name Type Description
output const io::OutputConfig& The output to describe.

Returns QString: The type name, then - and the address and port, the serial port and baud rate, or the path when that is not blank, then (Signal K) or (ViewSync) for those encodings and (disabled) for a disabled output.

Declared in src/app/dialogs/outputs_page.hpp:304 · defined in src/app/dialogs/outputs_page.cpp:638

page_of()

static int page_of(io::OutputConfig::Type type)

Returns the editor_stack page that edits a transport type.

Parameters

Name Type Description
type io::OutputConfig::Type The transport type.

Returns int: The page index from 0 to 5 listed at editor_stack; 6, the empty page, for a value outside the enumeration.

Declared in src/app/dialogs/outputs_page.hpp:310 · defined in src/app/dialogs/outputs_page.cpp:414

Private data members

outputs_

QList<io::OutputConfig> outputs_

The outputs being edited, in list order; row n of list shows element n.

Declared in src/app/dialogs/outputs_page.hpp:313

editing_

int editing_{-1}

Index in outputs_ of the output the editor widgets show, or -1 when they show none and must not be committed.

Declared in src/app/dialogs/outputs_page.hpp:316

loading_

bool loading_{false}

True while load refills list, so that the row changes it causes do not show or commit an output.

Declared in src/app/dialogs/outputs_page.hpp:319

profile_directory_

QString profile_directory_

Directory of the loaded profile's file, io::Profile::base_directory, against which the file dialog of the Browse... button resolves a relative output path; empty for a profile without a file.

Declared in src/app/dialogs/outputs_page.hpp:323