GpsInjectData.parse constructor

GpsInjectData.parse(
  1. ByteData data_
)

Implementation

factory GpsInjectData.parse(ByteData data_) {
  if (data_.lengthInBytes < GpsInjectData.mavlinkEncodedLength) {
    var len = GpsInjectData.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var targetSystem = data_.getUint8(0);
  var targetComponent = data_.getUint8(1);
  var len = data_.getUint8(2);
  var data = MavlinkMessage.asUint8List(data_, 3, 110);

  return GpsInjectData(
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      len: len,
      data: data);
}