GXPacket component calls this method when the checksum is counted.
- sender (GXPacket)
- Packet which checksum is counted.
- checksum ( Object %)
- Return Counted checksum.
- checksumType ( VariantType %)
- Return type of counted checksum.
If own checksum count is used, the SetChecksumParameters ChkType property must be set to Own (GX_CHK_OWN).
If checksum type is something different than Own (GX_CHK_OWN), this method is not called.
This event is called first time with empty data to resolve the size of used crc.
This event is called first time with empty data to resolve the size of used crc.
'Count checksum for packet. 'In this example checksum is the count of all data. 'Checksum is the count of data values of the added packet and it returns checksum as byte value. sub GXPacket1_CountChecksum(GXPacket sender, object Checksum, GX_VARTYPE ChecksumType) dim data, cnt, pos, 'Extract all data to the variable sender.ExtractData data, GX_VT_BYTE, 0, -1 cnt = UBound(data) Checksum = 0 for pos = 0 to cnt - 1 Checksum = Checksum + data(pos) next ChecksumType = GX_VT_BYTE end sub 'Note! 'Don't use this example to count checksum in real application. 'This is only an example and a simple one.
Assembly: Gurux.Client (Module: Gurux.Client) Version: 5.0.0.1