EscInfo.parse constructor

EscInfo.parse(
  1. ByteData data_
)

Implementation

factory EscInfo.parse(ByteData data_) {
  if (data_.lengthInBytes < EscInfo.mavlinkEncodedLength) {
    var len = EscInfo.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUsec = data_.getUint64(0, Endian.little);
  var errorCount = MavlinkMessage.asUint32List(data_, 8, 4);
  var counter = data_.getUint16(24, Endian.little);
  var failureFlags = MavlinkMessage.asUint16List(data_, 26, 4);
  var temperature = MavlinkMessage.asInt16List(data_, 34, 4);
  var index = data_.getUint8(42);
  var count = data_.getUint8(43);
  var connectionType = data_.getUint8(44);
  var info = data_.getUint8(45);

  return EscInfo(
      timeUsec: timeUsec,
      errorCount: errorCount,
      counter: counter,
      failureFlags: failureFlags,
      temperature: temperature,
      index: index,
      count: count,
      connectionType: connectionType,
      info: info);
}