Fixed CCSDS parsing
+ Using bitvec now for parsing binary data + Fixed issues with how some data was handled across byte boundaries + Updated CCSDS def + Added test to verify good ccsds parsing + clippy + fmt
This commit is contained in:
+17
-14
@@ -3,7 +3,17 @@
|
||||
# Ref: https://public.ccsds.org/Pubs/133x0b2e1.pdfa
|
||||
#
|
||||
# Example Packet:
|
||||
# [0xe0, 0xa1, 0xc0, 0x00, 0x00, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05]
|
||||
# [0x12, 0x01, 0xc0, 0x00, 0x00, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05]
|
||||
#
|
||||
# Output:
|
||||
# Version Number: 0
|
||||
# Packet Type: 1
|
||||
# Secondary Header Flag: 0
|
||||
# APID: 0x201
|
||||
# Sequence Flags: 3
|
||||
# Packet Sequence Count: 0
|
||||
# Data Length: 5
|
||||
# Data: [1, 2, 3, 4, 5]
|
||||
|
||||
# CCSDS packet w/ primary header + payload
|
||||
[[formats]]
|
||||
@@ -12,33 +22,27 @@ 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
|
||||
print_type = {print = "Base", base = 16}
|
||||
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]]
|
||||
@@ -57,42 +61,41 @@ 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
|
||||
print_type = {print = "Base", base = 16}
|
||||
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 = "Data"
|
||||
# Allow payloads up to the max size that can be specfied in "Data Length"
|
||||
field_type = {type = "Bytes", max_len = 65535, endianness = "BigEndian"}
|
||||
|
||||
[[formats.fields]]
|
||||
name = "Secondary header"
|
||||
field_type = {type = "Bytes", max_len = 8, endianness = "BigEndian"}
|
||||
field_type = {type = "Bytes", max_len = 6, endianness = "BigEndian"}
|
||||
|
||||
[[formats.fields]]
|
||||
name = "data"
|
||||
|
||||
+11
-1
@@ -1,5 +1,15 @@
|
||||
# Example fields to show off configuration
|
||||
# Example data to use "[0x00, 0x55, 0xff, 0x43, 0xd2 0x99 0x90, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x57, 0x6f, 0x72, 0x6c, 0x64]"
|
||||
#
|
||||
# Example data:
|
||||
# "[0x00, 0x55, 0xff, 0x43, 0xd2 0x99 0x90, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x00, 0x57, 0x6f, 0x72, 0x6c, 0x64]"
|
||||
#
|
||||
# Example Output:
|
||||
# int field: 85
|
||||
# uint field: 0xf
|
||||
# uint field: 0xf
|
||||
# float field: 421.1997
|
||||
# string field: [72, 101, 108, 108, 111]
|
||||
# bytes field: [87, 111, 114, 108, 100]
|
||||
|
||||
[[formats]]
|
||||
# Format name
|
||||
|
||||
Reference in New Issue
Block a user