TerrainData.parse constructor

TerrainData.parse(
  1. ByteData data_
)

Implementation

factory TerrainData.parse(ByteData data_) {
  if (data_.lengthInBytes < TerrainData.mavlinkEncodedLength) {
    var len = TerrainData.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var lat = data_.getInt32(0, Endian.little);
  var lon = data_.getInt32(4, Endian.little);
  var gridSpacing = data_.getUint16(8, Endian.little);
  var data = MavlinkMessage.asInt16List(data_, 10, 16);
  var gridbit = data_.getUint8(42);

  return TerrainData(
      lat: lat,
      lon: lon,
      gridSpacing: gridSpacing,
      data: data,
      gridbit: gridbit);
}