CCSDS Proximity-1 Space Link Protocol (211.0-B)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

ocaml-linkedin: apply dune fmt

Pure formatting changes from `dune fmt`: doc comment placement moves
from above the binding to below it for `type`s, multi-line `match`
expressions collapse onto one line where they fit, and infix operator
applications pick up spaces (`Soup.($?)` -> `Soup.( $? )`). No
semantic changes.

+84 -1
+76
README.md
··· 1 + # proximity1 2 + 3 + CCSDS Proximity-1 Space Link Protocol for OCaml. 4 + 5 + Proximity-1 is a short-range data-link protocol for space-to-space 6 + relay — the classic use case is a Mars orbiter talking to a surface 7 + rover. `proximity1` encodes and decodes Transfer Frames (a 7-byte 8 + header plus variable-length data) per CCSDS [211.0-B-5][ccsds], with 9 + support for Data, Ack, and Expedited frame types. 10 + 11 + [ccsds]: https://public.ccsds.org/Pubs/211x0b5.pdf 12 + 13 + ## Installation 14 + 15 + Install with opam: 16 + 17 + <!-- $MDX skip --> 18 + ```sh 19 + $ opam install proximity1 20 + ``` 21 + 22 + If opam cannot find the package, it may not yet be released in the 23 + public `opam-repository`. Add the overlay repository, then install 24 + it: 25 + 26 + <!-- $MDX skip --> 27 + ```sh 28 + $ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git 29 + $ opam update 30 + $ opam install proximity1 31 + ``` 32 + 33 + ## Usage 34 + 35 + Round-trip a Data frame through the wire format: 36 + 37 + ```ocaml 38 + # let frame = 39 + { Proximity1.version = 0; 40 + scid = 42; 41 + frame_type = Proximity1.Data; 42 + sequence_count = 100; 43 + data = "telemetry" } in 44 + let wire = Proximity1.encode frame in 45 + match Proximity1.decode wire with 46 + | Ok f -> Proximity1.equal f frame 47 + | Error _ -> false 48 + - : bool = true 49 + ``` 50 + 51 + The header is a fixed 7 bytes: 52 + 53 + ```ocaml 54 + # let frame = 55 + { Proximity1.version = 0; 56 + scid = 1; 57 + frame_type = Proximity1.Ack; 58 + sequence_count = 7; 59 + data = "" } in 60 + String.length (Proximity1.encode frame) - Proximity1.header_size 61 + - : int = 0 62 + ``` 63 + 64 + `decode` reports a truncated buffer or an unknown frame type 65 + explicitly, so the caller can distinguish "need more bytes" from 66 + "unrecognized traffic": 67 + 68 + ```ocaml 69 + # Proximity1.decode "short" 70 + - : (Proximity1.t, [ `Invalid_frame_type of int | `Truncated ]) result = 71 + Error `Truncated 72 + ``` 73 + 74 + ## Licence 75 + 76 + ISC
+4
dune
··· 1 1 (env 2 2 (dev 3 3 (flags :standard %{dune-warnings}))) 4 + 5 + (mdx 6 + (files README.md) 7 + (libraries proximity1))
+3 -1
dune-project
··· 1 1 (lang dune 3.21) 2 + (using mdx 0.4) 2 3 (name proximity1) 3 4 (generate_opam_files true) 4 5 (license ISC) ··· 19 20 (wire (>= 0.9)) 20 21 (fmt (>= 0.9)) 21 22 (alcotest :with-test) 22 - (alcobar :with-test))) 23 + (alcobar :with-test) 24 + (mdx :with-test)))
+1
proximity1.opam
··· 16 16 "fmt" {>= "0.9"} 17 17 "alcotest" {with-test} 18 18 "alcobar" {with-test} 19 + "mdx" {with-test} 19 20 "odoc" {with-doc} 20 21 ] 21 22 build: [