C# 클래스 GSF.IO.Checksums.Crc16

Generates a byte-wise 16-bit CRC calculation.

2-byte (16-bit) CRC: The generating polynomial is

16 15 2 1

G(X) = X + X + X + X

파일 보기 프로젝트 열기: GridProtectionAlliance/gsf 1 사용 예제들

공개 메소드들

메소드 설명
Crc16 ( ) : System

Creates a new instance of the Crc16 class. The checksum starts off with a value of 0x0000.

Crc16 ( ChecksumType checksumType ) : System

Creates a new instance of the Crc16 class.

Reset ( ) : void

Resets the CRC-16 data checksum as if no update was ever called.

Reset ( ChecksumType checksumType ) : void

Resets the CRC-16 data checksum as if no update was ever called.

Update ( byte value ) : void

Updates the checksum with the byte value.

Update ( byte buffer, int offset, int count ) : void

Adds the byte array to the data checksum.

메소드 상세

Crc16() 공개 메소드

Creates a new instance of the Crc16 class. The checksum starts off with a value of 0x0000.
public Crc16 ( ) : System
리턴 System

Crc16() 공개 메소드

Creates a new instance of the Crc16 class.
public Crc16 ( ChecksumType checksumType ) : System
checksumType ChecksumType /// Type of calculation to perform, CRC-16 or ModBus. ///
리턴 System

Reset() 공개 메소드

Resets the CRC-16 data checksum as if no update was ever called.
public Reset ( ) : void
리턴 void

Reset() 공개 메소드

Resets the CRC-16 data checksum as if no update was ever called.
public Reset ( ChecksumType checksumType ) : void
checksumType ChecksumType Type of CRC calculation. CRC-16 resets to 0x0000, ModBus resets to 0xFFFF
리턴 void

Update() 공개 메소드

Updates the checksum with the byte value.
public Update ( byte value ) : void
value byte The value to use for the update.
리턴 void

Update() 공개 메소드

Adds the byte array to the data checksum.
public Update ( byte buffer, int offset, int count ) : void
buffer byte The buffer which contains the data
offset int The offset in the buffer where the data starts
count int The number of data bytes to update the CRC with.
리턴 void