SensorpodStatus.parse constructor

SensorpodStatus.parse(
  1. ByteData data_
)

Implementation

factory SensorpodStatus.parse(ByteData data_) {
  if (data_.lengthInBytes < SensorpodStatus.mavlinkEncodedLength) {
    var len = SensorpodStatus.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 freeSpace = data_.getUint16(8, Endian.little);
  var visensorRate1 = data_.getUint8(10);
  var visensorRate2 = data_.getUint8(11);
  var visensorRate3 = data_.getUint8(12);
  var visensorRate4 = data_.getUint8(13);
  var recordingNodesCount = data_.getUint8(14);
  var cpuTemp = data_.getUint8(15);

  return SensorpodStatus(
      timestamp: timestamp,
      freeSpace: freeSpace,
      visensorRate1: visensorRate1,
      visensorRate2: visensorRate2,
      visensorRate3: visensorRate3,
      visensorRate4: visensorRate4,
      recordingNodesCount: recordingNodesCount,
      cpuTemp: cpuTemp);
}