OpenDroneIdSystem.parse constructor

OpenDroneIdSystem.parse(
  1. ByteData data_
)

Implementation

factory OpenDroneIdSystem.parse(ByteData data_) {
  if (data_.lengthInBytes < OpenDroneIdSystem.mavlinkEncodedLength) {
    var len = OpenDroneIdSystem.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var operatorLatitude = data_.getInt32(0, Endian.little);
  var operatorLongitude = data_.getInt32(4, Endian.little);
  var areaCeiling = data_.getFloat32(8, Endian.little);
  var areaFloor = data_.getFloat32(12, Endian.little);
  var operatorAltitudeGeo = data_.getFloat32(16, Endian.little);
  var timestamp = data_.getUint32(20, Endian.little);
  var areaCount = data_.getUint16(24, Endian.little);
  var areaRadius = data_.getUint16(26, Endian.little);
  var targetSystem = data_.getUint8(28);
  var targetComponent = data_.getUint8(29);
  var idOrMac = MavlinkMessage.asUint8List(data_, 30, 20);
  var operatorLocationType = data_.getUint8(50);
  var classificationType = data_.getUint8(51);
  var categoryEu = data_.getUint8(52);
  var classEu = data_.getUint8(53);

  return OpenDroneIdSystem(
      operatorLatitude: operatorLatitude,
      operatorLongitude: operatorLongitude,
      areaCeiling: areaCeiling,
      areaFloor: areaFloor,
      operatorAltitudeGeo: operatorAltitudeGeo,
      timestamp: timestamp,
      areaCount: areaCount,
      areaRadius: areaRadius,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      idOrMac: idOrMac,
      operatorLocationType: operatorLocationType,
      classificationType: classificationType,
      categoryEu: categoryEu,
      classEu: classEu);
}