EscTelemetry1To4.parse constructor

EscTelemetry1To4.parse(
  1. ByteData data_
)

Implementation

factory EscTelemetry1To4.parse(ByteData data_) {
  if (data_.lengthInBytes < EscTelemetry1To4.mavlinkEncodedLength) {
    var len = EscTelemetry1To4.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var voltage = MavlinkMessage.asUint16List(data_, 0, 4);
  var current = MavlinkMessage.asUint16List(data_, 8, 4);
  var totalcurrent = MavlinkMessage.asUint16List(data_, 16, 4);
  var rpm = MavlinkMessage.asUint16List(data_, 24, 4);
  var count = MavlinkMessage.asUint16List(data_, 32, 4);
  var temperature = MavlinkMessage.asUint8List(data_, 40, 4);

  return EscTelemetry1To4(
      voltage: voltage,
      current: current,
      totalcurrent: totalcurrent,
      rpm: rpm,
      count: count,
      temperature: temperature);
}