HilRcInputsRaw.parse constructor

HilRcInputsRaw.parse(
  1. ByteData data_
)

Implementation

factory HilRcInputsRaw.parse(ByteData data_) {
  if (data_.lengthInBytes < HilRcInputsRaw.mavlinkEncodedLength) {
    var len = HilRcInputsRaw.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUsec = data_.getUint64(0, Endian.little);
  var chan1Raw = data_.getUint16(8, Endian.little);
  var chan2Raw = data_.getUint16(10, Endian.little);
  var chan3Raw = data_.getUint16(12, Endian.little);
  var chan4Raw = data_.getUint16(14, Endian.little);
  var chan5Raw = data_.getUint16(16, Endian.little);
  var chan6Raw = data_.getUint16(18, Endian.little);
  var chan7Raw = data_.getUint16(20, Endian.little);
  var chan8Raw = data_.getUint16(22, Endian.little);
  var chan9Raw = data_.getUint16(24, Endian.little);
  var chan10Raw = data_.getUint16(26, Endian.little);
  var chan11Raw = data_.getUint16(28, Endian.little);
  var chan12Raw = data_.getUint16(30, Endian.little);
  var rssi = data_.getUint8(32);

  return HilRcInputsRaw(
      timeUsec: timeUsec,
      chan1Raw: chan1Raw,
      chan2Raw: chan2Raw,
      chan3Raw: chan3Raw,
      chan4Raw: chan4Raw,
      chan5Raw: chan5Raw,
      chan6Raw: chan6Raw,
      chan7Raw: chan7Raw,
      chan8Raw: chan8Raw,
      chan9Raw: chan9Raw,
      chan10Raw: chan10Raw,
      chan11Raw: chan11Raw,
      chan12Raw: chan12Raw,
      rssi: rssi);
}