ApAdc.parse constructor

ApAdc.parse(
  1. ByteData data_
)

Implementation

factory ApAdc.parse(ByteData data_) {
  if (data_.lengthInBytes < ApAdc.mavlinkEncodedLength) {
    var len = ApAdc.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var adc1 = data_.getUint16(0, Endian.little);
  var adc2 = data_.getUint16(2, Endian.little);
  var adc3 = data_.getUint16(4, Endian.little);
  var adc4 = data_.getUint16(6, Endian.little);
  var adc5 = data_.getUint16(8, Endian.little);
  var adc6 = data_.getUint16(10, Endian.little);

  return ApAdc(
      adc1: adc1, adc2: adc2, adc3: adc3, adc4: adc4, adc5: adc5, adc6: adc6);
}