Skip to main content

Module course

Module course 

Source
Expand description

Starting and stopping active route following, on the wire.

Distinct from crate::resources (which only ever stores a route, never sails one) and from crate::anchor (a plain data-model path with no server-side logic behind it): navigation.course.* is Signal K’s own Course API, a dedicated REST resource with a handler that resolves a route resource, decides which waypoint is next, and publishes that back out as navigation.course.nextPoint/ previousPoint deltas. That handler is why this module exists rather than one more anchor-style bare-value PUT. Confirmed against the Course API bundled with signalk-server (dist/api/course):

  • It lives under /signalk/v2/api/vessels/self/navigation/course, one full API version ahead of the plain /v1/api/... data-model paths crate::anchor PUTs to: the v1 path answers a bare 404, the v2 one a real CourseInfo body. Sharing the rest of the path with anchor (vessels/self/navigation/...) does not carry over.
  • PUT .../activeRoute takes the destination body unwrapped ({"href": ..., "pointIndex": ...} directly, not {"value": {...}}} the way anchor’s plain data-model paths do, since this is a REST resource endpoint, not a generic value write), and replies with the exact state/statusCode/message shape crate::anchor::read_request_response already reads, reused here rather than duplicated.
  • DELETE .../course (the bare path, no /activeRoute suffix) is how the server defines “stop”, not a PUT of null.
  • PUT .../activeRoute/nextPoint, value {"value": 1}, advances pointIndex by one; the server recomputes nextPoint/ previousPoint itself from the route’s own geometry (confirmed by reading the server’s own handler, dist/api/course, the activeRoute/:action route).

Reading back what is being followed (nextPoint, previousPoint) is not this module’s job: a client watches the delta stream for that, the same way crate::anchor’s own doc explains for navigation.anchor.position. This module provides only the write half: starting or stopping the follow.

Structs§

Client
A client for starting or stopping active route following on one server.