LedControl.parse constructor

LedControl.parse(
  1. ByteData data_
)

Implementation

factory LedControl.parse(ByteData data_) {
  if (data_.lengthInBytes < LedControl.mavlinkEncodedLength) {
    var len = LedControl.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 instance = data_.getUint8(2);
  var pattern = data_.getUint8(3);
  var customLen = data_.getUint8(4);
  var customBytes = MavlinkMessage.asUint8List(data_, 5, 24);

  return LedControl(
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      instance: instance,
      pattern: pattern,
      customLen: customLen,
      customBytes: customBytes);
}