ButtonChange.parse constructor

ButtonChange.parse(
  1. ByteData data_
)

Implementation

factory ButtonChange.parse(ByteData data_) {
  if (data_.lengthInBytes < ButtonChange.mavlinkEncodedLength) {
    var len = ButtonChange.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeBootMs = data_.getUint32(0, Endian.little);
  var lastChangeMs = data_.getUint32(4, Endian.little);
  var state = data_.getUint8(8);

  return ButtonChange(
      timeBootMs: timeBootMs, lastChangeMs: lastChangeMs, state: state);
}