generatePayloadChecksum static method

int generatePayloadChecksum(
  1. Uint8List payload
)

Implementation

static int generatePayloadChecksum(Uint8List payload) {
  int checksum = 0;

  for (int byte in payload) {
    if (byte >= 0) {
      checksum += byte;
    } else {
      checksum += 256 + byte;
    }
  }
  return checksum;
}