GpsStatus.parse constructor

GpsStatus.parse(
  1. ByteData data_
)

Implementation

factory GpsStatus.parse(ByteData data_) {
  if (data_.lengthInBytes < GpsStatus.mavlinkEncodedLength) {
    var len = GpsStatus.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var satellitesVisible = data_.getUint8(0);
  var satellitePrn = MavlinkMessage.asUint8List(data_, 1, 20);
  var satelliteUsed = MavlinkMessage.asUint8List(data_, 21, 20);
  var satelliteElevation = MavlinkMessage.asUint8List(data_, 41, 20);
  var satelliteAzimuth = MavlinkMessage.asUint8List(data_, 61, 20);
  var satelliteSnr = MavlinkMessage.asUint8List(data_, 81, 20);

  return GpsStatus(
      satellitesVisible: satellitesVisible,
      satellitePrn: satellitePrn,
      satelliteUsed: satelliteUsed,
      satelliteElevation: satelliteElevation,
      satelliteAzimuth: satelliteAzimuth,
      satelliteSnr: satelliteSnr);
}