DataTransmissionHandshake.parse constructor

DataTransmissionHandshake.parse(
  1. ByteData data_
)

Implementation

factory DataTransmissionHandshake.parse(ByteData data_) {
  if (data_.lengthInBytes < DataTransmissionHandshake.mavlinkEncodedLength) {
    var len =
        DataTransmissionHandshake.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var size = data_.getUint32(0, Endian.little);
  var width = data_.getUint16(4, Endian.little);
  var height = data_.getUint16(6, Endian.little);
  var packets = data_.getUint16(8, Endian.little);
  var type = data_.getUint8(10);
  var payload = data_.getUint8(11);
  var jpgQuality = data_.getUint8(12);

  return DataTransmissionHandshake(
      size: size,
      width: width,
      height: height,
      packets: packets,
      type: type,
      payload: payload,
      jpgQuality: jpgQuality);
}