Added default formatters + error handling

This commit is contained in:
2022-04-09 12:34:15 -06:00
parent f8ba81e2ca
commit 59351fb699
8 changed files with 337 additions and 21 deletions
+49
View File
@@ -5,6 +5,7 @@
# Example Packet:
# [0xe0, 0xa1, 0xc0, 0x00, 0x00, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05]
# CCSDS packet w/ primary header + payload
[[formats]]
name = "ccsds"
bit_flip = false
@@ -47,3 +48,51 @@ field_type = {type = "UInt", bit_width = 16, endianness = "BigEndian"}
name = "Data"
# Allow payloads up to the max size that can be specfied in "Data Length"
field_type = {type = "Bytes", max_len = 65535, endianness = "BigEndian"}
# CCSDS packet w/ primary header + secondary header + payload
[[formats]]
name = "ccsds_sec"
bit_flip = false
[[formats.fields]]
name = "Version Number"
bit_flip = true
field_type = {type = "UInt", bit_width = 3, endianness = "BigEndian"}
[[formats.fields]]
name = "Packet Type"
bit_flip = true
field_type = {type = "UInt", bit_width = 1, endianness = "BigEndian"}
[[formats.fields]]
name = "Secondary Header Flag"
bit_flip = true
field_type = {type = "UInt", bit_width = 1, endianness = "BigEndian"}
[[formats.fields]]
name = "APID"
bit_flip = true
field_type = {type = "UInt", bit_width = 11, endianness = "BigEndian"}
[[formats.fields]]
name = "Sequence Flags"
bit_flip = true
field_type = {type = "UInt", bit_width = 2, endianness = "BigEndian"}
[[formats.fields]]
name = "Packet Sequence Count"
bit_flip = true
field_type = {type = "UInt", bit_width = 14, endianness = "BigEndian"}
[[formats.fields]]
name = "Data Length"
field_type = {type = "UInt", bit_width = 16, endianness = "BigEndian"}
[[formats.fields]]
name = "Secondary header"
field_type = {type = "Bytes", max_len = 8, endianness = "BigEndian"}
[[formats.fields]]
name = "data"
# allow payloads up to the max size that can be specfied in "data length"
field_type = {type = "Bytes", max_len = 65535, endianness = "BigEndian"}
+8
View File
@@ -0,0 +1,8 @@
# Built-In Formats
All formats in this directory are automatically included in the formaty binary. Additional formats can be included
at run time by using the `--config` flag.
## Formats Included
* [CCSDS](ccsds.toml) - Standard CCSDS command/tlm packets
* `ccsds`: CCSDS packet with primary header + raw payload
* `ccsds_sec`: CCSDS packet with primary header + secondary header + raw payload