proximity1#
CCSDS Proximity-1 Space Link Protocol for OCaml.
Proximity-1 is a short-range data-link protocol for space-to-space
relay — the classic use case is a Mars orbiter talking to a surface
rover. proximity1 encodes and decodes Transfer Frames (a 7-byte
header plus variable-length data) per CCSDS 211.0-B-5, with
support for Data, Ack, and Expedited frame types.
Installation#
Install with opam:
$ opam install proximity1
If opam cannot find the package, it may not yet be released in the
public opam-repository. Add the overlay repository, then install
it:
$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install proximity1
Usage#
Round-trip a Data frame through the wire format:
# let frame =
{ Proximity1.version = 0;
scid = 42;
frame_type = Proximity1.Data;
sequence_count = 100;
data = "telemetry" } in
let wire = Proximity1.encode frame in
match Proximity1.decode wire with
| Ok f -> Proximity1.equal f frame
| Error _ -> false
- : bool = true
The header is a fixed 7 bytes:
# let frame =
{ Proximity1.version = 0;
scid = 1;
frame_type = Proximity1.Ack;
sequence_count = 7;
data = "" } in
String.length (Proximity1.encode frame) - Proximity1.header_size
- : int = 0
decode reports a truncated buffer or an unknown frame type
explicitly, so the caller can distinguish "need more bytes" from
"unrecognized traffic":
# Proximity1.decode "short"
- : (Proximity1.t, [ `Invalid_frame_type of int | `Truncated ]) result =
Error `Truncated
Licence#
ISC