CameraStatus.parse constructor

CameraStatus.parse(
  1. ByteData data_
)

Implementation

factory CameraStatus.parse(ByteData data_) {
  if (data_.lengthInBytes < CameraStatus.mavlinkEncodedLength) {
    var len = CameraStatus.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUsec = data_.getUint64(0, Endian.little);
  var p1 = data_.getFloat32(8, Endian.little);
  var p2 = data_.getFloat32(12, Endian.little);
  var p3 = data_.getFloat32(16, Endian.little);
  var p4 = data_.getFloat32(20, Endian.little);
  var imgIdx = data_.getUint16(24, Endian.little);
  var targetSystem = data_.getUint8(26);
  var camIdx = data_.getUint8(27);
  var eventId = data_.getUint8(28);

  return CameraStatus(
      timeUsec: timeUsec,
      p1: p1,
      p2: p2,
      p3: p3,
      p4: p4,
      imgIdx: imgIdx,
      targetSystem: targetSystem,
      camIdx: camIdx,
      eventId: eventId);
}