pub enum Measurement {
Show 27 variants
Position(Position),
CourseOverGround(f64),
SpeedOverGround(f64),
Heading(f64),
VesselName(String),
AisTargetStatus(AisTargetStatus),
ClosestApproachAlarm(NotificationSeverity),
AisClass(AisClass),
AisShipType(String),
Callsign(String),
ClosestApproach {
cpa_m: Option<f64>,
tcpa_s: Option<f64>,
},
Depth(Depth),
TransducerToKeel(f64),
SurfaceToTransducer(f64),
MaximumDraft(f64),
DesignLength(f64),
DesignBeam(f64),
WindAngleApparent(f64),
WindSpeedApparent(f64),
WindDirectionTrue(f64),
WindSpeedTrue(f64),
AnchorPosition(Option<Position>),
AnchorMaxRadius(Option<f64>),
CourseNextPoint(Option<Position>),
CoursePreviousPoint(Option<Position>),
CourseActiveRouteHref(Option<String>),
ResourceChanged {
resource_type: String,
id: String,
},
}Expand description
The values a caller has a use for. Everything else on the wire is skipped.
Clone, not Copy: most variants are a plain number or [Position],
cheap to duplicate either way, but
CourseActiveRouteHref carries
an owned String, which Copy cannot hold – a caller matching the
same reading against several consumers in turn clones it explicitly.
Variants§
Position(Position)
Where the vessel is.
CourseOverGround(f64)
Course over ground, degrees true – converted from Signal K’s radians.
SpeedOverGround(f64)
Speed over ground in knots, converted from metres per second.
Heading(f64)
Heading, degrees true, converted from radians.
VesselName(String)
A vessel’s own name, from the bare name path – the same path
on any context, self or otherwise, which is what makes this
useful for an AIS target: a position with no name attached is
just a dot on the chart.
AisTargetStatus(AisTargetStatus)
An AIS (or other) target’s own tracking status, sensors.ais.status
– confirmed live against sk-ais-status-plugin, not a Signal K
specification path, but a real, already-observed convention worth
reading passively the same as anything else this crate did not
invent. See AisTargetStatus’s own doc.
ClosestApproachAlarm(NotificationSeverity)
A CPA/TCPA collision alarm’s own severity, from
notifications.navigation.closestApproach – not a Signal K
specification path (notifications.collision.* is the schema’s
own “Well Known Name” for this; no CPA plugin surveyed while this
was built actually uses it), but a real, already-observed
convention: both signalk-derived-data and
signalk-ais-target-prioritizer publish their own computed
CPA/TCPA alarm here, confirmed live against the latter (the one
a first client was built against – see NotificationSeverity’s
own doc). Read passively, the same “worth reading, not worth
depending on being there” treatment Measurement::AisTargetStatus
already gets: a server with no such plugin simply never produces
this reading, and nothing downstream requires it.
AisClass(AisClass)
The transponder class, from sensors.ais.class.
AisShipType(String)
What kind of vessel it says it is, design.aisShipType’s own
name – “Cargo ship”, “Sailing vessel”. Only the name is kept;
the numeric id is the same fact in a code nobody reads.
Callsign(String)
The VHF call sign, communication.callsignVhf – read off that
flat path, or nested in a vessel-root update the way AIS static
data actually sends it; see Context’s own module and this
enum’s measurement_of for which is which.
ClosestApproach
signalk-ais-target-prioritizer’s own closest-point-of-approach
figures for a target, from navigation.closestApproach – the
numbers behind the alarm Measurement::ClosestApproachAlarm
carries only the severity of. Confirmed live: the plugin publishes
this object for every target it tracks, and leaves distance and
timeTo out of it whenever there is no approach to speak of (a
target moving away, or further than its own ceilings), so both are
None then and a reader must let that overwrite what it held, not
keep the last figure. Nothing here computes a CPA: this reads the
plugin’s answer, as a client reads its alarm.
Fields
Depth(Depth)
A sounding, carrying what it was measured from.
TransducerToKeel(f64)
Transducer face to the bottom of the keel, metres. Configuration rather than a measurement, but it arrives the same way.
SurfaceToTransducer(f64)
Water surface to the transducer face, metres. Likewise.
MaximumDraft(f64)
The vessel’s own maximum draft, metres. Static hull data rather than
a live reading, but Signal K sends it the same way – once, on
design.draft, as part of the burst a server hands a client on
first subscribing to itself.
DesignLength(f64)
The vessel’s own length overall, metres, from design.length’s own
overall field – static hull data, same delivery as
Measurement::MaximumDraft and for the same reason.
DesignBeam(f64)
The vessel’s own beam (maximum width), metres, from design.beam.
Unlike Measurement::MaximumDraft/Measurement::DesignLength,
the schema gives beam no sibling fields to choose among – it is
already the one number this is.
WindAngleApparent(f64)
Apparent wind angle, degrees off the bow, positive to starboard – converted from Signal K’s radians, which already carry the same convention the other way round (“negative to port”).
WindSpeedApparent(f64)
Apparent wind speed in knots, converted from metres per second.
WindDirectionTrue(f64)
True wind direction, degrees true – an absolute bearing relative
to true north, not an angle off the bow, converted from Signal K’s
radians. Published only by a server whose own instruments (or a
calculation plugin) have already done the wind-triangle work; see
WindAngleApparent for the raw
reading every installation has instead.
WindSpeedTrue(f64)
True wind speed in knots, converted from metres per second.
AnchorPosition(Option<Position>)
The anchor watch’s own position, navigation.anchor.position –
None when the path is explicitly nulled, which is how
signalk-anchoralarm-plugin (and, per the Signal K convention it
follows, any other implementation of this path) reports the
anchor raised, confirmed live against a running server. Distinct
from every other Measurement here in that a None is itself
meaningful and must overwrite whatever a reader kept from before
– there is no staleness to lean on the way there is for a fix
that simply stops arriving.
AnchorMaxRadius(Option<f64>)
The anchor watch’s own swing radius, navigation.anchor.maxRadius,
metres. None on the same explicit-null convention as
AnchorPosition, which a real
server nulls at the same time as the position.
CourseNextPoint(Option<Position>)
Where the vessel is navigating towards right now,
navigation.course.nextPoint’s own position – Signal K’s
Course API, confirmed live against the reference implementation
bundled with signalk-server. None when the whole nextPoint
is explicitly nulled, the same convention
AnchorPosition uses: the server
sends exactly that the moment nothing is being followed any more
(course cleared, or never set), and that null is itself the
answer to “is a route currently active”, not merely a value gone
stale.
CoursePreviousPoint(Option<Position>)
Where the vessel started navigating from, for whichever leg
CourseNextPoint is the far end
of – navigation.course.previousPoint’s own position. A fixed
point once following begins (confirmed live: the server reports
the vessel’s own position at that moment, type: "VesselPosition", not a continuously-updated “where I am now”),
which is what makes it usable as the from end of a cross-track
calculation at all – a leg that moved with the vessel would
always measure zero off itself. None on the same explicit-null
convention CourseNextPoint
itself uses.
CourseActiveRouteHref(Option<String>)
The href of whatever route is actively being followed,
navigation.course.activeRoute’s own href field – confirmed
live, the whole activeRoute object (href, name, reverse,
pointIndex, pointTotal) arrives as one delta at this path, not
nested the way CourseNextPoint’s
own position is. Only href is kept – the rest names how far
along the route the vessel already is, which
CourseNextPoint/
CoursePreviousPoint already
answer more directly – and it exists so a caller can fetch the
route’s own full geometry to draw, the one thing following a
route cannot otherwise show: which waypoints lie ahead, past the
leg actually underway. None on the same explicit-null
convention as the other two: a real server nulls the whole
activeRoute object, not just this field, the moment nothing is
being followed.
ResourceChanged
Something was created, updated, or deleted at
resources.<resource_type>.<id> – confirmed live against the
server’s own buildDeltaMsg (dist/api/resources/index.js):
broadcast on every POST/PUT/DELETE through the Resources
API, with no context field at all (resources are not
per-vessel the way navigation data is), which the None arm of
this module’s own context handling already treats as self – see
parse’s own doc.
Carries no more than “something changed here”, not the
resource’s own new value: that arrives as arbitrary JSON this
crate has no business parsing – signalk sits below
tracks/routes/waypoints in this workspace’s own one-way
dependency order (see this module’s own top doc), so it cannot
know their shapes, only that a path matching this pattern
exists. A caller reacts by asking again through the REST API it
already has working (the same request a mariner’s own Refresh
button already makes) rather than a second, parallel path
parsing this JSON that could drift from the first.
Trait Implementations§
Source§impl Clone for Measurement
impl Clone for Measurement
Source§fn clone(&self) -> Measurement
fn clone(&self) -> Measurement
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Measurement
impl Debug for Measurement
Source§impl PartialEq for Measurement
impl PartialEq for Measurement
Source§fn eq(&self, other: &Measurement) -> bool
fn eq(&self, other: &Measurement) -> bool
self and other values to be equal, and is used by ==.