SetMagOffsets.parse constructor

SetMagOffsets.parse(
  1. ByteData data_
)

Implementation

factory SetMagOffsets.parse(ByteData data_) {
  if (data_.lengthInBytes < SetMagOffsets.mavlinkEncodedLength) {
    var len = SetMagOffsets.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var magOfsX = data_.getInt16(0, Endian.little);
  var magOfsY = data_.getInt16(2, Endian.little);
  var magOfsZ = data_.getInt16(4, Endian.little);
  var targetSystem = data_.getUint8(6);
  var targetComponent = data_.getUint8(7);

  return SetMagOffsets(
      magOfsX: magOfsX,
      magOfsY: magOfsY,
      magOfsZ: magOfsZ,
      targetSystem: targetSystem,
      targetComponent: targetComponent);
}