RcChannelsScaled.parse constructor

RcChannelsScaled.parse(
  1. ByteData data_
)

Implementation

factory RcChannelsScaled.parse(ByteData data_) {
  if (data_.lengthInBytes < RcChannelsScaled.mavlinkEncodedLength) {
    var len = RcChannelsScaled.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeBootMs = data_.getUint32(0, Endian.little);
  var chan1Scaled = data_.getInt16(4, Endian.little);
  var chan2Scaled = data_.getInt16(6, Endian.little);
  var chan3Scaled = data_.getInt16(8, Endian.little);
  var chan4Scaled = data_.getInt16(10, Endian.little);
  var chan5Scaled = data_.getInt16(12, Endian.little);
  var chan6Scaled = data_.getInt16(14, Endian.little);
  var chan7Scaled = data_.getInt16(16, Endian.little);
  var chan8Scaled = data_.getInt16(18, Endian.little);
  var port = data_.getUint8(20);
  var rssi = data_.getUint8(21);

  return RcChannelsScaled(
      timeBootMs: timeBootMs,
      chan1Scaled: chan1Scaled,
      chan2Scaled: chan2Scaled,
      chan3Scaled: chan3Scaled,
      chan4Scaled: chan4Scaled,
      chan5Scaled: chan5Scaled,
      chan6Scaled: chan6Scaled,
      chan7Scaled: chan7Scaled,
      chan8Scaled: chan8Scaled,
      port: port,
      rssi: rssi);
}