HerelinkTelem.parse constructor

HerelinkTelem.parse(
  1. ByteData data_
)

Implementation

factory HerelinkTelem.parse(ByteData data_) {
  if (data_.lengthInBytes < HerelinkTelem.mavlinkEncodedLength) {
    var len = HerelinkTelem.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var rfFreq = data_.getUint32(0, Endian.little);
  var linkBw = data_.getUint32(4, Endian.little);
  var linkRate = data_.getUint32(8, Endian.little);
  var snr = data_.getInt16(12, Endian.little);
  var cpuTemp = data_.getInt16(14, Endian.little);
  var boardTemp = data_.getInt16(16, Endian.little);
  var rssi = data_.getUint8(18);

  return HerelinkTelem(
      rfFreq: rfFreq,
      linkBw: linkBw,
      linkRate: linkRate,
      snr: snr,
      cpuTemp: cpuTemp,
      boardTemp: boardTemp,
      rssi: rssi);
}