Checksum

@SerialInfo
@Target(allowedTargets = [AnnotationTarget.CLASS])
annotation class Checksum(val width: Int, val polynomial: ULong, val init: ULong, val xorOut: ULong, val reflectIn: Boolean = false, val reflectOut: Boolean = false)

Annotation added for serializing using BluetoothFormat

Adds a com.splendo.kaluga.base.bytes.CRC value of size width to the end of the body (before any prefix) If the decoded checksum does not match the calculated checksum of the body and BluetoothFormat.validateChecksum is true will result in a InvalidChecksumException.

Parameters

width

the width of the CRC in bits. Must be between 1 and 64 bits.

polynomial

the polynomial used to compute the CRC.

init

the initial value of the CRC.

xorOut

the value to XOR with the result to get the final CRC.

reflectIn

whether to reflect the input bytes before computing the CRC.

reflectOut

whether to reflect the output bytes after computing the CRC.

See also

Properties

Link copied to clipboard
val init: ULong
Link copied to clipboard
Link copied to clipboard
val reflectIn: Boolean = false
Link copied to clipboard
val reflectOut: Boolean = false
Link copied to clipboard
val width: Int
Link copied to clipboard