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#
opam install aos
Usage#
(* Decode an AOS frame *)
let () =
let buf = (* ... frame bytes ... *) in
match Aos.decode buf with
| Error e -> Printf.printf "Error: %a\n" Aos.pp_error e
| Ok frame ->
Printf.printf "SCID: %d, VCID: %d, Data: %d bytes\n"
(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 () =
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
Printf.printf "Encoded: %d bytes\n" (String.length encoded)
(* Create a frame with CLCW *)
let () =
let scid = Aos.scid_exn 42 in
let vcid = Aos.vcid_exn 5 in
let clcw_vcid = Clcw.vcid_exn 5 in
let clcw = Clcw.v ~vcid:clcw_vcid ~report_value:100 () in
let frame = Aos.with_clcw ~scid ~vcid ~vcfc:1 ~clcw "data" in
let encoded = Aos.encode frame in
Printf.printf "Frame with CLCW: %d bytes\n" (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