deserializePayload method

  1. @override
int deserializePayload(
  1. IridiumMsgRxBuilder 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.IridiumMsgRxBuilder builder, ByteData byteData,
    Endian endianness, int offset) {
  var byteOffset = offset;

  // field origin
  var originSSize = byteData.getUint16(byteOffset, endianness);
  byteOffset += 2;
  var originDData = List.filled(originSSize, 0);
  for (var i = 0; i < originSSize; i++) {
    originDData[i] = byteData.getUint8(byteOffset++);
  }
  var originDecoded = utf8.decode(originDData);
  builder.origin = originDecoded;
  // field htime
  builder.htime = byteData.getFloat64(byteOffset, endianness);
  byteOffset += 8;
  // field lat
  builder.lat = byteData.getFloat64(byteOffset, endianness);
  byteOffset += 8;
  // field lon
  builder.lon = byteData.getFloat64(byteOffset, endianness);
  byteOffset += 8;
  // field data
  var dataSSize = byteData.getUint16(byteOffset, endianness);
  byteOffset += 2;
  var dataDData = List.filled(dataSSize, 0);
  for (var i = 0; i < dataSSize; i++) {
    dataDData[i] = byteData.getUint8(byteOffset++);
  }
  builder.data = dataDData;

  return byteOffset - offset;
}