OpenDroneIdLocation.parse constructor

OpenDroneIdLocation.parse(
  1. ByteData data_
)

Implementation

factory OpenDroneIdLocation.parse(ByteData data_) {
  if (data_.lengthInBytes < OpenDroneIdLocation.mavlinkEncodedLength) {
    var len = OpenDroneIdLocation.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var latitude = data_.getInt32(0, Endian.little);
  var longitude = data_.getInt32(4, Endian.little);
  var altitudeBarometric = data_.getFloat32(8, Endian.little);
  var altitudeGeodetic = data_.getFloat32(12, Endian.little);
  var height = data_.getFloat32(16, Endian.little);
  var timestamp = data_.getFloat32(20, Endian.little);
  var direction = data_.getUint16(24, Endian.little);
  var speedHorizontal = data_.getUint16(26, Endian.little);
  var speedVertical = data_.getInt16(28, Endian.little);
  var targetSystem = data_.getUint8(30);
  var targetComponent = data_.getUint8(31);
  var idOrMac = MavlinkMessage.asUint8List(data_, 32, 20);
  var status = data_.getUint8(52);
  var heightReference = data_.getUint8(53);
  var horizontalAccuracy = data_.getUint8(54);
  var verticalAccuracy = data_.getUint8(55);
  var barometerAccuracy = data_.getUint8(56);
  var speedAccuracy = data_.getUint8(57);
  var timestampAccuracy = data_.getUint8(58);

  return OpenDroneIdLocation(
      latitude: latitude,
      longitude: longitude,
      altitudeBarometric: altitudeBarometric,
      altitudeGeodetic: altitudeGeodetic,
      height: height,
      timestamp: timestamp,
      direction: direction,
      speedHorizontal: speedHorizontal,
      speedVertical: speedVertical,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      idOrMac: idOrMac,
      status: status,
      heightReference: heightReference,
      horizontalAccuracy: horizontalAccuracy,
      verticalAccuracy: verticalAccuracy,
      barometerAccuracy: barometerAccuracy,
      speedAccuracy: speedAccuracy,
      timestampAccuracy: timestampAccuracy);
}