GpsRawInt.parse constructor

GpsRawInt.parse(
  1. ByteData data_
)

Implementation

factory GpsRawInt.parse(ByteData data_) {
  if (data_.lengthInBytes < GpsRawInt.mavlinkEncodedLength) {
    var len = GpsRawInt.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 cog = data_.getUint16(26, Endian.little);
  var fixType = data_.getUint8(28);
  var satellitesVisible = data_.getUint8(29);
  var altEllipsoid = data_.getInt32(30, Endian.little);
  var hAcc = data_.getUint32(34, Endian.little);
  var vAcc = data_.getUint32(38, Endian.little);
  var velAcc = data_.getUint32(42, Endian.little);
  var hdgAcc = data_.getUint32(46, Endian.little);
  var yaw = data_.getUint16(50, Endian.little);

  return GpsRawInt(
      timeUsec: timeUsec,
      lat: lat,
      lon: lon,
      alt: alt,
      eph: eph,
      epv: epv,
      vel: vel,
      cog: cog,
      fixType: fixType,
      satellitesVisible: satellitesVisible,
      altEllipsoid: altEllipsoid,
      hAcc: hAcc,
      vAcc: vAcc,
      velAcc: velAcc,
      hdgAcc: hdgAcc,
      yaw: yaw);
}