--- /dev/null
+module Datum = struct
+ type t =
+ { index : int
+ ; v1 : float
+ ; v2 : float
+ ; v3 : float
+ ; v4 : float
+ ; v5 : float
+ ; v6 : float
+ ; v7 : float
+ ; v8 : float
+ }
+
+ let of_bitstring bits =
+ bitmatch bits with
+ | { index : 32 : littleendian
+ ; v1 : 32 : littleendian
+ ; v2 : 32 : littleendian
+ ; v3 : 32 : littleendian
+ ; v4 : 32 : littleendian
+ ; v5 : 32 : littleendian
+ ; v6 : 32 : littleendian
+ ; v7 : 32 : littleendian
+ ; v8 : 32 : littleendian
+ } ->
+ { index = Int32.to_int index
+ ; v1 = Int32.float_of_bits v1
+ ; v2 = Int32.float_of_bits v2
+ ; v3 = Int32.float_of_bits v3
+ ; v4 = Int32.float_of_bits v4
+ ; v5 = Int32.float_of_bits v5
+ ; v6 = Int32.float_of_bits v6
+ ; v7 = Int32.float_of_bits v7
+ ; v8 = Int32.float_of_bits v8
+ }
+
+ let show {index; v1; v2; v3; v4; v5; v6; v7; v8} =
+ Printf.sprintf
+ "| %3d | %11f | %11f | %11f | %11f | %11f | %11f | %11f | %11f |"
+ index v1 v2 v3 v4 v5 v6 v7 v8
+end
+
+let sample_packet_base64 =
+ "REFUQUADAAAAbcpGQLt81EBfZNlATnUoNwDAecSow2RAnCv6QLrbQTcRAAAA3i8VQFL3ZT6dPfFCx4IFQwDAecQAwHnEAMB5xADAecQUAAAA1ZciQg6ik8JGBv9AdDxoPgAAgD9G/o3CAAAgQgAAlsI="
+
+let rec split blocks =
+ bitmatch blocks with
+ | { block : 36 * 8 : bitstring
+ ; blocks : -1 : bitstring
+ } ->
+ block :: (split blocks)
+ | {_ : 0 : bitstring} ->
+ []
+
+let main () =
+ let packet = B64.decode sample_packet_base64 in
+ let packet = Bitstring.bitstring_of_string packet in
+ ( bitmatch packet with
+ | { "DATA" : 4 * 8 : string
+ ; "@" : 1 * 8 : string
+ ; blocks : -1 : bitstring
+ } ->
+ let blocks = split blocks in
+ List.iter (fun b -> print_endline (Datum.show (Datum.of_bitstring b))) blocks;
+ )
+
+let () = main ()
\ No newline at end of file