BatteryStatusV2.parse constructor
BatteryStatusV2.parse(
- ByteData data_
Implementation
factory BatteryStatusV2.parse(ByteData data_) {
if (data_.lengthInBytes < BatteryStatusV2.mavlinkEncodedLength) {
var len = BatteryStatusV2.mavlinkEncodedLength - data_.lengthInBytes;
var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
data_ = Uint8List.fromList(d).buffer.asByteData();
}
var voltage = data_.getFloat32(0, Endian.little);
var current = data_.getFloat32(4, Endian.little);
var capacityConsumed = data_.getFloat32(8, Endian.little);
var capacityRemaining = data_.getFloat32(12, Endian.little);
var statusFlags = data_.getUint32(16, Endian.little);
var temperature = data_.getInt16(20, Endian.little);
var id = data_.getUint8(22);
var percentRemaining = data_.getUint8(23);
return BatteryStatusV2(
voltage: voltage,
current: current,
capacityConsumed: capacityConsumed,
capacityRemaining: capacityRemaining,
statusFlags: statusFlags,
temperature: temperature,
id: id,
percentRemaining: percentRemaining);
}