SensMppt.parse constructor

SensMppt.parse(
  1. ByteData data_
)

Implementation

factory SensMppt.parse(ByteData data_) {
  if (data_.lengthInBytes < SensMppt.mavlinkEncodedLength) {
    var len = SensMppt.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var mpptTimestamp = data_.getUint64(0, Endian.little);
  var mppt1Volt = data_.getFloat32(8, Endian.little);
  var mppt1Amp = data_.getFloat32(12, Endian.little);
  var mppt2Volt = data_.getFloat32(16, Endian.little);
  var mppt2Amp = data_.getFloat32(20, Endian.little);
  var mppt3Volt = data_.getFloat32(24, Endian.little);
  var mppt3Amp = data_.getFloat32(28, Endian.little);
  var mppt1Pwm = data_.getUint16(32, Endian.little);
  var mppt2Pwm = data_.getUint16(34, Endian.little);
  var mppt3Pwm = data_.getUint16(36, Endian.little);
  var mppt1Status = data_.getUint8(38);
  var mppt2Status = data_.getUint8(39);
  var mppt3Status = data_.getUint8(40);

  return SensMppt(
      mpptTimestamp: mpptTimestamp,
      mppt1Volt: mppt1Volt,
      mppt1Amp: mppt1Amp,
      mppt2Volt: mppt2Volt,
      mppt2Amp: mppt2Amp,
      mppt3Volt: mppt3Volt,
      mppt3Amp: mppt3Amp,
      mppt1Pwm: mppt1Pwm,
      mppt2Pwm: mppt2Pwm,
      mppt3Pwm: mppt3Pwm,
      mppt1Status: mppt1Status,
      mppt2Status: mppt2Status,
      mppt3Status: mppt3Status);
}