Skip to main content

Crate navcore_signalk_client

Crate navcore_signalk_client 

Source
Expand description

The wire to a Signal K server.

This crate handles everything that touches the network. [signalk] reads a delta and reconciles sources as a pure function of what it is handed; this crate finds a server, gets let in, and keeps the socket open.

The separation lets the delta reader, the unit conversions and the handover between two position sources be tested without a boat, a network or a server, and lets a recorded passage be replayed through exactly the code that sailed it.

§The three steps

discovery listens for servers announcing themselves over mDNS. The announcement carries the vessel’s own identifier, so nothing has to be configured by hand.

access asks for a token and waits for a human to approve it, once. token reads what an approved token says about itself; a token already held is read again on every start, independent of the request that won it.

stream opens the data stream and keeps it open, reconnecting for as long as it is asked to. Failure is reported as a state, not as an error to abort on: when a wireless link on a boat drops, the fix goes visibly stale rather than the connection stopping.

Re-exports§

pub use access::Access;
pub use access::PendingRequest;
pub use access::Permissions;
pub use access::Requested;
pub use access::check_access;
pub use access::request_access;
pub use discovery::Discovery;
pub use discovery::Server;
pub use discovery::discover;
pub use discovery::resolve_stated_server;
pub use onboard::Credentials;
pub use onboard::Onboard;
pub use onboard::Onboarding;
pub use onboard::Stage;
pub use server_info::fetch as fetch_server_info;
pub use server_info::ServerInfo;
pub use units::fetch_active as fetch_active_units;
pub use stream::Connection;
pub use stream::Event;
pub use token::Token;
pub use trust::Trust;

Modules§

access
Being let in.
anchor
Setting the anchor watch, on the wire.
course
Starting and stopping active route following, on the wire.
discovery
Finding the server on the local network.
onboard
Getting let in, and staying that way – the one sequence every Signal K client goes through before it has anything else to do: find a server, connect if there is already a token, ask for one otherwise, wait for a human, and start over under a fresh token if the server ever takes an old one back.
resources
Standalone waypoints and routes, on the wire.
server_info
Fetching the server’s own identity off the wire.
stream
Keeping the data stream open.
token
Reading what a Signal K device token says about itself.
trust
Deciding which server is the boat’s.
units
Fetching a mariner’s own display units off the wire.

Enums§

ClientError
Anything that can go wrong on the way to a server.