RadioRcChannels.parse constructor

RadioRcChannels.parse(
  1. ByteData data_
)

Implementation

factory RadioRcChannels.parse(ByteData data_) {
  if (data_.lengthInBytes < RadioRcChannels.mavlinkEncodedLength) {
    var len = RadioRcChannels.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var count = data_.getUint8(0);
  var flags = data_.getUint8(1);
  var channels = MavlinkMessage.asInt16List(data_, 2, 24);

  return RadioRcChannels(count: count, flags: flags, channels: channels);
}