FlexifunctionBufferFunction.parse constructor

FlexifunctionBufferFunction.parse(
  1. ByteData data_
)

Implementation

factory FlexifunctionBufferFunction.parse(ByteData data_) {
  if (data_.lengthInBytes <
      FlexifunctionBufferFunction.mavlinkEncodedLength) {
    var len = FlexifunctionBufferFunction.mavlinkEncodedLength -
        data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var funcIndex = data_.getUint16(0, Endian.little);
  var funcCount = data_.getUint16(2, Endian.little);
  var dataAddress = data_.getUint16(4, Endian.little);
  var dataSize = data_.getUint16(6, Endian.little);
  var targetSystem = data_.getUint8(8);
  var targetComponent = data_.getUint8(9);
  var data = MavlinkMessage.asInt8List(data_, 10, 48);

  return FlexifunctionBufferFunction(
      funcIndex: funcIndex,
      funcCount: funcCount,
      dataAddress: dataAddress,
      dataSize: dataSize,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      data: data);
}