Skip to main content

Module engine

Module engine 

Source
Expand description

The engine: the Qt sensorviz’s MainWindow behaviour, with no UI.

spawn starts the engine and returns an Engine handle. The UI talks to it only through Engine::command and Engine::query, and hears from it only through the Event sink: the whole view state after every change, and log lines.

§Threading

One thread, the engine thread, owns all state in one Viewer: the open log’s Session, the per-tag Preferences, the status line and the outstanding message. Commands and queries are applied on it in the order they arrive. Session is Send and not Sync, which this keeps.

§Commands

CommandArgumentsDoes
readyOpens EngineConfig::initial_log and loads EngineConfig::initial_preferences, if set
openpathFile > Load: remembers the open log’s display choices, then opens the log and applies its tag’s preferences
set_visible_streamsidsView > Visible Streams
set_stream_rangeid, lower, upperView > Ranges: the range and the ranges linked to it
reset_zoomView > Reset Zoom: clears the custom ranges
set_break_at_gapsonView > Break Lines at Gaps
set_cursors_visibleonView > Show Cursors
set_utc_offsethoursConfiguration > UTC Offset
set_parameterid, valueA transform parameter (Sea-level Pressure, Declination, Battery Forward)
set_title, set_title_visibletext, onThe graph title
set_colors, set_axis_sidescolors / sides: id to #rrggbb / left/rightStream Colors, Axis Sides
load_preferences, store_preferencespathFile > Preferences > Load, Store
load_default_preferencesFile > Preferences > Load Defaults
save_filepath, base64Writes bytes the page made (File > Export PDF)

§Queries

QueryArgumentsAnswer
envelopet0, t1, width{traces: {id: {t, v}}, ms}: each drawn trace’s M4 envelope at width columns; a gap marker’s value is null
hovert{time, rows: [{text}]}: the hover readout
rangeid{lower, upper}: where the range dialog starts
compasstThe compass panel at t, from the sample at or after it: {time, heading, pitch, roll, dip, field, gravity, declination, batteryForward}, angles as the Qt panel shows them; null without a compass
about{title, version, userGuide, previewDialog}

Structs§

Engine
The UI’s side of the engine: a cheap, cloneable sender of messages.
EngineConfig
Where the engine starts, and what it tells Help.
Message 🔒
A message for the page to show once: a failed load, a refused file.
UiLogger
A log logger that forwards records to the sink as Event::Log. Install it once, before spawn.
Viewer
Everything the engine thread owns.

Enums§

Event
What the engine tells the UI, through the sink given to spawn.
Msg 🔒
Messages to the engine thread, applied in the order they arrive.

Statics§

LOGGER
The logger to install with log::set_logger.
LOG_LEVEL 🔒
The level passed on, as log::Level as u8 (1 ERROR .. 5 TRACE).
SINK 🔒
The sink UiLogger forwards to, set by spawn.

Functions§

arg_bool 🔒
A boolean argument, or false.
arg_f64 🔒
A number argument, if it is one.
arg_str 🔒
A string argument, or “”.
file_info 🔒
The File Info pane, line for line as the Qt app’s updateMetadata() writes it: the file, tag type, profile, record sets, the compass calibration, the compass source, then the info rows but for the large config and info blobs.
parse_color 🔒
#rrggbb as 0xRRGGBB.
run 🔒
The engine loop: apply messages and publish the view state when it changed.
spawn
Starts the engine thread and returns its handle. Nothing is opened until the page sends ready.
status_line 🔒
The status line, as the Qt app’s updateMetadata() writes it.

Type Aliases§

Sink 🔒
The event sink, shared between the engine thread and the logger.