Closed All4Gis closed 6 years ago
Good morning Francisco,
Unless you are validating KLV packets or authoring KLV packets your usecase may not require you to use the packet_checksum function.
klvdata.common.packet_checksum(data) takes a KLV packet as an array of bytes and calculates the checksum of the packet. The function assumes the KLV packet passed in contains as its final element a checksum. The included checksum is ignored.
Implementers validating KLV packets require this function. MISB ST 0601.8-08 states, “All instances of a UAS Datalink LS where the computed checksum is not identical to the included checksum shall be discarded.”
Implementers authoring KLV packets require this function. MISB ST 0601.8-11 states, “All instances of the UAS Datalink LS shall contain as the final element Tag 1, (Checksum).”
There are two tests in test.test_common.Checksum that exercise the packet_checksum functionality.
The klvdata.msb0601.Checksum BytesElementParser is used in the klvdata system when parsing the MISB ST 0601 Local Set (LS) tag 1 “Checksum”. It is simply a two byte array as received in the KLV packet. The Checksum ElementParser does not utilize the packet_checksum function.
There is one test in test.test_misb_0601.ParserSingleShort.test_checksum that exercises the Checksum ElementParser functionality.
I hope this information helps, -Matt
Hi.
CheckSum is not decode correctly.
Example values: bytes: b'f\xbd' bytes: b']\x8c'
Return in a video,but if use:
class BytesValue(BaseValue): def init(self, value): self.value = packet_checksum(value)
Always return bytes: b'\x00\x00'
I don't undertand the function packet_checksum and never use it.
Can you explain me this function?