ParamValue.parse constructor

ParamValue.parse(
  1. ByteData data_
)

Implementation

factory ParamValue.parse(ByteData data_) {
  if (data_.lengthInBytes < ParamValue.mavlinkEncodedLength) {
    var len = ParamValue.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var paramValue = data_.getFloat32(0, Endian.little);
  var paramCount = data_.getUint16(4, Endian.little);
  var paramIndex = data_.getUint16(6, Endian.little);
  var paramId = MavlinkMessage.asInt8List(data_, 8, 16);
  var paramType = data_.getUint8(24);

  return ParamValue(
      paramValue: paramValue,
      paramCount: paramCount,
      paramIndex: paramIndex,
      paramId: paramId,
      paramType: paramType);
}