XBee C# library API reference

Show / Hide Table of Contents

Class XBeeChecksum

This class stores, computes and verifies the checksum of the API packets.

Inheritance
System.Object
XBeeChecksum
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: XBeeLibrary.Core.Packet
Assembly: XBeeLibrary.Core.dll
Syntax
public class XBeeChecksum
Remarks

To test data integrity, a checksum is calculated and verified on non-escaped API data.

To calculate

Not including frame delimiters and Length, add all bytes keeping only the lowest 8 bits of the result and subtract the result from 0xFF.

To verify

Add all bytes (include checksum, but not the delimiter and Length). If the checksum is correct, the sum will equal 0xFF.

Methods

Add(Byte[])

Adds the given data to the checksum.

Declaration
public void Add(byte[] data)
Parameters
Type Name Description
System.Byte[] data

Byte array to add.

Add(Int32)

Adds the given byte to the checksum.

Declaration
public void Add(int value)
Parameters
Type Name Description
System.Int32 value

Byte to add.

Generate()

Generates the checksum byte for the API packet.

Declaration
public byte Generate()
Returns
Type Description
System.Byte

Checksum byte.

Reset()

Resets the checksum.

Declaration
public void Reset()

Validate()

Validates the checksum.

Declaration
public bool Validate()
Returns
Type Description
System.Boolean

true if checksum is valid, false otherwise.

Product page More documentation Official site About Digi Contact us Support
©2019 Digi International Inc. All rights reserved.
Digi International Inc.