ocaml-aos#
CCSDS AOS (Advanced Orbiting Systems) Transfer Frame parser and encoder.
AOS frames are defined in CCSDS 732.0-B-4 and used for high-rate downlinks from satellites.
Installation#
Install with opam:
$ opam install aos
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 aos
Usage#
(* Decode an AOS frame *)
let decode buf =
match Aos.decode buf with
| Error e -> Fmt.pr "Error: %a@." Aos.pp_error e
| Ok frame ->
Fmt.pr "SCID: %d, VCID: %d, Data: %d bytes@."
(Aos.scid_to_int frame.header.scid)
(Aos.vcid_to_int frame.header.vcid)
(String.length frame.data)
(* Create and encode an AOS frame *)
let encode_simple () =
let scid = Aos.scid_exn 42 in
let vcid = Aos.vcid_exn 5 in
let frame = Aos.v ~scid ~vcid ~vcfc:12345 "payload data" in
let encoded = Aos.encode frame in
Fmt.pr "Encoded: %d bytes@." (String.length encoded)
(* Create a frame with CLCW *)
let encode_with_clcw () =
let scid = Aos.scid_exn 42 in
let vcid = Aos.vcid_exn 5 in
let clcw = Clcw.v ~vcid:5 ~report_value:100 () in
let frame = Aos.with_clcw ~scid ~vcid ~vcfc:1 ~clcw "data" in
let encoded = Aos.encode frame in
Fmt.pr "Frame with CLCW: %d bytes@." (String.length encoded)
Frame Format#
Primary header (6 bytes):
Byte 0-1: TFVN(2b) | SCID(8b) | VCID(6b)
Byte 2-4: VC Frame Count (24b)
Byte 5: RF(1b) | SF(1b) | spare(2b) | VFCC(4b)
Optional insert zone (variable)
Data field (variable)
Optional OCF (4 bytes) - Contains CLCW
Optional FECF (2 bytes) - CRC-16-CCITT
Licence#
MIT