HilGps.parse constructor

HilGps.parse(
  1. ByteData data_
)

Implementation

factory HilGps.parse(ByteData data_) {
  if (data_.lengthInBytes < HilGps.mavlinkEncodedLength) {
    var len = HilGps.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUsec = data_.getUint64(0, Endian.little);
  var lat = data_.getInt32(8, Endian.little);
  var lon = data_.getInt32(12, Endian.little);
  var alt = data_.getInt32(16, Endian.little);
  var eph = data_.getUint16(20, Endian.little);
  var epv = data_.getUint16(22, Endian.little);
  var vel = data_.getUint16(24, Endian.little);
  var vn = data_.getInt16(26, Endian.little);
  var ve = data_.getInt16(28, Endian.little);
  var vd = data_.getInt16(30, Endian.little);
  var cog = data_.getUint16(32, Endian.little);
  var fixType = data_.getUint8(34);
  var satellitesVisible = data_.getUint8(35);
  var id = data_.getUint8(36);
  var yaw = data_.getUint16(37, Endian.little);

  return HilGps(
      timeUsec: timeUsec,
      lat: lat,
      lon: lon,
      alt: alt,
      eph: eph,
      epv: epv,
      vel: vel,
      vn: vn,
      ve: ve,
      vd: vd,
      cog: cog,
      fixType: fixType,
      satellitesVisible: satellitesVisible,
      id: id,
      yaw: yaw);
}