PlayTune.parse constructor

PlayTune.parse(
  1. ByteData data_
)

Implementation

factory PlayTune.parse(ByteData data_) {
  if (data_.lengthInBytes < PlayTune.mavlinkEncodedLength) {
    var len = PlayTune.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 tune = MavlinkMessage.asInt8List(data_, 2, 30);
  var tune2 = MavlinkMessage.asInt8List(data_, 32, 200);

  return PlayTune(
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      tune: tune,
      tune2: tune2);
}