Expand description
Signal K as an adapter.
A Signal K server aggregates NMEA 0183, NMEA 2000 and SeaTalk
instrument data, so this crate never parses a sentence directly. It
translates Signal K deltas into this workspace’s own types. Ranking
multiple data sources and assembling a complete fix belongs to
[fix], which this crate depends on; this is the only crate in the
workspace with a dependency on Signal K itself.
§The two things it does
delta turns what arrives on the wire into this workspace’s units.
Signal K is SI – radians and metres per second – and everything above
nav-math is degrees and knots. One conversion, in one place, with the
tests that keep it there.
apply_measurement feeds one reading to a [fix::FixBuilder] under
construction. It is a thin thing on purpose: fix does not know Signal K
exists, so this is the one place a Measurement and a builder’s setters
meet, and it is the only part of assembling a fix that would need
rewriting for a client reading raw NMEA instead.
§What it deliberately does not do
No sockets, no mDNS, no HTTP, no clock. Everything here is a pure function of what it was handed, which is what lets a recorded stream of deltas replay ashore and produce the same track, the same handovers between sources and the same moments of going stale. The shell that finds the server, holds the token and keeps the WebSocket open is thin by design, and sits above this.
§What is not modelled here on purpose
Signal K’s own idea of a route, and course calculations. The route
resource cannot express a leg, and the Course API states that it
performs no course calculations of its own – both are things this
project already does better for itself in routes and nav-math;
using them as vocabulary is worth it, using them as an engine is not.
delta::Measurement::CourseNextPoint is exactly that vocabulary use,
not an exception to it: it reads which point a route-following device
(this one or another) currently considers the destination, the same
plain fact AnchorPosition already is for the anchor watch – no
bearing, distance or ETA is asked of Signal K to get it, and computing
any of those once a next point is known is nav-math’s job, same as
it always was.
Re-exports§
pub use delta::AisClass;pub use delta::AisTargetStatus;pub use delta::Context;pub use delta::Delta;pub use delta::Depth;pub use delta::Measurement;pub use delta::NotificationSeverity;pub use delta::Offsets;pub use delta::Reading;pub use delta::Sounding;pub use delta::parse;pub use polar::PolarResource;pub use polar::PolarResourceError;pub use units::Preferences;pub use wind::DEFAULT_WIND_GOOD_FOR;pub use wind::Wind;pub use wind::WindTracker;
Modules§
- delta
- Reading a Signal K delta, in the units the rest of this workspace uses.
- notification
- Raising, and standing down, a Signal K notification, on the wire.
- polar
- A boat’s own performance polar, in Signal K’s own shape.
- units
- A mariner’s own display units, as
signalk-server’sunitpreferencesfeature states them. - wind
- The vessel’s true wind, tracked from separate Signal K readings and resolved on demand.
Functions§
- apply_
measurement - Feeds one measurement to a fix under construction.