SensPowerBoard.parse constructor

SensPowerBoard.parse(
  1. ByteData data_
)

Implementation

factory SensPowerBoard.parse(ByteData data_) {
  if (data_.lengthInBytes < SensPowerBoard.mavlinkEncodedLength) {
    var len = SensPowerBoard.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timestamp = data_.getUint64(0, Endian.little);
  var pwrBrdSystemVolt = data_.getFloat32(8, Endian.little);
  var pwrBrdServoVolt = data_.getFloat32(12, Endian.little);
  var pwrBrdDigitalVolt = data_.getFloat32(16, Endian.little);
  var pwrBrdMotLAmp = data_.getFloat32(20, Endian.little);
  var pwrBrdMotRAmp = data_.getFloat32(24, Endian.little);
  var pwrBrdAnalogAmp = data_.getFloat32(28, Endian.little);
  var pwrBrdDigitalAmp = data_.getFloat32(32, Endian.little);
  var pwrBrdExtAmp = data_.getFloat32(36, Endian.little);
  var pwrBrdAuxAmp = data_.getFloat32(40, Endian.little);
  var pwrBrdStatus = data_.getUint8(44);
  var pwrBrdLedStatus = data_.getUint8(45);

  return SensPowerBoard(
      timestamp: timestamp,
      pwrBrdSystemVolt: pwrBrdSystemVolt,
      pwrBrdServoVolt: pwrBrdServoVolt,
      pwrBrdDigitalVolt: pwrBrdDigitalVolt,
      pwrBrdMotLAmp: pwrBrdMotLAmp,
      pwrBrdMotRAmp: pwrBrdMotRAmp,
      pwrBrdAnalogAmp: pwrBrdAnalogAmp,
      pwrBrdDigitalAmp: pwrBrdDigitalAmp,
      pwrBrdExtAmp: pwrBrdExtAmp,
      pwrBrdAuxAmp: pwrBrdAuxAmp,
      pwrBrdStatus: pwrBrdStatus,
      pwrBrdLedStatus: pwrBrdLedStatus);
}