Pummpcomm v2.5.1 Pummpcomm.Crc.Crc16 View Source

16-bit Cyclic Redundancy Check.

Link to this section Summary

Functions

Checks CRC16 sent in page matches CRC16 calculated from rest of page

CRC16 of binary

The section of page that does not contain the crc_data

Link to this section Functions

Link to this function check_crc_16(page) View Source
check_crc_16(binary) ::
  {:error, String.t} |
  {:fail, String.t} |
  {:ok, non_neg_integer}

Checks CRC16 sent in page matches CRC16 calculated from rest of page.

Returns

  • {:error, "Page is too short"} - if the page is too short
  • {:fail, "<actual-crc-16> does not match <expected-crc-16>"} - CRC16 in page does not match calculated CRC16 for page
  • {:ok, expected_crc16} - expected_crc16 extracted from page.
Link to this function crc_16(binary) View Source
crc_16(binary) :: non_neg_integer

CRC16 of binary

Link to this function page_data(page) View Source
page_data(binary) :: binary

The section of page that does not contain the crc_data