RadioLinkStats.parse constructor

RadioLinkStats.parse(
  1. ByteData data_
)

Implementation

factory RadioLinkStats.parse(ByteData data_) {
  if (data_.lengthInBytes < RadioLinkStats.mavlinkEncodedLength) {
    var len = RadioLinkStats.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var flags = data_.getUint8(0);
  var rxLq = data_.getUint8(1);
  var rxRssi1 = data_.getUint8(2);
  var rxSnr1 = data_.getInt8(3);
  var rxRssi2 = data_.getUint8(4);
  var rxSnr2 = data_.getInt8(5);
  var rxReceiveAntenna = data_.getUint8(6);
  var rxTransmitAntenna = data_.getUint8(7);
  var txLq = data_.getUint8(8);
  var txRssi1 = data_.getUint8(9);
  var txSnr1 = data_.getInt8(10);
  var txRssi2 = data_.getUint8(11);
  var txSnr2 = data_.getInt8(12);
  var txReceiveAntenna = data_.getUint8(13);
  var txTransmitAntenna = data_.getUint8(14);

  return RadioLinkStats(
      flags: flags,
      rxLq: rxLq,
      rxRssi1: rxRssi1,
      rxSnr1: rxSnr1,
      rxRssi2: rxRssi2,
      rxSnr2: rxSnr2,
      rxReceiveAntenna: rxReceiveAntenna,
      rxTransmitAntenna: rxTransmitAntenna,
      txLq: txLq,
      txRssi1: txRssi1,
      txSnr1: txSnr1,
      txRssi2: txRssi2,
      txSnr2: txSnr2,
      txReceiveAntenna: txReceiveAntenna,
      txTransmitAntenna: txTransmitAntenna);
}