Function check_controllino_checksums

Source
fn check_controllino_checksums(data: &[u8]) -> bool
Expand description

Calculates and validates the checksums of a byte sequence received from the Controllino.

This private helper function computes two XOR-based checksums from specific bytes within the input data array and compares them against the checksums embedded in the received data itself. It’s crucial for verifying the integrity of messages sent by the Controllino device.

If the checksums do not match, a warning is logged with detailed information about the discrepancy, aiding in debugging communication issues.

§Arguments

  • data - A slice of u8 bytes representing the message received from the Controllino. It is expected to be at least 8 bytes long.

§Returns

  • true: If both calculated checksums match the received checksums, indicating data integrity.
  • false: If the checksums do not match.