deserializePayload method

  1. @override
int deserializePayload(
  1. ReportControlBuilder builder,
  2. ByteData byteData,
  3. Endian endianness,
  4. int offset,
)
override

Call to deserialize only the payload, no header. The Builder is to allow passing the message to build into. returns a int with a serialized size

Implementation

@override
int deserializePayload(imc.ReportControlBuilder builder, ByteData byteData,
    Endian endianness, int offset) {
  var byteOffset = offset;

  // field op
  builder.op = imc.ReportControlEnumOp(byteData.getUint8(byteOffset));
  byteOffset += 1;
  // field commInterface
  builder.commInterface =
      imc.ReportControlBitfieldCommInterface(byteData.getUint8(byteOffset));
  byteOffset += 1;
  // field period
  builder.period = byteData.getUint16(byteOffset, endianness);
  byteOffset += 2;
  // field sysDst
  var sysDstSSize = byteData.getUint16(byteOffset, endianness);
  byteOffset += 2;
  var sysDstDData = List.filled(sysDstSSize, 0);
  for (var i = 0; i < sysDstSSize; i++) {
    sysDstDData[i] = byteData.getUint8(byteOffset++);
  }
  var sysDstDecoded = utf8.decode(sysDstDData);
  builder.sysDst = sysDstDecoded;

  return byteOffset - offset;
}