Skip to main content

Module polar

Module polar 

Source
Expand description

A boat’s own performance polar, in Signal K’s own shape.

performance.polars (a map of UUID to polar), performance.activePolar (which UUID is in effect) and performance.activePolarData (that one’s own data) are a real, schema-defined convention – see @signalk/signalk-schema’s own performance.json group. Reading and writing that shape is what this module is for; deciding when to fetch or publish it, and which UUID is active, is a caller’s concern, the same distance crate::delta keeps from deciding when to open a connection.

§Why this is stored on the server, not locally

A polar stored only on one device is the same kind of state routes/waypoints already avoid caching locally, for the same reason: every device on the boat should see the same polar, regardless of which one built or edited it.

Structs§

PolarResource
A polar, with the identifying metadata Signal K’s own schema carries alongside the table itself – one entry of performance.polars.

Enums§

PolarResourceError
Something wrong with a polar resource on the wire.

Functions§

parse
Reads one polar resource – the object at one UUID under performance.polars, or the whole of performance.activePolarData.
to_json
Writes one polar resource back out in Signal K’s own shape, suitable for a PUT to performance.polars.<id> or performance.activePolarData.